Project-1: Modelling an electric Car with Li-ion battery
Create a MATLAB model of electric car which uses lithium ion battery and suitable motor. Choose suitable blocks from Simscape or Powertrain block set. Implement the vehicle speed control using PI controller and generate brake and accelerator commands. Avoid using readymade driver block for speed control.
Prepare a report about your model including following:
Objectives, System level configurations, Model parameters, Results, Conclusion.
(Note- The simulink model file should be compulsorily attached)
Introduction
A new study related to Vehicle/Automobile engineering says that by coming 2025, there will be a major transformation in the automobile sector. Many automakers are working to change the vehicle technologies, the major area is to decrease the pollution and use electrification in the upcoming vehicles. The researchers and automakers are continuously working to reduce CO2 emissions.
New technology like high capacity lithium type battery will be a major energy source for the propulsion of electric vehicles.The power and performance of electric vehicles is depending upon the two machines i.e. a brushless DC motor (BLDC) or an induction motor. The brush DC motor is replaced by DC brushless motors and Induction motors. Also, the lead-acid battery is replaced by lithium-ion batteries for EVs. Because the future of both the components induction or brushless DC motors depends upon their demands and uses.
At present, with the new technologies, some manufacturer has launched its products which are Tesla, Chevy Bolt EV, Tata nexon ev and Nissan leaf which are fully electric battery-based car.An electric vehicle (EV) is defined as a vehicle that uses an electric motor or a traction motor for propulsion as opposed to an internal combustion (IC) engine used by conventional vehicles. Electric vehicles use electricity for power instead of fossil fuels as conventional vehicles would and because of this difference, electric vehicles do not produce any exhaust gases or pollution. The power needed for the operation of an EV can come from a variety of sources such as batteries, generators, or through a collector system. Batteries fitted in to the body of an EV are capable of high energy densities in order for them to meet the power demands and range requirements. Generators are machines which generate electrical energy from an input of mechanical work and are a part of the electric motor, and they operate during braking to produce the phenomenon of 'regenerative braking'. Collector systems are off-vehicle systems which allow for the charging of an EV from homes or public charging stations. The electricity used for charging in these systems are generated from solar panels which can be used by the grid or by homes of EV owners so that they can charge their vehicles more conveniently.EVs are increasing in demand in recent years due to the need to reduce vehicle emissions which are damaging to the environment. Government incentives and private companies are working on schemes to quicken the adoption of electric vehicles. Since EVs do not produce any emissions, they are more environmentally friendly than conventional vehicles are. The generation of the electricty used to charge the vehicles also comes from solar energy (a renewable energy source) and not fossil fuels which makes them sustainable. EVs can meet the same performance standards of conventional vehicles and even surpass that of theirs and this has been seen with the automotive company Tesla. Regenerative braking in EVs adds to their efficiency as the unused energy in braking gets reused purposefully. Another benefit is that EVs have fewer moving/rotating parts and this means lesser maintenance costs than you would have with IC engine vehicles e.g. changing oil, transmission fluid. This, in the long term would give better savings than you would get with conventional vehicles. This is because they cost considerable more than conventional vehicles due to the high cost of batteries and electric components. But, the cost of batteries is getting cheaper over time and manufacturers are developing newer and more efficient batteries.A compromise between IC engine vehicles and EVs exists as Hybrid Electric Vehicles (HEVs). HEVs combine an IC engine with an electric propulsion system to produce a 'hybrid' between the two different classes of vehicles. The purpose of this is to use the power available form the electric powertrain to improve the fuel economy of the vehicle so that it does not rely solely on the petrol/diesel it uses as fuel. This in turn will also improve the overall performance of the HEV. The IC engine can be used to power the electric motor to charge the battery or use directly in the electric drive motor with a combination of a motor and generator in one.
Components
The main components of an EV are:
- Auxiliary Battery: In an electric drive vehicle, the auxiliary battery provides electricity to power vehicle accessories.
- Traction Battery Pack: Traction battery pack is also known as Electric Vehicle Battery (EVB) which is used to store the electricity. Some examples of traction battery energy storage systems are as given:
- Lithium-Ion
- Nickel-Metal Hydride
- Lead-Acid
- Ultra-Capacitors
- DC/DC Converter: Basically, DC/DC converter is an electronic device which is used to converts higher-voltage DC power from the traction battery pack to the lower-voltage DC power. The converted power is used to run the vehicle accessories. It is also used to recharge the auxiliary battery.
- Electric Traction Motor: Another important component is electric traction motor and this device is used to provide motive power to the wheels.
- Onboard charger: Takes the incoming AC electricity supplied via the charge port and converts it to DC power for charging the traction battery. It monitors battery characteristics such as voltage, current, temperature, and state of charge while charging the pack.
- Power electronics controller: This unit manages the flow of electrical energy delivered by the traction battery, controlling the speed of the electric traction motor and the torque it produces.
- Charge port: The charge port allows the vehicle to connect to an external power supply in order to charge the traction battery pack.
- Thermal system (cooling): This system maintains a proper operating temperature range of the electric motor, power electronics, and other components.

