Project-1: Modelling an electric Car with Li-ion battery
AIM : To 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.
About Lithium-ion batteries:
This are one of the most widely used types of rechargeable battery, and their dominance continues to grow year-over-year. Here a brief overview of a technology that has transcended generations in technology.
In the 1970s a team of research scientists began working on what would become the lithium-ion (Li-ion) battery, a type of rechargeable battery that would one day power pretty much everything. From portable electronics to electric vehicles, it’s a technology that has well and truly shaped the electronics industry and our world.

we can seefrom the below figure the four components of a typical Li-ion battery. On the right is the anode and on the right is the cathode (the positive terminal). These are kept apart by a porous separator and an electrolyt

- In the normal operation of a Li-ion battery, positively charged lithium ions (Li+ ions) flow from the anode to the cathode through the porous separator. A corresponding electron current flows through the electrical load from the anode to the cathode. Lithium is used because it’s the cheapest, lightest, and most abundant electropositive chemical element.
- It is simple a technology has proven to be totally transformational. Without it it’s likely that the digital revolution that we’ve seen over the last few decades with portable devices leading the way would not have occurred. In addition, the major progress we’re seeing with electric vehicles would have struggled to take off.
- Given that the fundamental structure of the Li-ion battery is the same as that of Alessandro Volta who described and invented the first battery—composed of copper and zinc stacks separated by saltwater—in 1800 the levels of innovation and progress that we’ve seen and continue to see is staggering.
SIMULINK MODEL:

1) Modeeling of the vehicle body system:
This subsytem mainly consist of the different blocks they are
- Tires
- inertia
- vehicle body
- simple gear

i) Tire:


A-axles: This port is a mechincal rotational port which is associated with the axle that the tire sits on it
S-slip: This port is physical siginal outport which is associated with the relative slip between the tire and road
H-hub: This port is a mechincal translational port which is associated with the wheel hub which transmits the torque generated by the tire to the remaning of the vehicle
N - Normal reaction: This port is a physical input port which is associated with the normal force acting on the tire
The normal froce is positive when it acts downward on the tire pressing it against the pavement this tires are connected to the vehicle body
ii) Vehicle body:
Here the vehicle body as several inputs which can be modulated for the vehicle to have the basic setup


- Here NR-normal reaction ,This port is physical siginal output port for the normal force on the rear axle wheel force are considering postive if it acting as downwards
- NF- normal force front, This port is physical siginal output port for th normal reactions force on the front axle when wheels force are considered postive if acting downwards
- H-horizontal motion, This port is conserving port which is associated with the horizontal motion of the vehicle body which connects tire traction motion to this port
- V- longitudinal velocity ,This port is speed of the vehicle body
- Beta Road incline angle This port is used for the grade of the vehicle
iii) Inertia:


Here T= J dw/dt
where T= inertia torque J= inertia ,ohm= angular velocity T= time
The inertia is mainly connected to the simple gear to fing the inertia because of axel and gear are a mechanical roating device
iv) Simple gear:


The simple gear block mainly represents a gearbox whic contains the connected drivelines axes of the base gear ,B and follwing gear F
B: base gear: The output of this base gear is connected to the input of DC motor R it is a rotational mechanical conserving port
F: Follower: The output of this follower is connected to the rear axel it is also a rotational mechincal conserving
2) Distance subsytem:

It mainly contains the integrator block and divide block
This block is used in calcualting the distance travelled by the vehicle
3) SOC battery system:

This subsytem mainly consist of following blocks
1) Battery
2) Controlled current source
3) Bus selector
4) Product
5) Integrator
6) Divide
7) Goto
1) Battery:


- Here if we select the infinite of the battery charge capacity paramter the block changes as the battery as a series resistor and constant voltage source
- I when we select the finite for the battery charge capacity then the block changes to battery as a series resistor and a charge dependent voltage source
- The connection of the battery is the negative terminal is connected to the ground and then it controls the current source physical port to the postive port direction which aslo indicates the flow of the current
- The postive terminal is then connected to the controlled current source of the electrical conserving ports
2) Controlled current source:


- This controlled current source block mainly represents the ideal current source which is the powerful enough to maintain the required current through the voltage across the source
- In the controlled current source it consist of two port connected to the battery and one electrical converting port is connected with the PS-simulink converter to rate the transmission block and scope
- It is device which detects and convert the current to get an output voltage which is directly proportional to the current in the designed path
- If when the current passing through the circuit a voltage grops across the path where the current is flowing
- The magentic field is genrated near the current carrying conductor
3) PS-simulink converter:

- It mainly says about the connecting the physical siginal to the simulink siginal
- we mainly use this block in the system to connect mostly scopes like physical siginals to the simulink siginal or simulink scope
- For calculating the SOC we have to use the subsystem to connect different paramters like rate transition gain discreate time integrator constant and sum block
4) Product block:

This block mainly used to get the output results by multiplying the two inputs two scalars a scalar and a non scalar or two nonscalr which have the same dimensions
the default paramter values which specify the behaviour
4) Motor controller subsytem:

The main compents used in the above figure are:
1) Dc motor
2) H- bridge
3)Controlled PWM voltage
4) Controlled voltage source
5) Slover configuration
1) DC motor:


