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.
Theory:
All-electric vehicles (EVs), also referred to as battery electric vehicles, have an electric motor instead of an internal combustion engine. The vehicle uses a large traction battery pack to power the electric motor and must be plugged in to a wall outlet or charging equipment, also called electric vehicle supply equipment (EVSE). Because it runs on electricity, the vehicle emits no exhaust from a tailpipe and does not contain the typical liquid fuel components, such as a fuel pump, fuel line, or fuel tank
Key Components of an All-Electric Car
Block Diagram:

Important steps to follow while modelling an Electric Vehicle.
1)Selection of motor
2)Motor Parameter( Rating and Speed)
3)Battery Pack
4)Motor Controller system
The motor that we are going to select for this model is PMDC Motor. (Permanent Magnet DC motor)
The advantage with PMDC motor is that they are highly efficient and power losses are negligible. They are alo smaller in size.
These are the Rating parameter of the motor.

Next is Battery System for the motor:
Lithium-ion Batteries are the best source of power for EV's because of the follwing advantages.
High energy density
Compact size
longer life.
We also have to come up with the battery voltage and current parameters for the battery pack system.
Since our PMDC motor has a supply voltage of 330V our battery voltage must also provide a voltage of 330V
The Rated capacity of the battery is 75Ah.

The Battery Parameters are also fixed. Now our motor controller is chosen.For modelling purposes PID & PI controller are widely used for speed control. While modelling an EV in MATLAB, we use a reference drive cycle. After the end of modelling we can check whether our actual drive cycle matches with reference cycle. To match them we use PID or PI controllers. The Purpose of a PI controller in a closed loop system(feedback sstem) is to find out the error difference. After finding out the error difference, The controller tries to negate it.

There are two controllers within the PI controller.
1) Proportional controller - are reffered as the type of controllers in which the output signal shows proportionality with the error signal. It is given as

Kp is the proportional gain
2) Integral Controller : are the types of controller where the output is proportional to the integral of the error signal. This is given as

Ki is the Integral gain.
The Kp and Ki gain values are the ones that minimizes the error difference in the system. These values are found out by trail and error method. We can use the Tune option in PID tuner app in Matlab. But since our model is not linearised (Linearised models describe the relationship between two quantities that show a constant rate of change) we cannot use the PID tuner app.)
The other motor controller that we chose is PWM H Bridge controller. This controller is connected to Battery pack. This H bridge controller is used to draw only necessary amount of current from the battery based on the EV's drive cycle speed. Using such motor controller will help conserve energy and also control the motor speed based on the acceleration and brake commands given by driver.
Selection process is completed now we can look at the EV simulink Model.
Details of the Simulink Model.
Drive cycle Source:
This is the Reference drive cycle that we set for EV model. This can be done by using drive cycle source block in MATLAB. Our reference drive cycle is UDDS Urban Dynamometer Driving Schedule (UDDS) driving cycle is a typical urban driving cycle with average speed of 31.51km/h and has frequent braking and acceleration.


This is the Reference block of our drive cycle it should match the actual drive cycle in output plot.
Now we will setup a control system of the model.

The Reference Drive cycle is passed onto the adder block. Then the PI controller is connected with the block. The signals coming out of the PI Controller are then connected to two saturation blocks which sets an upper and lowe limit. These two signals acts as acceleration and brake commands for EV.
The parameter of the PI controller block is shown below.

The Saturation paramaeters are shown below.


Now we will look at the H bridge controller circuit.

The Signals coming out of the saturation block are sent to controlled voltage sources. The controlled voltage source block is used for the sources.They are used to keep the voltage of the signals constant regardless of current flowing through circuit.
Then they are sent to a controlled PWM voltage block. This represent a pulse with modulated voltage source. The parameters of the PWM block is shown below.

The frequency is kept at 6000Hz. The mode of simulation is kept as averaged so as to speed up the simulation time.
Connect the voltage source with the controlled PWM block as shown above.
Now H-bridge block is used. The parameter of the controller are shown below:

Enable the averaged simulation mode and aslo enable regenerative braking. The threshold voltage parameter are shown below:

The H-bridge controller is used to change the polarity of the voltage applied at the DC motor so as to run the vehicle in forward and reverse direction as per the acce;eration and brake commands.
This is the end of the controller circuit. in Matlab an electricla circuit must have atleast one electrical reference block and one solver configuration block connected. Connect them anuwhere in controller circuit.
Now we will move on to the Batter Pack system.

The H bridge block is connected to a current sensor and the current sensor is connected to a controlled current source block. The Genetic Battery block is used to create a battery pack for the model. Thves us the current sensor current entering into controller system from battery pack.
The Battery pack parameters are shown below.

Now we need to extract the output from this battery. The output of this battery is the current voltage & SOC. They can be extracted using a bus selector. The bus selector block parameters are shown below:

These signals are then connected to scope window as shown in above image.The scope block will plot the values of current volatge and SOC for the entire drive cycle.
Now we will see the motor drive and vehcile body system of the EV model.

The PMDC Motor is connected with the H-bridge controller, so that motor operates based on the acceleration and brake commands given by driver. A mechanical rotational reference is connected to the DC motor. The parameters of the PMDC motor is given below:

The simple gear box block is used to transmit the power from the motor to the wheels. Its parameter is shown below:

The vehicle Dynamics block is used to simulate a vehicle body based on the mass,frontal area, drag co-efficient, grade and wind velocity.This is the main body of the vehicle.
Parameters are shown below:


The wind velocity is keyed in the dynamic block using a PS constant block.Connect the PS constant block at Port W for wind velocity. Beta is for grade angle which is not considered in this case.

The wind velocity is kept at 5m/s where as we have not considered any grade angle for the vehicle. After the vehicle dynamics block use the tire(magic formula) block to simulate the tires and connect them to vehicle dynamic block as shown above. Consider the rolling resistance for tire. The parameter is hown below.


Now use the output port of the vehicle dynamics block(the V port) to connect to a scope window. This will help us to plot the actual drive cycle of the model.
The output of the vehicle dynamics block is feedback to the control system adder block. Doing this will minimize the error difference between the actual and reference drive cycle.
In addition a display block is connected to output of the vehicle dynamics block to diaplay the speed in KMPH.
Use a constant block and convert the value from m/s(multiply it by 3.6 with velocity to get the speed in kmph). Simulate the model for results.
From the plot it is evident that actual drive cycle is almost matching with the reference drive cycle.But the peak velocity is lesser in the actaul drive cycle(15m/s). this is because of many factors. The rolling resistance of the vehicle is taken into consideration & hence this will affect the velocity of the vehicle. The wind velocity also affect the speed of the vehicle.
SOC

The Battery SOC falls upto 99% this is because of regenrative braking. when decelerate, the battery gets recharged. The motor function as an electric generator during this period. So while acceleration the battery discharges and charges at deceleration.
The Voltage and the current plot of the battery are shown below:

Current :

Drive cycle Comparision Original and Actual Drive cycle.
