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.
Answer:
MATLAB model of electric car which uses lithium ion battery and suitable motor:

https://drive.google.com/file/d/1pPIQVL3ElJhjzIGvlitkazk6OtyC7x1J/view?usp=sharing
system level configuration and model parameter:
Driving cycle:


vehicle speed controller using PID controller:

Tuned PID configuration :

PID
The block output is a weighted sum of the input signal, the integral of the input signal, and the derivative of the input signal. The weights are the proportional, integral, and derivative gain parameters.
The Driver block is a controller for the vehicle, it controls the acceleration, and braking of the vehivle. The block is implemented with a PID controller which is basically the main controller in the whole drive cycle. The PID controller works as colsed loop speed control, it takes the input as a reference speed and correct the error genereted by the vehicle speeds. PID conroller is tuned for the adequate acceleration and deacceleration command itis done by limiting its output to upper and lower saturation. Separting the output of the PID to accelerate and deacceleration command we use a saturation block for each command, for acc command we use an upper saturation value and for the deaccelerate command, we use a lower saturation value.
PID Gain Tuning
The RD controller coefficients are tunable either manually or automatically.

Saturation:The Saturation block produces an output signal that is the value of the input signal bounded to the upper and lower saturation values. The upper and lower limits are specified by the parameters Upper limit and Lower limit.


Zero-Crossing Detection:
A variable-step solver dynamically adjusts the time step size, causing it to increase when a variable is changing slowly and to decrease when the variable changes rapidly. This behavior causes the solver to take many small steps in the vicinity of a discontinuity because the variable is rapidly changing in this region. This improves accuracy but can lead to excessive simulation times.

Motor and Controller:

D.C MOTOR:

PWM:

»BATTERY
The Datasheet Battery block implements a lithium-ion, lithium-polymer, or lead-acid battery that you can parameterize using manufacturer data.
To create the open-circuit voltage and internal resistance parameters that you need for the block, use the manufacturer discharge characteristics by temperature data.
To determine the battery output voltage, the block uses lookup tables for the battery open-circuit voltage and the internal resistance. The lookup tables are functions of the state-of charge (SOC) and battery temperature, characterizing the battery performance at various operating points:
Ports
Inputs
Capinit Battery capacity
scalar
BattCurr — Battery load current
scalar
BattTemp Battery temperature
scalar


