Real-Time Signal Instrumentation Workflows
R2026bInstrumenting signals (adding signals to an instrument) eases workflows for visualizing signal data that real-time applications generate. Simulink® Real-Time™ user interfaces help you visualize instrumented signals by using:
There are programmatic options for collecting signal data that do not require modifications in your model, such as adding File Log blocks or marking signals for logging. These programmatic options include:
You can apply the
addForFileLogfunction to add signals to an instrument in aTargetobject. The instrument transfers the signal data from the target computer to the development computer in the same manner and with the same controls (for example,AutoImportFileLogoption for thestartfunction) as when file log data is collected through a File Log block.You can apply the
addForSDIfunction to add signals to an instrument in aTargetobject. When added to aTargetobject, the instrument transfers the signal data from the target computer to the development computer in the same manner and with the same controls (for example, thestartRecordingandstopRecordingfunctions) as streaming signal data. The streaming data is available in the Simulation Data Inspector during the simulation run, and the data is not saved on the target computer.You can apply the
addForMATLABfunction to add signals to an instrument in aTargetobject. When added to aTargetobject, the instrument transfers the signal data from the target computer to the development computer in the same manner and with the same controls as streaming signal data; same as with theaddForSDIfunction. The difference is that the streaming data is accessible through apps written in MATLAB rather than being accessible through the Simulation Data Inspector.
Tip
These programmatic options for signal logging and streaming support are dynamic. You can modify signal logging and streaming selections in your real-time application without re-building your model. If you prefer, you can use the Simulink Real-Time Instrument Viewer user interface to view and modify instruments for your real-time applications.
These steps show how to add a signal to an instrument then add the
instrument to a Target
object for file logging.
Create target object and connect to target computer. Open model and configure model for target computer. Build model.
tg = slrealtime; connect(tg); model = 'slrt_ex_osc'; openExample(model); modelSTF = getSTFName(tg); set_param(model,"SystemTargetFile",modelSTF); slbuild(model);
Create instrument object and add signal from real-time application.
tgInst = slrealtime.Instrument(model); addSignal(tgInst,'SigGen');Add an instrument to the
Targetobject for file logging.addForFileLog(tg.Instruments,tgInst);
Load and run the real-time application. After the simulation runs, import the file log data to the development computer and visualize signals in the Simulation Data Inspector.
See Also
Target | addForFileLog | addForMATLAB | addForSDI | getAllForFileLog | getAllForMATLAB | getAllForSDI | removeAllForFileLog | removeAllForMATLAB | removeAllForSDI | removeForFileLog | removeForMATLAB | removeForSDI | view
Topics
- Log or Stream Real-Time Signals by Using the Simulation Data Inspector
- Post-Process Real-Time Signals Streamed to the Simulation Data Inspector
- Real-Time Signal Logging and Streaming Basics
- Troubleshoot Signals Not Accessible by Name
- Filter Hierarchical List of Signals and Parameters in Simulink Real-Time Explorer