Main Content

数据记录

在模型仿真期间将数据记录到工作区,以便用于后续数据处理

您可以将仿真数据记录到工作区或磁盘上的临时文件中,以便进行调试和校验。使用数据记录,您可以分析仿真过程中内部模块变量如何随时间变化。如果记录仿真数据,之后您可以查询、绘制和分析这些数据,而无需重新运行仿真。您可以使用 Simscape™ 数据记录和选择性记录插桩来记录模块变量数据。

Simscape 数据记录可记录模型中选定模块或所有模块的所有变量,并将数据输出到仿真日志工作区变量。您可以使用 Simscape 结果浏览器工具以交互方式可视化和导航 Simscape 数据记录结果。您可以使用数据记录和 Simscape 结果浏览器来查看仿真结果,而无需向模型添加传感器和示波器。要了解详细信息,请参阅Log, Navigate, and Plot Simulation Data

选择性记录仅会记录启用了记录功能的模块上的选定变量。Simscape 会将变量与 Simulink® 信号一起记录到 Simulink.SimulationData.Dataset 对象中。您可以通过用户界面为 Simscape 模块启用选择性记录。您可以在“插桩表”中查看并选择用于记录的模块变量,而无需编译模型。要可视化选择性记录结果,请使用仿真数据检查器。要了解详细信息,请参阅Log Selected Block Variables

您还可以通过编程方式管理选择性记录插桩。要了解详细信息,请参阅Log Selected Variables Programmatically

工具

Simscape 结果浏览器Navigate and plot simulation data logging results

函数

全部展开

simscape.logging.NodeHierarchy tree for simulation data
simscape.logging.SeriesTime-value series for simulation data
simscape.logging.exportSave logged simulation data in MLDATX file
simscape.logging.importCreate simulation log variable to access data in MLDATX file
simscape.logging.plotPlot logged simulation data for Node or Series
simscape.logging.plotxyPlot logged simulation data for one node or series against another
simscape.logging.findNodeFind 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.findPathFind 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.getSimulationLogIdentify latest Simscape simulation log for a model (自 R2024a 起)
simscape.logging.timestampDetermine whether simulation log is current or stale (自 R2021a 起)
sscexploreOpen Simscape Results Explorer to interact with logged simulation data
sscprintzcsPrint zero crossing information for logged simulation data
simscape.instrumentation.VariableTableStore and manage block variable data (自 R2024a 起)
simscape.instrumentation.VariableConfigurationConfiguration for variable (自 R2024a 起)
simscape.instrumentation.defaultVariableTableReturn default VariableTable object for block (自 R2024a 起)
simscape.instrumentation.setVariableTableSet VariableTable object for block (自 R2024a 起)
simscape.instrumentation.getVariableTableGet current VariableTable object for block (自 R2024a 起)
simscape.instrumentation.enableLoggingEnable logging for block (自 R2024a 起)
simscape.instrumentation.disableLoggingDisable logging for block (自 R2024a 起)
simscape.instrumentation.isLoggingEnabledReturns whether logging is enabled for a block (自 R2024a 起)

主题

Simscape 数据记录

选择性记录