Final Project: Design of an Electric Vehicle
To Create a MATLAB model of electric car which uses a battery and a DC motor.
The way of approach for creating the MATLAB model of electric car is shown below buy a simple block diagram.

An Electric Vehicle is a vehicle that uses one or more electric motors, traction motors for propulsion. An electric vehicle may be powered through a collector system by electricity from off-vehicle sources, or may be self-contained with a battery, solar panels,fuel cells or an electric generator to convert fuel to electricity.
The component of electric vehicle are

Battery: The battery of an electric car can be charged through the use of ordinary grid electricity at a specialized power station. But aside from the conventional lithium-ion battery technologies, there are also other major battery technologies which can be used for electric cars.
- Lithium-Ion Batteries This battery technology gives extra performance and range. However, it also carries the highest price tag. Lithium-ion batteries are lighter than Lead acid and Nickel metal. These are also the batteries used in digital cameras and smartphones.
- Lead Acid Batteries This battery technology is the most popular. It is also the cheapest among the battery technologies. What's good about it is its 97% recyclable.
- Nickel Metal Hydride Batteries This battery technology provides higher output and better performance but it costs much more than lead-acid batteries.
Motor Controller The motor controller of an electric car administers its complete operation and the distribution of its power at any given moment. It acts as a floodgate between the motor and batteries. It helps monitor and regulates all key performance indications such as the vehicles operator, motor, battery, and accelerator pedal. It has a microprocessor which can limit or redirect current. It is used to either improve the mechanical performance of the car or suit the operators driving style. There are also more refined controllers which are capable of greater accuracy and thus, higher efficiency.
Electric Motor Unlike a gasoline engine with lots of moving parts, a motor only has one moving part. This makes it a very reliable source of motive power. Choosing an electric motor depends on the cars system voltage. They can be structured to use either AC or DC current. AC motors are less expensive and lighter compared to DC motors. They are also more common and they tend to suffer from less mechanical wear and tear. However, AC technology requires a more refined or sophisticated motor controller.
PROCEDURE:
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 block

- The N port of the tire corresponds to the Normal Reaction acting on it. 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.
- 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 tires are parameterized by Peak longitudinal force and corresponding slip.
- The other block parameters such as - rated vertical load, peak longitudinal force at rated load and slip at peak force at rated load - are kept with their default values.
- The tire radius is given as 0.3 m.
- The tire inertia is kept as 1 kg-m^2. Also, the rolling resistance is given with a constant coefficient of 0.015.

- This 2 axle (4 wheel) assebly is now connected to Velocity Body

This block basically represents a two-axle vehicle body in longitudinal motion. The block accounts for
- body mass
- aerodynamic drag
- road incline
- weight distribution between axles due to acceleration
- road profile
Here, the connection H is the mechanical translational conserving port hub. NF correspond to the output ports for nomral reaction forces on front axle and rear axle wheels respectively. Connection V represents the actual output translational velocity of the vehicle is the road inclination angle W corresponds to the headwind speed (headwind - direction opposite to that of vehicle).


these are the parameters taken for the simulation.
the below is the vehicle body subsystem.

DC Motor:

Simulink provides an inbuilt bodel block for DC motor which converts electrical input into mechanical rotational output. 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 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.
The + and - terminals of the motor are connected to the motor controller. If these terminals are directly connected to a battery, the required DC motor will run on the rated capacity of the battery. This will eventually result into no control over the DC motor and the vehicle will run at top speed throughout the simulation. Thus, a motor controller is very much needed.
Motor Controller:
H-Bridge circuit:

- This block represents an H-bridge motor drive. The block can be driven by the Controlled PWM Voltage block in 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.



- Simulink provides an inbuilt Controlled PWM Voltage block. This block is used for providing the proper pulse inputs to the H-Brdige circuit.



The input scaling parameters given are 0V for 0% duty cycle and 1V for 100% duty cycle. Accordingly, the output voltage amplitude becomes 1V.

The H-Bridge circuit along with the PWM input, together form the motor controller circuit.

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.

Battery Pack:

- The Battery block implements a generic dynamic model that represents most popular types of rechargeable batteries.
- This figure shows the equivalent circuit that the block models.

Charge and Discharge Characteristics
The circuit parameters can be modified to represent a specific battery type and its discharge characteristics. A typical discharge curve consists of three sections.

The first section represents the exponential voltage drop when the battery is charged. The width of the drop depends on the battery type. The second section represents the charge that can be extracted from the battery until the voltage drops below the battery nominal voltage. Finally, the third section represents the total discharge of the battery, when the voltage drops rapidly.
When the battery current is negative, the battery recharges, following a charge characteristic.
The model parameters are derived from the discharge characteristics. The discharging and charging characteristics are assumed to be the same.
The Exp(s) transfer function represents the hysteresis phenomenon for the lead-acid, nickel-cadmium (NiCD), and nickel-metal hydride (NiMH) batteries during the charge and discharge cycles. The exponential voltage increases when a battery is charging, regardless of the battery's state of charge. When the battery is discharging, the exponential voltage decreases immediately.

INPUT DRIVE CYCLE
Here in this model i have given my own drive cycle with the help of signal builder block .We can also give the inbuilt input drive cycle.


here I have given gain as 100 so the max acceleration is 100km/hr
Battery State of Charge:
The essential process to calculate the SOC is by subtracting the charge from the rated capacity of the battery.

The simulink model of ELECTRIC CAR

Simulation
- The system is ran for simulation for 2000 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.
OUTPUT:
Reference speed VS Actual vehicle speed

The Blue line represents the Reference speed and the Yellow represents the actual vehicle speed.
Distance covered

The total distance covered during the Run is 29.04km.
Battery state of charge:

The State-of-Charge of the battery at the end of simulation run is nearly about 93.84 %
- This means that the battery is not completely drained at the end and the vehicle can run on the same drive cycle.
- Also, the thing to be noted here is, since we had enabled the regenerative braking for the simulation, the battery SOC increases slightly whenever the vehicle undergoes heavy deceleration.
- Again, this depends upon the generating tendency of the motor and the maximum amount of current that the battery can take
Conclusion:
The model was succesfully ran and the results have been properly analyzed. It was very interesting in doing the model and learnt lot of things like claculating the battery state of charge the distance covered by the vehicle at the end of run time etc.
THANK YOU