Model and Simulate an Electric All-Terrain Vehicle with Simscape
From the series: Improving Your Racecar Development
Learn how to model an electric all-terrain vehicle (ATV) for off-road student competitions such as Baja SAE. Watch an overview of how to develop the model using Simscape™. Then use the model as a reference for optimizing ATV parameters, performing brake tests, running the ATV on uneven surfaces, and calculating the state of charge of the battery. A list of resources is provided for when you build your own ATV model.
For more information, you can access the following resources:
- Getting Started with Simscape
- Motor Control Video Serries
- How to Design Motor Controllers Using Simscape Electrical
- Student Competition: Physical Modeling Training
- Estimate Battery State of Charge with Simulink
- How to Optimize Model Parameters in Simulink
- Winners of eBAJA SAEINDIA 2019 use MATLAB and Simulink for their Vehicle Design
Published: 20 Apr 2021
In this video, we will see how we can model an all-terrain electric vehicle or in short ATV. We will see how by combining various physical systems such as electrical, mechanical we can easily model an ATV.
For the video, we will refer to the ATVs used in off-road student competitions where the vehicle has a rear-wheel drive and is driven by a BLDC motor.
The video will also provide information on how you can use the model as a reference for optimizing certain vehicle parameters, performing simplified emergency brake tests, running a vehicle on a bump, and finally performing closed loop simulation to track the drive cycle and measure the state of charge.
We hope you will find the video useful and will implement the learnings to develop your vehicle model.
So, with this let’s get started and welcome you all to the MATLAB and Simulink Racing Lounge.
Imagine you have a simulation model of your electric vehicle. What can you do with that?
Well, you can try new ideas. For example, whether to go with a simple gear assembly or to use a chain drive.
You can find and fix errors in the design phase. To give an example, while in simulation, you can find the reason why your powertrain is unable to track the drive cycle.
And finally, you can convert models into production code.
So, here is the open-loop model that we have developed using Simscape that enables you to rapidly create models of physical systems within the Simulink environment. The model outputs the vehicle velocity based on the input duty cycle.
It consists of a battery source which consists of cells in series where each cell is an RC equivalent circuit.
The motor and inverter subsystem consists of a buck converter to step down the input voltage. The BLDC motor phases are controlled by the commutation logic provided to the three-phase inverter. Each of these subsystems has been built using blocks from Simscape Electrical based on physical connections.
Further, we have a simple gear for transmission and a simple longitudinal vehicle dynamics subsystem consisting of a vehicle body, tires, and brakes.
In the model, you can add a dashboard for the duty cycle and change the values to check out the vehicle’s velocity.
Well, as you see the model works fine. However, that’s not the case always. Maybe you made the model with proper connections, but you are not getting the expected output. One of the most common reasons is the selection of inappropriate vehicle parameters. For example, check out this BLDC motor block that requires multiple parameters and if you vary the magnet flux linkage you can see that it is limiting the maximum velocity for the vehicle. So, what to do now. One option is to ensure that you input the correct parameters, or you can try to optimize the parameter based on your requirements.
Exploring the second option, let us define our design requirements. We want that after t1 seconds the vehicle velocity should be in certain bounds based on which we can estimate the magnet flux linkage. To perform this estimation, we will bring in a “Check Custom bounds” block from the Simulink Design Optimization toolbox and will define the bounds. Further, we click on the Response optimizer under the app section, define the design variable which in this case is the flux, and run the optimization. As we can see, once the optimization is complete, the velocity is within the range, and here is the estimated value. Now, we will use the same value for performing further simulations.
Moving to the next section, where we are interested to measure the stopping distance. The vehicle accelerates and once it reaches a certain distance the driver applies the brake. To apply this logic, we use the same model. We will add disc brakes to exert friction torque on the front and rear shaft. Next, we will connect the measured distance port to two switches. One switch will accelerate the vehicle until it reaches 60m and another switch will make sure that the brakes are applied at the same time. Please note that we are assuming an ideal situation with no delay. Now, once we run the simulation, you can see that the velocity drops from finite value to zero and the stopping distance is around 8 meters. Please note that the stopping distance can be further reduced based on your optimal vehicle parameters and design.
Another important variable that we need to add is the road inclination. The ATVs mostly drive on roads with varying inclination. Hence, let’s see how to include the road inclination. It is always recommended to use recorded terrain data such that from that data you can prepare a 1d lookup table between distance traveled and road inclination. As we don’t have that data, we just created a simple trapezoidal bump. So, to implement the same in the model we wrote a few lines of MATLAB code and calculated the inclination and prepared a lookup table. As you can see the inclination remains constant at 30 degrees, then drops to zero and then again goes to -30 degrees. The table takes in the distance traveled by the ATV and outputs the incline angle. So here is the additional subsystem that implements the varying inclination in the model. As we run the simulation, we can see that the vehicle velocity decreases with a positive inclination and then increases as it approaches negative inclination.
Until now all were open-loop models. Now, let’s check out the closed-loop model where we will try to track the drive cycle and measure the SOC. In the model, we have added a drive cycle block from the powertrain blockset that generates a user-defined drive cycle from a mat file. As we didn’t have the test data from an actual ATV, we have used a random signal to demonstrate the model. However, it would be great if you have a recorded test data for the drive cycle. Something, like what one the winners of the off-road competitions used for their vehicle design. The team used the recorded data and calculated the range and SOC. Now, that you have some more motivation, let’s get back to our model. Now to close the loop, we measure the velocity error and have added a PID controller to output the required duty cycle and brake signal. Finally, we have added a subsystem to measure the state of charge of the vehicle based on traditional open-circuit voltage measurement and coulomb counting. Now, as we run the simulation, we see that the vehicle can track the drive cycle, and the simulation stops as the battery reaches 20 % SOC. This was a simplistic approach to calculate the SOC. However, if you are interested to know more about alternative approaches such as Kalman filtering please check out the webpage dedicated towards battery state of charge estimation.
So, we just saw how you can model a simple electric all-terrain vehicle using Simscape. You must be wondering what the resources are to learn more. So, let’s check it out. If you are a part of the automotive student team and want to get started with Simscape, please go through the Physical modeling tutorial that will help your team get started with modeling, simulating, and analyzing automotive domains. Further, if you are interested to learn more about motor control please do check out the Motor Control series, and to implement the learnings in Simscape check out the “how to design motor controllers” videos. In case, you are from some different domain, you can visit the Simscape webpage for additional resources.
So, with this, we are at the end of the video, and if you have any questions reach out to us at racinglounge@mathworks.com, and don’t forget to join our MATLAB and Simulink Racing Lounge group Facebook for the latest content and related news.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)