Project-1: Modelling an electric Car with Li-ion battery
Below is an example report that documents the design and simulation of an electric vehicle model in MATLAB. The model uses a lithium-ion battery, a suitable electric motor from Simscape/Powertrain libraries, and implements a custom PI controller to generate accelerator and brake commands for vehicle speed control. A schematic overview of the model is also provided.
MATLAB Model of an Electric Car with Lithium-Ion Battery and PI Speed Control
1. Objectives
-
Develop a MATLAB/Simulink model: Create a simulation of an electric vehicle using Simscape and Powertrain blocks.
-
Integrate energy and power components: Utilize a lithium-ion battery block to supply energy and a suitable electric motor block to provide propulsion.
-
Implement custom speed control: Design and implement a PI controller (instead of using the ready-made driver block) that computes accelerator and brake commands based on the vehicle’s speed error.
-
Analyze performance: Validate the system by evaluating vehicle speed response and control efforts under different operating conditions.
2. System-Level Configuration
The simulation is structured as follows:
-
Battery System:
-
Block Used: Lithium-ion Battery block from Simscape Electrical.
-
Function: Provides a stable DC voltage supply (e.g., 400 V) and delivers power to the motor.
-
-
Powertrain and Motor:
-
Block Used: Electric motor (e.g., Permanent Magnet Synchronous Motor or equivalent) from the Powertrain block set.
-
Inverter: Converts the battery’s DC supply to the required AC/controlled signals for the motor drive.
-
Transmission & Vehicle Dynamics: A mechanical subsystem representing the vehicle’s inertial properties, drag, rolling resistance, and drivetrain losses.
-
-
PI Controller for Speed Control:
-
Controller Design: A PI controller block is implemented to regulate the vehicle speed.
-
Control Inputs: The measured vehicle speed is compared with a desired setpoint.
-
Outputs: The error is processed to produce two command signals:
-
Accelerator Command: Increases power input when the speed is below the setpoint.
-
Brake Command: Engaged when overshoot or deceleration is required.
-
-
Note: The design avoids the use of a pre-built driver block and relies on custom logic built from basic Simulink blocks (summing junctions, gains, integrators, etc.).
-
-
Interconnection Overview:
csharp[Battery] --> [Inverter] --> [Motor] | v [Vehicle Dynamics] <-- [PI Controller] <-- [Speed Measurement]This configuration ensures that power flow, motor response, and vehicle dynamics are properly captured, while the PI controller actively adjusts the input commands to maintain the desired speed.
3. Model Parameters
A set of typical parameters was chosen for simulation. The values can be adjusted based on the specific design and performance targets:
-
Lithium-Ion Battery:
-
Nominal Voltage: 400 V
-
Capacity: 100 Ah
-
Internal Resistance: ~2 mΩ (example value)
-
-
Electric Motor:
-
Rated Power: 100 kW
-
Nominal Speed: 4000 rpm
-
Torque Constant: (e.g., 0.8 Nm/A)
-
Inertia: (e.g., 0.2 kg·m²)
-
-
Vehicle Dynamics:
-
Mass: 1500 kg
-
Aerodynamic Drag Coefficient: 0.3
-
Frontal Area: 2.2 m²
-
Rolling Resistance Coefficient: 0.015
-
-
PI Controller Settings:
-
Proportional Gain (Kₚ): Tuned via simulation (e.g., 0.1–1.0)
-
Integral Gain (Kᵢ): Tuned via simulation (e.g., 0.05–0.5)
-
Reference Speed: Set to a desired cruising speed (e.g., 25 m/s ~ 90 km/h)
-
The tuning of the PI controller is critical to achieve a fast response with minimal overshoot while ensuring robust operation over different driving conditions.
4. Results
After running the simulation, the following observations were made:
-
Speed Response:
The vehicle’s speed rises smoothly toward the setpoint. The PI controller effectively reduces the speed error, and the accelerator command is modulated to achieve the target speed within a few seconds. -
Control Signal Behavior:
The accelerator command increases when the vehicle speed is below the target and reduces as the speed approaches the setpoint. When the speed exceeds the desired value (if a disturbance is applied), the brake command is generated to decelerate the vehicle smoothly. -
Transient Performance:
With properly tuned gains, the system exhibits minimal overshoot and a rapid settling time. These results indicate that the custom PI controller is successful in managing both acceleration and deceleration without requiring additional driver blocks.
Figures and simulation plots (e.g., vehicle speed vs. time, control signals) can be generated using MATLAB’s plotting functions, showcasing the dynamic behavior of the vehicle under the given conditions.
5. Conclusion
The developed MATLAB/Simulink model demonstrates a comprehensive approach to electric vehicle simulation by integrating key powertrain components such as a lithium-ion battery, a suitable electric motor, and vehicle dynamics. The custom PI controller efficiently generates accelerator and brake commands to maintain the desired speed. This model provides a flexible platform for further analysis and optimization of control strategies, battery management, and overall vehicle performance. Future work may include refining the controller parameters, integrating more complex road and traffic conditions, and extending the model to include regenerative braking and energy recovery features.
This report outlines a robust methodology for modeling and controlling an electric vehicle in MATLAB, meeting the design objectives while offering a foundation for further enhancements and real-world implementation.