All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Modelling and Electric Car with Li-ion battery Objective: To create a MATLAB model of electric car which uses lithium ion battery and suitable motor. Suitable blocks from Simscape or Powertrain block set are to be used. Implement the vehicle speed control using PI controller and generate brake and accelerator commands.…
Jiji M
updated on 15 Feb 2023
Modelling and Electric Car with Li-ion battery
Objective:
To create a MATLAB model of electric car which uses lithium ion battery and suitable motor. Suitable blocks from Simscape or Powertrain block set are to be used. Implement the vehicle speed control using PI controller and generate brake and accelerator commands.
We need to illustrate the electric car in a simple block diagram, where the blocks could be Vehicle body, battery, DC motor, power converter and a drive cycle. This block diagram shows the main blocks needed to design an electric car. We have drive cycle block which gives a series of data representing the speed of vehicle at different time period under different conditions. Drive controller is to manage the motor drive under different conditions. Power converter is the switching circuit which converts the power to desired form to run the motor using switching technology with the help of semiconductor devices and triggering pulse. DC motor converts electrical energy to mechanical energy inorder to rotate the wheel and control the vehicle body. Battery is connected as power source for electric motor which drives the electric car. Using the above block diagram, we need to create a simulink model for the electric car.
System level configurations:
Simulink model:
In this electric car model, the following are the main blocks included:
The drive cycle source is connected to the reference velocity input for the driver block. The second input to the driver block is the feedback velocity from vehicle body of the transmission block. The acceleration command and deceleration commands are the outputs from the driver block, which is given as inputs for control system and motor subsystem. The current output is given as input for battrey and gear ouput is given as gear input for the transmission block are obtained from control system and motor subsystem. We will get the motor voltage and motor curreny from the Control system and motor subsystem. From the battery subsystem, we can directly get the SOC%, voltage and current. We have provided the distance calculation as well to calculate the distance travelled.
1. Drive cycle source:
Drive cycle generates a standard or user-specified longitudinal drive cycle. The block output is the vehicle longitudinal speed. We can import drive cycles from:
-Predefined sources
-Workspace variables, including arrays and time series objects
-mat, xls, xlsx, or txt files
Use the fault tracking parameters to identify drive cycle faults within specified speed and time tolerances.
2. Driver block:
In the driver block, here we have 2 input commands and 2 output commands. Reference velocity and Velocity are considered as the input. To get the reference velocity, a drive cycle source is given as input and to get the velocity, a feedback signal is taken from the Transmission block. The refernce velocity is given to the positive of sum block and velocity is given to negative of sum block. The output of the sum block is given to a PID controller block. Then the PID block output signal is given to two saturation blocks named Acceleration and Deceleration.The acceleration block and deceleration block outputs are connected to control system and motor system block. Here we have considered PID controller, so as to give the inputs for saturation blocks, which is then connected to transfer function blocks to give the desired command outputs for control system and motor block.
3. Control system and Motor subsystem:
The acceleration and deceleration commands are given as inputs to 2 controlled voltage sources. The 1st controlled voltage source is connected to +ve reference for Controlled PWM voltage and 2nd controlled voltage source is connected to BRK port of H-bridge. PWM ports of Controlled PWM voltage and H-bridge are connected. The +ve output from H-bridge is connected to current sensor and current output is taken and -ve terminal of current sensor is connected to DC motor. From the DC motor a voltage sensor is connected across and voltage output is taken. The R port of motor is taken to get torque output and C port is connected to mechanical rotational reference. All the -ve ports and REF, REV are connected to common electrical reference. A solver configuration block is also connected.
The blocks included in the control system and motor subsystem are:
The block represents an ideal voltage source that is powerful enough to maintain the specified voltage at its output regardless of the current passing through it. The output voltage is V = Vs, where Vs is the numerical value presented at the physical signal port.
This block creates a Pulse-Width Modulated (PWM) voltage across the PWM and REF ports. The output voltage is zero when the pulse is low, and is equal to the Output voltage amplitude parameter when high. Duty cycle is set by the input value. Right-click the block and select Simscape->Block choices to switch between electrical +ref/-ref ports and PS input u to specify the input value.
At time zero, the pulse is initialized as high unless the duty cycle is set to zero or the Pulse delay time is greater than zero. The Simulation mode can be set to PWM or Averaged. In PWM mode, the output is a PWM signal. In Averaged mode, the output is constant with value equal to the averaged PWM signal.
This block represents an H-bridge motor drive. The block can be driven by the Controlled PWM Voltage block in PWM or Averaged mode. In PWM mode, the motor is powered if the PWM port voltage is above the Enable threshold voltage. In Averaged mode, the PWM port voltage divided by the PWM signal amplitude parameter defines the ratio of the on-time to the PWM period. Using this ratio and assumptions about the load, the block applies an average voltage to the load that achieves the correct average load current. The Simulation mode parameter value must be the same for the Controlled PWM Voltage and H-Bridge blocks.
If the REV port voltage is greater than the Reverse threshold voltage, then the output voltage polarity is reversed. If the BRK port voltage is greater than the Braking threshold voltage, then the output terminals are short circuited via one bridge arm in series with the parallel combination of a second bridge arm and a freewheeling diode. Voltages at ports PWM, REV and BRK are defined relative to the REF port.
The block represents an ideal current sensor, that is, a device that converts current measured in any electrical branch into a physical signal proportional to the current. Connections + and - are conserving electrical ports through which the sensor is inserted into the circuit. Connection I is a physical signal port that outputs current value.
This block represents the electrical and torque characteristics of a DC motor. The block assumes that no electromagnetic energy is lost, and hence the back-emf and torque constants have the same numerical value when in SI units. Motor parameters can either be specified directly, or derived from no-load speed and stall torque. If no information is available on armature inductance, this parameter can be set to some small non-zero value.
When a positive current flows from the electrical + to - ports, a positive torque acts from the mechanical C to R ports. Motor torque direction can be changed by altering the sign of the back-emf or torque constants.
The block represents an ideal voltage sensor, that is, a device that converts voltage measured between any electrical connections into a physical signal proportional to the voltage. Connections + and - are conserving electrical ports through which the sensor is connected to the circuit. Connection V is a physical signal port that outputs voltage value.
This block defines solver settings to use for simulation.
A model must contain at least one electrical reference port (electrical ground).
This block represents a mechanical rotational reference point, that is, a frame or a ground. Use it to connect mechanical rotational ports that are rigidly affixed to the frame (ground).
4. Battery and SOC subsystem:
We have consideredLi-Ion battery and a controlled current source. The +ve of battery is connected to +ve of current source for which the input current to s port of controlled current source is given from the control system and motor subsystem. The -ve of battery is connected to -ve of current source. The output port m of battery is connected to sample control bus selector, from which we can get the SOC%, voltage and current.
The battery and SOC subsystem block includes:
Here we are using a Li-Ion battery for this model. The block implements a generic battery model for most popular battery types. Temperature and aging (due to cycling) effects can be specified for Lithium-Ion battery type.
Converts the Simulink input signal into an equivalent current source. The generated current is driven by the input signal of the block. We can initialize your circuit with a specific AC or DC current. If we want to start the simulation in steady-state, the block input must be connected to a signal starting as a sinusoidal or DC waveform corresponding to the initial values.
This block accepts a bus as input which can be created from a Bus Creator, Bus Selector or a block that defines its output using a bus object.
The powergui block allows you to choose one of these methods to solve your circuit:
The powergui block also opens tools for steady-state and simulation results analysis and for advanced parameter design.
5. Transmission block subsystem:
The transmission block subsystem has simple gear, inertia block, tires (2 rear and 2 front), vehicle body, PS constants and terminators. The simple gear input B gets the input from control system and motor subsystem. The F port of simple gear is connected to A ports of 2 rear tires. An inertia is also connected to F port of gear. The A ports of both front tires are connected. The S ports of all 4 tires are connected to PS-terminator. The N ports of the rear tires are connected to NR part of vehicle body. The N ports of the front tires are connected to NF port of vehicle body. H ports of all the tires are connected to H port of vehicle body. The beta port and w port of the vehicle body is connected to PS constants as road inclination angle and headwind speed. The v port of vehicle body gives the velocity which is the feedback velocity input for driver block.
The transmission subsystem block includes:
This block represents a two-axle vehicle body in longitudinal motion. The block accounts for body mass, aerodynamic drag, road incline, and weight distribution between axles due to acceleration and road profile. The vehicle can have the same or a different number of wheels on each axle. Optionally include pitch and suspension dynamics or additional variable mass and inertia. The vehicle does not move vertically relative to the ground.
Connection H is the mechanical translational conserving port associated with the horizontal motion of the vehicle body. The resulting traction motion developed by tires should be connected to this port. Connections V, NF, and NR are physical signal output ports for vehicle velocity and front and rear normal wheel forces, respectively. Wheel forces are considered positive if acting downwards. Connections W and beta are physical signal input ports corresponding to headwind speed and road inclination angle, respectively. If variable mass is modeled, the physical signal input ports CG and M are exposed. CG accepts a two- element vector representing the x and y distance offsets from vehicle CG to additional load mass CG. M represents the additional mass. If both variable mass and pitch dynamics are included, the physical signal port J accepts the inertia of the additional mass about its own CG.
This block represents the longitudinal behavior of a highway tire characterized by the tire Magic Formula. The block is built from Tire-Road Interaction (Magic Formula) and Simscape Foundation Library Wheel and Axle blocks. Optionally, the effects of tire inertia, stiffness, and damping can be included.
Connection A is the mechanical rotational conserving port for the wheel axle. Connection H is the mechanical translational conserving port for the wheel hub through which the thrust developed by the tire is applied to the vehicle. Connection N is a physical signal input port that applies the normal force acting on the tire. The force is considered positive if it acts downwards. Connection S is a physical signal output port that reports the tire slip. Optionally expose physical signal port M by setting Parameterize by to Physical signal Magic Formula coefficients. Physical signal port M accepts a four element vector corresponding to the B, C, D, and E Magic Formula coefficients.
This block represents a fixed-ratio gear or gear box. No inertia or compliance is modeled in this block. You can optionally include gear meshing and viscous bearing losses.
Connections B (base) and F (follower) are mechanical rotational conserving ports. Specify the relation between base and follower rotation directions with the Output shaft rotates parameter. Optionally include thermal effects and expose thermal conserving port H by right-clicking on the block and selecting Simscape block choices to switch between variants.
PS-constant block creates a physical signal constant:
y = constant
The Constant parameter accepts both positive and negative values. The block output is a physical signal port.
PS terminator block is used to terminate physical signal outputs. Unconnected physical signal output ports do not generate warnings, but connection to a PS Terminator can be used to indicate that the signal was not inadvertently left unconnected.
6. Scope:
The scope display signals generated during simulation.
7. Simulink-PS and PS-Simulink converters:
Simulink-PS converter converts the Simulink input signal to a Physical Signal.
The unit expression in 'Input signal unit' parameter is associated with the Simulink input signal and determines the unit assigned to the Physical Signal.
PS-Simulink converter converts the input Physical Signal to a Simulink output signal.
The unit expression in 'Output signal unit' parameter must match or be commensurate with the unit of the Physical Signal and determines the conversion from the Physical Signal to the Simulink output signal.
Model parameters:
Below given are the model parameters considered for the model:
We are considering the FTP75 drive cycle source to get the reference velocity.
1. PID controller:
The controller selected is PID controller, with proportional gain of 12, integral gain of 1e-04 and dervivative gain of 2.5.
2. Saturation : Acceleration and Deceleration
The acceleration and deceleration blocks have given upper limit as 1 and lower limit as 0 for acceleration, where as upper limit is 0 and lower limit is -0 for deceleration.
1. Controlled PWM voltage:
The PWM frequency is given as 3000 Hz and simulation mode is averaged mode.
2. H-bridge:
For H-bridge, the simulation mode is averaged, with threshold voltage as 2.5V, PWM signal amplitude to be 5 V, reverse threshold abd braking threshold voltages to be 2.5V. The output voltage amplitude is given to be 330 V, and total bridge resistance andfreewheeling diode resistance are given as 0.1 and 0.05 ohms.
3. DC motor:
The DC motor no load speed has been changed to 3000 rpm and rated speed at rated load is given as 2400 rpm. The rated DC supply voltage os 330V and rated load is 50kW.
1. Vehicle body:
The vehicle bosy frontal area has been changed to 1.6 m², drag coefficient is 0.02 and air density is 1.18kg/m³. The horizontal distance fron CG to rear axle and front axle are 1.6m and 1.4m, respectively.
2. Tire (Rear):
Rear Tires are parametrized by peak lomgitudinal force and corresponding slip. Rated vertical load is 3000N peak longitudinal force at rated load is 3500 N. The rolling radius is 0.25m and rolling resistance is considered with constant coefficient model. The constant coefficient is 0.015 and velocity threshold is 0.001m/s.
3. Tire(Front):
The front tire is para,eterized by load dependent magic formula coefficients with rolling radius 0.3m.
4. Simple gear:
The gear, Follower to base teeth ratio has been changed to 4 and the output shaft rotates in the same direction as input shaft.
5. Inertia:
Inretia is given to be 0.01 kg/m².
1. Battery:
Li-Ion battery is considered with nominal voltage of 330 V, rated capacity as 100 Ah, and initial state of charge as 100%.
2. Controlled current source:
Distance calculation:
From the vehicle velocity distance is calculated to be 4.735 km.
Results:
1. Reference velocity and velocity:
From the above velocity graph, it is clear that the vehicle velocity is tracing the reference velocity.
2. Distance travelled:
From the above graph it is clear that the distance travelled by the vehicle is 4.735km.
3. Battery SOC%, Current and voltage:
From the above graph, it is clear that the SOC drops from 100% to nearly 99.7% and so on. During discharge time, battery soc is decreasing and increasing. The voltage rises to a maximum of 1200 V and decreases upto 400V. The current increases to 100 A and decreases upto -200 A.
4. Motor current and voltage:
The motor current rises upto 200 A and decreases upto -150 A. The motor voltage rises upto 330V and it changes increases and decreases during discharge time.
Conclusion:
MATLAB model for electric car with Li-Ion battery with suitable DC motor. Instead of the readymade driver block for speed control, a new driver block with a PID controller has been created. Model has been created successfully and the distance travelled by the vehicle was calculated to be 4.735km.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 5 Challenge
1. Consider a scenario where an aggressive driver is accelerating very rapidly and braking harshly in a city driving. Is battery better a choice to supply power than UC in this scenario? True False Why? Answer: False. In this scenario, battery is not a better choice in the given driving scenario.The drivers driving…
12 Feb 2024 02:39 PM IST
Week 2 Challenge
1. Compare four different types of fuel cells and state their applications. Answer: The four types of fuel cells are: Polymer Electrolyte Membrane Fuel Cell (PEM) Alkaline Fuel Cell (AFC) Direct Methonol Fuel Cell (DMFC) Solid Oxide Fuel Cell (SOFC) PEM AFC DMFC SOFC Power 0.01 - 250 0.1 - 50 0.001…
01 Feb 2024 12:58 PM IST
Week 4 Session 5
1. Explain the various applications of Power converters in an Electric vehicle. For Example what type of converter will you use for Horn which requires DC and less than 10V. Likewise come up with different applications. Application: Here are some examples of power converter applications in an electric vehicle: DC-DC Converter…
24 Jun 2023 06:28 AM IST
Final Project: Electric Rickshaw modelling
Create a detailed MATLAB model of an electric rickshaw (three wheel passenger vehicle) as per details below: Rear wheels driven by PM brushed type motor Assume efficiency points of motor controller and motor Make an excel sheet of all input and assumed data Results: For any three standard driving cycles show…
23 Jun 2023 06:59 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.