Products & Services Solutions Academia Support User Community Company

Learn more about SimDriveline   

Trimming and Linearizing Driveline Models

About Trimming, Inverse Dynamics, and Linearization

An important part of analyzing a driveline system is finding stable steady states of motion and understanding how the driveline responds to small changes in inputs. Trimming and linearization are the formal steps of such an analysis. This section explains how to trim and linearize your driveline model and the related concepts of states and inverse dynamics. It concludes with three interrelated examples illustrating these points with a car model.

Trimming a driveline means finding a state of motion that satisfies certain conditions on some combination of the degrees of freedom (DoFs) and their derivatives. Trimming usually starts with a guess. The solution to the trimming problem is the trim or operating point.

Linearizing a system means finding the response of the system to small perturbations in its motion. These perturbations can be small changes in initial conditions or in the applied torques. Simulink provides a basic command (among others) for linearization called linmod.

Driveline and Simulink States

Simulink represents driveline DoFs and other information about a model's dynamics with states. Trimming a driveline requires extracting its driveline states, which are part of the complete set of Simulink states of your model. Although the number of driveline states in a model is equal to the number of independent DoFs (with all clutches unlocked), the driveline states in general are linear combinations of the angular velocities, not the angular velocities of particular driveline axes. This DoF-to-state transformation is not known beforehand, so you must trim your driveline without specifying which state is which.

State information is also useful for analyzing a driveline's inverse dynamics. Normally, you apply torques to a driveline and then determine the motions. Inverse dynamics means specifying motions to determine what torques are needed to produce those motions.

You can extract state and model output data from your simulation by selecting the appropriate check boxes in the Data Import/Export pane of your model's Configuration Parameters dialog. The default state and output vectors are xout and yout, respectively.

Relation Between Trimming and Linearization

Trimming and linearization are closely intertwined. Trimming a system leads to a trim or operating point. That configuration of the system is then often the system trajectory around which you linearize the motion. If, after linearization, the operating point proves to be unstable, you typically attempt another trim and locate a different trim point.

Role of Discrete Driveline Modes

The collective mode of the driveline is the set of all its clutch modes. If clutch mode changes are possible, trimming requires determining which clutches are locked and unlocked, as well as finding the state of continuous motion.

During linearization, simulation starts with the clutch modes you specify and performs a clutch mode iteration to find a consistent state of all clutches. It then implements the perturbation of continuous states, holding the clutch modes fixed.

Inverse Dynamics and Trimming

A typical driveline simulation is based on torque-actuating the driveline axes, then measuring the resulting motions. This analysis is called forward dynamics. If you motion-actuate (instead of torque actuating) some parts of your driveline, those axes and the equivalent states are no longer independent. There is no point in measuring their angular velocities because you already specify them.

If you want outputs from these axes, measure instead the torques flowing along them. Knowing these torques is the starting point of inverse dynamics analysis.

Trimming involves a mixture of forward and inverse dynamics. You apply torques to some axes and specified motions to others. You have trimmed the model once you have determined a desired and consistent driveline motion state. Knowing its state in that trajectory, you can linearize the model's motion.

Relation of Trimming and Linearization to Control Design

A complete driveline system usually consists of the driveline part (the plant) and a controller that changes the plant state in response to human or automatic commands. In designing a controller for a driveline, it is essential to locate stable operating points and analyze the system's response at those operating points to small changes in control inputs. These are precisely trimming and linearization.

These products provide specialized and advanced methods that help you design controllers with MATLAB and Simulink:

In addition, Stateflow® is a powerful tool for designing and analyzing transitions among discrete states such as those found in clutches and transmissions.

Finding and Using Driveline States

This section helps you locate and use SimDriveline states. See the Simulink documentation for more about states in general.

See Counting Driveline States in a Full Car following for an example.

Relationship of States to Degrees of Freedom

Understanding degrees of freedom (DoFs) in your driveline model is essential for advanced analysis, simulation, and troubleshooting. (See Analyzing Degrees of Freedom preceding.) Simulink represents these DoFs as part of the model's states.

The driveline states are a subset of the model's total states. You can count the number of driveline states in your model by counting the independent DoFs with all clutches unlocked. Both DoFs and states are based on the angular velocities of the associated axes. See Analyzing Degrees of Freedom preceding for further discussion of DoFs.

The independent DoFs are essentially the unbroken driveline axes or branched axis groups, as well as axes connected by true constraints like gears. Axes on either side of a dynamic element are independent. (For the purpose of identifying states, Simulink treats clutches as dynamic elements, not as constraints.)

When all clutches are unlocked, the driveline states are all independent. Once a clutch locks, one of the associated DoFs becomes dependent. The two associated states become dependent because the two angular velocities are necessarily equal.

Locating Driveline States in Simulink

Your driveline model consists of a mixture of SimDriveline and ordinary Simulink blocks. The model in general has Simulink states associated with the Simulink blocks. The driveline states of a single driveline system are associated with the Kinematic subsystem of the Driveline Environment block of that driveline. You can list all model states with the Simulink model command:

  1. Open a model. In this example, use drive_model.

  2. At the command line, enter

    [sys,x0,str,ts] = drive_model([],[],[],'sizes');
    sys
    str

