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

配置 MATLAB S-Function 的模块功能

在 S-Function 中实现采样时间、输入和输出函数

MATLAB® S-Function 允许您通过各种 S-Function API 配置扩展的模块功能。

  • 创建和配置输入/输出端口。

  • 指定基于模块和基于端口的采样时间。

  • 使用 DWork 向量分配内存

  • 将参数传递给 S-Function。

  • 创建运行时参数

方法

全部展开

setupSpecify the number of inputs, outputs, states, parameters, and other characteristics of the MATLAB S-function
OutputsCompute the signals that this MATLAB S-function block emits
TerminatePerform any actions required at termination of the simulation
CheckParametersCheck the validity of a MATLAB S-Function's parameters
DerivativesCompute a MATLAB S-Function's derivatives
DisableRespond to disabling of an enabled system containing this MATLAB S-Function block
EnableRespond to enabling of an enabled system containing this MATLAB S-Function block
GetOperatingPointReturn MATLAB S-function's simulation operating point as a MATLAB data structure
InitializeConditionsInitialize the state vectors of this MATLAB S-function
PostPropagationSetupSpecify the sizes of the work vectors and create the run-time parameters required by this MATLAB S-function
ProcessParametersProcess the MATLAB S-function's parameters
ProjectionPerturb the solver's solution of a system's states to better satisfy time-invariant solution relationships
SetAllowConstantSampleTimeSpecify sample time behavior and tunability for S-function blocks with port-based sample times
SetInputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an input port
SetInputPortDataTypeSet the data types of the signals accepted by an input port
SetInputPortDimensionsSet the dimensions of the signals accepted by an input port
SetInputPortDimensionsModePropagate the dimensions mode
SetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
SetOutputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an output port
SetOutputPortDataTypeSet the data type of the signals emitted by an output port
SetOutputPortDimensionsSet the dimensions of the signals accepted by an output port
SetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected
SetOperatingPointRestore operating point of MATLAB S-function
SimStatusChangeRespond to a pause or resumption of the simulation of the model that contains this MATLAB S-function
StartInitialize the state vectors of this MATLAB S-function
UpdateUpdate a block's states
WriteRTWGenerate code generation data for the MATLAB S-function

Simulink.BlockPreCompInputPortDataProvide precompilation information about block input port
Simulink.BlockPreCompOutputPortDataProvide precompilation information about block output port
Simulink.MSFcnRunTimeBlock获取有关 Level-2 MATLAB S-Function 模块的运行时信息
Simulink.RunTimeBlock允许 Level-2 MATLAB S-Function 和其他 MATLAB 程序在仿真运行时获取有关模块的信息
Simulink.BlockDataProvide run-time information about block-related data, such as block parameters
Simulink.BlockPortDataDescribe block input or output port
Simulink.BlockCompDworkDataProvide postcompilation information about block's DWork vector
Simulink.BlockCompInputPortDataProvide postcompilation information about block input port
Simulink.BlockCompOutputPortDataProvide postcompilation information about block output port

主题

Create Input and Output Ports

Create input and output ports on a MATLAB S-function block.

Specify S-Function Sample Times

How to specify the rate or rates at which your block operates in MATLAB S-functions.

Use DWork Vectors in S-Functions

Use DWork vectors to allocate .

Inherit Custom Data Types

Inherit custom data types for the values of a block's signals and parameters in MATLAB S-functions.

Pass Dialog Parameters to S-Functions

Process parameters passed via the MATLAB S-function block dialog box.

Create and Update S-Function Run-Time Parameters

Create and use run-time parameters in MATLAB S-functions.

Use MATLAB S-Functions as Sim Viewing Devices in External Mode

Specify MATLAB S-function as a sim viewing device for use in external mode.