used in the system is a Datasheet battery which implements a model for the lithium-ion
battery. why most of the EV uses lithium—ion cells as a source, like any other battery because battery like a lead acid battery which required constant maintenance and monitoring, hydrogen cells which are quite bulky and expensive also capacitor banks are used as a battery pack but they have a high discharge rate and drain quickly. Hence the Lithium-Ion Battery eliminates all such disadvantages and requires fewer maintenaince and operational cost are less.
Longevity- The average lithium-ion battery life span for large capacity is more than 8 years. Safety-reduce the risk of accidents by eliminating exposures to flammable fuels able to withstand even in the high temperature without explosions.
Environment Impact- Lithium-Ion Battery provide significaant environmental benefits over fossil fuels. With the steady increase in the electric
vehicle, we can see an immediate impact on the reduction in carbon emission.
The battery pack is packed with 30 numbers of cells in series and 2 numbers of cells in parallel each. Rated capacity of the battery (Ah) = 100
Output Voltage = 12V
The Battery rated capacity is 100 Ah and rateed voltage is 12 volt the battery provides 1200kwh considering its charging/ discharging.
Charging of battery: If the applied current is 10 amperes, then it would be 1004h/104=10 hrs. approximately.
Discharging: Battery Ah X Battery Volt/ Applied load say, 100Ah X 12V/100 watts = 12 hrs. (With 40% loss at the max =12 x 40/ 100 = 4.8 hrs). The
Backup will last up to 4.8 hrs.
Formula to calculate SOC = SOC(t) = SOC(t-1)+J [I /C Bat.dt Where SOC(t) = State of charge at time t
SOC(t-1) = Initial state of charge I = charge/discharge current(A) T = time(H)
The BattCurr and the BattVolt are connected to the motor controller respectively, the batt SOC can be determined by the bus selector SOC is
scaled to 100 by using a gain block.
Parameter for Battery-
- Battery Type = Lithium-Ion Battery
- BattchargeMax =100Ah
- No of Cells in Series = 30
- No of Cells in Parallel = 2
- Output Battery Voltage = 12V
when you discharge your battery by variable load, it means you have different discharge current ratios. In this case, you should consider 2 different issues for calculation of your SOC.
- How much is the discharge current
- How the voltage of the battery changes
Assuming you are using Lead-acid battery, your battery should have a cut-off voltage indicated in battery datasheet.
If your battery reaches to this voltages, your regulator should disconnect the battery from the circuit to prevent battery damage. High load demand (high discharge current) leads to fast voltage drop. So your battery might be able to discharge but it leads to damage. In this cases, discharge can be controlled by charge regulator and different discharge strategies.
VEHICLE BODY AND WHEELS:


> IN VEHICLE BODY
Description
The Vehicle Body 1DOF Longitudinal block implements a one degree-of-freedom (1D0F) rigid vehicle body with constant mass undergoing longitudinal (that is, forward and reverse) motion. Use the block:
- In powertrain and fuel economy studies to represent the vehicle inertial and drag loads when weight transfer from vertical and pitch motions are negligible.
- To determine the engine torque and power required for the vehicle to follow a specified drive cycle. You can select block options to create input ports for external forces, moments, air temperature, and wind speed.
In this model vehicle body (1D0F) longitudnal block is implemented. This bolck helps us to determine the vehicle inertia and drag load. There are mainly two forces acting on the wheels which are Longitudnal Force and Normal Force. These forces act on the rear and front of the wheels, the longitudnal forces on rear and front is given by (FwF & FwR). Whereas the normal forces are given by (FzF & FzR). This forces is connected to the respective axle of the wheels.
The Vehicle Body consist of grade and wind input ports which can be used to simulate slope and wind drag but this port are been grounded to minimize the complexity of the model. The Xdot output port is a longitudnal force in the X-Axis which acts as the velocity/speed of the vehicle in
m/s.

>WHEELS
The Longitudinal Wheel block implements the longitudinal behavior of an ideal wheel. You can specify the longitudinal force and rolling resistance calculation method, and brake type. Use the block in driveline and longitudinal vehicle simulations where low frequency tire-road and braking forces are required to determine vehicle acceleration, braking, and wheel-rolling resistance. For example, you can use the block to determine the torque and power requirements for a specified drive cycle or braking event. The block is not suitable for applications that require combined lateral slip.
There are four types of Longitudinal Wheel blocks. Each block implements a different brake type. one of it is Longitudinal Wheel - Disc Brake
The wheels used in this vehicle are longitudnal wheels have brakes of disc type brakes have great stopping power and cause less wear and tear and provide precises braking. This block implements the longitudnal behaviour of actual wheels.
This vehicle is front wheeled drive hence the axle torque is connected to the front of the wheels and the axle of the rear wheel is Grounded.
The longitudnal forces of the tires are set to magic formula constant the magic formula is a separate from of a characteristics function of stiffness, shape, peak and curvature. (BODE)
he Magic Formula is a specific form for the tire characteristic function, characterized by four dimensionless coefficients, B, C, D, and E, or stiffness, shape, peak, and curvature:
Magic Formula is given as (FF : f(k2, Fz) : FZD sin(C'tan — 1[IBK — EIBK — tan — 1(Bk)[}])
The Brake input command for the front and rear wheels are connected commonly as one input port. Omega is the angular velocity of the wheels in
the y-axis, hence this force is considered as torque input to the wheels.
REULTS AND GRAPHS:
DISTANCE GRAPHS: THE VEHICLE COVER APROX. 12KM FOR SINGLE CHARGE

SOC% GRAPH:

CURRENT GRAPH:

VOLTAGE GRAPH:

DRIVING CYCLE AND VELOCITY GRAPH:


SIMULINK MODEL:
https://drive.google.com/file/d/1pPIQVL3ElJhjzIGvlitkazk6OtyC7x1J/view?usp=sharing
CONCLUSION:
we Create a MATLAB model of electric car which uses lithium ion battery with suitable motor. by using suitable blocks from Simscape or Powertrain block set. and we Implement the vehicle speed control using PI controller and generate brake and accelerator commands. we have seen System level configurations, Model parameters, the model run as per our reference input given with less error in it due to pid controller