You can log simulation data to the workspace, or to a temporary file on disk, for debugging and verification. Data logging lets you analyze how internal block variables change with time during simulation. For example, you might want to see that the pressure in a hydraulic cylinder is above some minimum value or compare it against the pump pressure. If you log simulation data, you can later query, plot, and analyze it without rerunning the simulation.
Simscape™ Results Explorer is an interactive tool that lets you navigate and plot the simulation data logging results. You can use data logging and the Simscape Results Explorer to view simulation results, instead of adding sensors and scopes to your model.
||Save logged simulation data in HDF5 file|
||Create simulation log variable to access data in HDF5 file|
||Plot logged simulation data for node or series|
||Plot logged simulation data for one node or series against another|
||Find Node object corresponding to block or subsystem|
||Find path to node in logged simulation data tree|
||Open Simscape Results Explorer to interact with logged simulation data|
||Print zero crossing information for logged simulation data|
You can log simulation data to the workspace, or to a temporary file on disk, for debugging and verification.
Using data logging is a best practice for Simscape models because it provides access to important simulation and analysis tools.
Instead of logging the simulation data for the whole model, you can log data just for the selected blocks.
When you set the Log simulation data configuration
settings, other options in the Data Logging group box become available.
When you log simulation data, you can either store the data in a workspace variable, or stream the data to a temporary file on disk and have the workspace variable point to that temporary file.
Simscape Results Explorer is an interactive tool that lets you navigate and plot the simulation data logging results.
This example shows the basic workflow for logging simulation data for the whole model and then navigating and plotting the logged data using Simscape Results Explorer.
This example shows how you can log and plot simulation data instead of adding sensors to your model.
This example shows how you can access and analyze information on zero crossings during simulation.
This example shows how you can set your model to log simulation data for selected blocks only and how to view simulation data using Simscape Results Explorer.
When you display logged simulation data in Simscape Results
Explorer, the data along the
x-axis is always time, in seconds.
Simscape Results Explorer has a set of default units for plotting the logged data.
This example shows the basic workflow for viewing sparkline plots of logged simulation data for selected blocks and variables directly on the model canvas.