Using Operating Point Data for Model Initialization - MATLAB & Simulink (original) (raw)

Using Operating Points to Initialize Model Variables

Block-level variable initialization lets you specify the priority and target for individual block variables. You can also initialize variables for a whole model from the saved operating point data.

You can use OperatingPoint objects to save sets of data necessary to initialize a model, manipulate this data, and then use it to initialize another model, or the same model before another simulation run. These sets of data contain a hierarchy of variable initialization targets. Each target consists of a variable value, unit, and initialization priority, as described in Variable Initialization Priority.

The OperatingPoint data hierarchy is a tree, with nodes corresponding to subsystems and blocks in a model. At the lowest level of the data tree, inside the block nodes, are the variable initialization targets for that block.

When you use an OperatingPoint to initialize a model, the solver matches the OperatingPoint data hierarchy to the model hierarchy and applies the initialization targets from the operating point to the respective model variables. If there is no variable matching an operating point target, this target is ignored. After applying all the data from the operating point, the solver performs model initialization as described in Initial Conditions Computation.

After you initialize the variables and prior to simulating the model, you can open the Variable Viewer to see which of the variable targets have been satisfied. For details, see Variable Viewer.

Suggested Workflow

  1. Create an OperatingPoint object by extracting data from the model or from the simulation log. For more information, see Extracting Variable Initialization Data into an Operating Point.
  2. Modify the operating point data, if needed, by changing, adding, or removing targets and nodes. For more information, see Manipulating Operating Point Data.
  3. When satisfied with the operating point data, apply it to initialize another model, or the same model for another simulation run. For more information, see Applying Operating Point Data to Initialize Model.

Extracting Variable Initialization Data into an Operating Point

You can create an OperatingPoint object by extracting data from an existing model or from logged simulation data. For more information, see simscape.op.create.

You can extract variable initialization targets from a model in these ways:

Alternatively, you can simulate the model while logging simulation data, and then extract variable targets from the simulation log at a specified time,t:

When you extract data from a model into an operating point, the elements in the data hierarchy of the OperatingPoint object match the structure of the model. The operating point data tree has nodes corresponding to subsystems and blocks in the model, with variable initialization targets for each block at the lowest level of the data tree hierarchy. Similarly, when you extract an operating point from logged simulation data, the operating point data tree matches the data tree of the simulation log. For an example, see Find Relative Path to Block Node in Operating Point Data Tree.

Manipulating Operating Point Data

You can create an empty OperatingPoint object, or populate it with the data extracted from an existing model or from logged simulation data.

Once you create an OperatingPoint object, you can modify it in these ways:

Applying Operating Point Data to Initialize Model

To initialize a model from an operating point:

  1. Open the Configuration Parameters dialog box.
  2. On the Simscape pane, select the Enable operating point initialization check box.
  3. In the Model operating point textbox, enter the name of the workspace variable associated with an OperatingPoint object.

You can also use the equivalent command-line interface to set the model configuration parameters:

where modelname is the name of the model and_opname_ is the name of the OperatingPoint object.

See Also

simscape.op.OperatingPoint | simscape.op.Target

Topics