Documentation

ssSetBusInputAsStruct

Specify whether to convert the input bus signal for an S-function from virtual to nonvirtual

Syntax

void ssSetBusInputAsStruct(SimStruct *S, int_T portNum, boolean_T val)

Arguments

S

SimStruct that represents an S-Function block

portNum

The zero-based index of the input port of the S-function block

val

True, if the input signal is a virtual bus and should be converted to a nonvirtual bus; false otherwise

Returns

None

Description

Use to instruct Simulink® to convert the virtual bus that is connected to the block from a virtual to a nonvirtual bus. Simulink inserts a Signal Conversion block (with the Output block parameter set to Nonvirtual bus) at the input of the S-function, if necessary. If the incoming signal is already a nonvirtual bus, this method takes no action.

Languages

C, C++

Example

static void mdlInitializeSizes(SimStruct *S)
{
    char* busName;
    
    /* Bus object name is passed in as a parameter */
    ssGetSFcnParamName(S, 0, &busName);
    ssSetBusOutputObjectName(S, 0, busName);

    /* Output nonvirtual bus */
    ssSetBusInputAsStruct(S, 0, true);
    ssSetBusOutputAsStruct(S, 0, true);

        …
 }
Was this topic helpful?