MATLAB Examples

Using Bus signals and Structure Parameters in the FMU Import Block

This model shows how to use bus signals and structure parameters in an FMU Import block. The FMU supports execution in Model Exchange mode.


Bus Signals and Structure Parameters Model

This FMU file models a simple system that computes the weighted average of two input bus signals, $vehicle$, packed into an array of buses. Each of the input bus signals contains four bus elements, $wheel$. Each bus element contains two scalar signals, $position$ and $speed$. The FMU accepts two structure parameters, $Weight$ and $Bias$, and uses them to compute the weighted average $ev$ of input signals:

ev.wheel(i).position = vehicle(1).wheel(i).position \cdot Weight.v1 +
Bias.v1 + vehicle(2).wheel(i).position \cdot Weight.v2 + Bias.v2

ev.wheel(i).speed = vehicle(1).wheel(i).speed \cdot Weight.v1 +
Bias.v1 + vehicle(2).wheel(i).speed \cdot Weight.v2 + Bias.v2


i = 1 \ldots 4.

The FMU file supports FMI 1.0 Model Exchange mode.

The FMU Import block supports non-virtual bus types. You must create a bus object whose structure matches the associated structure in the FMU file. When naming the bus object structures, use the variable names defined in the modelDescription.xml of the FMU file. For more information, see FMU documentation.