Contents

ssSetInputPortComplexSignal

Set the numeric type (real or complex) of an input port

Syntax

CSignal_T ssSetInputPortComplexSignal(SimStruct *S, int_T port, 
 CSignal_T csig)

Arguments

S

SimStruct representing an S-Function block.

port

Index of an input port.

csig

Numeric type of the signals accepted by port. Valid values are COMPLEX_NO (real signal), COMPLEX_YES (complex signal), and COMPLEX_INHERITED (numeric type inherited from driving block).

Returns

1 (COMPLEX_YES), 0 (COMPLEX_NO), or -1 (COMPLEX_INHERITED) depending on the value specified by csig.

Description

Use this function in mdlInitializeSizes to initialize the input port numeric type. If the numeric type of the input port is inherited from the block to which it is connected, set the numeric type to COMPLEX_INHERITED. In this case, the S-function must provide mdlSetInputPortComplexSignal and mdlSetDefaultPortComplexSignals methods to enable the numeric type to be set correctly during signal propagation. The default numeric type of an input port is real.

Languages

C, C++

Example

Assume that an S-function has three input ports. The first input port accepts real (noncomplex) signals. The second input port accepts complex signals. The third port accepts signals of either type. The following example specifies the correct numeric type for each port.

ssSetInputPortComplexSignal(S, 0, COMPLEX_NO)
ssSetInputPortComplexSignal(S, 1, COMPLEX_YES)
ssSetInputPortComplexSignal(S, 2, COMPLEX_INHERITED)

See the S-function sfun_cplx.csfun_cplx.c used in sfcndemo_cplxsfcndemo_cplx for a complete example that uses this function.

Was this topic helpful?