The relevant elements of sys are

str lists all model states, including the driveline states associated with each Driveline Environment block.

Trimming a Driveline with Inverse Dynamics

For a specific example of trimming, see Trimming a Full Car to Rest following.

Consider trimming a model with a mixture of forward and inverse dynamics. In this example, the model is called drive_model. Open the model.

Inserting Sensors, Actuators, Scopes, Inports, and Outports

First set up driveline sensors and actuators and model inputs and outputs, as necessary and desired.

  1. Attach Torque Actuators (or the equivalent, such as Engines) to whichever axes you want to torque-actuate. If you want to measure their resulting motions, add Motion Sensors as well.

  2. Attach Motion Actuators to whichever axes you want to move according to prior specifications. If you want to measure their resulting torques, add Torque Sensors as well.

  3. For whatever measurements you want to save to your workspace, feed the corresponding Motion and Torque Sensor output signals to Outport blocks.

  4. For any external input signals you need to feed into the model, add Inport blocks.

If you want to visually examine sensor output, add and connect Scopes as desired.

Counting the States

Now count the states, inputs, and outputs by using the 'sizes' option in the model command. See Finding and Using Driveline States preceding.

From sys, read the number of states, outputs, and inputs. From str, read the subset of driveline states.

Configuring and Initializing the Model

Configure the model to extract state and output data.

  1. From the Simulation menu, open the Configuration Parameters dialog. Select the Data Import/Export node.

  2. In that pane, under Save to Workspace, select the States and Output check boxes. The default workspace variables for this data are xout and yout, respectively.

  3. Close the dialog.

Check the model's blocks to impose the initial conditions as you want them. If you are feeding input and/or initial state data into the model, check those values as well.

Finding a Trim Point

You can now run your model as needed. Each time you do, for all time steps, the array xout receives the state values and the array yout receives all the output values.

  1. As necessary, adjust the torque and motion actuators in the model until you locate the desired motion state. The torques as you impose and measure them are the torques needed to produce the motion that you see.

  2. Once you reach the desired motion state in a simulation, examine the components of xout, especially those representing the driveline states.

    If you want to use this state as a linearization point, extract the state vector from xout at a time step when the driveline is moving exactly as you want it to. Store the vector as x0, for example.

Linearizing a Driveline Model

For a specific example, see Linearizing a Full Car at Rest following.

Consider linearizing a model with the Simulink linmod command. In this example, the model is called drive_model. If you need to locate a trim point before linearizing, first see Trimming a Driveline with Inverse Dynamics preceding.

By default, the linmod command extracts linear models of the state space (A, B, C, D) form. If x is the state vector, u is the input vector, and y is the output vector, the matrices play the following roles in the linearized state space dynamics. The order of states, inputs, and outputs is the same in the linear model as in the full model.

Linearizing at the Null State and Null Inputs

To linearize your model at zero simulation time and the combination x = [] and u = [], enter

[A,B,C,D] = linmod('drive_model');

This approach can produce a trivial state space. A nontrivial state space often requires nonnull inputs u, at least, and possibly nonnull outputs y as well.

Linearizing at a Predefined State

If you have predefined state and input vectors x0 and u0, you can linearize in that configuration and at zero simulation time by entering

[A,B,C,D] = linmod('drive_model',x0,u0);

You can save a predefined x0 vector from a trim operation. See Trimming a Driveline with Inverse Dynamics preceding.

A nonnull u0 is often needed to obtain a nontrivial state space.

Other Linearization Options

Consult the command reference for linmod and the Simulink documentation for complete linearization options.

Counting Driveline States in a Full Car

The full car model of Modeling and Simulating a Complete Car in the Simple Models chapter serves as an example of degrees of freedom (DoFs) and states. Here you use a variant version of the model called drive_full_car_trim.

Finding and Using Driveline States preceding discusses state counting in general. This example is the starting point for the subsequent example, Trimming a Full Car to Rest.

Identifying the Degrees of Freedom

First count the independent DoFs of the system. With all clutches unlocked, the model has four independent driveline DoFs.

  1. Open drive_full_car_trim. Three subsystems, Converter with Lockup Clutch, CR-CR 4-Speed, and Vehicle Load-Wheels-Road-Power Scope, are part of the driveline system. (There is also a Torque Actuator hidden in the Gasoline Engine block.)

    Full Car Model: Degrees of Freedom

  2. Identify the driveline axis running from the Engine to the Converter subsystem. This is one independent DoF. Then open that subsystem.

    Full Car: Converter with Lockup Clutch Subsystem

    The Torque Converter introduces a new independent DoF to the right. This axis then connects to the transmission. Close the Converter subsystem.

  3. Open the CR-CR 4-Speed transmission subsystem.

    Full Car: CR-CR 4-Speed Transmission Subsystem

    This subsystem adds six new driveline connection lines. The two Housing and two complex Gear blocks add six apparent constraints. (The two Planetary Gear blocks are complex and impose two constraints each.) But these constraints are embedded into two independent loops, so only 6 – 2 = 4 constraints are independent. Thus the transmission introduces 6 – 4 = 2 new independent DoFs.

    Close the transmission subsystem.

  4. Look under the Vehicle Load subsystem mask.

    Full Car: Vehicle Load Subsystem

    With the Forward Gear constraint, there are no new independent DoFs in this subsystem. Close it.

