In this example, the air-fuel ratio control system is composed of three Simulink models:
Fuel Rate Control Component:
Engine Gas Dynamics Component:
Once the controller and plant components are export to FMU format, they can be integrated using the top-level model. The generated FMUs can also be imported into other simulation tools that support FMI. For a list of Tools that support FMI, see: https://fmi-standard.org/tools/.
fmudemo_export_fuelsys_controller example model.
From Simulation tab, click drop-down button for Save. In Export Model To section, click Standalone FMU.... In FMU Export dialog, configure wrapper model and icon settings, and specify save location for generated FMU.
Click Create to export to FMU. The
fmudemo_export_fuelsys_controller.fmu file can be found at specified save location.
fmudemo_export_fuelsys_plant example model.
FMU can also be exported using command-line. In MATLAB command line window, use
% Export model to Standalone Co-Simulation FMU 2.0 exportToFMU2CS('fmudemo_export_fuelsys_plant', 'CreateModelAfterGeneratingFMU', 'off', 'AddIcon', 'snapshot', 'SaveDirectory', pwd);
You can use optional arguements CreateModelAfterGeneratingFMU, AddIcon, SaveDirectory to configure FMU export settings. For more information, call
Once both FMUs are successfully exported, you may use the top model
fmudemo_export_fuelsys_top to fully integrate the system for testing.