You can compute a steady-state operating point of a Simulink^{®} model
by specifying constraints on the model outputs, 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 output specifications interactively using the Linear Analysis
Tool or programmatically at the MATLAB^{®} command line. For each output, you can specify a known value or you
can constrain the output value using minimum and maximum bounds. If an output is
not known, you can specify an initial guess. You can also specify which outputs
must be at steady-state at the trimmed operating point.

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

Open the Simulink model.

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

For this example, find a steady-state operating point at which the engine speed is fixed at 2000 rpm.

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`

.

In the Trim the model dialog box, on the **Outputs** tab,
there are no outputs listed since the model has no root-level
outputs.

For this example, specify a known steady-state engine speed. To do so, in
the Simulink model window, right-click the output signal of the
rad/s to rpm block, and select **Linear Analysis Points** > **Trim Output Constraint**.

The signal constraint marker appears in the model, indicating that
the signal is available for trimming to an output constraint. The signal now
appears in the Trim the model dialog box, under the
**Outputs** tab.

Specify a known speed value. In the **Known** column,
select the corresponding row and, in the **Value** column,
set the value to `2000`

.

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 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.

On the **Output** tab, the **Actual
Value** and **Desired Value** are both
`2000`

, showing that the output constraint has been
satisfied.

You can also specify bounds for outputs during trimming. For example,
suppose that you know that there is a steady-state condition between
`1900`

and `2100`

rpm. To specify
this range, in the Trim the model dialog box, on the
**Outputs** tab:

In the

**Known**column, clear the entry for the output specification.In the

**Minimum**and**Maximum**columns, specify the constraint bounds.In the

**Value**column, specify an initial guess for the value, if you have one.

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

The trimmed operating point, `op_trim2`

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

Double-click `op_trim2`

.

In the Edit dialog box, on the **Output** tab, the
**Actual Value** is within the bounds shown in the
**Desired Value** column.

This example shows how to compute a steady-state operating point by specifying known output 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 ----------

Since there are no root-level outputs in the model, the default operating point specification object has no output specifications.

For this example, specify a known steady-state engine speed. To do so, add an output specification at the output of the rad/s to rpm block.

```
opspec = addoutputspec(opspec,'scdspeed/rad//s to rpm',1);
```

Specify a known value of `2000`

rpm for the output constraint.

opspec.Outputs(1).Known = 1; opspec.Outputs(1).y = 2000;

View the updated operating point specification.

opspec

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: ---------- (1.) scdspeed/rad//s to rpm spec: y = 2e+03

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.66e-13 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 209 dx: -8.48e-12 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 0.00382 [-Inf Inf] Outputs: ---------- (1.) scdspeed/rad//s to rpm y: 2e+03 (2e+03)

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 outputs during trimming. For example, suppose that you know that there is a steady-state condition between `1900`

and `2100`

rpm. To trim the speed to this range, modify the operating point specifications.

opspec.Outputs(1).Min = 1900; opspec.Outputs(1).Max = 2100;

In this case, since you do not know the output value, specify the output as unknown. You can also provide an initial guess for the output value.

opspec.Outputs(1).Known = 0; opspec.Outputs(1).y = 2050;

Find an 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.544 dx: 2.99e-13 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 209 dx: -9.9e-13 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 0.005 [-Inf Inf] Outputs: ---------- (1.) scdspeed/rad//s to rpm y: 2e+03 [1.9e+03 2.1e+03]

The operating point search report shows that the specifications were met successfully.

Was this topic helpful?