## Driveline States & Effect of Clutches

### Driveline States and Degrees of Freedom

It is best to have some familiarity with advanced Simulink® modeling techniques before using this section. For more information on driveline degrees of freedom, see Driveline Degrees of Freedom.

Simulink and Simscape™ represent driveline degrees of freedom (DoFs) and other information about the dynamics of a model with states. The driveline states are a subset of the total states of the model. Although the number of independent 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 velocities, not the velocities of particular driveline axes. Before you simulate a model, this DoF-to-state transformation is not known.

You can extract state and model output data from your simulation. In the Model Configuration Parameters property inspector, select the appropriate check boxes in the Data Import/Export pane. The default state and output vectors are `xout` and `yout`, respectively.

#### Discontinuous Clutch State Changes

In part, the overall state of the driveline is the set of all its clutch states. Because clutches are dynamic constraints, the nature of the driveline states in a model with clutches and clutch-like elements can change during simulation. When a clutch locks, two independent driveline states become dependent on one another.

For software to design and analyze transitions among discontinuous states such as those found in clutches and transmissions, see Stateflow.

#### Inverse Dynamics

State information is also useful for analyzing the inverse dynamics of a driveline. Often, you apply torques and forces to a driveline in forward dynamics and then determine the motions. Inverse dynamics means specifying motions to determine what torques and forces produce those motions.

If you motion-actuate some parts of your driveline instead, those axes and the equivalent states are no longer independent. If you want outputs from these axes, measure the torques and forces flowing along them. Knowing these torques and forces is the starting point of inverse dynamic analysis.

### Find and Use Driveline States

This section explains how you locate and use Simscape Driveline™ states.

#### Locating Driveline States in Simulink

Your driveline model consists of a mixture of Simscape Driveline, Simscape, and ordinary Simulink blocks. In general, a model has Simulink states associated with the Simulink blocks. The Simscape Driveline and Simscape states of a single driveline system are associated with the Solver Configuration block of that driveline.

You can list all model states with the Simulink `Simulink.BlockDiagram.getInitialState` method:

1. Open the Simple Gear model as an example.

2. At the command line, enter:

```sigt = Simulink.BlockDiagram.getInitialState('SimpleGear'); sigt.time sigt.signals```

The `Simulink.BlockDiagram.getInitialState` method initializes the model at zero time and captures the model states within the `.signals` structure. This list is the total set of states, not just the independent states. The Simscape and driveline states are a subset of the total states.

#### Trimming and Linearization — Clutch States

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, such as changes to initial conditions or to the applied forces and torques. Trimming and linearization are the formal steps of such an analysis.

If you implement clutch state changes in your simulation, trimming requires that you start by specifying which clutches are locked and unlocked. The trimming procedure then determines the state of continuous motion. During linearization, simulation starts with the clutch states that you specify and iterates to find a consistent state of all clutches. It then implements the perturbation of continuous states, holding the clutch states fixed.

For more information about trimming and linearizing Simscape models, see Finding an Operating Point and Linearizing at an Operating Point.