Final Project: Design of an Electric Vehicle
# AIM
Create a MATLAB model of an electric car that uses a battery and a DC motor
# OBJECTIVE
Study about the modeling of electric vehicles and the blocks used in MATLAB modeling of EV. Thus prepare a detailed report on electric car modeling using a suitable duty cycle.
# THEORY
Electric cars function by plugging into a charge point and taking electricity from the grid. They store the electricity in rechargeable batteries that power an electric motor, which turns the wheels. Electric cars accelerate faster than vehicles with traditional fuel engines – so they feel lighter to drive.

* How does Charging work?
You can charge an electric vehicle by plugging it into a public charging station or into a home charger. There is plenty of charging to stay fully charged while you're out and about. But to get the best deal for home charging, it's important to get the right EV electric tariff so you can spend less money charging and save more on your bill.
* EV and their ranges
How far you can travel on a full charge depends on the vehicle. Each model has a different range, battery size and efficiency. The perfect electric car for you will be the one you can use for your normal journeys without having to stop and charge up halfway through.
* What types of electric cars are there?
There are a few different types of electric vehicles (EV). Some run purely on electricity, these are called pure electric vehicles. And some can also be run on petrol or diesel, these are called hybrid electric vehicles.
- Plug-in electric - This means the car runs purely on electricity and gets all its power when it's plugged in to charge. This type doesn't need petrol or diesel to run so doesn't produce any emissions like traditional cars.
- Plug-in hybrid - These cars mainly run on electricity but also have a traditional fuel engine so you can use petrol or diesel too if they run out of charge. When running on fuel, these cars will produce emissions but when they're running on electricity, they won't. Plug-in hybrids can be plugged into an electricity source to recharge their battery.
- Hybrid-electric - These run mainly on fuel like petrol or diesel but also have an electric battery too, which is recharged through regenerative braking. These let you switch between using your fuel engine and using 'EV' mode at the touch of a button. These cars cannot be plugged into an electricity source and rely on petrol or diesel for energy.
* What are the inner parts of EV ?
EVs have 90% fewer moving parts than an ICE (Internal Combustion Engine) car. Here's a breakdown of the parts that keep an EV moving:
- Electric Engine/Motor - Provides power to rotate the wheels. It can be DC/AC type, however, AC motors are more common.
- Inverter - Converts the electric current in the form of Direct Current (DC) into Alternating Current (AC)
- Drivetrain - EVs have a single-speed transmission that sends power from the motor to the wheels.
- Batteries - Store the electricity required to run an EV. The higher the kW of the battery, the higher the range.
- Charging - Plug into an outlet or EV charging point to charge your battery.
* EV Batteries
Kilowatts (kW) is a unit of power (how much energy a device needs to work). A kilowatt-hour(kWh) is a unit of energy (it shows how much energy has been used), e.g. a 100 watt lightbulb uses 0.1 kilowatts each hour. An average home consumes 3,100 kWh of energy a year. An electric car consumes an average of 2,000 kWh of energy a year.
* How to charge an EV?
You can charge an electric vehicle either by plugging it into a socket or by plugging into a charging unit. There are plenty of charging stations around the UK to stay fully charged while you're out and about. There are three types of chargers:
Three-pin plug - a standard three-pin plug that you can connect to any 13 amp socket.
Socketed - a charge point where you can connect either a Type 1 or Type 2 cable.
Tethered - a charge point with a cable attached with either a Type 1 or Type 2 connector.
* How long does it take to charge an electric car?
There are also three EV charging speeds:
- Slow - typically rated up to 3kW. Often used to charge overnight or at the workplace. Charging time: 8-10 hours.
- Fast - typically rated at either 7Kw or 22kW. Tend to be installed in car parks, supermarkets, leisure centers and houses with off-street parking. Charging time: 3-4 hours.
- Rapid - typically rated from 43 kW. Only compatible with EVs that have the rapid charging capability. Charging time: 30-60 minutes.
An EVs range is dependent on the battery size (kWh). The higher the EV battery kWh, the more power, the further you travel. Here are examples of how far some electric cars charge will go:
- Volkswagen e-Golf - range: 125 miles - equivalent to a journey from Bristol to Snowdonia National Park.
- Hyundai Kona Electric - range: 250 miles - equivalent to a journey from London to the Lake District.
- Jaguar I-Pace - range: 220 miles - equivalent to a journey from Edinburgh to Birmingham
Tata Tigor EV (Rs. 12.49 – 13.64 lakh)