- From the above figures we can see that it mainly consist 2 sides to the block
- The mechincal block is in right side i.e green line and electrical block on left side i.e blue line
- Here mechincal block as 2 ports C and R , here c refers to the casing and R refers to the rotor which is helps in producing the torque
- The electrical side as postive and negitive terminals for the voltages to be applied
- If when the postive voltage is electrical conserving port which is associated with the DC motor
- If the negtive volatge is electrical conserving port asscoiated with the Dc motor
- Here in this system the postive is connected with current sensor and the negative is connected with the negtive terminal of H bridge
- R is the Dc motor rotor which connects with the mechincal rotataional port where it is asimole gear where as C is the DC motor case it is connected to the mechincal rotational reference
2) H-bridge:


- It mainly consist of 2 ports the left side id for controlling of the voltage siginals and the right side for the terminals to provide the controlled voltage of the Dc motor
- The left side ports of H bridge are
- PWM: This a pulse width modulation which will provide the voltage pulses to the H bridge either in the PWM or average mode
- REF: this a reference port
- REV this is reverse port
- BRK:this is a brake port
- Here the PWm ourput is connected with the PWM input of controlled PWM voltage
- The REF and REV port are connected with REF port of the controlled PWM voltage port
- The BRK port is connected with the controlled volatge source
- It mainly shows that the postive terminal is connected to the postive of the current sensor and negative is connected with the negative of the DC motor
3) Controlled PWM voltage:


- Here Ref+: is the postive electrical reference voltage
- Ref-: is the negtive electrical reference voltage
- PWm: is the electrical conserving port which is associated with the pwm siginal
- REf: is the conserving port which is associated with the floating zero volt reference
- The value of the output voltage amplitude paramter gives amplitude of the output voltage
4) Controlled voltage source:

- This block mainly represents the ideal voltage source which is powerful enough to maintain the specified voltage at its output of the current flowing through the source
- The output voltage is v=vs were vs is the numerical value presented at the physical port
- The block has one physical siginal port and two electrical conserving ports which is associated with its electrical terminals
5) Solver configuration:

- The slover configuration block mainly represnts the slover paramters that your model needs before you can begins simulation
- This block has a coserving port you can add this block anywere on the physical network circuit by creating a branch point and connecting it to the only port of the solver configuration
- It is connected with the controlled PWM voltage anf for a model only one slover configuration is connected
5) PID block subsytem:

This subsytem mainly consist of the
1) PID block
2) Acceleration saturation
3) Decceleration saturation
4) Sum
PID block:


The tuning values are KP = 0.0100108019359488 Ki= 0.00101437091378446 Kd= 0.0234764426987
- here the closed loopnsysten like PID controller includes a feedback control system
- This feedback system calculate the feedback variable using the fixed point to generate an error siginal
- S based on this it will alters the system output this process will continue till the error reaches to zero otherwise the value of the feedback varable becomes equivalent to the fixed point
- VelRef: This is reference port vehicle velocity is connected with the speed result block its units are m/sec
- VelFdbk:It is longitudinal vehicle velocity whuch is connected with an integrator block for the continuous time integration of the VelFdbk siginal
- AccelCmd: This commanded vehicle acceleration is connected with the controlled voltage source input siginal by combining with ps simulink converter
- DecelCmd: This commanded vehicle deaccelration is connected with another controlled voltage source by combination of ps simulink converter
Acceleration Saturation:

- In this saturation block it imposes the upper and lower boundaries on a siginal
- if when the input siginal is within the range specified by the lower limit and upper limit paramters the input siginal passes through unchanged
- If when the input siginal is outside this bounds the siginal is clipped to the upper or lower boundry
- If whe the lower limit and upper limit paramters are set to the same value the block outputs are

Decceleration saturation:


- Here upper limit specifies the upper bound on the input siginal
- when the input siginal to the saturation block is shown in above value the output block is clipped to this value
- Lower limit specifies the lower bound on the input siginal
- when the input siginal to the saturatin block is below this value the output of the block is clipped to this value
Drive cycle source:


- Here the connection of drive cycle Refspeed is connected with the VelRef of longitudinal driver and then to the scope results which generates vehicle reference speed
- The block output is specified by the vehicle longitudinal speed which we can use to perdict the engine torque and fuel consumption which requires to the achiev desired speed and acceleration
- It aslo produces the realstic velocity and shift reference for the closed loop acceleration and braking commands for the vehicle control and plant model
- Here study and tune and optimize vegicle control system performance and system robustness over mutliple drive cycles
Result block:

Output results:
Vehicle speed and reference speed

- Here the simulation was run about 2474 sec and we have obtined the results as shown abobe graph
- Here it as 2 individual graphs which shows the results for SOC and vehicle speed result
- Here the graph of the battery SOC shows linear and slowly it is discharing at rate from 100 to 60
- And aslo if we observe in the 2nd graph the vehicle speed is some what same as drive cycle source by which increasing saturation values
Conclusion:
we have Created a MATLAB model of electric car which using lithium ion battery and with suitable motor. and also suitable blocks from Simscape or Powertrain block set. Implemented the vehicle speed control using PI controller and generated brake and accelerator commands. BY Avoiding the use of readymade driver block for speed control.
Prepared a report about the model including following:
Objectives, System level configurations, Model parameters, Results, Conclusion