Compile Source Code for Functional Mock-up Units
When you build a model that includes FMU
blocks, you must compile the FMU source code by using the QNX® Neutrino® compiler
q++. This compiler
creates shared object SO files that you include in the FMU. This process makes sure that
the FMU contains the code to run on a Simulink®
Real-Time™ target computer. For more information, see Apply Functional Mock-up Units by Using Simulink Real-Time.
Implement the FMU Block in Model
To implement the
vanDerPol block in the Simulink model by using
the FMU, specify the FMU name for the block. Open the model
slrt_ex_vanderpol, double-click the FMU block
vanDerPol, and select the
file for the FMU name block parameter.
Build the model, load the real-time application on the target computer, and run the real-time application.
Compile FMU File That Contains Source Code
slrealtime.fmu.compileFMUSources function compiles an FMU file that
contains source code. The process outputs an FMU file and Simulink Real-Time binary
file in the same folder as the input FMU file and appends an
_slrt suffix to the output file name. This example selects an
FMU file to compile and overwrites previous compiler output.
% create variable to provide path and file name my_file = ['C:\work\my_fmu_work\','vanDerPol.fmu'] % compile the FMU file and overwrite previous output slrealtime.fmu.compileFMUSources(my_file,'overwriteBinary',true)