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.
Objective: To create a MATLAB model of electric car using lithium-ion Battery and by using the suitable motor and by following the below conditions
- Choosing suitable blocks from Simscape or Powertrain block set.
- Implementing the vehicle speed control using PI controller and generate brake and accelerator commands.
- By avoiding the readymade available driver block for speed control.
discussing in detail about the
- System level configurations
- Model parameters
- Results
- Conclusion
Electric Vehicle: An All-electric vehicle also called a Battery Electric Vehicle (BEV), uses one or more electric motors 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 Vehicle
EVs have 90% fewer moving parts than an ICE (Internal Combustion Engine) car.
Battery: Store the energy required to run an EV. The higher the rating of the battery, the higher the range.
Electric Motor: Using power from the battery pack, this motor drives the vehicle's wheels. Some vehicles use motor generators that perform both the drive and regeneration functions.
Power electronics controller (Inverter): 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 battery pack.
Onboard charger: Takes the incoming AC electricity supplied via the charge port and converts it to DC power for charging the traction battery. It also communicates with the charging equipment and monitors battery characteristics such as voltage, current, temperature, and state of charge while charging the pack.
Thermal system (cooling): This system maintains a proper operating temperature range of the engine, electric motor, power electronics, and other components.
Transmission (electric): The transmission transfers mechanical power from the electric motor to drive the wheels.

Vehicle Modelling:
- In order to be able to estimate the performance of an electric vehicle, it is very important to have a proper model of it.
- The electric vehicle model is very complex as it contains many different components. Each component needs to be modelled properly in order to prevent wrong conclusions.
- The design or rating of each component is a difficult task as the parameters of one component affect the power level of another one.
- There is therefore a risk that one component is rated inappropriately which may make the vehicle unnecessarily expensive or inefficient. Therefore, System level configurations are necessary.
Block-Diagram:

Simulink Model of Electric Vehicle:
Simulink Blocks used:
- Drive Cycle Source
- PI Controller
- Saturation Block
- Transfer Function Block
- Controlled PWM voltage
- Constant Voltage Source
- H-Bridge
- DC Motor
- Vehicle Body
- Tire (Magical Formula)
- Simple Gear
- Current Sensor
- Controlled Current Source
- Battery
- Electrical Reference
- Mechanical Rotational Reference
- Integrator
- Divide
- Bus Selector
- Constant
- Display
- Scope
- Solver
- PS-Simulink Converter
- Power gui
- Goto
- From
System Level Modelling of EV

Vehicle Body

A four-wheel drive model of an electric vehicle is developed. Two wheels place at the front portion and the other two placed at the rear portion. Both real and front wheels are controlled by an DC motor which is controlled by H bridge. The vehicle body placed on the four wheels of the drive with initial parameters of environments like wind, inclined and throttle. For simplicity grade, environmental factors are considered negligible. Before performing the modelling of the four-wheel electric vehicle drive train, we finalize the parameters and behaviour of the vehicle body. The vehicle parameters are chosen to be Settings.

Tire:

This block represents the longitudinal behaviour of a highway tire characterized by the tire magic formula. 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 the physical signal input port that applies the normal force acting on the tire. Connection S is a physical signal output port that reports the tire slip.

Drive Cycle:
A drive cycle is typically represented by a series of data points which plots vehicle speed against time. Driving cycles are produced to assess the performance of vehicles in various ways, including fuel consumption and pollutant emissions. This is being modelled in MATLAB using drive cycle source.


PID Controller:


PID control respectively stands for proportional, integral and derivative control, and is the most commonly used control technique in industry
PID control involves several tasks that include:
- Selecting an appropriate PID algorithm (P, PI, or PID)
- Tuning controller gains
- Simulating the controller against a plant model
- Implementing the controller on a target processor Controller

Controlled PWM Voltage

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.
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.

H-Bridge Circuit

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.

DC Motor

The dc motor block is used to represent the electrical and torque characteristics of the motor. Motor parameters are specified directly or derived from rated load and stall torque.

Simple Gear:

This Simple Gear Block represents an ideal nonplanetary, fixed gear ratio gear box. The gear is determined as the ratio of the input shaft angular velocity to that of the output shaft.

Battery:

This Battery block implements a generic dynamic model that represents most popular types of rechargeable batteries. Here we used Lithium-ion type of battery.

Controlled Voltage Source:

This block provides the necessary voltage that is required for the vehicle. The Controlled Voltage Source block converts a Simulink input signal into an equivalent voltage source. The generated voltage is driven by the input signal of the block. We can initialize the Controlled Voltage Source block with a specific AC or DC voltage. If we want to start the simulation in steady state, the Simulink input must be connected to a signal that begins the simulation as a sinusoidal or DC waveform that corresponds to the initial values.
Controlled Current Source:

Similar to voltage block this block produces an ideal current that is powerful enough to maintain the specified current regardless of the voltage across it.
Working
In this model input signal or drive cycle data is given to PID controller block. The PID controller block generates acceleration and deceleration commands based on the drive cycle data and the acceleration command will be given to the controlled PWM voltage. The controlled PWM signals generate PWM signals for turning ON and turning off the switches in H bridge rectifier which controls the motor circuit. Th motor gives the required torque output and velocity output can be fed back to the longitudinal driver. The speed of vehicle and output velocity of the vehicle can be compared in the scope.
Now we run the simulation for 2474 seconds and check the output results for 2 cases
Case-1 with default values of PI controller
Case-2 With the Tuned values of PI controller.
Case-1 With default values of PI controller
Vehicle Speed Scope:

- From this scope we can see two signals. The blue signal indicates the drive cycle data and the yellow signal represents the vehicle body speed.
- The PI controller tries to maintain the drive cycle data, processes it and controls the vehicle's speed according to the reference speed.
- This graph approximately overlaps each other during acceleration and deceleration.
Voltage, Current and SOC Scope

- SOC graph shows how the state of battery varies over the drive cycle time.
- Initially the battery SOC is 100% and reached to 89.5%.
- As the simulation starts the charge of the battery gets decreased and when vehicle is in braking mode there will be little rise in the graph. Which is nothing but the regenerative braking mode is in action.
- There will a fall of SOC after the simulation.
Case-2 With Tuned Values of PI controller.
Vehicle Speed Scope:

- From this scope we can see two signals. The blue signal indicates the drive cycle data and the yellow signal represents the vehicle body speed.
- The Values of P and I were updated by tuning the plant and updating the block.
- The PI controller tries to maintain the drive cycle data, processes it and controls the vehicle's speed according to the reference speed.
- This graph approximately overlaps each other during acceleration and deceleration.

Voltage, Current and SOC Scope
- SOC graph shows how the state of battery varies over the drive cycle time.
- Initially the battery SOC is 100% and reached to 85%.
- As the simulation starts the charge of the battery gets decreased and when vehicle is in braking mode there will be little rise in the graph. Which is nothing but the regenerative braking mode is in action.
- There will a fall of SOC after the simulation.
Conclusion
The above electric car model has been created with all the necessary components using the SIMULINK and the model is simulated with all the proper procedure. This simulation gives the vehicle speed output, current flowing from the battery and the state of charge as well as the distance travelled with the simulation running time. This EV model covers 5.78km. The SOC of the battery is discharged efficiently up to 85% from full charge.