Main Content

Add and Implement Propagation Methods

When to Use Propagation Methods

Propagation methods define output specifications. Use them when the output specifications cannot be inferred directly from the inputs during Simulink®model compilation.

Consider using propagation methods in your System object™ when:

  • The System object requires access to all MATLAB®functions that do not support code generation, which means that you cannot generate code for simulation. You must use propagation methods in this case and the interpreted execution mode for simulation. Code generation modes will not be supported.

  • You want to use variable-size signals.

  • You do not care whether code is generated, but you want to improve startup performance. Use propagation methods to specify information for the inputs and outputs, enabling quicker startup time.

At startup, the Simulink software tries to evaluate the input and output ports of the model blocks for signal attribute propagation. In the case ofMATLAB Systemblocks, if the software cannot perform this evaluation, it displays a message prompting you to add propagation methods to the System object.

Implement Propagation Methods

Simulink evaluates the uses of the propagation methods to evaluate the input and output ports of theMATLAB Systemblock for startup.

Each method has a default implementation, listed in theDefault Implementation Should Suffice ifcolumn. If your System object does not use the default implementation, you must implement a version of the propagation method for your System object.

Description Propagation Method Default Implementation Should Suffice if Example

Gets dimensions of output ports. The associated method isgetOutputSize.

getOutputSizeImpl

  • Only one input

  • Only one output

  • 一个输入输出尺寸一样大小

Gets data types of output ports. The associated method isgetOutputDataType.

getOutputDataTypeImpl

  • Only one input

  • Only one output

  • Output data type always the same as the input data type

Indicates whether output ports are complex or not. The associated method isisOutputComplex.

isOutputComplexImpl

  • Only one input

  • Only one output

  • Output complexity always the same as th input complexity

Whether output ports are fixed size. The associated method isisOutputFixedSize.

isOutputFixedSizeImpl

  • Only one input

  • Only one output

  • Output and input are fixed-size

Gets the size, data type, and complexity of a discrete state property. The associated method isgetDiscreteStateSpecification.

getDiscreteStateSpecificationImpl

NoDiscreteStateproperties

N/A

Related Topics