Signal Logging and Streaming Basics
Signal logging acquires signal data during a real-time run and stores it on the target computer. After you stop the real-time application, you transfer the data 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 development computer.
Simulink® Real-Time™ signal logging samples at the base sample time. You can log signals to the Simulation Data Inspector by:
Mark signals for immediate logging to the Simulation Data Inspector.
Connect signals to File Log blocks for buffered logging to the Simulation Data Inspector.
With regards to logging:
Simulink Real-Time Explorer works with multidimensional signals in column-major format.
Some signals are not observable.
Like signal logging, signal streaming also acquires signal data during a real-time run on the target computer. But, unlike signal logging that uses a File Log block or signals marked for logging, signal streaming uses an instrument that you add to the real-time application. You add signals to the instrument by using the Real-Time tab in the Simulink Editor or by selecting signals for streaming in the Simulink Real-Time Explorer. The streaming signal data transfers from the target computer to the development computer while the real-time application is running.
How Application is Run Affects Signals Logged
The Run on Target button provides slightly different data
logging support than running the real-time application by using the start
(tg)
command:
When you run the real-time application by using the
start(tg)
command, only signals marked for data 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.
File Logging and Streaming Workflow
You can get signal data into the Simulation Data Inspector through logging by using a File Log block or through streaming by marking a signal for logging in the model or selecting a signal for streaming in the Simulink Real-Time Explorer.
Signal logging through a File Log block provides options that let you control:
The number of file logs that are retained on the target computer
Whether file log data is auto imported into the Simulation Data Inspector
Whether file log data is exported into the base workspace
You can configure these options by using the option for the real-time application
start
(tg)
function or by using the Run in Real-Time selection in the Simulink
Real-Time Explorer or the Simulink Editor. The File Logging and Streaming
Workflow figure shows how these options configure operation of the
real-time application start
(tg)
function. Where startRecording
and
stopRecording
appear in the figure, you can use either these
functions or the corresponding Start Recording and Stop
Recording buttons on the Real-Time tab in the
Simulink Editor or in the Simulink Real-Time Explorer.
File Logging and Streaming Workflow
While the real-time application is running, you can control file logging from File Log blocks:
Default logging logs signal data for the entire simulation run.
Enable or disable file logging by using the Enable File Log block in the model. If the model includes an Enable File Log, the
startRecording
function andstopRecording
function control only streaming, not logging.Enable or disable file logging by using the
startRecording
function orstopRecording
function. These function also enable or disable streaming. Alternatively, you can use the Start Recording button and Stop Recording button on the Real-Time tab in the Simulink Editor or in the Simulink Real-Time Explorer.
After file logging stops, which occurs:
By using the
stop
(tg)
functionBy
StopTime
expiringBy using the
stopRecording
(tg)
function or Stop Recording button
The configuration of the AutoImportFileLog
option selects whether file log data is auto imported
into the Simulation Data Inspector or whether you use the import
(tg.FileLog)
function to import the data.
Auto import of the file log is handled differently by the workflows in the File Logging and Streaming Workflow figure:
For all the workflows, the auto import operation occurs when the real-time application stops.
For the recording workflow, the auto import operation also occurs when the
stopRecording
function is called.
See Also
File
Log | Enable File
Log | import
| start
| stop
| startRecording
| stopRecording