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 .

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)
 Operating point specification for the Model scdspeedctrl.
 (Time-Varying Components Evaluated at time t=0)

States: 
----------
(1.) scdspeedctrl/External Disturbance/Transfer Fcn
	 spec:  dx = 0,  initial guess: 0
	 spec:  dx = 0,  initial guess: 0
(2.) scdspeedctrl/PID Controller/Filter/Cont. Filter/Filter
	 spec:  dx = 0,  initial guess: 0
(3.) scdspeedctrl/PID Controller/Integrator/Continuous/Integrator
	 spec:  dx = 0,  initial guess: 8.98
(4.) scdspeedctrl/Reference Filter/State Space
	 spec:  dx = 0,  initial guess: 200
(5.) scdspeedctrl/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar
	 spec:  dx = 0,  initial guess: 0.544
(6.) scdspeedctrl/Vehicle Dynamics/w = T//J w0 = 209 rad//s
	 spec:  dx = 0,  initial guess: 209

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

 Operating point search 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/Cont. Filter/Filter
      x:             0      dx:             0 (0)
(3.) scdspeedctrl/PID Controller/Integrator/Continuous/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:             0      dx:             0 (0)
      x:            20      dx:             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