Simplify Interface for Structured Data with FMU Import Block
This examples shows how to use the FMU block to simplify the Simulink interface for structured data. The FMU block imports existing functional mockup units (FMUs) into Simulink®.
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 * Weight.v1 + Bias.v1 + vehicle(2).wheel(i).position * Weight.v2 + Bias.v2
ev.wheel(i).speed = vehicle(1).wheel(i).speed * Weight.v1 + Bias.v1 + vehicle(2).wheel(i).speed * Weight.v2 + Bias.v2
where
i = 1...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.