This model has four independent DoFs with all clutches unlocked:

When the Transmission Locks.   When you engage the CR-CR 4-Speed transmission, two of its clutches lock, removing its two independent DoFs and reducing the total from four to two. They are the engine-to-converter axis and the converter-to-road axis.

There are still four driveline states, but two become dependent.

When the Lockup Clutch Also Locks.   When the transmission is engaged and the lockup clutch in the Converter subsystem is also locked, only one independent DoF remains. This DoF is the entire drivetrain from engine to road.

Of the four driveline states, only one is independent.

Finding the States

Now list the model states.

[sys,x0,str,ts] = drive_full_car_trim([],[],[],'sizes');

sys
sys =
    10
     0
     4
     0
     0
     0
     2
str
str = 
    [1x88 char]
    'drive_full_car_trim/Clutch Hydraulics/Actuator R Dynamics'
    'drive_full_car_trim/Clutch Hydraulics/Actuator A Dynamics'
    'drive_full_car_trim/Clutch Hydraulics/Actuator D Dynamics'
    'drive_full_car_trim/Clutch Hydraulics/Actuator B Dynamics'
    'drive_full_car_trim/Clutch Hydraulics/Actuator C Dynamics'
    'drive_full_car_trim/Driveline Environment/Subsystem/Kinematic Block'
    'drive_full_car_trim/Driveline Environment/Subsystem/Kinematic Block'
    'drive_full_car_trim/Driveline Environment/Subsystem/Kinematic Block'
    'drive_full_car_trim/Driveline Environment/Subsystem/Kinematic Block'

The model has a total of 10 states and four outputs. The driveline states are the last four, associated with the Kinematic subsystem of the Driveline Environment block.

Trimming a Full Car to Rest

Here you use the variant full car model called drive_full_car_trim to obtain a trim or operating point. In this example, the car's operating point is at rest.

Trimming a Driveline with Inverse Dynamics preceding discusses trimming in general. This example is based on the preceding example, Counting Driveline States in a Full Car, and forms the starting point for the subsequent example, Linearizing a Full Car at Rest.

Configuring the Model for Trimming

Open and examine drive_full_car_trim.

Full Car Model Customized for Trimming

Reading the Model States and Outputs

Examine the simulation data.

  1. Open the Road Speed scope and run the model. The simulation stops when the car reaches rest.

  2. In your workspace, read the state data from xout and angular velocity data from yout. Each row of these arrays represents a time step; the columns are the vector components.

Defining an Operating Point from the State

To linearize the model at the rest state, you need to first define that state. At the last simulation time step, the car is not exactly at, but very close, to rest. Save this state as a vector x0 and use it as the linearization point.

  1. Determine the number of time steps by examining tout in the workspace or entering at the command line

    length(tout)
  2. Define the quasi-rest state in your workspace by extracting the last entry in xout. At the command line, enter

    x0 = xout(length(tout),:);

x0 and each row of xout have ten components, corresponding to the ten states obtained in Counting Driveline States in a Full Car preceding.

Linearizing a Full Car at Rest

Here you use the variant full car model called drive_full_car_trim to linearize the full car at the operating point of rest.

Linearizing a Driveline Model preceding discusses linearization in general. This example is based on the previous example, Trimming a Full Car to Rest, which you need to carry out before proceeding here. The result of that example is a saved linearization point, the quasi-rest state x0.

Creating Model Inputs

To guarantee a nontrivial linearized model, insert at least one model input. The simplest choice is to convert the Gasoline Engine throttle signal into a model input.

  1. Disconnect the zero Constant block from the Gasoline Engine block.

  2. Replace it with an Inport block with Port number set to 1.

Obtaining the Linearized Model

Linearize the model with the linmod command.

  1. At the command line, define the input throttle signal by entering

    u0 = 0;
  2. Then obtain the state space model arrays (A, B, C, D) by entering

    [A,B,C,D] = linmod('drive_full_car_trim',x0,u0);

    linmod carries out a clutch mode iteration first and locks clutches A and D of the CR-CR 4-Speed transmission subsystem.

There are 10 states (ten components in x), one input (one component in u), and four outputs (four components in y). (Four of the 10 states are driveline states.) Thus A is 10-by-10, B is 10-by-1, C is 4-by-10, and D is 4-by-1.

Finding the Minimal Realization of the State Space

Although there are four apparent driveline DoFs, with the CR-CR transmission engaged, only two are independent. Thus not all the states of x are independent, and the state space form (A, B, C, D) contains redundant information.

Reduce the state space model to its minimal form by entering at the command line

[a,b,c,d] = minreal(A,B,C,D);
8 states removed.

Of 10 states, state space reduction removes eight, leaving two states, corresponding to the two independent DoFs. There are still four outputs in y and one input in u. Thus a is 2-by-2, b is 2-by-1, c is 4-by-2, and d is 4-by-1.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS