Documentation Center

  • Trial Software
  • Product Updates

Sim Viewing Devices in External Mode

A sim viewing device encapsulates processing and viewing of signals received from the target system in external mode. During simulation in external mode, the target system uploads the appropriate input values to the sim viewing device in the Simulink® model. The sim viewing device then conditions the input signals as needed and renders the signals on the screen. A sim viewing device runs only on the host, generating no code in the target system and, therefore, allowing extra processing of displayed signals without burdening the generated code.

You can use your S-function as a sim viewing device in external mode if it satisfies the following conditions.

  • The S-function has no output ports.

  • The S-function contains no states.

  • The generated code does not require the conditioned signals produced by the S-function.

To specify a C MEX S-function as a sim viewing device, set the SS_OPTION_SIM_VIEWING_DEVICE option in the mdlInitializeSizes function. For example

 ssSetOptions(S, SS_OPTION_SIM_VIEWING_DEVICE);

To specify a Level-2 MATLAB® S-function as a sim viewing device, call the run-time object's SetSimViewingDevice method in the S-function setup callback method.

When simulating a model in Rapid Accelerator mode, signal logging or a To Workspace block connected to the sim viewing device will not log any data.

External mode compatible S-functions are selected, and the trigger is armed, by using the External Signal & Triggering dialog box. For more information see Host/Target Communication in the Simulink Coder™ documentation.

Was this topic helpful?