The Tata Tigor EV is the first with a starting price of Rs. 12.49 lakhs, ex-showroom and is also the only compact sedan on this list. This car comes equipped with a 26 kWh battery that provides the driver with a range of 306 kms per charge and in turn powers an electric motor with an output of 74 bhp and 170 Nm of torque. The car takes eight and a half hours to charge to 80 percent using a 15-ampere wall adapter, however, will charge to 80 percent within an hour if a DC fast charger is used.
Tata Nexon EV (Rs. 14.79 – 17.40 lakh)

The Nexon is equipped with a 30.2 kWh battery that provides a range of 312 kms per charge and powers an electric motor with an output of 127 bhp and 245 Nm of torque. The battery can be charged up to 80 percent in eight hours using a regular 15-ampere wall socket, or within just an hour if one uses the DC fast charging option.
Tata Nexon EV Max ( Rs. 17.74 – 19.24 lakh)

The latest entrant in this list and a bigger sibling to the Nexon EV, the Nexon EV Max offers what you want; more mileage and speed over the standard Nexon EV, which will continue to be offered alongside the latest sibling. Tata Motors claims a charging time of 56 minutes from 0-80 percent via a 50kW DC fast charger.
MG ZS EV (Rs. 22 – 25.88 lakh)

MG Motors offers the ZS EV in two variants – Excite and Exclusive priced at Rs 22 lakh and Rs 25.88 lakh, respectively. The new MG ZS EV gets a bigger 50.3 kWh battery pack that now returns an ARAI-claimed range of 461 km on a single charge. The car can sprint 0-100kmph in 8.5 seconds and has 175 bhp of peak power on offer.
Hyundai Kona ( Rs. 23.84 – 24.02 lakh)

The 39.2 kWh battery enables the Kona to have a milage of 452 kms per charge with performance specs of 134 bhp of power with 395 Nm of torque. When charging the Kona, it could be left overnight when using a regular wall socket or could also be fast-charged to 80 percent within an hour.
# SIMULATION MODEL
* Component of the electrical vehicle :

Battery:
- Most electric vehicles use lithium-ion batteries (Li-Ions or LIBs). Lithium-ion batteries have a higher energy density, longer life span and higher power density than most other practical batteries. Complicating factors include safety, durability, thermal breakdown and cost. Li-ion batteries should be used within the safe temperature and voltage ranges in order to operate safely and efficiently.
- Increasing the battery's lifespan decreases effective costs. One technique is to operate a subset of the battery cells at a time and switching these subsets.
- In the past, nickel-metal hydride battery batteries were used in some electric cars, such as those made by General Motors. These battery types are considered outdated due to their tendencies to self-discharge in the heat. Furthermore, a patent for this type of battery was held by Chevron, which created a problem for their widespread development. These factors, coupled with their high cost, have led to lithium-ion batteries leading as the predominant battery for EVs.
- The prices of lithium-ion batteries are constantly decreasing, contributing to a reduction in the price of electric vehicles.

Electrical Motor:
- The power of a vehicle's electric motor, as in other machines, is measured in kilowatts (kW). Electric motors can deliver their maximum torque over a wide RPM range.
- This means that the performance of a vehicle with a 100 kW electric motor exceeds that of a vehicle with a 100 kW internal combustion engine, which can only deliver its maximum torque within a limited range of engine speed.
- The efficiency of charging varies considerably depending on the type of charger, and energy is lost during the process of converting the electrical energy to mechanical energy.
- Usually, direct current (DC) electricity is fed into a DC/AC inverter where it is converted to alternating current (AC) electricity and this AC electricity is connected to a 3-phase AC motor.
- For electric trains, forklift trucks, and some electric cars, DC motors are often used. In some cases, universal motors are used, and then AC or DC may be employed. In recent production vehicles, various motor types have been implemented; for instance, induction motors within Tesla Motor vehicles and permanent magnet machines in the Nissan Leaf and Chevrolet Bolt
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 vehicle's operator, motor, battery, and accelerator pedal. It has a microprocessor that can limit or redirect current.
- It is used to either improve the mechanical performance of the car or suit the operator's driving style. There are also more refined controllers which are capable of greater accuracy and thus, higher efficiency.
* MATLAB MODEL

The electric vehicle is constructed in a manner of four step-by-step processes,so to design of the EV model always starts within the order:
1) construction of vehicle body design
2)Selecting the motor
3)Suitable control unit for motor
4)Source of energy for motors
1) construction of vehicle body design