Batteries store the electrical energy needed to power the EV in all of its systems and needs. Power converters convert the power coming from the battery to a usable form for the motor. This conversion can be from DC to AC or vice versa and can even be between 2 different magnitudes of DC to DC or AC to AC. Motor controllers are electronics which control the amount of power delivered to the motor via control signals so that the motor is running as commanded. The motor is used for propulsion in order to move the vehicle in forward or reverse motoring. The generator is a part of the motor and just works in the opposite method to the motor. When braking, the vehicle can generate electricity and send this power back to the battery, charging it (regenerative braking). The transmission system is needed for the vehicle to change speeds as it accelerates/decelerates. The wheels are needed for traction on the roads and depending on the powertrain, the EV may be an FWD or RWD (forward or rear wheel drive). If a vehicle is an FWD, only the front axle wheels produce propulsion i.e.. rotate from motor effect and if it is an RWD, the back axle wheels produce it instead. All wheel drives (AWDs) also exist where the front and rear axle wheels work together to produce propulsion.
i took the referenece of Tata nexon ev for doing this model:

In this report, I will be modelling an electric vehicle with a DC motor and battery system using the SIMULINK software. The components I will need for my model exist as blocks in the SIMULINK block library. I will be modelling this EV for a drive cycle and measure the velocity characteristics and the current and SOC characteristics of its battery system.
System Level Configuration
To model an EV in SIMULINK, we will need to model for a mentioned components separately and then have them work together. All the main components are available in the library of SIMULINK blocks and we will be adding each component and configuring its parameters to fit the requirements of the model. First, I have modelled the vehicle main body.

Tires
The tires used in this EV model are the 'magic formula' tires. There are several tire blocks that can be used for modelling a vehicle but I have used the magic formula ones because it allows us to model the longitudinal behavior of vehicle tires on highways. They also allow us to model extra effects such as tire inertia, stiffness which allow for greater accuracy of real world conditions. The magic formula tire block is shown below:

We can see that it has 4 ports and they are:
- N - This port stands for 'Normal' and is the physical signal input port for the normal force acting on the tire and is considered positive in the downwards direction.
- S - This port stands for 'Slip' and is the physical signal output port is that reports the slip acting on the tire.
- A - This port stands for 'Axle' and is the mechanical rotational conserving port for the wheel axle.
- H - This port stands for 'Hub' and is the mechanical translational conserving port for the wheel hub through which the thrust developed by the tires is applied to the vehicle body.
Double clicking the magic formula tire block takes us to its parameters.
Main
The image below shows the settings for the main parameters of the magic formula tires:

