My S-function works in Normal simulation mode, but does not work in External Simulation mode?

Last Updated:

Not all S-Functions are compatible with real-time operation in External simulation mode. This is mainly due to the C/C++ code calling functions that are not supported by the MATLAB Coder and/or Simulink Coder toolboxes. If you have to use these unsupported functions for your application in External mode, then as a workaround you should be able to set up a QUARC communication client/server configuration between two QUARC models, one running in Normal mode and the other running in External mode. In this configuration, the S-Function could be run in a communication client Simulink model configured for Normal simulation mode, and sending/receiving data to/from a QUARC-based Simulink model running in External mode, i.e., the communication server. The real-timecommunication between both client and server models can be readily implemented using the QUARC Stream blocks. For more information and details on how to do this, please refer to the QUARC communication built-in demos. These demos can be located by typing qc_show_demos in the MATLAB command window.

Note: When implementing the QUARC-based Simulink client model to run in Normal mode, make sure you also use the QUARC System Timebase block. This will slow down theNormal mode simulation time to make it run in pseudo-real-time, in a way that is compatible with its communication server model counterpart running in External mode.See the QUARC User Manual for more information.

Can't find what you're looking for?