Is there a straightforward way to get names or IDs of signals recorded using Outport blocks in Simulink Real-Time?
9 views (last 30 days)
Show older comments
I have a big model where I am logging a large number of signals. I currently use Outport blocks, then look at the data in tg.OutputLog in the workspace after stopping the simulation. However, OutputLog contains only the signal data in columns, no labels. In order to know what each column corresponds to, I have to go through my model and keep track of how the signals are ordered and bundled before ending up at the root-level outport blocks. This is difficult and tedious for a large model with muxes going into other muxes in various subsystems, and made worse by the fact hat the model is frequently being changed/updated.
Is there an easier way to figure out what the tg.OutputLog data corresponds to?
The normal Simulink signal logging functionality (where you can enable logging through a signal's properties or through the Model Data viewer) would be ideal, since signal names are included in the logged data, but this does not work for real-time since logsout is not saved -- the documentation states "the data logging variables tout, xout, yout, and logsout are available only when you use Simulink to simulate the model in non-real-time."
I also know signal groups can be created and saved in the SLRT explorer but that seems to be for monitoring only, I don't see an option for logging ( documentation ).
The only other option I can think of is to have a script where I feed in a list of signal names and it adds them to file scopes (using the SimulinkRealTime.fileScope.addsignal function). However, this is still quite tedious and requires me to maintain a list separate from my model, and also the documentation states SimulinkRealTime.target.getsignalid (IDs are needed to add signals) is being deprecated in future releases.
0 Comments
Answers (1)
Jon Lobo
on 19 Dec 2017
Hello, I have a few recommendations for you. First off, I would suggest using file scope over tg.OutputLog as the output log is limited by RAM size whereas filescope uses the hard drive. Additionally, the output log has the limitations you mentioned above.
You can use the file scope without going the command line route (SimulinkRealTime.fileScope etc). There is a block in the Simulink Real-Time library to do this. (see: Target Scope). Please note there are three kinds (target, file, and host).
While getsignalid is marked for deprecation, you don't actually need it anymore since you can add signals to the file scope by knowing their path in the model. When you use the tg object and explore the list of signals (tg.ShowSignals = 'on'), you'll see the available signals in your model. You can double check the path syntax by using tg.getsignal(signalpath) where signalpath is the path to your signal of interest.
Now, these are just some options pertaining to your current workflow. Depending on which version of MATLAB you are using, it may be significantly easier for you to explore using the Simulink Data Inspector as that works with Simulink Real-Time as well. (see: Inspect Simulink® Real-Time™ Data with Simulation Data Inspector)
See Also
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!