As we can see, we are parameterizing the tires with 'Load dependent Magic Formula coefficients' and the remaining parameters that follow with it are default.
Geometry
The image below shows the parameters of the tire geometry. There is only one parameter that can be modified and it is the rolling radius and has been set to a nominal value of 0.3m.

Dynamics
The next parameters are the dynamics of the magic formula tires. This is where we can model additional effects e.g. tire inertia and the initial velocity if we are modeling to specify those 2 conditions.

Here, we can model the rolling resistance parameters on the tires and I have chosen to switch ON the rolling resistance force on the tires. Also, I have selected a constant coefficient of rolling resistance of 0.022 and a velocity threshold of 0.001.

Advanced
Finally, the last parameter for the magic formula tires is the velocity threshold and this has been set to 0.1m/s. Below this speed, the block will not model any of the mentioned effects of motion on to the tire, hence called a 'threshold' velocity.
Vehicle Body
To model a vehicle's body, we need to first add the vehicle body block and this is shown below:

This block contains 6 ports which can be used to model the various aspects of the vehicle body. The ports are mentioned and elaborated below:
- H - This stands for 'Hub' and is used to connect the hubs of the wheels to the main body of the vehicle.
- V - This is a physical signal output port which stands for 'Velocity' and is used to output the speed/velocity at which the vehicle is moving at.
- W - This is a physical signal input port and allows us to model a 'headwind' acting on the vehicle by giving a speed for it.
- NR - This is a physical signal output port to model the rear wheel normal forces.
- NF - This is a physical signal output to model the front wheel normal forces.
- beta - This is a physical signal input port and allows us to model the vehicle on an inclination angle to create the effect of a hill climbing force.
If we double click the vehicle body block, we can see and modify its parameters and this is shown in the image below:
Main :As you can see, we are able to modify various parameters of the vehicle body e.g. mass, number of wheels per axle, distance of the center of gravity to the front and rear axles. These are the main parameters and have been left with the default values assigned when the block was added to the workspace. The next tab shows the parameters for 'Drag' and this is shown below: here the kerb weight of the vehicle is 1400kg as tata nexon ev the payload weight is 70kg man

Drag:
We can see from this image that the parameters of frontal area, drag coefficient and air density can be modified in order to effect the drag force acting on the vehicle. In my case, I have used the assumed values in order for the model to resemble a typical sedan. Air density and frontal area are normal for this type of vehicle. The frontal area is the product of the width and height .

Gear
Next, we will model the transmission system of the EV. I have decided to use a 'Simple Gear' block so as to simplify the transmission system parameters. This block models a gear system with a fixed gear ratio with no inertia effects, however we can modify the effects of the meshing of the gear teeth. The simple gear block is shown below:


Simple Gear is a Final drive ratio which is a gearbox that constrains the connected driveline axes of the base gear and the follower gear.
B: The output B, base gear is connected with the input of DC motor R. It is a Rotational mechanical conserving port.
F: The output of F, follower gear is connected with the rear axle. It is also a Rotational mechanical conserving port.
In Simple Gear Block we can also do some changes according to our need
- Follower (F) to base (B) teeth ratio (NF/NB): 6, The value should be in Positive and it is a fixed ratio gFB of the follower gear to the base gear.
- Output shaft rotates: In the same direction as the input shaft, it is depending upon the direction of follower and base gear.
Meshing Losses
- Friction model: From drop-down, we can select Constant efficiency which calculates the Reduce torque transfer by a constant efficiency factor.
- Efficiency: 0.80, here we can change the efficiency depending upon our need, basically it is a Torque transfer efficiency between base gear shaft to the follower gear shaft.
- Follower power threshold: 0.001 W, it is an absolute value of the follower shaft power above which the full efficiency factor is in effect.
-
Motor
For the EV model, I have selected to use a DC motor block as the motor. This is because DC motors are easier to model and have fewer parameters to modify for a particular application. For this model, a DC motor will do just fine. The DC motor block is shown below:

-
As we can see, there are 2 sides to the block: the mechanical side on the right and the electrical side on the left. The mechanical side has 2 ports, C and R. The C refers to the casing and the R for the rotation of the rotor which produces a torque. The electrical side has a positive and a negative terminal for the voltages to be applied. If a positive voltage is applied to the DC motor block from the positive to the negative terminal, a positive torque will act from the C port to the R port. The direction of the torque produced by the DC motor can be changed by changing the sign of the back emf or the torque constant. The C port of the mechanical side needs to be connected to a mechanical rotational reference because it will be stationary. The R port will be connected to the open connection of the simple gear from the vehicle body block. The positive terminal on the electrical side is connected to the positive terminal of a power converter which in my case will be an 'H bridge'.
The mechanical rotational reference block is shown below:

Double clicking the DC motor block takes us to its parameters. The electrical torque parameters are first considered. Here, I have chosen to parameterize the block 'By rated power, rated speed & no-load speed'. This lets us modify parameters such as DC supply voltage, rated load. I have kept all values default except for the no load speed, rated speed, rated load and the DC supply voltage which were changed to the values shown in the image below:
Electrical torque:

In the mechanical parameters, we can modify the rotor inertia, damping and initial rotor speed. However, these values were kept to their default settings.


Power Converter
The power converter is needed to provide power of the correct form and magnitude from one component to another. In the case of EVs, a power converter is needed to provide a DC voltage from the battery of the EV to the DC motor so that it can operate properly with the required parameters. As mentioned earlier, I have used an H-Bridge motor drive as my power converter. Its block is shown below:

The H Bridge has 2 sides to it: the left side is for the controlling of the voltage signals and the right side is for the terminals to provide the controlled voltage to the DC motor. The left side ports of the H-Bridge block are:
- PWM - This stands for Pulse Width Modulation which will provide the voltage pulses to the H-Bridge either in the PWM or average mode.
- REF - This stands for Reference.
- REV - This stands for Reverse.
- BRK - This stands for Brake.
Opening the H-Bridge block will take us to its parameters shown below:

The main parameters are for the simulation mode and load assumptions of the H-Bridge. I have selected the H-Bridge to run on an internal power supply with an averaged simulation mode instead of the PWM mode. This is because using the PWM mode will result in significantly longer simulation times compared to using the averaged mode. I have enabled the regenerative braking mode and set the load current characteristics to the smoothed option.

The next parameters of the H-Bridge are its input thresholds. Here we can set the various voltage limits of its 4 left hand side ports. These values are left to their default settings.

The last parameters for the H-Bride pertain to its bridge parameters. Only the first parameter of 'Output voltage amplitude' was modified. This is because the DC motor has been parameterized to run on a DC supply voltage of 320V. So this same value is used for the output voltage amplitude.
controlled PWM Voltage
Next, I have used a 'Controlled PWM Voltage' block to provide a controlled pulse width modulated voltage to the H-Bridge block. The block will output the PWM voltage through its 'PWM' and 'REF' ports which will feed in to the same ports found on the H-Bridge block. If the pulse is low the output voltage is considered 0V whereas if the pulse is high, the output voltage will be equal to the output voltage amplitude which was set to 330V in the H-Bridge block. The pulses of voltage created by this block are dependent on the duty cycle which is the ratio of the time that the switch is ON to the time taken for 1 cycle (which is the time for which the switch is ON and OFF). The duty cycle is set by the input of the controlled PWM voltage block.
The duty cycle formula is given by:
The duty cycle formula is given by:
δ=Ton/Ton+Toff=Ton/Tcyc
where,
Duty Cycle - δ
On Time - Ton
Off Time - Toff
Time taken for 1 cycle - Tcyc
The controlled PWM voltage block is shown below:


The main settings pertain to the PWM parameters. Here all the parameters are maintained at their default values. I have chosen the 'Averaged' simulation mode so that the average value of the voltage pulses are generated and fed in to the H-Bridge. This will allow for quicker simulation times, just like for the H-Bridge block parameters. The remaining parameters of 'Input Scaling' and 'Output Voltage' are unchanged.
Controlled Voltage Source
The input ports of the controlled PWM voltage block are still unconnected and that is because they require a controlled voltage source to provide the voltages to produce the voltage pulses to be fed in to the H-Bridge. For this, I have used the controlled voltage source block. This block is useful because it will provide the necessary voltage that is powerful enough to maintain the voltage at the output regardless of the current that passes through it. This controlled voltage source block is shown below:

In this model, 2 controlled voltage sources have been used. One block is to provide the voltage for the acceleration of the vehicle and the other is to provide the voltage for the deceleration of the vehicle.
Electrical Reference
The electrical reference block is used to create a grounding effect for electrical circuits. Any model that uses electrical or electronics components will need to have at least one electrical reference block in it. The electrical reference block is shown below:

In my EV model, we are using this block for 2 occasions. The first is for to create an electrical ground between the controlled voltage source, controlled PWM voltage and the H-Bridge blocks. The second is for the battery system which will be modelled afterwards.
In my EV model, we are using this block for 2 occasions. The first is for to create an electrical ground between the controlled voltage source, controlled PWM voltage and the H-Bridge blocks. The second is for the battery system which will be modelled afterwards.
Solver Configuration
The solver configuration block is used to solve any necessary equations in a model and in my case, I have used them in the connection to the 'REV' port of the H-Bridge block. The solver configuration block is shown below:

The image below shows the connections that can be made with the components discussed till this point.

Drive Cycle
A drive cycle is a data set that contains velocity and time data for the purpose of modelling the motion of a vehicle. The drive cycle will be a plot of the velocity against the time and it is made to resemble typical driving conditions that a consumer may experience themselves in. For instance, they can model highway driving situations, driving in urban areas, or driving with full power etc. Drive cycles are used by automotive companies for various testing procedures such as mileage, pollution tests, and acceleration and top speed tests. There are various different drive cycles that are industry standard e.g. Urban Dynamometer Driving Schedule (UDDS), FTP 75.
n my EV model, a drive cycle is used as the reference velocity data for the longitudinal driver block to send acceleration or deceleration commands according to the drive cycle. There are 3 ways of implementing a drive cycle. One method is to create or own drive cycle with a spreadsheet of velocity data in one column and time data in another column. Another method is to use a signal builder block and create signals that represent the velocities at which the vehicle should travel and the durations for which those velocities are to be maintained. The last method is to use the industry standard drive cycles which are in - built in to the SIMULINK library.In this i had used the wot drive cycle and the FTP75 as well.
The drive cycle block is shown below:

By default, the drive cycle block is set to the FTP75 drive cycle. This can be modified by opening the block parameters shown below:


The following image shows the Battery Pack Subsystem
Lithium-ion battery is used for this model with a nominal voltage of 320V. The SOC of the battery reduces as the vehicle starts.
The power controller provides the input cuurent to the battery while charging. The SOC, current and Voltage are the parameters of the battery.

1. Li-ion Battery:
The Battery block implements a generic dynamic model that represent most popular types of rechargeable batteries.
The following image shows the Li-ion Battery block from powertrain blockset.
2) Bus Selector:
This block accept a bus as input which can be created from Bus creator, Bus selector. from the m port of the battery block , we get SOC,ampere and voltage values. These values are extracted using bus selector , which when connected to the m port , will show those values as shown below,
PID Controller
The PID controller block is essential for the speed control of the EV model. The PID controller block takes the error data between the drive cycle data and the actual speed of the vehicle (from the sum block) and works to minimize this error. The PID controller block is shown below:

Double-clicking the block opens the block parameters shown below:

In this model, I have used the continuous-time domain PID controller. All other parameters are left as default.


