Design of an Electric Vehicle using Simulink
Aim: To create a MATLAB model of an Electric Vehicle using a Battery, DC motor, and various Powertrain block sets.
Procedure:
This includes the engine, transmission, the driveshaft, differentials, axles; basically anything from the engine through to the rotating wheels.
Initialization of the Electric Vehicle model
1. Vehicle body:
The following figure shows the subsystem of the vehicle body used for the model

The following blocks are used for the implementation of this subsystem
a. Tire (Magic formula): It represents the longitudinal behavior of a highway tire. 4 tires are used in total, 2 for front wheels, and 2 for rear wheels. The rear wheels are used for the tractive power action. There are 4 terminals in this block namely 'H' (hub), 'S' (tire slip), 'N' (normal force applied to the tire), and 'A' (axle connection).
b. Vehicle body: It represents a two-axle vehicle body in longitudinal motion. The block accounts for body mass, aerodynamic drag, road incline, and weight distribution between axles due to acceleration and road profile. There are 6 terminals in this block namely 'H' (horizontal motion), 'V' (longitudinal velocity), 'W' (headwind speed), 'NR' (rear axle normal force), 'NF' (front axle normal force), and 'beta' (road incline angle).
c. Simple gear: It represents a fixed-ratio gear or gearbox. There are 2 terminals in this block namely 'B' (base) and 'F' (follower). They both are mechanical rotational conserving ports.
Connections made:
- Flip the front tires and connect 'H' terminals of both pairs of wheels to the 'H' terminal of the vehicle body.
- Short the 'N' terminals of both the rear wheels and connect them to the 'NR' terminal of the vehicle body.
- Short the 'N' terminals of both the front wheels and connect them to the 'NF' terminal of the vehicle body.
- Short the 'A' terminals of both the rear wheels and connect them to the 'F' terminal of the Simple gear.
- Short the 'A' terminals of both the front wheels.
- Terminate the 'S' terminal of all the four wheels with the help of a PS-Terminal block.
- Connect PS-constants to both 'W' and 'beta' terminals of the vehicle body and keep it as default.
- The input to this subsystem is connected to the 'B' terminal of the Simple gear.
- The output of this subsystem is given through the 'V' terminal of the vehicle body.
- The output port is connected to a scope showing the velocity of the vehicle over the defined period of time and also to an integrator block.
2. Electrical Network:
The following figure shows the subsystem of the Electrical network used in this model

The following blocks are used for the implementation of this subsystem
a. DC motor: A DC motor is any of a class of rotary electrical motors that converts direct current electrical energy into mechanical energy. This block represents the electrical and torque characteristics of a DC motor. It has both electrical and mechanical components and is coupled through a shaft. There are 4 terminals in this block namely '+ve' and '-ve' from the electrical half and 'R' ( rotor casing) and 'C' (motor casing) from the mechanical half.
b. H-bridge: H-bridge is an electronic circuit that switches the polarity of a voltage applied to a load. These circuits are often used in robotics and other applications to allow DC motors to run forward or backward. This block represents an H-bridge motor drive. There are 6 terminals in this block namely '+ve' and '-ve' which are the output terminals, 'PWM' (pulse-width modulated signal), 'REF' (reference), 'REV' (reverse), and 'BRK' (brake).
c. Controlled PWM voltage: Controlled pulse-width modulated voltage regulator works by driving the motor with a series of “ON-OFF” pulses and varying the duty cycle, the fraction of time that the output voltage is “ON” compared to when it is “OFF”, of the pulses while keeping the frequency constant. There are 4 terminal in this block namely 'ref+' (positive electrical reference voltage), 'ref-' (negative electrical reference voltage), 'PWM' (pulse-width modulated) signal, and 'REF' (floating zero reference voltage).
d. Battery: Battery is an electrical device used to give DC voltage across any 2 terminals. There are 2 terminals in this block namely '+ve' and '-ve'.
e. Controlled voltage source: It is an ideal voltage source that is powerful enough to maintain the specified voltage at its output regardless of the current passing through it. This block has one physical signal input port and two electrical conserving ports associated with its electrical terminals. Here, two such controlled voltage source blocks are used.
f. Controlled current source: It is an ideal current source that is powerful enough to maintain the specified current through it regardless of the voltage across it. This block has one physical signal input port and two electrical conserving ports associated with its electrical terminals.
g. Current sensor: Current sensor is a device that converts current measured in any electrical branch into a physical signal proportional to the current. Terminals '+' and '–' are electrical conserving ports through which the sensor is inserted into the circuit. Terminal 'I' is a physical signal port that outputs the measurement result.
h. Electrical reference port, Mechanical rotational reference point, and the Solver configuration are the miscellaneous blocks used in this subsystem.
Connections made:
- There are two input ports to this subsystem and both are connected to the Controlled voltage source blocks respectively.
- The '+ve' of one of the controlled voltage sources is connected to the 'ref+' terminal of the controlled PWM voltage block and the '+ve' of the other is connected to the 'BRK' terminal of the H-bridge block.
- The 'PWM' terminal of the controlled PWM voltage block is connected to the 'PWM' port of the H-bridge block.
- Battery connections are made across the controlled current source block.
- The current sensor is connected to the controlled current source block and the output is given SOC output port.
- Connect the '+' and '-' terminals of the H-bridge block to the DC motor terminals via the current sensor.
- The 'R' terminal of the DC motor is given to the output port of this subsystem.
- All the reference terminals, battery circuit, and DC motor are connected to the Electrical reference port.
- The 'C' terminal of the DC motor is connected to the Mechanical reference point.
- And a Solver configuration is applied where all the reference nodes are grounded.
- There are two output ports in this subsystem, where the 'SOC' output port is connected to the SOC subsystem and a scope showing the current flowing in the network, and the 'DC Motor output' port is connected to the Vehicle body subsystem.
3. State-of-Charge (SOC):
The following figure shows the subsystem to calculate the SOC given by the prepared Electric vehicle model

