本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

加载用于仿真的信号数据

加载用于仿真模型的信号数据

可以使用几种不同的方法将数据加载到模型中,包括:

  • 根级输入端口 - 从工作区导入信号数据,使用 Input 配置参数将其导入到 InportEnableTrigger 模块的根级输入端口。要将多个信号导入到根级输入端口中,请考虑使用 Root Inport Mapper 工具。

  • From File 模块 - 从 MAT 文件读取数据,将数据输出为信号。

  • From Spreadsheet 模块 - 从 Microsoft® Excel® 电子表格或 CSV 电子表格读取数据,将数据输出为一个或多个信号。

  • 信源模块 - 添加一个信源模块(例如 Sine Wave 模块)以生成要输入到另一个模块的信号。

  • Signal Builder 模块 - 创建分段线性信号源的可互换组,以在模型中使用。

  • 持久数据 - 将大数据从 MAT 文件以流式传入模型。

您可以通过文件、工作区变量或模型参数来创建输入信号数据。您可以从另一个信源使用上次仿真时记录的数据,也可以自己创建数据。要确定使用哪种信号加载方法,请参阅Comparison of Signal Loading Techniques

模块

全部展开

Inport为子系统或外部输入创建输入端口
Enable将使能端口添加到子系统或模型
Trigger向子系统或模型添加触发器或函数端口
From File从 MAT 文件加载数据
From Spreadsheet从电子表格读取数据
From Workspace从工作区加载信号数据
Signal Builder创建和生成可交替的具有分段线性波形的信号组
Signal EditorDisplay, create, edit, and switch interchangeable scenarios

函数

全部展开

getRootInportMapCreate custom object to map signals to root-level inports
convertToSlDatasetConvert contents of MAT-file to Simulink.SimulationData.Dataset object
getSlRootInportMapCreate custom object to map signals to root-level inports using Simulink mapping mode
createInputDatasetGenerate dataset object for root-level Inport or bus element ports in model
signalbuilder(不推荐)创建和访问 Signal Builder 模块
signalBuilderToSignalEditorImport signal data and properties from Signal Builder block to Signal Editor block
getInputStringCreate comma-separated list of variables to map
Simulink.BlockDiagram.getInitialStateReturn initial state data of block diagram
Simulink.Bus.createMATLABStruct创建与总线使用相同的层次结构和属性的 MATLAB 结构体
Simulink.SimulationData.createStructOfTimeseriesCreate structure of timeseries data to load as simulation input for bus
signalEditorStart Signal Editor

主题

信号加载

提供用于仿真的信号数据

确定模型的信号数据要求并加载输入信号数据。

信号加载方法概述

了解向模型中导入信号数据的可用方法。

Comparison of Signal Loading Techniques

Determine the signal loading approach that meets your modeling requirements. Often, mapping signal data to root inports works well.

Load Signal Data That Uses Units

Load signal data that uses units from data logged in a previous simulation. Signal logging, the To File block, and the To Workspace block can include units information for Dataset or Timeseries logging formats.

Load Data Logged In Another Simulation

Load signal data into a model that was logged in a previous simulation.

Load Data to Model a Continuous Plant

Import signal data to a continuous plant model, which uses signal data that is smooth and uninterrupted in time, with a signal data for each time value.

Load Data to Test a Discrete Algorithm

Test a discrete algorithm by importing discrete signals, which are signals that you define using evenly spaced time values. One signal value is read at each time step, using the sample time of the source block.

为输入测试用例加载数据

为大多数输入测试用例导入信号数据时,应最大程度减少时间点数。您加载的信号数据包括具有斜坡和不连续点的样本。

将数据加载到根级输入端口

将数据加载到根级输入端口

从工作区加载数据并将其应用于根级输入。

Load Bus Data to Root-Level Input Ports

Import bus data to top-level input ports by manually specifying the data in the Input configuration parameter or by using the Root Inport Mapper tool.

使用 Root Inport Mapper 工具映射数据

要将信号和总线数据导入、可视化并映射到根级输入端口,请使用 Root Inport Mapper 工具。

Map Root Inport Signal Data

Open the Root Inport Mapper Tool and select the mapping mode.

Create Signal Data for Root Inport Mapping

Create data for root inport mapping using specific guidelines and conventions.

创建和编辑信号数据

使用 Signal Editor 可创建和编辑输入信号并组织它们以用于根级端口映射或多个仿真。

View and Inspect Signal Data

View and inspect signal data before mapping the data.

Preview Signal Data

Preview input signal or bus data with the Signal Preview window.

Map Signal Data to Root Input Ports

Map signal data to root input ports by selecting map modes and options and selecting data. Interpret mapping results.

Import Signal Data for Root Inport Mapping

Import signal and bus data for root inport mapping. You can also import test vectors from Simulink® Design Verifier™ environment.

Create and Use Custom Map Modes

Create custom map modes if you do not want to use existing map modes in the Root Inport Mapper tool.

Root Inport Mapping Scenarios

Work with scenarios in the Root Inport Mapper tool. Create and save scenarios, and load previously saved scenarios.

Generate MATLAB Scripts for Simulation with Scenarios

After associating a scenario with the model, generate a MATLAB® script to perform batch simulations.

其他信号加载方法

使用 From Workspace 模块加载数据

使用 From Workspace 模块加载信号数据。

使用 From File 模块加载数据

使用 From File 模块加载信号数据。

Load Big Data for Simulations

Load big data as simulation input.

特色示例