Initialize Steady-State Operating Point Search Using Simulation Snapshot

Initialize Operating Point Search Using Linear Analysis Tool

This example shows how to use the Linear Analysis Tool to initialize the values of an operating point search using a simulation snapshot.

If you know the approximate time when the model reaches the neighborhood of a steady-state operating point, you can use simulation to get state values to use as the initial conditions for numerical optimization.

  1. Open the Simulink® model.

    sys = ('watertank');

  2. In the Simulink Editor, select Analysis > Control Design > Linear Analysis.

  3. In the Linear Analysis Tool, in the Operating Point drop-down list, click Take Simulation Snapshot.

  4. In the Enter snapshot times to linearize dialog box, enter 10 in the Simulation snapshot times field to extract the operating point at this simulation time.

  5. Click Take Snapshots to take a snapshot of the system at the specified time.

    The snapshot, op_snapshot1, appears in the Linear Analysis Workspace and contains all of the system state values at the specified time.

  6. In the Linear Analysis tab, in the Operating Point drop-down list, click Trim Model.

    The Trim the model dialog box opens.

  7. Initialize the operating point states with the simulation snapshot values.

    Click Import.

  8. In the Import initial values and specifications dialog box, select op_snapshot1, and click Import.

    The state values displayed in the Trim the model dialog box update to reflect the imported values.

  9. Click Start trimming to find the optimized operating point using the states at t = 10 as the initial values.

  10. Double-click op_trim1 in the Linear Analysis Workspace to evaluate whether the resulting operating point values meet the specifications.

    The Actual dx values are at or near zero, showing that the operating point is at a steady state.

Initialize Operating Point Search Using MATLAB® Code

This example shows how to initialize operating point values for optimization-based operating searches.

Open the Simulink model.

sys = 'watertank';

Simulate the model for ten time units and extract an operating point snapshot.

opsim = findop(sys,10);

Create an operating point specification object. By default, all model states are specified to be at steady state.

opspec = operspec(sys);

Configure initial values for operating point search.

opspec = initopspec(opspec,opsim);

Find the steady-state operating point that meets these specifications.

[op,opreport] = findop(sys,opspec);
 Operating point search report:

 Operating point search report for the Model watertank.
 (Time-Varying Components Evaluated at time t=10)

Operating point specifications were successfully met.
(1.) watertank/PID Controller/Integrator
      x:          1.26      dx:             0 (0)
(2.) watertank/Water-Tank System/H
      x:            10      dx:      -1.1e-14 (0)

Inputs: None 

Outputs: None 

The time derivative of each state, dx, is effectively zero. This value of the state derivative indicates that the operating point is at steady state.

See Also

Related Topics

Was this topic helpful?