Main Content

Level-2 MATLAB S-Function Compliance with Model Operating Point

A model operating point contains complete information about the state of a simulation at the time when the operating point is saved. When you use a model operating point to specify the initial state for a simulation, the simulation results exactly match results for an equivalent simulation that runs from the beginning rather than starting from the operating point. For more information, see Use Model Operating Point for Faster Simulation Workflow.

When you write an S-function, you must specify whether and how the software saves and restores the S-function operating point when saving and restoring the model operating point. Specify the S-function operating point compliance by setting the OperatingPointCompliance property on the instance of the Simulink.MSFcnRunTimeBlock class that represents the block.

block.OperatingPointCompliance = setting

The table summarizes the possible values for setting.

SettingResult
'Unknown'

This setting is the default when you do not explicitly specify the operating point compliance.

The software behaves the same as when you specify USE_DEFAULT_OPERATING_POINT and issues a warning.

'Default'

The software handles the operating point information for the S-function the same as for built-in blocks. The software saves and restores this information about the S-function as part of the Simulink.op.ModelOperatingPoint object for the model:

  • Continuous state values

  • Non-scratch DWork vector values, including mode DWork vector values

  • Zero-crossing signal values

'UseEmpty'

The software does not save any information about the S-function as part of the Simulink.op.ModelOperatingPoint object for the model. Use this option when the S-function does not have state information that is relevant for saving and restoring the model operating point.

This option is common for sink blocks, or blocks with no output ports, that use PWork or DWork vectors to store handles to files or figure windows.

This option is not supported for S-functions that register discrete states, continuous states, or zero-crossing signals.

'UseCustom'

The software uses the custom GetOperatingPoint and SetOperatingPoint methods for saving and restoring information about the S-function as part of the Simulink.op.ModelOperatingPoint object for the model.

For an example of how to implement these custom methods, see msfcn_varpulse.m.

'Disallow'

The S-function does not allow saving or restoring its operating point. The software issues an error when you try to save or restore a Simulink.op.ModelOperatingPoint object for the model that contains the S-function.

See Also

Functions

Blocks

Related Topics