The following blocks are used for the implementation of this subsystem
a. Rate Transition: Rate Transition block transfers data from the output of a block operating at one rate to the input of another block operating at a different rate. The Rate Transition block's parameters allow you to specify options that trade data integrity and deterministic transfer for faster response and/or lower memory requirements.
b. Discrete-Time Integrator: The Discrete-Time Integrator block implements discrete-time integration or accumulation of the input signal. The block can integrate or accumulate using the Forward Euler, Backward Euler, and Trapezoidal methods.
c. Gain, Add/Subtract, and Constant are the miscellaneous blocks used in this subsystem.
Connections made:
- There is one input to this subsystem which is the current given by the controlled current source and connected to the Rate Transition block.
- The output of the Rate Transition block is given to the gain block and is further connected to the Discrete-Time Integrator block.
- The output of the Discrete-Time Integrator block and a Constant block is connected to the Add/Subtract block and the output of this is given to another gain block.
- The output of gain is given to the output port of this SOC subsystem.
- The output port is connected to a scope showing the SOC of the battery after a successful run of the vehicle.
4. Drive Cycle Input:
The following figure shows the Drive cycle subsystem used to give reference drive cycle input to this Electric vehicle model

The following blocks are used for the implementation of this subsystem
a. Drive Cycle Source (FTP75): Drive cycle source generates a standard or user-specified longitudinal drive cycle. This block output is the vehicle longitudinal speed. Here, an FTP75 drive cycle is used.
b. Signal Builder: It is used to give the simple drive cycle input signals to the model.
c. From Excel Sheet: It is used to give the drive cycle data input to the model prepared manually in the excel spreadsheet.
d. Multiport switch: The Multiport Switch block determines which of several inputs to the block passes to the output. The block bases this decision on the value of the first input. The first input is the control input and the remaining inputs are the data inputs. The value of the control input determines which data input passes to the output.
e. Constant: It is given to the control input of the multiport switch and this value of the constant decides which data input passes to the output.
Connections made:
- Drive cycle source, Signal builder, and Excel sheet data are connected to the input ports of the Multiport switch.
- The Constant block is connected to the control input port of the Multiport switch.
- The output of this Multiport switch is the output port of this subsystem.
- The output port is connected to the 'VelRef' port of the Longitudinal driver block and also to the scope showing the reference velocity set by the chosen drive cycle.
5. Longitudinal Driver:
It is a parametric longitudinal speed tracking controller for generating normalized acceleration and braking commands. Based on reference and feedback velocities, the block generates normalized acceleration and braking commands that can vary from 0 through 1.
There are 6 terminals in this block namely 'VelRef' (Reference vehicle velocity), 'VelFdbk' (Longitudinal vehicle velocity), 'Grade' (Road grade angle), 'AccelCmd' (Commanded vehicle acceleration), 'DecelCmd' (Commanded vehicle deceleration), and 'Info'.

Connections made:
- Input to the 'VelRef' port is given by the output of the Ref Drive cycle subsystem.
- Input to the 'VelFdbk' port is the feedback of the actual vehicle velocity.
- Input to the 'Grade' is given by a Constant block.
- 'AccelCmd' port is the output terminal and is connected to a scope to show the input acceleration given by this block with the help of an internal PI controller in this block.
- Also, 'AccelCmd' output is given as one of the inputs to the Electrical Subsystem, i-e 'AccelCmd' --> 'Controlled Voltage Source' --> 'ref+ port of Controlled PWM Voltage'.
- 'DecelCmd' port is the output terminal and is given as one of the inputs to the Electrical Subsystem, i-e 'DecelCmd' --> 'Controlled Voltage Source' --> 'Brk port of H-bridge'.
- 'Info' port is terminated with the help of a terminator block.
Miscellaneous connections:
- The 'Velocity' output port of the Vehicle body subsystem is connected to an integrator block.
- The output of the integrator block and a Constant block is given to the 'Multiply-Divide' block.
- The output of this 'Multiply-divide' block is then finally given to the Display block which shows the distance traveled by this model.
The following figure shows the main model design of an Electric vehicle Powertrain designed

Model Parameters:
1. Vehicle Body Subsystem:
a. Tire:


b. Vehicle body:


c. Simple gear:

2. Electrical Network Subsystem:
a. DC Motor:


b. Battery:

c. H-bridge:



d. PWM Controlled Voltage:


3. SOC Subsystem:
a. Current:

b. Gain input:






