Writing S-Functions | ![]() ![]() |
Get the zero-crossing signal values.
Syntax
Arguments
S
SimStruct representing an S-Function block.
Description
Returns a pointer to the vector containing the current values of the signals that the variable-step solver monitors for zero crossings. The variable-step solver tracks the signs of these signals to bracket points where they cross zero. The solver then takes simulation time steps at the points where the zero crossings occur. This vector has length ssGetNumNonsampledZCs(S)
.
Example
The following excerpt from matlabroot/simulink/src/sfun_zc.c
illustrates usage of this macro to update the zero-crossing array in the mdlZeroCrossings
callback function.
static void mdlZeroCrossings(SimStruct *S) { int_T i; real_T *zcSignals = ssGetNonsampledZCs(S); InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0); int_T nZCSignals = ssGetNumNonsampledZCs(S); for (i = 0; i < nZCSignals; i++) { zcSignals[i] = *uPtrs[i]; } }
Languages
See Also
![]() | ssGetModeVectorValue | ssGetNumContStates | ![]() |