Real-Time Scope Objects

The Simulink® Real-Time™ software uses scope objects to represent scopes on the target computer. Use scope object functions to view and collect signal data.

The Simulink Real-Time software uses scopes and scope objects as an alternative to using Simulink scopes and external mode. A scope can exist as part of a Simulink model system or outside a model system.

  • A scope that is part of a Simulink model system is a scope block. You add a Simulink Real-Time scope block to the model, build a real-time application from that model, and download that application to the target computer.

  • A scope that is outside a model is not a scope block. For example, if you create a scope with the function, that scope is not defined within the model. After the model has been downloaded and initialized, you add this scope to the model.

This difference affects when and how the scope executes to acquire data.

Scope blocks inherit sample times. A scope block in the root model or a normal subsystem executes at the sample time of its input signals. A scope block in a conditionally executed (triggered/enabled) subsystem executes whenever the containing subsystem executes. In the latter case, the scope might acquire samples at irregular intervals.

A scope that is not part of a model executes at the base sample time of the model. Therefore, it might acquire repeated samples. For example, if the model base sample time is 0.001, and you add to the scope a signal whose sample time is 0.005, the scope acquires five identical samples for this signal, and then the next five identical samples, and so on.

Understanding the structure of scope objects helps you to use the MATLAB® command-line interface to view and collect signal data. A scope object on the development computer represents a scope on the target computer. You use scope objects to observe the signals from your real-time application during a real-time run or analyze the data after the run is finished.

To create a scope object:

  • Add a Simulink Real-Time scope block to your Simulink model, build the model to create a scope, and then use the real-time application object function to create a scope object.

  • Use the real-time application object function to create a scope, create a scope object, and assign the scope properties to the scope object.

Upon creation, the Simulink Real-Time software assigns the required scope object class for the scope type:

A scope object has associated properties and functions specific to that scope type, as well as properties and functions held in common with the other scopes. The scope object functions allow you to control scopes on your target computer.

If you want to control the real-time application from the target computer, use target computer commands (see Control Real-Time Application at Target Computer Command Line).

Was this topic helpful?