Real-Time Signal Logging and Streaming Basics
Simulink® Real-Time™ signal logging with a File Log block or signal streaming from a real-time application differs from non-real-time Signal logging in Simulink. The differences include:
Real-time file logging of signals acquires signal data during a real-time application run and stores it on the Speedgoat® target computer. After the real-time application stops writing to the log file, the signal data can be transferred from the target computer to the development computer for analysis. You can plot and analyze the data, and later save it to a disk on the MATLAB® development computer.
Real-time signal streaming uses an instrument that you add to the real-time application. You add signals to the instrument by using selections from the Real-Time tab in the Simulink Editor, by selecting signals for streaming in the Simulink Real-Time Explorer, by marking signals for logging, or by adding other signal viewers such as a Scope block. The streaming signal data is transferred from the target computer to the development computer while the real-time application is running.
This graphic shows the signal data flow for visualizing signals by using real-time signal logging and streaming.
Real-Time Signal Logging and Streaming Comparison
Retain Real-Time Signal Data for Post-Processing
You can visualize and analyze real-time signal data in the Simulation Data Inspector after running the real-time application. To select these signals in the model before building the real-time application:
Mark signals for logging to the Simulation Data Inspector. The streamed signal data for these signals is visible while the real-time application is running and available in the Simulation Data Inspector after the real-time application stops.
Connect signals to File Log blocks for logging to a file on the target computer. After the real-time application stops writing the log file, the signal data is imported into the Simulation Data Inspector.
With regards to file logging:
Real-time signal logging to a log file samples at the base sample time by default.
You can observe signals that are present in the real-time application. Some signals are not observable.
Simulink Real-Time Explorer works with multidimensional signals in column-major format.
Display Real-Time Signal Data without Retaining for Post-Processing
Most types of signal streaming permit viewing signal data only during a real-time application run on the target computer. For these run-time-only viewers, signal streaming can use a viewer that you add to the model before building the real-time application, use an instrument that you add to the real-time application, or use a viewer—such as an App Designer instrument panel—that connects to the real-time application. Types of run-time-only signal viewers include:
Adding a Scope block or other viewer to the model for viewing signals in a Scope window during external mode simulation with the model connected to the real-time application.
Adding signals to an instrument in the real-time application by using selections from the Real-Time tab in the Simulink Editor or by selecting signals for streaming in the Simulink Real-Time Explorer. You can view these signals in the Simulation Data Inspector or on an Axes tab in the Simulink Real-Time Explorer.
Connecting signals to an Axes component or other viewer in an App Designer instrument panel for viewing signals in the app while the real-time application runs.
Real-Time Signal Logging is Affected by How Application is Run
The Run on Target button provides slightly different data
logging support than running the real-time application by using the start
(tg)
function:
When you run the real-time application by using the
start(tg)
function, only signals marked for signal logging or connected to a File Log block are logged to the Simulation Data Inspector.When you run the real-time application by using the Run on Target button on the real-time tab in the Simulink Editor or the Start button in the Simulink Real-Time Explorer, signals marked for logging, signals connected to File Log blocks, and signals connected to Scope blocks are logged to the Simulation Data Inspector.
Signal Triggering for External Mode Simulation
When setting up signal triggering (Source set to signal),
explicitly specify the element number of the signal in the Trigger
signal:Element box. If the signal is a scalar, enter a value of
1
. If the signal is a wide signal, enter a value from
1
to 10
. When uploading Simulink
Real-Time signals to Simulink scopes, do not enter Last
or Any
in
this box.
The Direction:Holdoff value does not affect the Simulink Real-Time signal uploading feature.
For more information about external mode, see Simulink External Mode Interface.
See Also
File
Log | Enable File
Log | import
| start
| stop
| startRecording
| stopRecording
Related Examples
More About
- Real-Time File Logging and Streaming Workflow
- Stream Real-Time Signals by Using Simulink External Mode
- Log or Stream Real-Time Signals by Using the Simulation Data Inspector
- View Simulation Data in Simulation Data Inspector
- Troubleshoot Signals Not Accessible by Name
- Filter Hierarchical List of Signals and Parameters in Simulink Real-Time Explorer