File Logging in Simulink Real-Time - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 4:43
Loaded: 3.52%
Stream Type LIVE
Remaining Time 4:43
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
  • en (Main), selected
    Video length is 4:43

    File Logging in Simulink Real-Time

    Learn about the new File Log block to log signals with Simulink Real-Time™. Use this block to log signals on the Speedgoat target computer. With Simulation Data Inspector, you can visualize file log data while interacting with the Speedgoat target computer using Simulink®, MATLAB®, and deployment mode run on startup. See an example model and demonstration of the block and how to use it in your Simulink model.

    Published: 13 Sep 2020

    File log block, introduced in 2020b, enhanced and simplified the mechanism for logging signals with Simulink real time. This addresses logging signals that are not required for immediate streaming while the real-time application is running, but more for signals that you want to log on the target computer and post process. This is crucial for many field deployment or DSL workflows. Really any time you want to run multiple tests and log large sets of signals.

    Let's take a look at an example model where I've used two file log blocks. You can have multiple file log blocks in a model. In this particular example, I've interfaced bus signals to the file log blocks, but you can also use individual signals or signals coming in for months, as well. You can choose the decimation for the samples that are recorded. This is the second file log block that I have. Again, interface to a bus with two signals coming in. If you have other signals that you want to record for immediate viewing, you can always use the standard workflow for logging signals using simulation data inspector. You just need to right click and select enable data logging.

    To use Simulink as the UI in external mode, you can use the one click run on target option which will build, deploy, and connect this model to the real time application download on the target computer. Once the real time application starts running on the target, the file logging service starts recording the data. You can add, enable, block to enable, and disable the file logging service or use MATLAB API to do the same.

    Simulation data inspector can be used to view the signals that were badged for immediate visualization while the real-time application is running on the target computer. Once the old application stops running, the signals that were logged using the file log service are available in the same simulation data inspector UI. Here, you can see there are two runs for one real-time application run. One which records the data, which was badged for immediate visualization, another which was signals that were logged using the file log service.

    In the configuration parameters, under Simulink real-time options, you can select the number of file log runs to retain on the target computer. What this allows you to do is store multiple file log runs for a real time application without them having been ordered. So this is especially useful in deployment workflows where you might be running the real time application a multiple number of times without connecting back to a MATLAB session to bring back the data stored on the target computer.

    Now let's take a look at a test engineer persona who might be using MATLAB API to interact with the real time application. First, we'll create a target object to interact with the target computer. Then, we can use that target object to load a particular application. In this case, we've used the same example.

    Now the default behavior, if the MATLAB session is connected to the computer, is to bring back the file log once the application stops running. But a test engineer might want to run the real time application a number of times and bring back all the file logs for the different ones at the end. For that, you can start the application and set the order import file log flag defaults, which will allow you to not auto-import file log after each run.

    Simulink real-time explorer can be used to interactively import file logs. For deployment workflows, you could select one of the real-time applications to run at startup. That way, once the target computer powers on, that particular real-time application starts running. The import file log button can be used to import particular file logs. You can import particular file logs according to a real time application name and the date timestamp. The imported fault log is viewable on the simulation data inspector.

    For more information on file logging please see the links below.

    Related Products