- Represents a two-axle vehicle body in motion.
- Accounts for body mass, and aerodynamic drag. grade, externally defined mass and centre of gravity of the vehicle body.
Input Ports:
W=Wind Velocity in m/s
beta=Grade angle in radians
Output Ports:
V=Velocity in m/s
NR=Normal force on Rear Axle (N)
NF=Normal Force on Front Axle (N)
Vehicle 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, connection H is the mechanical translational conserving port hub.
- NF & NR correspond to the output ports for normal reaction forces on the front axle and rear axle wheels respectively.
- Connection V represents the actual output translational velocity of the vehicle.
- beta is the road inclination angle & W corresponds to the headwind speed (headwind direction opposite to that of the vehicle).
- The gross weight is given to be 1000 kg


Tire:

- The vehicle is assumed to be front axle is driven (4 wheels- 2 on each axle).
- The wheels are modeled using simple Tire (Magic formula) Simulink blocks.
- The block can model tire dynamics under constant or variable contact surface conditions.
- Input Port:
N=Normal force acting on the tire, positive when force is acting downwards/towards the contact surface.
- Output Port:
S=Slip value is relative to tire and surface of contact.
- Conserving Ports:
H=represents wheel hub which transmits thrust generated by the wheel to the body of the vehicle.
A=represents the axle on which the tires are mounted.


- 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.
Gear:
- A simple gear block is used to connect the motor to the rear axle of the vehicle.
- It represents the gearbox that connects the input shaft to the base gear and output from the follower gear.

- Conserving Ports:
B=port associated with an input shaft (motor shaft)
F=port associated with the output shaft (axle/ differential)
- Gear ratio and output direction are modified. Meshing loss is kept constant and gear is having a constant efficiency throughout the simulation.
- Viscous losses and faults are kept at default conditions
2)Selecting the motor and Power Control

D.C Motor:
This is the DC Motor that would give rotational power to the wheels and become the sole power generation source.
The DC Motors terminals are connected as mentioned below.
+ =Electrical signal to the motor Positive Terminal
- =Electrical signal to the motor Negative Terminal
R=Casing of the Motor connected with the Mechanical Rotational Reference Block
C=Rotor Case connected to the Mechanical Rotational reference
The parameter considered is, The Armature inductance is as default, varied the changes in the No-Load Speed 3000 rpm, the rated speed 1800 rpm, the Rated Load at 2kW, and the Rated DC Supply Voltage 29 V. All other parameters are as default.

H Bridge

The H-Bridge helps in controlling the power that is input according to the requirement. The output provided is converted voltage as per the controlled parameters.



Controlled PWM Voltage:

The Controlled PWM Voltage Block helps in keeping the Modulated Pulses as per the required pulses. So that the operations happen smoothly and higher variations are not observed.
The Ports are connected as follows.
PWM=PWM connected directly to the H-Block
REF=REF connected directly to the H-Block
ref+ = Reference Positive connected with Driver Model ith the Acceleration Commands from the
ref- =Reference Negative connected with the Deceleration Commands from the Driver Model
Note: The parameters are set as default.


3)Battery and SOC System

Battery
Implements a generic battery model for most popular battery types. Temperature and ageing (due to cycling) effects can be specified for Lithium-Ion battery type.


4)Source of energy for motors
Longitudinal Driver:

- The longitudinal Driver is an inbuilt block provided by the powertrain blocks.
- It is a parametric longitudinal speed tracking controller for generating normalized Acceleration and Braking commands based on reference and feedback velocities,
- 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 the 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 Pl. Accordingly, the block implements proportional-integral (PI) control with tracking windup and feed-forward gains.

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.
In this selected driving cycle is FTP75


This is the plot of the FTP75 drive cycle

# SIMULATION RESULTS
* Velocity Waveforms

- The blue line is a graph of the drive cycle source and the yellow line shows the corresponding velocity graph
- From the above waveform,the actual velocity of the vehicle differs from the reference drive cycle velocity.
- This is because the chosen battery capacity and motors are not able to propel the speed up to the required extent.
- If the battery is higher capacity is chosen,the actual velocity will tend to match with reference voltage
* Distance Covered

- The yellow line shows the distance covered by the electrical car
* Battery Outputs

- The state of charge (SOC) is a measurement of the amount of energy available in a battery at a specific point in time expressed as a percentage
- During acceleration battery losses energy and during deceleration it stores energy.
- These changes can be observed in SOC of the battery.


- Here we observed variations in the battery voltage due to the acceleration and deceleration of vehicle
- The current signal looks similar to the voltage but in opposite to th battery because of the battery terminal connection
- If we observe the current signal,it gets the output based on the current which is the electrical signal that passes between the H bridge and the DC motor
# CONCLUSION
Studied bout Electric vehicle modeling and studied about each block. From the above model and from the assumed parameters,we found that the velocity of an electric vehicle is 35.96 km and the distance covered by the electric vehicle is 8:121 km and also the variation of SOC and the battery current and battery voltage is also studied.