Electrical Vehicles are rapidly replacing conventional ICE vehicles across the globe. But selecting the right architecture and components is a difficult task because of the options available in today’s time. A vehicle is basically an electromechanical system with a large number of subsystems. The close integration of all the sub-systems is essential for deriving the most out of it and making it more efficient. Testing all the combination physically is neither practically feasible nor possible. So, a simulating tool is essential to evaluate important parameters such as range, acceleration, power, and cost of the system in order to compare and validate the design.
MATLAB Simulink is a powerful tool that lets you design and validates your system. This feature-laden software with its computing prowess is a good software to accelerate your design phase. In this article, we will see how we can use MATLAB to design an EV power train. We will be utilizing generic parameters for a vehicle. Throughout this article, we will just scratch the surface of MATLAB Simulink and see how it works.
Where can Matlab be used in EV
Designing an EV is an elaborate process as it involves a lot of different sub-systems, and in order to maximize the performance of an EV, a lot of parameters and testing need to be done. The MATLAB Simulink and Simscape provide features to design and simulate essential Electric Vehicle use cases. The 7 most important use cases for Matlab are:
- Tune regenerative braking algorithms
- Explore electric powertrain architectures
- Modify a suspension design
- Optimize vehicle performance
- Develop active chassis controls
- Validate ADAS algorithms
- Test using hardware-in-the-loop (HIL)
Electric Vehicle Model
We have modeled a simple EV power train and simulated it with actual forces and resistance the vehicle has to endure in real world scenarios. We have coupled it with blocks such as vehicle body, tires, etc, in order to include data such as wheel friction, air resistance, rolling resistance, etc. Since we are only testing how we can utilize this software to simulate different scenarios, we avoided using data from a specific vehicle.
The signal editor block is used for designing signals. The signal can be used in a user-defined manner. We can use the signal editor block to feed any customizable data showing the speed of the vehicle to the longitudinal driver block.
Note: We have not used the signal editor block, but you can use the signal editor block in place of a Drive cycle source.
Drive Cycle Source
Generates a standard or user-specified longitudinal drive cycle. The block output is the vehicle longitudinal speed. You can import drive cycles from:
- - Predefined sources
- - Workspace variables, including arrays and time series objects
- - mat, xls, xlsx, or txt files
Use the fault tracking parameters to identify drive cycle faults within the specified speed and time tolerances.
Longitudinal Driver Block
The Longitudinal Driver block acts as an actual driver who interprets the vehicle speed command from a reference signal. The block is capable of taking feedback velocity of the vehicle and changing the speed by giving output signals, it can decide when the vehicle needs to be accelerated and when the break needs to be applied. There are also options to control the gear.
Simulink-PS/ PS-Simulink Converter
There are physical signals (PS) and Simulink Signal and we can’t use the Physical signals and Simulink signals interchangeably, thus require Simulink-PS Converter or PS-Simulink Converter depending on the input and output.
For eg. the acceleration command and break commands coming out from the driver block are Simulink signals which need to be converted into signal commands. For that, we utilize Simulink to PS converter.
Controlled Voltage Source
The Controlled Voltage Source block is used to give a constant voltage output. It has 2 electrical conserving ports and a physical signal port. The output from the controlled voltage source is fed to the controlled PWM voltage source.
Controlled PWM Voltage Source
This block is used for providing a controlled PWM voltage output. The PWM signal is used for controlling the speed of the traction motor. The duty cycle is given by:
Vref is the reference voltage across the ref+ and ref- ports.
Vmin denotes the minimum reference voltage.
Vmax denotes the maximum reference voltage.
H-Bridge Motor Driver
The H-bridge block is used to drive a motor. It has 2 modes an average mode where the block is used to apply an average voltage and the PWM mode where the motor is driven when the input voltage is above an enabled threshold voltage. The H-bridge block has 2 output ports, a positive and a negative port which is directly connected to the motor that has to be controlled. There is also a REV port. When the reverse threshold voltage is lower than the REV port voltage, the polarity of the motor is reversed, and if the BRK port voltage is greater than the value of breaking threshold voltage, it indicates that the vehicle is in breaking condition.
For traction motor, we are using a simple DC motor, but we can also use any other type of motor such as an Induction motor, PMSM, SRM, etc.
When working with bigger models, it is always a good idea to create a sub-system in order to declutter the whole model and to group components into a single block. You can easily create a subsystem by selecting the required components and pressing Ctrl+G or right-clicking on the selected blocks and then pressing on Create System from Selection from the drop-down menu which appears.
The EV model is a combination of both electrical and mechanical parts. The mechanical parts in the system include tires, vehicle body, transmission gears, and the motor. The 4 tires and the vehicle body are formed into a subsystem to separate the mechanical component from that of electrical components. The image of the subsystem is attached below.
The different components of our electric vehicle’s body, which let us feed physical forces experienced by the vehicle are used in the subsystem, the different blocks are explained below:
The vehicle body block represents a dual axel vehicle or a 4-wheeler. We can set parameters such as the weight distribution, mass, road incline, aerodynamic drag, etc. There are a total of 6 ports, W, V, H, NR, NF, and beta. The ports W and beta are physical signal input ports which are for wind speed and inclination of road respectively. Connections to V, NF, and NR are physical signal output ports for the velocity of the vehicle, Front axle, and rear axle normal forces and the H is for the horizontal motion and the tire is connected to this port.
Tire (Magic formula)
We have selected the tire(Magic formula). As can be seen in the sub-system, we have connected the hub of all 4 tires with the vehicle body’s hub. The tire (Magical Formula) is a tire block with longitudinal behavior. We are using it in a constant condition. We have connected the S with a terminator block, the S determines the slip of the tire. N is connected with the NR and NF ports of the vehicle block while the H, which is for the hub is connected to the H of the vehicle body. The A is the axel connection and is connected with the motor’s output shaft.
The terminator block is used to terminate a physical connection. It is a good practice to terminate any unused connection as it makes it clearer to understand and also terminates the port, hence, when a subsystem block is connected these ports are not visible on the sub-system.
We can not use a regular constant block for providing physical signals, thus a physical signal block is used. This block is used for creating a physical signal constantly.
This block is used for giving a fixed gear ratio. This is a mechanical component and can be avoided, but it gives users the ability to adjust vehicle speed wrt the rpm of the motor.
Testing and Simulation
After designing the circuit, all that is left is testing the circuit. We usually need to put scopes at any point in the circuit to measure the desired parameters. The scope module looks like the one shown below.
The scope can have multiple inputs, and the real-time output is displayed when the simulation starts. The drive cycle which is available in the default setting is an ftp75 which is a mandatory dynamometer test used as an industry standard. The high and low velocity makes it a good drive cycle to check the parameters of the drivetrain. The FTP75 drive cycle is shown below:
But we will be using ECE Extra-Urban Driving cycle since it is just a 400 s drive cycle with smoother accelerations. The below image shows how the velocity of the vehicle will be changing wrt time. The above image shows the speed, acceleration, and gear change wrt time. The bottom graph shows the real-time output during our simulation.
The below images are taken during the matlab simulation that shows the current used by the motor over time. The first image above shows how the current increases as the motor start, this image is provided in order to show the MATLAB’s capability and processing prowess, the time duration between each spike is just 0.001 seconds or 1 millisecond. The graph in the bottom shows a current vs time graph over a period of 120 seconds. It shows how the value of current slowly decreases when the vehicle is moving at a constant rate.
Matlab is a powerful mathematical tool that can be used for designing, testing, and validating different types of electrical and electro-mechanical systems. The EV model we have made is just for showing the capability of this powerful tool and helping you get started with Simulink. You can make as elaborate a model feeding as many parameters and data set in order to increase the accuracy of the result. The final word is that the large data set, high processing power, and simple user interface makes it a very good tool for designing, testing, and simulating your project without actually building it. I hope that this article helps you learn something new. If you have any doubts, please do feel to post the comments in the link below.