You can compute a steady-state operating point for a Simulink^{®} model by specifying constraints on the model states, and finding a
model operating condition that satisfies these constraints. For more information
on steady-state operating points, see About Operating Points and Compute Steady-State Operating Points.

You can trim your model to meet state specifications interactively
using the Linear Analysis Tool or programmatically at the MATLAB^{®} command
line. For each state in your model, you can specify a known value
or you can constrain the state value using minimum and maximum bounds.
If a state is not known, you can specify an initial guess. You can
also specify which states must be at steady-state at the trimmed operating
point.

You can also constrain the derivatives of states that are not at steady-state.

This example shows how to compute a steady-state operating point by specifying known state values and constraints using the Linear Analysis Tool.

Open the Simulink model.

```
sys = 'scdspeed';
open_system(sys)
```

To open the Linear Analysis Tool, in the Simulink model window, select **Analysis** > **Control Design** > **Linear Analysis**.

In the Linear Analysis Tool, on the **Linear Analysis** tab, in the
**Operating Point** drop-down list, select ```
Trim
Model
```

.

By default, on the **States** tab, the software specifies both model
states to be at equilibrium, as shown by the check marks in the **Steady
State** column. both states are also specified as unknown values; that is,
their steady-state values are calculated during trimming, with an initial guess specified in
the **Value** column.

Change the second state, the engine angular velocity, to be a known
value. In the **Known** column, select the corresponding row and, in the
**Value** column, set the value to `180`

.

You can also specify bounds for model states during trimming. For this example, constrain
the first state to be between `0.5`

and `0.7`

. To do so,
enter these values in the **Minimum** and **Maximum**
columns, respectively.

To compute the operating point that meets these specifications, click **Start
trimming**.

The software uses optimization to find the operating point that meets your specifications.

The Trim progress viewer shows the optimization progress and that the optimization
algorithm terminated successfully. The **(Maximum Error)** column shows the
maximum constraint violation at each iteration. The **Block** column shows
the block to which the constraint violation applies.

The trimmed operating point, `op_trim1`

, appears in the **Linear
Analysis Workspace**.

To evaluate whether the resulting operating point values meet the specifications, in the
**Linear Analysis Workspace**, double-click
`op_trim1`

.

In the Edit dialog box, on the **State** tab, the **Actual
Value** for the first state falls within the **Desired Value**
bounds, and the actual angular velocity is `180`

, as specified.

The **Actual dx** column shows the rates of change of the state values at
the operating point. Since these values are at or near zero the states are not changing,
showing that the operating point is in a steady state.

You can also constrain the derivatives of states that are not at steady state. Using such constraints, you can trim derivatives to known nonzero values or specify derivative tolerances for states that cannot reach steady state.

For example, suppose that you want to find the operating condition at which the engine
angular velocity is 180 rad/s and the angular acceleration is `50`

rad/s^{2}. To do so, first open the Trim the model dialog box.
In the Linear Analysis Tool, in the **Operating Point** drop-down list,
select `Trim Model`

.

In the **Steady State** column, clear the selection in the corresponding
row. Then, in the **dx Minimum** and **dx Maximum**
columns, set both state derivative bounds to `50`

.

To compute the operating point, click **Start trimming**.

In the Linear Analysis Tool, in the **Linear Analysis Workspace**,
double-click `op_trim2`

.

In the Edit dialog box, in the second row, the **Actual dx** column
matches the **Desired dx** column. Therefore the operating point meets the
specified state derivative constraints.

This example shows how to compute a steady-state operating point by specifying known state values and constraints.

Open the Simulink model.

```
mdl = 'scdspeed';
open_system(mdl)
```

Create a default operating point specification for the model.

opspec = operspec(mdl)

Operating point specification for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar spec: dx = 0, initial guess: 0.543 (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s spec: dx = 0, initial guess: 209 Inputs: ---------- (1.) scdspeed/Throttle perturbation initial guess: 0 Outputs: None ----------

By default, both states are specified to be at equilibrium, as shown by the `dx = 0`

specification. Both states are also specified as unknown values; that is, their steady-state values are calculated during trimming, with an `initial guess`

defined in the specification.

Change the second state, the engine angular velocity, to be a known value, and view the updated state specifications.

opspec.States(2).Known = 1; opspec.States

(1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar spec: dx = 0, initial guess: 0.543 (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s spec: dx = 0, x: 209

The value defined in the second state specification is now the known state value and not an initial guess.

Find an operating point that meets these specifications.

op1 = findop(mdl,opspec);

Operating point search report: --------------------------------- Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.544 dx: 2.03e-13 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 209 dx: -4.57e-13 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 0.00501 [-Inf Inf] Outputs: None ----------

The operating point search report shows that the specifications were met successfully, and that both states are at steady state as expected (`dx`

= 0).

You can also specify bounds for model states during trimming. For example, modify the operating point specifications to trim the second state to a known value of `180`

, while constraining the first state to be between `0.5`

and `0.7`

.

opspec.States(2).x = 180; opspec.States(1).Min = 0.5; opspec.States(1).Max = 0.7;

Find the operating point that meets these specifications.

op2 = findop(mdl,opspec);

Operating point search report: --------------------------------- Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.57 dx: 2.47e-10 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 180 dx: 2.03e-13 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: -0.881 [-Inf Inf] Outputs: None ----------

The operating point search report shows that the specifications were met successfully, and that the first state is within the specified bounds.

Finally, you can also constrain the derivatives of states that are not at steady state. Using such constraints, you can trim derivatives to known nonzero values or specify derivative tolerances for states that cannot reach steady state.

For example, suppose that you want to find the operating condition at which the engine angular velocity is `180`

rad/s and the angular acceleration is `50`

rad/s^2. To do so, disable the `SteadyState`

specification for that state, and set both state derivative bounds to the same target value.

opspec.States(2).SteadyState = 0; opspec.States(2).dxMin = 50; opspec.States(2).dxMax = 50;

The updated state specifications show the new state derivative constraints.

opspec.States

(1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar spec: dx = 0, initial guess: 0.543 (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s spec: 50 <= dx <= 50, x: 180

Find an operating point that meets these updated specifications.

op3 = findop(mdl,opspec);

Operating point search report: --------------------------------- Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.666 dx: 2.01e-08 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 180 dx: 50 [50, 50] Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 0.163 [-Inf Inf] Outputs: None ----------

Was this topic helpful?