DynamicVehicleBehaviorModeling-DeepDive_web-version
DynamicVehicleBehaviorModeling-DeepDive_web-version
BaseEngine is instantiated from the DLR Powertrain library. All other components are from the Modelica® standard library.
Step 2: Modeling the Transmission
With the engine out of the way, let's start looking at the transmission. Let’s model a simple transmission with a pair of motors from the
standard library. One motor is connected to the engine, acting as the generator and the other is connected to the wheels, driving the vehicle. To
control the motor, let's insert a current control block. This component is essentially an actuator, controlled from outside the transmission. The
input to this component is the requested motor current. The actual value for the requested current will have to be calculated based on the
torque required by the vehicle. For now, let's simply add a constant input with an initial value zero (motor is not running).
Battery modeled as a
capacitor with capacitance of
10F and an initial voltage of 300V Motor to drive
the vehicle
Step 3: Modeling the Vehicle
We'll start with a simple model for the vehicle. The main effects we need to capture are how torque is translated into a force on the vehicle, the
drag force present on the vehicle and the overall vehicle inertia. For this model, we are only interested in longitudinal dynamics, that is, we are
only interested in modeling the vehicle moving in a straight line. The first step in modeling the vehicle is to add wheels that transform the
torque generated from the transmission into forces that move the vehicle forward in a straight line. Note how the wheel model has a rotational
connector on one end indicated by a gray circle and a translational connector indicated by green square on the other. Let’s also add the overall
vehicle mass and a damper to represent losses that scale up with speed. In reality, aerodynamic drag scales differently, this is just an
approximation. So far everything looks good!
CHECKPOINT!
We started by adding the engine model and transmission
Wheels with rotational
connector on one end models. The engine control has two inputs. One determines
and translational whether fuel is being injected and the other specifies the
connector on the other throttle position. Our transmission control model has one
input which allows us to control how much current is input to
the motor. The transmission contains a battery which allows
us to store up electrical energy for use later. This is typically
done to allow the engine to operate at its most efficient
operating point. When large torque demand comes from the
driver, the torque is delivered by draining the battery rather
than forcing the engine to operate at an inefficient point. The
battery is also important because it provides a place to store
Aerodynamic drag energy recovered from regenerative braking. Finally, we have
added the wheels and attached the overall vehicle mass.
Step 4: Simulating the Behavior of the Vehicle
We can now simulate this model and study the behavior of the vehicle. Let’s Let’s increase the value of the commanded current and rerun the simulation,
start by observing the vehicle velocity, we see that the vehicle isn't moving. making the vehicle accelerate.
This is expected since the transmission controller is requesting zero motor
current.
The generator is producing electricity and since current is not requested by the Let's compare the battery voltage trajectory against the previous simulation. Sure
motor, it charges the battery instead, from its initial voltage of 300v. enough, we see that the battery is now charging more slowly because power that
was previously going into the battery is now powering the motor.
Interface
flange_b u flange flange1 flangeR
indicating normalized throttle position. The current
y1
engine control model defines both the interface, throttle
Implementation
FuelFlag
loop commands. We will separate this model into y
const
u
an implementation and an interface. true
Throttle
y1 k=1
We'll also add one additional input signal to the
new interface to supply the engine controller with k=0.2
u y
information about the state of the battery voltage.
We now have an interface which defines what is Let’s follow the same procedure for the engine subsystem, splitting it into an
common across all potential engine control models interface and a specific implementation. This interface includes inputs from the engine
and a specific implementation that just uses open controller and an output shaft for connection to the transmission. The
loop commands. implementation includes the internal combustion engine and the crankshaft. We will
follow this procedure for the transmission, the transmission-controller and the
vehicle model, adding additional sensors along the way.
Step 7: Creating Vehicle Architecture with Interfaces
To create the vehicle architecture, let's build a new version of our system model, but this time, using only the interfaces that we have
developed. After connecting the interfaces together, we end up with a model that looks very similar to what we had before, except this time
we haven't included any implementation details.
This architecture contains only the interfaces and no implementation has been specified. It captures the structure of our system, regardless of
the specific implementations we choose to use. Once the architecture has been created we don't need to connect subsystem models anymore,
all the interfaces have been connected to work across any implementation. Next step is to create a variant of the vehicle and decide which
implementations of each subsystem will be included in the variant.
Vehicle Architecture
CHECKPOINT!
After simulating the initial vehicle, we created
subsystems by aggregating multiple components
with related functions. The interfaces for each sub-
system was extracted, separating them from specific
implementations. The vehicle architecture now
captures the structure of the system, regardless of
the specific implementation for each subsystem.
stateGraphRoot FuelControl
Vehicle variant implementing
root Speed Trace Transmission and
State machine with 2
On Off Engine Control
states: Charging and
Discharging true
y
Charging Discharging
active
HighVoltage LowVoltage
Throttle
y1
B
R
>= <=
150 50 Starts charging
when voltage
Turns engine off below 50V
when voltage above
150V u
Battery voltage sensor
input from Transmission
Step 11: Simulating Vehicle with the New Controllers
With these two new controller implementations, let's take the vehicle out for a spin.
After we simulate the model, we plot the vehicle speed and compare it to the desired
Speed [ m/s ]
drive cycle profile. Here we see the transmission controller is doing a good job of
following the drive cycle speed trace. Now let's look at what is going on with the
engine and the battery. Notice how the engine comes on when the battery voltage
gets too low and turns off when the battery voltage gets too high. Another important
thing to know about the battery is that it is charging and discharging, even when the
engine is off. The discharging comes when the vehicle accelerates because the motor
takes energy from the batteries to increase the vehicle speed. But how is the battery
Voltage [ V ]
recharging when the engine is off? The answer is regenerative braking. When did we
implement regenerative braking? We did it in the transmission control. The PID
controller in the transmission controller requests positive torque from the motor
when the vehicle needs to accelerate, and requests negative torque when the vehicle
needs to decelerate. Because we are using acausal models, all of our components
State machine turns
include balance equations, for things like mass, momentum, charge and so on. In Engine on and off
order for these balance equations to work out, the kinetic energy in the vehicle has to
go somewhere. The motor turns it back into electricity when negative torque is
requested and the resulting current flows into the battery, charging the battery in the CHECKPOINT!
process. Using this series hybrid example, we've shown how to build a
complete multi-domain system model from scratch. We also
The important point here is that we don't need to implement regenerative braking. organized the model into subsystems following configuration
We implement a mathematical model of each component and then impose management best practices. We implemented some additional
conservation equations across all the connections. As a result, we are always assured controllers to demonstrate typical capabilities seen in a series
of accurate accounting. This is important because if model developers had to hybrid. Finally we simulated the vehicle with the new
implement all the consequences of the different modes for each component it would controllers and verified the controller behavior.
be very easy to overlook something. With acausal modeling, all of this is taken care of.
Next Step: Leverage the Vehicle Library to Model Your Vehicle
While it's good to know that all of this is possible with Dymola, it is also important to realize that you don't need to start from scratch. This
architecture based approach is very common and many of the specialized libraries that come with Dymola include not only high quality
component and subsystem models but also the interfaces and architectures that give you a head start in building models of your system. You
can also import your legacy models into Dymola, either using direct interfaces, or by adopting the standard FMI interface.
Vehicle Systems Modeling and Analysis (VeSyMA) is a complete set of libraries for vehicle modeling and simulation. It includes engine,
powertrain and suspensions libraries that work in conjunction with the Modelica Standard Library. In addition, battery with electrified
and hybrid powertrain libraries are available as well. Please watch the other videos in this series for more information on Dymola.
VeSyMA is registered trademark of Claytex Services Limited | Modelica is a registered trademark of the Modelica Association
FMI is a registered trademark of FMI Standard Org
Articles in the series:
Model-based Systems Engineering – A Primer
Dynamic Vehicle Behavior Simulation – A Deep Dive
System Architecture with SysML for Control Systems Engineers