数据记录
您可以将仿真数据记录到工作区或磁盘上的临时文件中,以便进行调试和校验。使用数据记录,您可以分析仿真过程中内部模块变量如何随时间变化。例如,您可能希望看到液压缸中的压力高于某个最小值,或将该压力与泵压力进行比较。如果记录仿真数据,之后您可以查询、绘制和分析这些数据,而无需重新运行仿真。
Simscape™ 结果浏览器是一款交互式工具,您可以使用该工具导航和绘制仿真数据记录的结果。您可以使用数据记录和 Simscape 结果浏览器来查看仿真结果,而无需向模型添加传感器和示波器。
工具
Simscape 结果浏览器 | Navigate and plot simulation data logging results |
函数
simscape.logging.export | Save logged simulation data in MLDATX file |
simscape.logging.import | Create simulation log variable to access data in MLDATX file |
simscape.logging.plot | Plot logged simulation data for Node or Series |
simscape.logging.plotxy | Plot logged simulation data for one node or series against another |
simscape.logging.findNode | Find Node object corresponding to block or subsystem (自 R2020a 起) |
simscape.logging.sli.findNode | (To be removed) Find Node object corresponding to block or
subsystem |
simscape.logging.findPath | Find path to node in logged simulation data tree (自 R2020a 起) |
simscape.logging.sli.findPath | (To be removed) Find path to node in logged simulation data tree |
simscape.logging.timestamp | Determine whether simulation log is current or stale (自 R2021a 起) |
sscexplore | Open Simscape Results Explorer to interact with logged simulation data |
sscprintzcs | Print zero crossing information for logged simulation data |
对象
simscape.logging.Node | Hierarchy tree for simulation data |
simscape.logging.Series | Time-value series for simulation data |
主题
- About Simscape Data Logging
You can log Simscape simulation data to the workspace, or to a temporary file on disk, for debugging and verification.
- Enable Simscape Data Logging for the Whole Model
Using data logging for the whole model is a best practice.
- Log Data for Selected Blocks Only
Instead of logging Simscape simulation data for the whole model, you can log data just for the selected blocks.
- Data Logging Options
Additional options for logging and displaying the simulation data.
- Stream Logging Data to Disk
When you log simulation data, you can stream the data to a temporary file on disk and have the workspace variable point to that temporary file.
- Saving and Retrieving Logged Simulation Data
Methods of storing logged simulation data for future use and retrieving it at a later time.
- Log, Navigate, and Plot Simulation Data
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.
- Log and Plot Simulation Data
This example shows how you can log and plot simulation data instead of adding sensors to your model.
- Log Simulation Statistics
This example shows how you can access and analyze information on zero crossings during simulation.
- Log and View Simulation Data for Selected Blocks
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.
- Plot Simulation Data in Different Units
When you display logged simulation data in Simscape Results Explorer, you can change the
y
-axis units directly on the plot. - Use Custom Units to Plot Simulation Data
This example shows how you can change to a custom unit display of logged simulation data.
- Indexing into Component Arrays
You can use command-line interface to index into an array of components, for example, to get or set operating point targets for a particular array member, or to plot simulation data.