Saturation Block
In order to set the acceleration and brake commands, I have used the saturation block. This block is used when we want to set limits for signals. This block is shown below:

In the case of the accelerator command, I have set the limits between 0 and 1 by opening the saturation block parameters as shown below:

Another saturation block was used for the deceleration/brake commands which is shown below:

To create the deceleration commands, I have used a different set of limits between -1 and 0. This is shown in the image below:

Transfer Function
The transfer function block is used when we want to insert a transfer function. A transfer function is defined as the ratio of the Laplace transform of the output of a system to the input of a system. The transfer function block is shown below:

From the block parameters, we can modify the transfer function by changing the numerator and denominator coefficients. I have used the default coefficients.
For the deceleration command, I have used another transfer function block with a slightly different transfer function. This is shown in the image below:

The transfer function block was modified by changing the coefficient of the denominator as shown in the image below:

results:

the distance travelled:
The distance travelled by the vehicle is 5.922km
Displacement is defined as distance in a given direction and is a vector quantity meaning it has both size and direction. So, if the velocity data in a drive cycle was negative, this would indicate that the vehicle is moving in the reverse direction and this would correspond to a negative displacement. The display block would indicate the same if the velocities in the drive cycle data were of that nature.
Speed Scope:
From this scope, we can see 2 signals. The blue signal represents the reference signal which originates from the drive cycle data whereas the yellow signal shows the actual velocity of the vehicle. The ftp drive cycle had been customized so that the vehicle begins acceleration under the WOT condition (i.e.. full power) at t = 5 seconds. This is supposed to be maintained till t = 20 seconds when the vehicle is supposed to begin deceleration. From t = 20 seconds to t = 30 seconds, the vehicle speed is back to 0m/s i.e.. rest. Because this is a reference signal, all the commands are instantaneous. This is why the increase and decrease in speed is very sudden within a fraction of a second. However, this effect will not be observed on the actual velocity of the vehicle. This is because in real world conditions, there are more considerations to factor in which will not make it possible for a vehicle to accelerate and decelerate as instantaneously as the drive cycle commanded. In the real world, the effects of rolling resistance, drag and road inclination make a difference because their presence would cause the vehicle's motion to deviate from the drive cycle commands. Other factors include, the vehicle's inertia and the inertia of the transmission system.
SOC Scope
The SOC scope shows how the state of charge of the battery varies over the drive cycle time. The battery was modelled to begin with an SOC of 1 (100%) and so when the simulation begins as we can observe that the charge and discghare is possible in this case as the charge is happening due to regenrating braking as we can observe that the discharge is peak is 99.3% and as the speed increases the discharge is happening and as the speed decreses the charge happens and the soc at the end of the simulation is99.5%.

The current scope shows how the current flowing from the battery to the motor varies with the drive cycle time. As we can see, initially the current flowing through the circuit is 0A and this corresponds to the drive cycle commanding the vehicle to be at rest for this time period.The current must have decreased over time because as the vehicle was accelerating, it required lesser current from the battery to continue accelerating. The highest current is always required when accelerating from rest due to the inertia of the vehicle. But once the vehicle is already in motion, it requires significantly lesser energy to continue accelerating.
Conclusion
In conclusion, the EV model has been created with the necessary block components using the SIMULINK software and the model has been simulated for a customized WOT drive cycle. The simulation has produced results of the velocity of the vehicle, current flowing from the battery, and the SOC of the battery as well as the distance travelled by the EV. Since the EV model was parameterized to simulate averaged voltage pulses in the H-Bridge and Controlled PWM voltage blocks to be fed in to the DC motor, the simulation was run very quickly within a matter of seconds.
The total distance travel by vehicle is 5.822km/s depending upon the FTP75 drive cycle and the total time for simulation was 2474 sec.
The battery is having 320 V which is a nominal voltage and the battery ampere per hour rating is 95 by which we calculated the SOC (state of charge) of battery 99.5%