Project
Aim :-
Create a MATLAB Simulink model of electric car which uses a battery and a DC motor. Choose suitable blocks from Powertrain block set. Prepare a report about the model including following:
Objectives:
1. System level configurations
2. Model parameters
3. Results
4. Conclusion
THEORY :
A vehicle that uses one or more devices that convert electrical energy into mechanical force for movement is called an Electric Vehicle (EV). An electric vehicle can get its electricity from external sources through a system that collects it, or it can generate its own electricity with a device that stores it, such as a battery, or a device that produces it, such as a solar panel, a fuel cell or an electric generator. EVs can be of different types, such as vehicles that travel on roads or rails, vessels that operate on water or under it, aircraft that fly in the air or spacecraft that travel in space.In this porject I am considering a battery operated DC motor driven electric vehicle
Components of an EV - An electric powered car has three primary components
- Battery
- Motor controller
- Electric motor.
Model Parameter
(1) Battery :
- To model the Battery pak, a simple Battery block is used. This is because, if the generic battery block is used instead, the simulation will run for a much longer time.
- Here, the selected option for Battery Charge Capacity is Finite. Accordingly, the block models the battery as a series internal resistance plus a charge-dependent voltage source.
If the chosen option had been Infinite, the voltage source would have been constant. - Also, the self-discharging of the battery and the battery dynaics are disabled.
- The Battery Nominal Voltage is given as 400V.
The Ampere-hour rating is assumed to be 50.
The rest all paramaters are left with their default values.
- To ensure the battery supplies current as per the requirements of the motor controller and not the rated current, a Current Sensor & Controlled Current Source pair is connected.

(2) Motor Controller :
- H-Bridge circuit -

- This block represents an H-brdge 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 enabled 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.
- Connection REF is for the reference input. This combined with the PWM connected will form the pulse input for the H-Bridge.
Here, the REF input is connected to the Electrical Reference (ground). - Connection REV corresponds to the reverse motion of the motor which essentially means, the backward motion of the vehicle.
Here, the backward motion of the vehicle is not accounted for and so, the port is connected to the electrical reference. - Connection BRK is for the braking of the vehicle.
- Since, the PWM mode results in a huge amount of simulation time, Averaged mode is selected for this simulation.
- Load current characteristics are considered to be smoothed here.
- Also, the regenerative braking is anabled for the simulation. This means, when the vehicle starts decelerating, corresponding amount of charge will be fed back to the battery.
Accordingly, the BRK input is connected to a Controlled Voltage Source. This will generate emf corresponding to the intensity of brakes applied and fed the power back to the battery.
- The Input Threshold parameters are left with their default values.

- The Output Voltage Amplitude of the H-Bridge circuit is given the same value as the rated DC supply voltage of the DC motor.

- Simulink provides an inbuilt Controlled PWM Voltage block. This block is used for providing the proper pulse inputs to the H-Brdige circuit.
The PWM & REF connections are for the corresponding ports on the H-Bridge circuit.
The 2 reference inputs correspond to the throttle inputs given by the driver. The block generates corresponding pulse width as per the accelerations and brakes apllied by the driver himself. 
- Here, the PWM frequency is 1000 Hz. Also, the simulation mode is Averaged as that in the H-Bridge circuit.

- The input scaling parameters given are -
0V for 0% duty cycle and 5V for 100% duty cycle. Accordingly, the output voltage amplitude becomes 5V. - The H-Bridge circuit along with the PWM input, together form the motor controller circuit.
(2) DC Motor :

- Simulink provides an inbuilt bodel block for DC motor which converts electrical input into mechanical rotational output.
Note : Here, the blue colour corresponds to the electrical side of the motor and the green colour corresponds to the mechanical side. - Here, the motor field type is kept as Permanent magnet and the model parameterization is done by rated load and speed.
The armature inductance and the mechanical parameters are given their default values.
All the other parameters are changed as shown below -

- The connection R represents the Rotor (rotational output) while the connection C is for the Casing (stationary). Thus, the R port is connected to the input of the vehicle subsystem created earlier. The C port is connected to a mechanical rotational reference.
- Simulink provides an inbuilt bodel block for DC motor which converts electrical input into mechanical rotational output.
(4) Vehicle Body Subsystem :
- The vehicle is assumed to be a front axle driven (4 wheels - 2 on each axle).
- The wheels are modelled using simple Tire (Magic formula) simulink blocks.

- The N port of the tire corresponds to the Normal Reaction acting on it.
The A port corresponds to the Mechanical Rotational conserving port for the wheel axle. Thus both the wheels on the same axle should form a connection through their respective A ports.
Connection H corresponds to the Mechanical Translational conserving port for the wheel hub through which the thrust developed by the tire is applied to the vehicle. Thus, all the 4 wheels form a connection through their respective H ports and this is in turn connected to the translational hub of the vehicle body.
The connection S represents the output port for slip of the tire. - The complete subsystem is shown below -
(5) Longitudinal Driver :
- Longitudinal Driver is an inbuilt block provided by the powertrain blockset.

- It is a parametric longitudinal speed tracking controller for generating normalized Acceleration and Braking commands based on reference and feedback velocities.
- The VelRef port is the reference velocity port where the input drive cycle data is fed.
The VelFdbk port corresponds to the feedback velocity. The actual velocity output given by the vehicle body is connected here. By comparing the actual (feedback) velocity with the reference velocity, the driver block generates acceleration and braking signals in order to minimise the error between the two concerned velocities.
Grade corresponds to the grade angle. For this simulation, no inclination is considered and hence, a constant block with value 0 is connected.
Info gives the output for the bus signal for different block calculations like difference in reference vehicle speed and vehicle speed, etc.
AccelCmd & DecelCmd correspond to the acceleration and deceleration commands generated respectively and are connected to the corresponding ports of the Controlled PWM Voltage block. - Here, the selected control type is PI. Acordingly, the block implements proportional-integral (PI) control with tracking windup and feed-forward gains.

(6) Reference Velocity (Drive Cycle) :
- The Drive Cycle Source block is used to provide the reference speed for the simulation.
- It generates a standard or user-specified longitudinal drive cycle.

(7) Battery State of Charge :
- A small subsystem is created to calculate the State of Charge of the battery.
- This subsystem takes the battery current as the input.

Simulation :
- The system is ran for simulation for 2474 s which is the total time for which the input drive cycle is defined.
- A Solver Configuration is added to ensure proper solving of the mathematical equations by the model.

- Scopes are connected to analyze different outputs such as the SOC of the battery, the reference velocity & the actual velocity of the vehicle and the distance covered by the vehicle during the total run.
- The distance is calculated by simply time-integration of the vehicle velocity.
CONCLUSION : The model was ran for simulation under the standard FTP75 drive cycle.