main content

export simulink model to standalone fmu -凯发k8网页登录

this example shows how to export simulink® component to standalone co-simulation fmu 2.0 with simulink compiler™. for a detailed explanation of the model, see:

in this example, the air-fuel ratio control system is composed of three simulink models:

  • fuel rate control component: fmudemo_export_fuelsys_controller,

  • engine gas dynamics component: fmudemo_export_fuelsys_plant, and

  • top-level model fmudemo_export_fuelsys_top.

once the controller and plant components are exported 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: .

export fuel rate control component to fmu

open the 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.

export engine gas dynamics component to fmu

open the fmudemo_export_fuelsys_plant example model.

fmu can also be exported using command-line. in matlab® command line window, use exporttofmu2cs command:

% export model to standalone co-simulation fmu 2.0
exporttofmu2cs('fmudemo_export_fuelsys_plant', 'createmodelaftergeneratingfmu', 'off', 'addicon', 'snapshot', 'savedirectory', pwd);

you can use optional arguments createmodelaftergeneratingfmu, addicon, and savedirectory to configure fmu export settings. for more information, call help exporttofmu2cs.

integrate fmu components in simulink

once both fmus are successfully exported, you may use the top model fmudemo_export_fuelsys_top to fully integrate the system for testing.

网站地图