Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Converting Level-1 C MEX S-Functions to Level-2

Guidelines for Converting Level-1 C MEX S-Functions to Level-2

Level-2 S-functions were introduced with Simulink version 2.2. Level-1 S-functions refer to S-functions that were written to work with Simulink version 2.1 and previous releases. Level-1 S-functions are compatible with Simulink version 2.2 and subsequent releases; you can use them in new models without making any code changes. However, to take advantage of new features in S-functions, Level-1 S-functions must be updated to Level-2 S-functions. Here are some guidelines:

Obsolete Macros

The following macros are obsolete. Replace each obsolete macro with the macro specified in the following table.

Obsolete Macro

Replace with

ssGetU(S), ssGetUPtrs(S)

ssGetInputPortSignalPtrs(S,port), ssGetInputPortSignal(S,port)

ssGetY(S)

ssGetOutputPortRealSignal(S,port)

ssGetX(S)

ssGetContStates(S), ssGetRealDiscStates(S)

ssGetStatus(S)

Normally not used, but ssGetErrorStatus(S) is available.

ssSetStatus(S,msg)

ssSetErrorStatus(S,msg)

ssGetSizes(S)

Specific call for the wanted item (i.e., ssGetNumContStates(S))

ssGetMinStepSize(S)

No longer supported.

ssGetPresentTimeEvent(S,sti)

ssGetTaskTime(S,sti)

ssGetSampleTimeEvent(S,sti)

ssGetSampleTime(S,sti)

ssSetSampleTimeEvent(S,t)

ssSetSampleTime(S,sti,t)

ssGetOffsetTimeEvent(S,sti)

ssGetOffsetTime(S,sti)

ssSetOffsetTimeEvent(S,sti,t)

ssSetOffsetTime(S,sti,t)

ssIsSampleHitEvent(S,sti,tid)

ssIsSampleHit(S,sti,tid)

ssGetNumInputArgs(S)

ssGetNumSFcnParams(S)

ssSetNumInputArgs(S, numInputArgs)

ssSetNumSFcnParams(S,numInputArgs)

ssGetNumArgs(S)

ssGetSFcnParamsCount(S)

ssGetArg(S,argNum)

ssGetSFcnParam(S,argNum)

ssGetNumInputs

ssGetNumInputPorts(S) and ssGetInputPortWidth(S,port)

ssSetNumInputs

ssSetNumInputPorts(S,nInputPorts) and ssSetInputPortWidth(S,port,val)

ssGetNumOutputs

ssGetNumOutputPorts(S) and ssGetOutputPortWidth(S,port)

ssSetNumOutputs

ssSetNumOutputPorts(S,nOutputPorts) and ssSetOutputPortWidth(S,port,val)


[1] UNIX is a registered trademark of The Open Group in the United States and other countries.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS