Code covered by the BSD License  

4.7 | 21 ratings Rate this file 277 Downloads (last 30 days) File Size: 9.29 MB File ID: #28441 Version: 1.13
image thumbnail

Hybrid-Electric Vehicle Model in Simulink


Steve Miller (view profile)


10 Aug 2010 (Updated )

Model of a hybrid-electric vehicle with system-level and detailed variants of electrical system.

| Watch this File

File Information

This file contains a hybrid-electric vehicle model built using Simscape, SimElectronics, SimDriveline, and SimPowerSystems that can be configured for system-level tests or power quality analyses. Model variants for the electrical, battery, and vehicle dynamics systems can be selected using configurable subsystems. A battery model created with the Simscape language is incorporated into the model. Supervisory logic is implemented with Stateflow. This model can be configured for hardware-in-the-loop testing.
Please read the README.txt file to get started.

To see the different variants included in this model, please watch the webinar, “Hybrid Electric Vehicle Modeling and Simulation“

To find other physical modeling examples, search for posts with the keyword "physical modeling"

To learn more about MathWorks Physical Modeling Products, go to:

Required Products SimDriveline
MATLAB release MATLAB 8.3 (R2014a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (50)
15 Aug 2015 Shiwei Xu


14 Jul 2015 Mohamed Awadallah  
07 Jul 2015 Harith Mohanan  
03 Jun 2015 Jalashwa

Can you give me a file for MATLAB 2011 ?

Comment only
25 Apr 2015 John Knight  
12 Jan 2015 Nitish sharma

using i m using R2014a
following error
Unable to load block diagram 'HEV_Electrical_Lib'
help me out reply soon

Comment only
06 Jan 2015 Nitish sharma

it fails to load library plz help me out with this problem.

04 Jan 2015 Chung

Chung (view profile)

Hi, thank you for providing this excellent model. I'm a student in university. I want to design a controller for the power split ratio(as you did by the state flow), but in my way I need to know the transfer function of the system especially the engine, so I wonder how can I get these transfer function.
Thank you very much

Comment only
19 Dec 2014 nadia belhouchette

Hi, I am a student at the university, I thank you for the development of this model is realized well. I need the transfer function for this engine model, can there anybody give me the transfer function?, I will be very grateful. thanks

Comment only
18 Aug 2014 Hemanth kumar Varada Reddy

Can you please tell me how to use Model Predictive control for this model.
This model uses PID controller, I want to use MPC instead. Please guide me how to do it.

Comment only
19 May 2014 Ramoz

Ramoz (view profile)

16 Apr 2014 Qifei Hang

Why there is no R13b version? Can you post one?

Comment only
10 Apr 2014 Qifei Hang

Thank you!

08 Apr 2014 Qifei Hang  
21 Feb 2014 Julian

Julian (view profile)

Hi Steve!

I have a Problem with the Model, i tried to use a port of it and now it says:

Initial conditions solve failed to converge.
...Equations of one or more components may be dependent or inconsistent. This can cause problems in transient initialization. Here is the set of components involved:
'SystemSimulation/Subsystem1/Ideal Rotational Motion Sensor'
Equation location is:
'C:/Program Files/MATLAB/R2013b/toolbox/physmod/simscape/library/m/+foundation/+mechanical/+sensors/angular_velocity.ssc' (line 45)

'SystemSimulation/Subsystem1/Ideal Torque Source'
Equation location is:
'C:/Program Files/MATLAB/R2013b/toolbox/physmod/simscape/library/m/+foundation/+mechanical/+sources/torque.ssc' (line 35)

Any hints?


27 Jan 2014 shailesh

Hi Steve ,
Great Job !
When I run startup_HEV_Model.m it is showing an error
Undefined function or variable 'HEV_Model_PARAM'.

Error in startup_HEV_Model (line 14)


Pls help me ASAP.

Comment only
22 Jan 2014 girish s

How to connect BLDC motor controller(AC7) to tires(magic formula) in simulink,It seems parameters are not matching.please help.....

15 Jan 2014 Roopesh Mishra

Nice Steve Sir, I want to connect PHEV car with PV array for charging purpose...Can u help me in this regarding..and which version is suitable for that

13 Jan 2014 Yu Junquan  
28 Dec 2013 abdussalam omar

electric vehicles

Comment only
28 Dec 2013 abdussalam omar

i could not get the file

Comment only
11 Dec 2013 Ahmet Unsal

I would like to modify this model for public transportation which means that I need to change the vehicle dynamics. When I do that (meaning that I increase the vehicle mass and change CG) the programs crashes. Do you have a possible solution for this problem? Best regards...

Comment only
11 Dec 2013 Ahmet Unsal

I would like create model for public transportation which means that I need to change the vehicle dynamics. When I do that (meaning that I increase the vehicle mass and CG) the programs crashes. Do you have a possible solution for this problem? Best regards...

Comment only
28 Aug 2013 nypradjna

I can't open the file :(

Comment only
28 Feb 2013 Zhila

Zhila (view profile)

Dear Steve, Thank you very much for the great model.
I wonder if the files and codes for connecting the model to the optimization algorithm would also be available?
I have a model of PHEV power-train which I want to integrate with an optimization algorithm, and I would like to examine what requirements I should care about in making such connections.
I will be grateful if such part is available and possible to be exchanged.

Thanks again.

13 Feb 2013 Hakeem Akorede Shittu

Hello Steve,
I have been able to run this simulation but I have little experience with MATLAB, therefore I did not understand some of the information. What I will like to do though is connect a Solar Panel Model to this Model and see what the level in the state of charge (SOC) of the battery will be after couple of hours. Thanks in advance

Comment only
13 Feb 2013 Steve Miller

Steve Miller (view profile)

@MD Rashidul -- did you run the startup_HEV_Model.m? It is looking for a library file that needs to be on your path.

Comment only
22 Jan 2013 MD Rashidul


while running 'HEV_ParallelSeries_10b / HEV_SeriesParallel', I got the following error. Would you please suggest something?



Failed to load library 'HEV_Electrical_Lib' referenced by 'HEV_SeriesParallel/Electrical'

Caused by:
Unable to load block diagram 'HEV_Electrical_Lib'

Comment only
15 Dec 2012 Loukia

Loukia (view profile)

01 Jul 2012 lll

lll (view profile)

I think the value of Motor_en in cruise mode(in the control stateflow, on the innermost level)should be '0', right?

Comment only
27 May 2012 indra setiawan

Dear Steve, i'm using R2011b.
And i found many errors. How i can open the model?

Comment only
05 May 2012 Deepak AGARWAL  
02 May 2012 sajad anbaran

would you please tell me that how i can obtain C code, if i succeed to run simulation.

30 Apr 2012 sajad anbaran

Hello Steve,
i'm trying to run your system in parallel mode with different stateflow method.since i can't make change in electric subsystem, i put zero for generator required torque. by doing so i disabled Gen.however, when i want to run the simulation, vehicle is always in electric alone mode and doesn't switch to other other word, motor is the only working power source and engine speed becomes negative. but when i return Gen to the system, everything works nice. another issue is that do i need to change sun ring arrangement of the planetary gear to be operated in parallel HEV. please help me in these issues.


steve i am using R2009b.can i run this file in that??? i'm facing lots of error in that.. please make me clear.

Comment only
09 Jan 2012 Steve Miller

Steve Miller (view profile)

Thanks for your comments, Abhishek.

The Vehicle Dynamics Full subsystem has aerodynamic drag included in it. The "Vehicle Body" block includes aerodynamic drag. The parameters for Drag Coefficient and Frontal Area are included in that calculation. See the documentation for that block: --Steve

Comment only
06 Jan 2012 Abhishek Rai

Hi Steve,
First of all I should congratulate you for your wonderful work.
While I was browsing through the "vehicle dnamics full" subsystem I found that you have not included the aerodynamic drag that you included in "Vehicle Dynamic Simple" subsystem.
I am curious to know tha answer.
Anticipating a soon reply.

28 Dec 2011 Andres RM

Hello Steve, I must conglaturate you because of the model. I'd like to ask you, where did you find documentation to create vectorial controller?


Comment only
09 Dec 2011 Max

Max (view profile)

Good time. Can you send me the model code in C language?

02 Nov 2011 Wencong  
13 Aug 2011 lee

lee (view profile)

Dear Steve,when I use this model to simulate a HEV system in matlab 2010b,it suggests that :Unable to load block diagram 'sdl_lib'.Can you tell me the reasons please?

Comment only
13 Aug 2011 lee

lee (view profile)

Dear Steve,when I use this model to simulate a pure EV system in matlab 2010b,it suggests that :Unable to load block diagram 'sdl_lib'.Can you tell me the reasons please?

Comment only
29 Jul 2011 Steve Miller

Steve Miller (view profile)

Basil -- try the R2010b version that is included in the submission. It may work with R2010a with some warnings.

BearCat -- you can delete the gauges blocks. Road height can be added, but the model currently assumes flat roads.

Lucas -- I haven't parameterized the other battery types. I suggest pulling the battery model directly from the Simulink browser and entering the values there.

Comment only
29 Jun 2011 Basil Aljorani

can i run this model with 2010a.

Comment only
04 Feb 2011 Lucas Fuentes

I am also interested in what BearCat asks. I need to be able to compare EVs to HEVs to conventional cars (internal combustion only).
Any tips on how to configure these types of vehicle?
Also, when I change the battery type from Ni-Hydride to anything but Li-Ion the simulation fails. I would be interested in comparing the different battery chemistries.

Comment only
14 Nov 2010 BearCat

It cannot find gaugeslibv2.mdl when I start the simulation!

Does the simulation by any chance also consider fuel consumption depending on road topography?

These might be noob questions. But I hope you will answer anyway :-)

