Configure Real-Time Host Scope Blocks

Simulink® Real-Time™ includes a specialized real-time Scope block that you can configure to display signal and time data on the development computer monitor. Add a Scope block to the model, select Scope type Host, and configure the other parameters as described in the following procedure.

  • Do not confuse Simulink Real-Time Scope blocks with standard Simulink Scope blocks.

  • To clarify your model functionality, consider adding signal labels. If you define signal labels, the host scope displays the labels, highlighted with pointed brackets, instead of the signal names. If you do not define signal labels, the host scope displays the short name of the signal.

This procedure uses the example model ex_slrt_rt_osc (open_system(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_rt_osc')))).

  1. In the Command Window, open ex_slrt_rt_osc.

  2. Double-click the block labeled Scope.

    The Scope block dialog box opens. By default, the target scope dialog box is displayed.

  3. In the Scope number box, a unique number is displayed that identifies the scope. This number is incremented each time that you add a Simulink Real-Time scope.

    This number identifies the Simulink Real-Time Scope block and the scope screen on the development or target computers.

  4. From the Scope type list, select Host. The updated dialog box is displayed.

  5. To start the scope automatically when the real-time application executes, select the Start scope when application starts check box. You can then open a host scope viewer from Simulink Real-Time Explorer.

    In Stand Alone mode, this setting is mandatory because the development computer is not available to issue a command to start scopes.

  6. In the Number of samples box, enter the number of values to be acquired in a data package.

  7. In the Number of pre/post samples box, enter the number of samples to save or skip. To save N samples before a trigger event, specify the value −N. To skip N samples after a trigger event, specify the value N. The default is 0.

  8. In the Decimation box, enter a value to indicate when data is collected. The value 1 means that data is collected at each sample time. A value of 2 or greater means that data is collected at less than every sample time.

  9. From the Trigger mode list, select one of the following:

    • FreeRun or Software Triggering — No extra parameters.

    • Signal Triggering — enter additional parameters, as required:

      • In the Trigger signal box, enter the index of a signal previously added to the scope.

        This parameter does not apply if the Add signal port to connect a signal trigger source check box is selected.

      • (Alternatively) Click the Add signal port to connect a signal trigger source check box, then connect an arbitrary trigger signal to the port Trigger signal.

      • In the Trigger level box, enter a value for the signal to cross before triggering.

      • From the Trigger slope list, select one of Either, Rising, or Falling.

    • Scope Triggering — enter additional parameters, as required:

      • In the Trigger scope number box, enter the scope number of a Scope block. If you use this trigger mode, add a second Scope block to your Simulink model.

      • To trigger one scope on a specific sample of another scope, enter a value in Sample to trigger on (-1 for end of acquisition). The default value, 0, indicates that the triggered scope starts on the same sample as the triggering scope.

    The host scope dialog box looks like this figure.

  10. Click OK.

  11. Save the model as ex_slrt_host_osc (open_system(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_host_osc')))). On the Simulation tab, from Save, click Save As.

See Also

Related Topics