Main Content

ssSupportsMultipleExecInstances

Specify that a For Each Subsystem block supports an S-function operating inside the subsystem.

Syntax

void ssSupportsMultipleExecInstances(SimStruct *S, boolean_T val)

Arguments

S

SimStruct that represents an S-Function block.

val

A character vector have a value of either true or false. If true, then the For Each Subsystem will support having an S-function operate inside of it.

Description

Allows an S-function block to operate from within a For Each Subsystem block. It is best to call this macro from the mdlSetWorkWidths function.

Languages

C, C++

Examples

In this example, the ssSupportsMultipleExecInstances function resides inside mdlInitializeSize. Basically, if a block unconditionally supports or does not support a For Each subsystem, the function can be used inside mdlInitializeSize. If the decision relies on the compiled information, however, then this function should be used inside mdlSetWorkWidths.

static void mdlInitializeSizes(SimStruct *S)
{
    ssSetNumDiscStates(S, 0); /* no default dstate */
    if (!ssSetNumInputPorts(S, 1)) return;
    ssSetInputPortWidth(S, 0, 1);
    if (!ssSetNumOutputPorts(S, 1)) return;
    ssSetOutputPortWidth(S, 0, 1);
    
    ssSetNumRWork(S, 0);
    ssSetNumDWork(S, 1);

    ssSetNumIWork(S, 0);
    ssSetNumPWork(S, 0);
    ssSetNumModes(S, 0);

    ssSetDWorkWidth(S, 0, 1);
    ssSetDWorkUsedAsDState(S, 0, SS_DWORK_USED_AS_DSTATE);
    ssSetDWorkName(S, 0, "State");

    ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE     |
                 SS_OPTION_WORKS_WITH_CODE_REUSE      |
                 SS_OPTION_USE_TLC_WITH_ACCELERATOR);
    
    ssSupportsMultipleExecInstances(S, true);
}

Version History

Introduced in R2010b