Project 2: BMS for EV
Project 2
Objective
To Run simulations, change the threshold, create plots and measure current and hydrogen consumption. Specify the outputs. How to run the model.
project discussion

The Electric Vehicle (EV) Driver Block, Power Train Block, and Vehicle Dynamics Block are components of a mathematical model used to simulate the behavior of an EV. These blocks represent different aspects of the vehicle and its behavior, and are used to study and understand the interactions between the different subsystems and to predict the performance of the vehicle under different operating conditions.
The EV Driver Block represents the driver and the driving behavior, such as the speed profile, acceleration, and deceleration, and provides the inputs to the other blocks. This block can be used to study the impact of different driving styles on the vehicle performance, such as energy consumption and range.
The Power Train Block represents the components of the vehicle that generate, store, and deliver power, including the battery, the electric motor, and the power electronics. This block is used to study the performance and efficiency of the power train, and to predict the energy consumption and range of the vehicle under different driving conditions.
The Vehicle Dynamics Block represents the mechanical and structural components of the vehicle, such as the suspension, steering, and tires, and is used to study the handling and stability of the vehicle. This block can be used to study the impact of different road conditions, such as rough roads and slopes, on the vehicle performance, and to optimize the suspension and chassis design for improved handling and stability.
By combining these blocks into a comprehensive mathematical model, it is possible to simulate the behavior of an EV under different operating conditions, and to predict its performance in terms of energy consumption, range, handling, and stability. This information can be used to optimize the design of the EV and its components, and to evaluate different strategies for improving the efficiency and performance of the vehicle.
simulation model
Driver block set

The driver block in an electric vehicle (EV) is a system that is responsible for controlling the vehicle's motion and ensuring that it follows a set reference velocity or trajectory. It typically consists of several components, including:
- PID Controller: A Proportional-Integral-Derivative (PID) controller is an algorithm that continuously adjusts the control inputs to the electric motor based on the difference between the reference velocity and the actual vehicle velocity. It uses the three terms proportional, integral, and derivative to calculate the control input, which helps to correct for any errors in the system and stabilize the vehicle's motion.
- Acceleration: The acceleration of the vehicle is controlled by adjusting the torque applied to the electric motor. A higher torque leads to a higher acceleration, and a lower torque results in a slower acceleration. The PID controller adjusts the torque based on the difference between the reference velocity and the actual vehicle velocity to ensure that the vehicle follows the desired reference trajectory.
- Brake: The brake is used to slow down or stop the vehicle. It works by applying a force to the wheels, which creates friction and reduces the velocity of the vehicle. In an EV, the brake can be either a traditional mechanical brake or a regenerative brake, which converts the vehicle's kinetic energy into electrical energy and stores it in the battery.
- Reference Velocity: The reference velocity is the desired velocity that the vehicle is trying to achieve. It can be set by the driver, or it can be generated by an autonomous control system. The PID controller uses the reference velocity as the target for the actual vehicle velocity and adjusts the control inputs to bring the actual velocity closer to the reference velocity.
- Vehicle Velocity: The vehicle velocity is the actual speed of the vehicle. It is measured using sensors on the vehicle and is used by the PID controller to calculate the difference between the reference velocity and the actual velocity. The difference between these two velocities is then used to calculate the control inputs, which are applied to the electric motor to control the vehicle's motion.
Power train block set

The powertrain block in an electric vehicle (EV) is a system that is responsible for converting the stored electrical energy in the battery into mechanical energy that can be used to power the vehicle. It typically consists of several components, including:
- Torque Calculation Block: This block is responsible for calculating the torque that needs to be applied to the electric motor in order to achieve the desired acceleration or velocity. It takes into account factors such as the vehicle's mass, the reference velocity, and the road conditions.
- Power Calculation Block: This block is responsible for calculating the power that is being generated by the electric motor. The power is equal to the torque multiplied by the rotational speed of the motor. This information is used to monitor the performance of the motor and to ensure that it is not overheating or being overworked.
- Traction Calculation Block: This block is responsible for determining the optimal distribution of torque between the front and rear wheels of the vehicle. It takes into account factors such as the road conditions and the vehicle's weight distribution to ensure that the vehicle has maximum traction and stability.
- Power Management Block: This block is responsible for managing the flow of electrical energy from the battery to the electric motor. It controls the voltage and current supplied to the motor, which affects the torque and power output of the motor.
- Energy Management Block: This block is responsible for managing the overall energy consumption of the vehicle. It takes into account factors such as the road conditions, the desired velocity, and the battery state of charge to ensure that the vehicle is using energy efficiently and that the battery does not become depleted. It also controls the charging of the battery to ensure that it is always in the best condition to provide power to the vehicle.
These components work together to ensure that the electric vehicle is able to efficiently convert the stored electrical energy in the battery into mechanical energy that can be used to power the vehicle. The powertrain block also ensures that the vehicle is able to achieve the desired velocity and acceleration, and that the battery is managed efficiently so that it is always ready to provide power when it is needed.
Vehicle dynamic blockset

The Vehicle Dynamics block set in an electric vehicle (EV) is a collection of mathematical models that simulate the dynamic behavior of the vehicle. It is used to predict the vehicle's motion and to understand how various factors, such as road conditions and driving behavior, impact the vehicle's performance. The key components of the Vehicle Dynamics block set include:
- Traction Force: The traction force is the force that is generated by the electric motor and transmitted to the wheels through the drivetrain. It determines the maximum acceleration and velocity that the vehicle can achieve.
- Vehicle Velocity: The vehicle velocity is the speed of the vehicle and is determined by the traction force and the resistance forces acting on the vehicle.
- Net Traction Force: The net traction force is the force available for acceleration after subtracting the resistance forces from the traction force.
- Rolling Resistance: Rolling resistance is the force that opposes the motion of the vehicle due to the deformation of the tires as they roll on the road.
- Gradient Resistance: Gradient resistance is the force that opposes the motion of the vehicle due to the incline of the road.
- Air Drag: Air drag is the force that opposes the motion of the vehicle due to the resistance of the air.
These components are used to simulate the dynamic behavior of the vehicle and to predict its motion in various road conditions and driving scenarios. The Vehicle Dynamics block set helps to optimize the control inputs to the electric motor and to ensure that the vehicle is able to achieve the desired performance and efficiency. It also helps to identify any limitations in the vehicle's performance and to design improvements to overcome those limitations.
Simulation results
Battery outputs (voltage, current, soc)

Fuel cell outputs (fuel cell current, fuel cell voltage, fuel cell soc, h2 consumption)

Ultra-capacitor outputs (soc, voltage, current)

Output of Reference speed to vehicle speed

conclusion
In conclusion, the simulation model for an electric vehicle (EV) that includes the Driver Block, Electric Powertrain, and Vehicle Dynamics blocksets is a valuable tool for understanding the behavior of the vehicle and for optimizing its performance. By incorporating these key components, the simulation model is able to accurately predict the vehicle's motion and to provide a clear understanding of how various factors, such as road conditions and driving behavior, impact the vehicle's performance.
The output of the simulation model is the reference speed, which represents the desired velocity of the vehicle. This reference speed is used to control the electric powertrain and to ensure that the vehicle is able to achieve the desired performance. The simulation model also provides valuable insights into the behavior of the vehicle and allows engineers to identify any limitations in the vehicle's performance and to design improvements to overcome those limitations.
Overall, the simulation model for an EV is a powerful tool for optimizing the performance and efficiency of the vehicle, and for ensuring that it is able to meet the needs of its users.