Main Content

ssSetOperatingPointCompliance

Specify the behavior of a Simulink S-function when saving and restoring the operating point of a model containing the S-function

Since R2019a

Syntax

void ssSetOperatingPointCompliance(S, setting)

Arguments

S

SimStruct that represents an S-function block.

setting

Define how to treat an S-function simulation state when saving and restoring the model simulation state. Permissible values are:

  • OPERATING_POINT_COMPLIANCE_UNKNOWN (default value)

  • USE_DEFAULT_OPERATING_POINT

  • USE_EMPTY_OPERATING_POINT

  • DISALLOW_OPERATING_POINT

  • USE_CUSTOM_OPERATING_POINT

Description

ssSetOperatingPointCompliance allows you to specify how Simulink® should treat an S-function during a save and restore of the model simulation snapshot (ModelOperatingPoint).

If the S-function does not specify its OperatingPointCompliance, then Simulink assumes the OPERATING_POINT_COMPLIANCE_UNKNOWN setting. This setting instructs Simulink to issue a warning and then switch to USE_DEFAULT_OPERATING_POINT in lieu of the OPERATING_POINT_COMPLIANCE_UNKNOWN.

If the option is set to OP_COMPLIANCE_DEFAULT and if the S-function does not use PWorks, then Simulink treats the S-function like a built-in block. Simulink saves and restores the same data as the operating point (for example continuous states, non-scratch DWork vectors, and zero crossing signal information), as it would for a built-in block. If S-function has Pworks, not setting compliance results in an error on saving operating point. Use custom compliance, USE_CUSTOM_OPERATING_POINT, to save data in Pworks.

Languages

C, C++

Examples

Use the ssSetOperatingPointCompliance function to specify the simulation state compliance of an S-function in the mdlInitializeSizes method. The specification is based on the first character vector parameter value.

static void mdlInitializeSizes(SimStruct* S)
{
    ssSetNumSFcnParams(S, 2); /* two parameters */
    if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) 
			return;
    ssSetSFcnParamTunable(S, 0, false);
    ssSetSFcnParamTunable(S, 1, false);

    {
        boolean_T visibility = 0U;
        ssSimStateCompliance setting =
            GetSimSnapParameterSetting(S, &visibility);
        if (ssGetErrorStatus(S)) return;

        ssSetOperatingPointCompliance(S, setting);
        ssSetOperatingPointVisibility(S, visibility);
    }

Version History

Introduced in R2019a