Getting Started with Simscape
Simscape™ enables you to model physical systems by modeling a battery electric vehicle. Learn how to assemble a schematic of electrical, mechanical, and fluid components into a model that helps you size components and make design decisions within Simscape.
Explore how to use simulation to select electric motors and size cooling systems that include pipes, pumps, and tanks. Simscape helps you:
- Assemble Simscape components into a mechanical schematic to model the vehicle.
- Simulate a passing maneuver to determine the required motor torque.
- Refine the electric motor model with parameters from a datasheet.
- Model the cooling system to keep the temperature below its maximum rated temperature with Simscape fluid components.
- Tune the physical model created in Simscape, incorporate 3D mechanical systems, and connect it to control algorithms in the Simulink® environment.
Additional Resources:
Published: 3 Feb 2021
Simscape enables engineers to model and simulate physical systems. Physical systems are made of electrical, mechanical, thermal, and other components, things you can see, touch, measure, and describe using laws of physics.
Here's an example-- an electric vehicle. An electric vehicle has electric motors, a mechanical drivetrain, and a cooling system to keep temperatures in check. All of these parts have to work together. The motors convert electric energy from the battery to mechanical energy that turns the gears, shafts, and wheels. And some of that energy is converted to heat.
Engineers can use a model of this system for tasks like sizing the battery and motor, estimating the range and efficiency of the vehicle, increasing its acceleration, or determining how to cool the motor. In this video, we'll size the motor and make sure it doesn't overheat.
Our test scenario is passing another vehicle on an uphill road. The torque produced by the motor must be enough for these tough conditions. We'll simulate this scenario to determine how much torque is needed and pick a motor.
Some of the energy taken from the battery is converted to heat. If the motor gets too hot, the wires will burn through their insulation and destroy the motor. With Simscape we can easily add thermal behavior without rederiving all the equations.
Simscape takes the component equations for each block and derives the equations describing the entire system based on how you connect these blocks. To make sure the system works no matter how hot it is outside, we can take our virtual car anywhere, from Siberia to the Sahara without leaving our desk.
First, we'll use Simscape to model the mechanical system. Next, we'll explore simulation results to refine the requirements for the motor. Then we'll account for its thermal behavior and determine the amount of cooling needed. Let's get started.
We use the command ssc_new to create a new model with the right settings for Simscape and some useful blocks. Let's use a torque source to represent a motor that can give us as much to torque as we need.
The C connection represents the motor housing. We attach that rigidly to the chassis of our vehicle. The R port represents the motor shaft, which we connect to a gearbox to increase the output torque.
Now we add wheels to make the car move, a mass to give it inertia, and a motion sensor to measure the car's speed. The components of our model are connected to each other, just like they are in the actual system. The lines connecting the components represent equations that describe how the components interact with one another. Each component also has equations describing its behavior.
Simscape derives the equations for the entire system and solves them at each time step during the simulation. Let's run the simulation and see what happens. The car just keeps going faster and faster. Yeah, I'm pretty sure my speedometer doesn't go that high.
We're missing some physical effects. We need to add rolling resistance of the tires, aerodynamic drag, and the road incline. We can add a friction block to capture the rolling resistance and drag. A fourth source lets us model the effect of gravity when driving up a steep hill.
Now our speed levels off, but we're still going pretty fast, kind of exciting, but I don't normally floor it for 5 minutes straight. Let's have a driver model to control the vehicle speed. This animation was produced by Simscape Multibody.
The vehicle is traveling on a highway at cruising speed when it ends up behind a slower vehicle. The driver accelerates to pass the car, then returns to the original lane. During the passing maneuver acceleration, the motor provides 200 newton-meters of torque.
Let's determine the passing time by opening a torque plot in the Simscape Results Explorer. The Results Explorer can show any Simscape variable over time. The torque is constant for 14 seconds while we pass the slower vehicle. That's a long time to spend in oncoming traffic.
Let's try increasing the torque during acceleration to 800 newton-meters. With more torque, the passing time is now under 4 seconds. This should meet the needs of even the most demanding drivers.
With an estimate of the required torque, we can choose a motor and incorporate its behavior into the model. The motor we've selected provides a maximum torque of 800 newton-meters and a maximum power output of 500 kilowatts. Simscape has multiple blocks to represent an electric motor with varying levels of detail.
With the motor and drive components, we can incorporate realistic torque speed behavior without modeling power electronic switching events. So it's perfect for our analysis. Let's insert the motor and drive block by typing in the canvas. Then set its torque, power, and efficiency from our motor's data sheet.
For this short test, let's model the battery as a constant voltage source. With our more realistic motor, the resulting passing time is longer, but still within reason. We could make this model even more accurate by modeling the exact battery behavior, the power converter, and other electrical effects.
It's great that our model helped us pick a motor that will provide plenty of acceleration. Now let's use it to make sure the system doesn't overheat.
Real motors are not perfectly efficient. Not all the energy provided by the battery goes into moving the vehicle. Some of that energy is converted to heat. To see how that impacts our motor temperature, let's model its thermal behavior. This helps us decide what we need to do to keep the motor within its rate of temperature.
How can we incorporate thermal effects? It's easy. We can add a thermal port to the motor, which lets us model heat transfer to the environment.
Heat conducts to the motor casing and convects to the outside air. We need to monitor the motor temperature. So we add a temperature sensor.
Now we can just click the Run button again, and simulate the updated model, and see how hot the motor gets. The motor temperature is over the design limit when the vehicle accelerates, and even just when cruising. That is not good. It's only rated to 140 degrees. It looks like we need to add a cooling system.
High-performance motors use liquid cooling to remove heat. The motor casing transfers heat to the coolant. And the radiator dumps that heat to the environment.
The pipe block allows us to model heat exchange between a moving fluid and the wall. We use one pipe to absorb heat from the motor, and another to transfer heat to the environment. To close the fluid loop, we'll insert a tank and a mass flow source that will serve as our pump. Using the fluid properties block, we can select the fluid flowing through our cooling system.
The temperature is below 120 degrees the whole time. This gives us plenty of safety margin if we really have the need for speed. In just a few minutes, we used Simscape to size motors and cooling systems with an electric vehicle model containing the battery, motor, drive train, and the wheels.
Even better, we could use optimization algorithms and let MATLAB find the best design for us. We can model the suspension using Simscape Multibody and look at how the car behaves on different road surfaces, and under challenging driving conditions. Simscape Multibody handles all of the 3D dynamics for you so that you can focus on your design. And Simulink can help us develop a controller to only turn on cooling when it's needed.
Ready to learn more about Simscape? Check out the Getting Started web page for more videos on Simscape for physical modeling. Welcome to Simscape.