Main Content

Synchronize Simulink Model Changes with Operating Point Specifications

Modifying your Simulink® model can change, add, or remove states, inputs, or outputs, which changes the operating point. You can synchronize existing operating point specification objects to reflect the changes in your model.

Synchronize Model Changes Using Steady State Manager

If you change your Simulink model while the Steady State Manager is open, you must synchronize the operating point specifications in the Steady State Manager to reflect the changes in the model.

Open the Simulink model.

sys = ('scdspeedctrl');
open_system(sys)

To open the Steady State Manager, in the Simulink model window, in the Apps gallery, click Steady State Manager.

To create an operating specification based on the current model configuration, in the Steady State Manager, on the Steady State tab, click Trim Specification.

In the spec1 document, the Reference Filter block has one state.

In the Simulink model window, 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.

To update the operating point specifications to reflect the model changes, in the Steady State Manager, on the Specification tab, click Sync from Model.

The software updates the specifications. The Reference Filter block now has two states.

To find the operating point that meets these specifications, on the Specification tab, click Trim Play button.

Synchronize Model Changes Using Model Linearizer

If you change your Simulink model while the Model Linearizer is open, you must synchronize the operating point specifications in the Model Linearizer to reflect the changes in the model.

Open the Simulink model.

sys = ('scdspeedctrl');
open_system(sys)

To open the Model Linearizer, in the Simulink model window, in the Apps gallery, click Model Linearizer.

In the Model Linearizer, in the Operating Points drop-down list, select Trim Model.

In the Trim the model dialog box, the Reference Filter block contains one state.

In the Simulink model window, 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.

To update the operating point specifications to reflect the model changes, in the Trim the model dialog box, click Sync with Model.

The software updates the specifications. The Reference Filter block now has two states.

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

Synchronize Model Changes at the Command Line

This example shows how to update an existing operating point specification object with changes in the Simulink® model.

Open the model.

sys = 'scdspeedctrl';
open_system(sys)

Create an operating point specification object based on the current model configuration.

opspec = operspec(sys)
opspec = 


 Operating point specification for the Model scdspeedctrl.
 (Time-Varying Components Evaluated at time t=0)

States: 
----------
     x         Known    SteadyState     Min         Max        dxMin       dxMax   
___________ ___________ ___________ ___________ ___________ ___________ ___________
                                                                                   
(1.) scdspeedctrl/External Disturbance/Transfer Fcn
     0         false       true        -Inf         Inf        -Inf         Inf    
     0         false       true        -Inf         Inf        -Inf         Inf    
(2.) scdspeedctrl/PID Controller/Filter/Cont. Filter/Filter
     0         false       true        -Inf         Inf        -Inf         Inf    
(3.) scdspeedctrl/PID Controller/Integrator/Continuous/Integrator
  8.9768       false       true        -Inf         Inf        -Inf         Inf    
(4.) scdspeedctrl/Reference Filter/State Space
    200        false       true        -Inf         Inf        -Inf         Inf    
(5.) scdspeedctrl/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar
  0.54363      false       true        -Inf         Inf        -Inf         Inf    
(6.) scdspeedctrl/Vehicle Dynamics/w = T//J w0 = 209 rad//s
 209.4395      false       true        -Inf         Inf        -Inf         Inf    

Inputs: None 
----------

Outputs: None 
----------

Change the transfer function of the Reference Filter block. Set the Numerator parameter to 100 and the Denominator parameter to [1 20 100].

set_param('scdspeedctrl/Reference Filter','N',"100");
set_param('scdspeedctrl/Reference Filter','D',"[1 20 100]");

Since the model parameters have changed, trying to find an operating point that meets the specifications in opspec using the following command generates an error.

op = findop(sys,opspec);

Update the operating point specification object to reflect the changes in the model.

opspec = update(opspec);

Find an operating point that meets the updated specifications.

op = findop(sys,opspec);
 Operating point search report:
---------------------------------

opreport = 


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

Operating point specifications were successfully met.
States: 
----------
    Min          x          Max        dxMin        dx         dxMax   
___________ ___________ ___________ ___________ ___________ ___________
                                                                       
(1.) scdspeedctrl/External Disturbance/Transfer Fcn
   -Inf          0          Inf          0           0           0     
   -Inf          0          Inf          0           0           0     
(2.) scdspeedctrl/PID Controller/Filter/Cont. Filter/Filter
   -Inf          0          Inf          0           0           0     
(3.) scdspeedctrl/PID Controller/Integrator/Continuous/Integrator
   -Inf       8.9768        Inf          0      -4.5077e-14      0     
(4.) scdspeedctrl/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar
   -Inf       0.54363       Inf          0      2.9365e-15       0     
(5.) scdspeedctrl/Vehicle Dynamics/w = T//J w0 = 209 rad//s
   -Inf      209.4395       Inf          0      -1.5226e-13      0     
(6.) scdspeedctrl/Reference Filter/State Space
   -Inf          0          Inf          0           0           0     
   -Inf         20          Inf          0           0           0     

Inputs: None 
----------

Outputs: None 
----------

After you update the operating point specification object, the optimization algorithm successfully finds the operating point.

See Also

Related Topics