All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM : Create a MATLAB model of an electric car which uses a battery and a DC motor. OBJECTIVES : To create a simple and low run time model of an electric car using SIMULINK. To examine the various performance characteristics such as Speed, State of Charge, Current and so on. To manipulate certain design…
Aniruddha Prabhu
updated on 08 Apr 2021
AIM : Create a MATLAB model of an electric car which uses a battery and a DC motor.
OBJECTIVES :
INTRODUCTION :
An electric car is a car which is propelled by one or more electric motors, using energy stored in rechargeable batteries. Compared to internal combustion engine (ICE) vehicles, electric cars are quieter, have no exhaust emissions, and lower emissions overall. In the United States, as of 2020, the total cost of ownership of recent EVs is cheaper than that of equivalent ICE cars, due to lower fuelling and maintenance costs. Charging an electric car can be done at a variety of charging stations; these charging stations can be installed in both houses and public areas.
Several countries have established government incentives for plug-in electric vehicles, tax credits, subsidies, and other non-monetary incentives. Several countries have established a phase-out of fossil fuel vehicles, and California, which is one of the largest vehicle markets, has an executive order to ban sales of new gasoline powered vehicles by 2035.
The Tesla Model 3, which has a maximum range of 570 km (353 miles) according to the Environmental Protection Agency EPA, has been the world's best-selling electric vehicle (EV) on an annual basis since 2018, and became the world's all-time best-selling electric car in early 2020.
As of December 2019, the global stock of pure electric passenger cars totalled 4.8 million units, representing two-thirds of all plug-in passenger cars in use. In 2019, over half (54%) of the world’s all-electric car fleet was in China. Despite rapid growth, the global stock of fully electric and plug-in hybrid cars represented about 1 out of every 200 vehicles (0.48%) on the world's roads by the end of 2019, of which pure electrics comprised 0.32%.
Electric Car Components
Traction Battery Pack : The function of the battery in an electric car is as an electrical energy storage system in the form of direct-current electricity (DC). If it gets a signal from the controller, the battery will flow DC electrical energy to the inverter to then be used to drive the motor. The type of battery used is a rechargeable battery that is arranged in such a way as to form what is called a traction battery pack.There are various types of electric car batteries. The most widely used is the type of lithium-ion batteries.
Power Inverter : The inverter functions to change the direct current (DC) on the battery into an alternating current (AC) and then this alternating current is used by an electric motor. In addition, the inverter on an electric car also has a function to change the AC current when regenerative braking to DC current and then used to recharge the battery. The type of inverter used in some electric car models is the bi-directional inverter category.
Controller : The main function of the controller is as a regulator of electrical energy from batteries and inverters that will be distributed to electric motors. While the controller itself gets the main input from the car pedal (which is set by the driver). This pedal setting will determine the frequency variation or voltage variation that will enter the motor, and at the same time determine the car’s speed.In brief, 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. This component will determine how electric car work.
Electric Traction Motor : Since the controller provides electrical power from the traction battery, the electric traction motors will work turning the transmission and wheels. Some hybrid electric cars use a type of generator-motor that performs the functions of propulsion and regeneration. In general, the type of electric motor used is the BLDC (brushless DC) motor.
Other Secondary Electric Car Components
Charger : It is a battery charging device. Chargers get electricity from outside sources, such as the utility grid or solar power plants. AC electricity is converted into DC electricity and then stored in the battery. There are 2 types of electric car chargers:
Transmission : The transmission transfers mechanical power from the electric traction motor to drive the wheels.
DC/DC Converter : This one of electric car parts that to converts higher-voltage DC power from the traction battery pack to the lower-voltage DC power needed to run vehicle accessories and recharge the auxiliary battery.
Battery : In an electric drive vehicle, the auxiliary battery provides electricity to power vehicle accessories.
Thermal System – Cooling : This system maintains a proper operating temperature range of the engine, electric motor, power electronics, and other components.
Charge Port : The charge port allows the vehicle to connect to an external power supply in order to charge the traction battery pack.
MATLAB SIMULINK MODEL OF PURE ELECTRIC VEHICLE
INDIVIDUAL SUB-SYSTEMS
Drive Cycle Source
This block generates a standard or user-specified longitudinal drive cycle. The block output is the specified vehicle longitudinal speed, which you can use to:
Predict the engine torque and fuel consumption that a vehicle requires to achieve desired speed and acceleration for a given gear shift reference.
Produce realistic velocity and shift references for closed loop acceleration and braking commands for vehicle control and plant models.
Study, tune, and optimize vehicle control, system performance, and system robustness over multiple drive cycles.
Identify the faults within tolerances specified by standardized tests, including:
EPA dynamometer driving schedules.
Worldwide Harmonised Light Vehicle Test Procedure (WLTP) laboratory tests.
For the drive cycles, you can use :
Drive cycles from predefined sources. By default, the block includes the FTP-75 drive cycle. Additional drive cycles can be installed from a support package. The support package has drive cycles that include the gear shift schedules, for example JC08 and CUEDC.
Workspace variables.
.mat, .xls, .xlsx, or .txt files.
Wide open throttle (WOT) parameters, including initial and nominal reference speed, deceleration start time, and final reference speed.
With reference to this model :
We have considered the FTP-75 Drive Cycle for testing the EV car performance characteristics.
Longitudinal Driver
This block implements a longitudinal speed-tracking controller. Based on reference and feedback velocities, the block generates normalized acceleration and braking commands that can vary from 0 through 1. You can use the block to model the dynamic response of a driver or to generate the commands necessary to track a longitudinal drive cycle.
External Actions parameters can be used to create input ports for signals that can disable, hold, or override the closed-loop acceleration or deceleration commands. The block uses this priority order for the input commands: disable (highest), hold, override.
With reference to this model :
We have not considered any external actions to simplify the model.
The controller type is set to Proportional-integral (PI) control with tracking windup and feed-forward gains.The Proportional Gain (Kp) is set to 150, whereas the Integral Gain (Ki) is set to 100.This tuning of the controller is done to help the vehicle follow the Drive Cycle to the greatest possible extent.
The shift type is set to none which represents 'No transmission'. Block outputs a constant gear of 1.This setting is used to minimize the number of parameters we need to generate acceleration and braking commands to track forward vehicle motion. This setting does not allow reverse vehicle motion.
Electric Motor Drive
Controlled Voltage Source : This block represents an ideal voltage source that is powerful enough to maintain the specified voltage at its output regardless of the current flowing through the source.The output voltage is V = Vs, where Vs is the numerical value presented at the physical signal port.The block has one physical signal input port and two electrical conserving ports associated with its electrical terminals.
With reference to this model :
We have used two Controlled Voltage Source blocks.The outputs associated with the Longitudinal Driver is fed as input to each of the two Controlled Voltage Source blocks, through the physical signal input port.The Controlled Voltage Source blocks generate an output voltage proportional to the Acceleration and Deceleration signals provided by the Longitudinal Driver.
The positive terminal of the Controlled Voltage Source block provided with Acceleration input signal is connected to the positive reference of the Controlled PWM Voltage block, whereas the negative terminal is grounded to an Electrical Reference block.
The negative terminal of the Controlled Voltage Source block provided with Deceleration input signal is connected to the Brake port of the H-Bridge block, whereas the negative terminal is grounded to an Electrical Reference block.
Controlled PWM Voltage : This block represents a pulse-width modulated (PWM) voltage source.It creates a Pulse-Width Modulated (PWM) voltage across the PWM and REF ports.The block calculates the duty cycle based on the reference voltage across its ref+ and ref- ports.The output voltage is zero when the pulse is low, and is equal to the Output voltage amplitude parameter when high.
With reference to this model :
We have set the simulation mode to 'Average' to speed up simulations.This applies the average of the demanded PWM voltage to the motor. The Averaged mode assumes that the impedance of the motor inductive term is small at the PWM frequency.Averaged mode also helps in linearising the model.We can only linearize the block for inputs corresponding to a duty cycle greater than zero and less than 100 percent.
H-Bridge : The H-Bridge block represents a H-bridge motor driver. The block has the following two Simulation mode options:
1. PWM — The H-Bridge block output is a controlled voltage that depends on the input signal at the PWM port. If the input signal has a value greater than the Enable threshold voltage parameter value, the H-Bridge block output is on and has a value equal to the value of the Output voltage amplitude parameter. If it has a value less than the Enable threshold voltage parameter value, the block maintains the load circuit using one of the following three Freewheeling mode options:
Via one semiconductor switch and one freewheeling diode.
Via two freewheeling diodes.
Via two semiconductor switches and one freewheeling diode.
The first and third options are sometimes referred to as synchronous operation.
The signal at the REV port determines the polarity of the output. If the value of the signal at the REV port is less than the value of the Reverse threshold voltage parameter, the output has positive polarity; otherwise, it has negative polarity.
2. Averaged — This mode has two Load current characteristics options:
Smoothed
Unsmoothed or Discontinuous.
With reference to this model :
We have set the Simulation mode parameter to 'Averaged' to speed up simulations when driving the H-Bridge block with a Controlled PWM Voltage block. We must also set the Simulation mode parameter of the Controlled PWM Voltage block to Averaged mode. This applies the average of the demanded PWM voltage to the motor. The accuracy of the Averaged mode simulation results relies on the validity of our assumption about the load current.
We have set the Power Supply to be 'Internal' and set the Load Current Characteristics to be 'Smoothed'.
We have also enabled 'Regenerative Braking' so that the DC motor can function as a generator during braking and thus help in recharging the battery.
The output voltage amplitude of the H-Bridge is set to 400 V.This has to match the rated DC supply voltage of the DC motor.
DC Motor : This block represents the electrical and torque characteristics of a DC motor.The block assumes that no electromagnetic energy is lost, and hence the back-emf and torque constants have the same numerical value when in SI units.When a positive current flows from the electrical + to - ports, a positive torque acts from the mechanical C to R ports. Motor torque direction can be changed by altering the sign of the back-emf or torque constants.
The C ports represents the Motor Casing whereas the R port represents the Rotor.The C port is connected to a Mechanical Rotational Reference block whereas the R port is connected to the Gear Drive of the 'Vehicle Body' sub-system.Hence it is the Rotor coupled with the Transmission, which propels the electric car.
With reference to this model :
We have considered 'Permanent Magnet' field type and the model parameterization based on 'Rated Load and Speed'.
No-load speed is set to 12000 RPM whereas Rated speed is set to 10000 RPM.
Rated load(Mechanical Power) is set to 560 kW and the motor is energized by a 400 V DC power supply.
Current Sensor : The Current Sensor block represents an ideal current sensor, that is, a device that converts current measured in any electrical branch into a physical signal proportional to the current.Connections + and – are electrical conserving ports through which the sensor is inserted into the circuit. Connection I is a physical signal port that outputs the measurement result.
With reference to this model :
The + and - terminals of the block are connected with the + and - terminals of the DC motor.This block helps us in determining the current drawn by the DC motor.The physical signal generated by this block is connected to the 'Battery Module' sub-system which in turn helps us in determing the State of Charge of the battery.
Mechanical Rotational Reference : This block represents a reference point, or frame, for all mechanical rotational ports. All rotational ports that are rigidly clamped to the frame (ground) must be connected to a Mechanical Rotational Reference block.
With reference to this model :
The Casing (C port) of the DC motor is connected to this block.
Electrical Reference : This block represents an electrical ground. Electrical conserving ports of all the blocks that are directly connected to ground must be connected to an Electrical Reference block. A model with electrical elements must contain at least one Electrical Reference block.
With reference to this model :
All the negative terminals of the electrical blocks used in the sub-system are connected to the Electrical Reference.Also the Reference ports of the Controlled Voltage Source and H-Bridge blocks are connected to this block.Since we have not considered using the DC motor for reverse motion of the electric car, we have connected the REV port of the H-bridge to the Electrical Reference.
Solver Configuration : Each physical network represented by a connected Simscape block diagram requires solver settings information for simulation.This specifies the solver parameters that our model needs before we can begin simulation.Each topologically distinct Simscape block diagram requires exactly one Solver Configuration block to be connected to it.
Battery Module
Battery : This block represents a simple battery model.
If we select Infinite for the Battery charge capacity parameter, the block models the battery as a series internal resistance and a constant voltage source. If we select Finite for the Battery charge capacity parameter, the block models the battery as a series internal resistance plus a charge-dependent voltage source defined by:
V = Vnom*SOC/(1-beta*(1-SOC))
where SOC is the state of charge and Vnom is the nominal voltage. Coefficient beta is calculated to satisfy a user-defined data point [AH1,V1].
With reference to this model :
We have considered 'Finite' battery charge capacity.The nominal voltage is set to 350 V whereas the battery capacity is set to 235 Ah.
The other battery parameters such as self-discharge, charge dynamics and battery fade have been disabled to simplify the battery sub-system.
Controlled Current Source : The Controlled Current Source block represents an ideal current source that is powerful enough to maintain the specified current through it regardless of the voltage across the source.The output current is I = Is, where Is is the numerical value presented at the physical signal port.The positive direction of the current flow is indicated by the arrow.The block has one physical signal input port and two electrical conserving ports associated with its electrical terminals.
With reference to this model :
The + and - terminals of this block are connected with the + and - terminals of the Battery.The physical signal from the Current Sensor of the DC motor is fed into the input signal port of this block.Hence the system is modelled in such a way that the current drawn by the DC motor is provided by the Battery.
State of Charge (SOC) Calculation
Rate Transition : This block transfers data from the output of a block operating at one rate to the input of a block operating at a different rate. The block parameters are used to trade data integrity and deterministic transfer for faster response or lower memory requirements.
With reference to this model :
We have selected 'Ensure data integrity during data transfer' and 'Ensure deterministic data transfer (maximum delay)' options.
The initial conditions are set to 0 whereas the output port sample time is set to -1 which specifies that the Rate Transition block inherits the output rate from the block to which the output port is connected.
Gain : This block multiplies the input by a constant value (gain). The input and the gain can each be a scalar, vector, or matrix.
With reference to this model :
We have set the gain to "100/(250*360)" which determines the rate of discharge of the battery.
Discrete Time Integrator : This block is used to create a purely discrete model by accumulation of input signal.
With reference to this model :
We have set the integration method to 'Forward Euler'.
The gain value is set to 1.0 which is semantically equivalent to connecting a Gain block to the input of the integrator.
The initial condition is set to 0 whereas the sample time is set to -1 to inherit the sample time from an upstream block.
Constant : This block generates a real or complex constant value signal.This block is used to provide a constant signal input.
With reference to this model :
We have considered the constant signal value to be "100" which represents the initial State of Charge (SOC) of the battery.
Sum : This block performs addition or subtraction on its inputs.
With reference to this model :
We have set the block to perform subtraction to determine the amount of charge left in the battery ie SOC.
Vehicle Body
Simple Gear : This block represents a gearbox that constrains the connected driveline axes of the base gear, B, and the follower gear, F, to co-rotate with a fixed ratio that we specify. We have an option to choose whether the follower axis rotates in the same or opposite direction as the base axis. If they rotate in the same direction, the angular velocity of the follower, ωF, and the angular velocity of the base, ωB, have the same sign. If they rotate in opposite directions, ωF and ωB have opposite signs.
With reference to this model :
We have set the Gear Ratio to 2 and ensured that the ouput shaft rotates in the same direction as the input shaft.
We have considered a constant efficiency friction model with 0.8 (80%) Efficiency and Follower power threshold of 0.001 W.
We have not applied any Viscous losses and disabled Faults.
Inertia : This block represents an ideal mechanical rotational inertia, described with the following equation:
T=J⋅dωdt
where T = Inertia Torque
J = Inertia
ω = Angular Velocity
t = Time
The block has one mechanical rotational conserving port. The block positive direction is from its port to the reference point. This means that the inertia torque is positive if inertia is accelerated in positive direction.
With reference to this model :
This block is connected to the Follower (F) output of the Simple Gear block.
We have set the inertia value to 0.01 kgm2.
Tire (Magic Formula) : The Tire (Magic Formula) block models a tire with longitudinal behavior given by the Magic Formula, an empirical equation based on four fitting coefficients. The block can model tire dynamics under constant or variable pavement conditions.The longitudinal direction of the tire is the same as its direction of motion as it rolls on pavement.
To increase the fidelity of the tire model, we can specify properties such as tire compliance, inertia, and rolling resistance. However, these properties increase the complexity of the tire model and can slow down simulation. Hence we consider ignoring tire compliance and inertia while simulating the model in real time or while preparing the model for hardware-in-the-loop (HIL) simulation.
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 a physical signal input port that applies the normal force acting on the tire. The force is considered positive if it acts downwards. Connection S is a physical signal output port that reports the tire slip.
With reference to this model :
We have set the parameterization type to 'Load-dependent Magic Formula Coefficients'.
We have considered the vertical load acting on each tire to be 3600 N.
We have set the Rolling Radius to be 0.3 m and turned on Rolling Resistance option with default settings.
Vehicle Body : The Vehicle Body block represents a two-axle vehicle body in longitudinal motion. The vehicle can have the same or a different number of wheels on each axle. For example, two wheels on the front axle and one wheel on the rear axle. The vehicle wheels are assumed identical in size. The vehicle can also have a center of gravity (CG) that is at or below the plane of travel.The block accounts for body mass, aerodynamic drag, road incline, and weight distribution between axles due to acceleration and road profile. Optionally include pitch and suspension dynamics. The vehicle does not move vertically relative to the ground.The block has an option to include an externally-defined mass and an externally-defined inertia. The mass, inertia, and center of gravity of the vehicle body can vary over the course of simulation in response to system changes.
Connection H is the mechanical translational conserving port associated with the horizontal motion of the vehicle body. The resulting traction motion developed by tires should be connected to this port. Connections V, NF, and NR are physical signal output ports for vehicle velocity and front and rear normal wheel forces, respectively. Wheel forces are considered positive if acting downwards. Connections W and beta are physical signal input ports corresponding to headwind speed and road inclination angle, respectively.
With reference to this model :
We have considered the Head Wind Speed to be 2.78 m/s and the Road Inclination to be 0 radians.
The rest of the parameters are provided with values as shown in the images below.
m/s to km/hr Sub-system
Distance Calculation Sub-system
RESULTS
As per the drive cycle the distance travelled by the vehicle should be 17.77 km. But the electric car modelled by us has travelled 17.03 km. Since the difference is very small, we can approve that the model we have created is feasible to a certain extent.
Drive Cycle Speed v/s Vehicle Speed
From the above graph it is evident that the vehicle manages to follow the drive cycle (FTP-75) to an appreciable extent. But the fact that the vehicle is not able to follow the drive cycle very closely in phases where the acceleration demanded by the drive cycle is high and abrupt cannot be denied. Also, at the deceleration phases of the drive cycle the vehicle is not able to decelerate to the required speed.
State of Charge (SOC)
From the above graph it is evident that the battery State of Charge (SOC) has reduced from an initial condition of 100 % to 59.43% over the duration of the drive cycle. On examining the graph carefully, it is seen that the battery has recharged fractionally at certain points. This is due to regenerative braking during the deceleration phases of the drive cycle. In the time phase between 1422 seconds and 1975 seconds the SOC of the battery neither increases nor decreases since the vehicle is at rest during this time phase of the drive cycle.
Current
From the above graph it is evident that the current varies between 690 A and -250 A. The current drawn by the DC motor varies as a function of the acceleration or deceleration of the vehicle. In the time phase between 1422 seconds and 1975 seconds it is seen that the current drawn is 0 A since the vehicle is at rest during this time phase of the drive cycle.
CONCLUSION
This outcome proclaims that the vehicle design parameters related to the Electric Motor Drive, Vehicle Body and Battery Module have to be tweaked appropriately to ensure that the vehicle follows the drive cycle as efficiently as possible.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Supervised Learning - Prediction Week 3 Challenge
Q1: Perform Gradient Descent in Python with any loss function. A1: Q2: Difference between L1 & L2 Gradient descent method. A2: L1 Gradient Descent (Lasso) L2 Gradient Descent (Ridge) 1. Penalizes the sum of absolute values of weights. 1. Penalizes the sum of squares of weights. 2. Solution is sparse. 2. Solution is non-sparse.…
18 Apr 2022 03:49 PM IST
Basics of ML & AL Week 2 Challenge
Q1: Calculate all 4 business moments using pen and paper for the below data set? A1: The excel sheet has been attached. Q2: What is the significance of expected value when simple mean (Sum of all observations/number of observations) is already in place? A2: Expected value is computed when the…
15 Apr 2022 09:29 AM IST
Basics of Probability and Statistics Week 1 Challenge
Q1: Why there is a difference in the formula of variance for population and sample ? A1: Population Variance σ2=1N∑(xi−μ)2 Sample Variance s2=1N−1∑(xi−¯x)2 It can be observed that there is a small difference in the two formulas. When calculating…
14 Apr 2022 06:34 AM IST
Project 2 Library Book Management System
The project has been completed.
29 Jan 2022 09:02 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.