Documentation

Synchronize Simulink Model Changes with Operating Point Specifications

Synchronize Simulink Model Changes with Linear Analysis Tool

This example shows how to update the operating point specifications in the Linear Analysis Tool to reflect changes to the Simulink® model.

Modifying your Simulink model can change, add, or remove states, inputs, or outputs, which changes the operating point. If you change your model while the Linear Analysis Tool is open, you must sync the operating point specifications in the Linear Analysis Tool to reflect the changes in the model.

  1. Open the Simulink model.

    sys = ('scdspeedctrl');
    open_system(sys)
  2. In the Simulink Editor, select Analysis > Control Design > Linear Analysis.

    The Linear Analysis Tool for the model opens, with the default operating point being set to the model initial condition.

  3. In the Linear Analysis Tool, in the Operating Points drop-down list, select Trim Model.

    The Trim the model dialog box appears.

    The Reference Filter block contains just one state.

  4. In the Simulink Editor, double-click the Reference Filter block. Change the Numerator of the transfer function to [100], and change the Denominator to [1 20 100]. Click OK.

    This change increases the order of the filter, adding a state to the Simulink model.

  5. In the Trim the model dialog, click Sync with Model to synchronize the operating point specifications in the Linear Analysis Tool with the updated model states.

    The dialog now shows two states for the Reference Filter block.

  6. Click Start trimming to compute the operating point.

Synchronize Simulink Model Changes with Existing Operating Point Specification Object

This example shows how to use update to update the operating point specification object after you update the Simulink model.

  1. Open the Simulink model.

    sys = 'scdspeedctrl';
    open_system(sys);
  2. Create operating point specification object.

    opspec = operspec(sys);

    By default, all model states are specified to be at steady state.

  3. In the Simulink Editor, double-click the Reference Filter block. Change the Numerator of the transfer function to [100] and the Denominator to [1 20 100]. Click OK.

  4. Attempt to find the steady-state operating point that meets these specifications.

    op = findop(sys,opspec);

    This command results in an error because the changes to your model are not reflected in your operating point specification object:

    ??? The model scdspeedctrl has been modified and the operating point
    object is out of date.  Update the object by calling the function
    update on your operating point object.
  5. Update the operating point specification object with changes to the model. Repeat the operating point search.

    opspec = update(opspec);
    op = findop(sys,opspec);
    bdclose(sys);
     Operating Point Search Report:
    ---------------------------------
    
     Operating Report for the Model scdspeedctrl.
     (Time-Varying Components Evaluated at time t=0)
    
    Operating point specifications were successfully met.
    States: 
    ----------
    (1.) scdspeedctrl/External Disturbance/Transfer Fcn
          x:             0      dx:             0 (0)
          x:             0      dx:             0 (0)
    (2.) scdspeedctrl/PID Controller/Filter
          x:             0      dx:            -0 (0)
    (3.) scdspeedctrl/PID Controller/Integrator
          x:          8.98      dx:     -4.51e-14 (0)
    (4.) scdspeedctrl/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar
          x:         0.544      dx:      2.94e-15 (0)
    (5.) scdspeedctrl/Vehicle Dynamics/w = T//J w0 = 209 rad//s
          x:           209      dx:     -1.52e-13 (0)
    (6.) scdspeedctrl/Reference Filter/State Space
          x:           200      dx:             0 (0)
    
    Inputs: None 
    ----------
    
    Outputs: None 
    ----------

    After updating the operating point specifications object, the optimization algorithm successfully finds the operating point.

Was this topic helpful?