Comment only
06 Sep 2010 curryxt ??

Dear Steve, if I want to use this model to simulate a pure EV system, how should I configure the model? I will highly apprecialte your help.

Comment only
24 Aug 2010 curryxt ??

Thanks a lot. The above trouble has been removed. While, if I want to use this model to simulate a pure EV system, how should I configure the model?

21 Aug 2010 Steve Miller

Steve Miller (view profile)

curryxt -- are you running release 2010a? Do you have all required products? The missing files you mention are part of the Simscape and SimElectronics installation.

Comment only
20 Aug 2010 curryxt ??

Sorry, when running, three models -elec_lib.mdl, fl_lib.mdl and 'nesl_utility.mdl cannot be founded ,also some blocks cannot get right parameter values.

Comment only
13 Dec 2010 1.1

Fix typo in description.

15 Mar 2011 1.2

Update to fix simulation issue in R2010b.
Update for R2011a coming soon...

22 Mar 2011 1.3

Updated release (R2010b) and required products (Simulink)

15 Apr 2011 1.5

Updated for R2011a.
1. Uses new Simscape-based SimDriveline library (includes gear loss models).
2. Added calculation of fuel economy using Curve Fitting Toolbox.
Zip file includes both R2010b and R2011a versions.

21 Apr 2011 1.6

Updated for R2011a release. Uses new Simscape-based SimDriveline library, and includes fuel economy calculation via imported data fitted to a surface using Curve Fitting Toolbox. R2010b version using original SimDriveline library still included.

29 Jul 2011 1.7

Updated HEV_Model_PCT.mdl, removing link to old content.

18 Mar 2013 1.9

Zip now contains R2013a version. Also includes versions for R2011b, R2011a, and R2010b.

09 Apr 2014 1.12

Minor update to R2014a image.

17 Apr 2014 1.13

Fixed link to webinar.

Contact us