Compute Operating Points from Specifications Using Steady State Manager
You can compute a steady-state operating point of a Simulink® model by specifying constraints on the model states, outputs, and inputs, and by 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.
To find an operating point for your Simulink model, you can interactively trim your model using the Steady State Manager, as shown in this example.
Alternatively, you can trim your model:
At the command line. For more information, see Compute Operating Points from Specifications at the Command Line.
In the Model Linearizer. For more information, see Compute Operating Points from Specifications Using Model Linearizer.
In this example, you compute an operating point to meet output specifications. Using a similar approach, you can define state or input specifications. Also, you can define a combination of state, output, and input specifications; that is, you do not have to use, for example, only state specifications.
For more information on trimming your model to meet specifications, see Compute Steady-State Operating Points from Specifications.
Open Steady State Manager
Open the Simulink model.
sys = 'scdspeed'; open_system(sys)
To open the Steady State Manager, in the Simulink model window, in the Apps gallery, click Steady State Manager.
Define Operating Point Specifications
To create an operating point specification, in Steady State Manager, on the Steady State tab, click Trim Specification.
In the data browser, in the Specifications section, the
software adds a default operating point specification,
spec1. Also, the Specification
tab opens along with a corresponding spec1
In the spec1 document, in the navigation tree, select the type of specification that you want to add. For this example, you want to find a steady-state operating point at which the engine speed is fixed at 2000 rpm using an output specification. Therefore, click Outputs.
Since the model does not have any root-level output ports or defined trim outputs constraints, the operating point specification does not have any outputs. To add an output to the operating point specification, on the Specification tab, click Add Outputs.
In the Add Output Specifications dialog box, specify the signals to which you want to add an output specification. To add a signal to the list, in the Simulink model window, click the output signal of the rad/s to rpm block. Doing so adds the signal to the Add Output Specifications dialog box.
Click Add Signal(s).
The software adds this signal to
spec1 as an output
specification. To view and edit the specification, in the
spec1 document, click
The selected signal is listed in the output specification table under the name of its source block.
To go to the block in your model that is associated with a given state, input, or output specification, in the specification table, click the block name.
Specify a known speed value. In the spec1 document, in
the Known column, select the corresponding row, and in
the Value column set the known value to
To compute the operating point that meets this output specification, on the Specification tab, click Trim .
The software trims the model and generates an operating point search report.
report1, is added to the data browser, in the
Reports section. Also, the
Report tab opens along with a corresponding
For this example, you use default trimming options. To specify different options, such as the optimization method or a custom cost function, on the Specification tab, click Trim Options.
To check whether the optimization search converged to a solution that meets the specifications, in the report1 document, click Optimization Status.
The optimization status shows that the optimization algorithm terminated successfully, finding an operating point that meets the specifications.
The Maximum Error plot and the Max Error column show the maximum constraint violation for each iteration. The Block column shows the block to which the maximum constraint violation applies.
Validate Operating Point
For this example, the optimization search converged to an operating point that met the specification. When the operating point search report indicates that the search was unsuccessful, you can validate your operating point against the specifications. To do so, in the report1 document, in the navigation tree, select the specifications that you want to check. For this example, click Outputs.
In the specification table, known values are highlighted in gray, and constraint violations are highlighted in red. For this example, there are no constraint violations.
You can also verify whether the operating point is at steady state. For example, in the report1 document, click States.
The Actual dx column shows the rates of change of the state values at the operating point. Since these values are near zero, the states are not changing, showing that the operating point is in a steady state.
For more information on validating operating points, see Validate Operating Point Against Specifications.
Trim Model for Different Specifications
You can also specify bounds for your specification rather than known values.
For example, suppose that you know that there is a steady-state condition in
the range from 1900 to 2100 rpm. To find this operating point, first create
another specification by copying and editing previous specification. In the
data browser, right-click
spec1, and select
The software adds
spec2 to the data browser. To open the
specification document for editing, double-click this new
In the spec2 document, click Outputs. Then, in the specification table:
In the Value column, specify an initial guess for the value, if you have one.
In the Known column, clear the entry for the output specification.
In the Minimum and Maximum columns, specify the lower and upper constraint bounds, respectively.
On the Specification tab, click Trim . The software trims the model and opens the operating point search report in the report2 document.
As shown in the Actual Value column, the trimmed output value is within the specified bounds.
Extract Operating Point from Report
The operating point search report is read-only and contains information
about both the specifications and the trimmed operating point. You can
extract either a specification or operating point object from a search
report. For example, on the Report tab for
report2, click Extract > Operating Point.
The software extracts the trimmed operating point,
from the report, adding it to the data browser, in the Operating
Export Operating Point Data
Once you have computed an operating point that meets your specifications, you can export the model to the MATLAB® workspace and set the initial conditions of your model to the values in the operating point. To do so, on the Operating Point tab, click Export or Set Initial Conditions, respectively.
For more information on setting your model initial conditions and simulating your model at a specific operating point, see Simulate Simulink Model at Specific Operating Point.