File Exchange

image thumbnail

Automotive Electrical System Simulation and Control

version 1.10 (280 KB) by Robyn Jackey
Automotive Electrical System Simulation and Control: A conventional vehicle electrical system model with alternator, battery, loads, and idl


Updated 06 Apr 2020

From GitHub

View Version History

View license on GitHub

This model shows an example of a conventional vehicle electrical system model, which was shown in the webinar "Optimizing Vehicle Electrical Design through System-Level Simulation". The model is intended to study component sizing, selection, and control.
The electrical system model contains a Simscape lead-acid battery model as described in SAE Paper 2007-01-0778. There are two choices for battery size.

The model also contains data-driven alternator model options using either look-up tables or Model-Based Calibration Toolbox blocks. The alternator model is described in SAE Paper 2007-01-3471.

Control may be added to monitor the system condition, and increase idle speed to compensate for bad conditions in the vehicle charging system.

Vehicle loads are modeled as variable resistive elements.


Simulink Design Optimization can be used to estimate battery parameters from experimental battery data. To see how, please watch this video (5 min):

Parameter estimation for these models from measured data sets at different temperature and current data is a complex task. To learn how MathWorks Consulting can teach you this technique, please contact us or see:

MathWorks Consulting: Battery Simulation and Controls


Cite As

Robyn Jackey (2021). Automotive Electrical System Simulation and Control (, GitHub. Retrieved .

Comments and Ratings (14)

lu hu

Anish Salvi

Robyn Jackey

Hi Raghuveer,

The battery block re-runs the initialization file ssc_lead_acid_battery_XXAh_ini.m when the simulation starts. You should modify the file directly to change theta_init. You will also need to set Qe_init differently at the end of the file because the spline didn't work right. I just set it to zero and it worked.

Note the under hood temperature in the Vehicle Inputs block will cause the battery temp to rise over time.

Raghuveer Sivakumar

Hi Robyn

I have been using your model and find it very useful. I was wondering if its possible to change the simulation condition to represent a cold setting i.e. temperatures of -10 degrees. I did try and change Theta_init, but when I ran the simulation it changed back to 25. Can you please tell me how to achieve cold simulation


Robyn Jackey


You will need to remove the 3D lookup as you mention. If you want to control power output, you will also need to modify the control loop that is adjusting alternator current to meet the voltage setpoint that was coming out of that lookup before.

If you want to discuss more or want some consulting assistance with this, please go to the "contact author" link to email me directly.


Hia Robyn,

Unsure if this is the right place to try and contact you, but I really enjoy the model and think it's a fantastic approach to solving the problem of no alternator/battery plant model.

I hate to ask a question, however, I'm trying to figure out how to modify it a bit so that I can give it a setpoint to try and regulate to based on a given vehicle load and engine speed speed; I'm looking to see the generator duty cycle modulate based on trying to maintain a power output given a battery voltage of my choosing.

Hopefully that makes sense!

This is instead of the 3d lookup based voltage setpoint that's based on temperature/current/engine rpm... do you have any suggestions as an easy way to do that?


Rani V.S


Hi Robyn,

I have read your SAE paper on battery modelling and I would like to know if it would eb possible for you to provide a Simulink-only version of the battery model.

Thanks in advance!


Hi, the model is great.
I am very new to simulink and I need to implement lead acid battery model.
May I know how to do the lead acid model with blocks.

Robyn Jackey

Hi David,

Roughly speaking, change the Costar parameter (capacity at 0°C – I think units are either Amp-seconds or Amp-hours) to match the capacity you want. Other resistance parameters may be inversely proportional to the change in capacity, so if you cut the capacity by half you would double the resistances.

If you need a detailed match to a specific model of battery, it gets a bit more complicated. I offer consulting service to help teach techniques to match the model to measured data.



The model is good, I am just wondering how to get a lower A/h battery like 21 A/h?


MATLAB Release Compatibility
Created with R2009b
Compatible with R2012b and later releases
Platform Compatibility
Windows macOS Linux

Inspired by: Battery Modeling

Inspired: Battery Modeling


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!