Export by a Command
You can export a model to an FMU format using a command. For more details on selections, see the scripting section below.
- Activate a model from the Package Browser.
-
From the Behavior Tools
section of the action bar, click Export to
FMU
.
The Export FMU dialog box appears.
Class to Export displays the selected class to export.
-
To select the name and location for the FMU, do the following:
-
Click after the Output file
name field to open the
Modelica Class FMU export dialog
box.
The Modelica Class FMU Export dialog box appears.
- Browse to the location where the exported FMU is to be located.
-
Optional: Enter a name for the new FMU file. By
default, the name of the Modelica model is proposed.
Important: The FMU file name must only contain letters, digits, and underscores. It must not begin with a digit. - Click Save to validate and close the Modelica Class FMU Export dialog box.
The path is inserted in the Export FMU dialog box.Tip: You can also edit the Output file name by typing. -
Click after the Output file
name field to open the
Modelica Class FMU export dialog
box.
-
Optional: Select the FMI type to use:
- Model exchange to export the model as model exchange.
- Co-simulation using Cvode to export the model as Co-simulation with the Cvode solver.
- Model exchange, and Co-simulation using Cvode to export both as model exchange, and Co-simulation using the Cvode solver.
- Co-simulation using Dymola solvers to
export the model as Co-simulation with the current Dymola solver and
tolerance. Note: This option is only available for FMI 1.0.
By default, Model exchange, and Co-simulation using Cvode is selected.
-
Select the complaint version:.
- Export as FMI 1.0 if you want to export an FMU compliant with FMI version 1.0.
- Export as FMI 2.0 if you want to export an FMU compliant with FMI version 2.0.
By default, Export as FMI 2.0 is selected.
- Optional:
Select options:
Note: Only one of the two first options can be selected.
-
Include source code to include the
source code in the exported FMU.
By default, this option is not selected.
Note: This option and Store result in mat file (see below) are mutually exclusive, you can only activate one of them at the same time. -
Export with string parameters
Note: String variables are not supported.
By default, this option is not selected.
-
Copy resources to FMU to copy the
external resources that are using the functions
Modelica.Utilites.Files.loadResources
orModelicaServices.ExternalReferences.loadResource
to the FMU.The FMU is larger because of this. If this is not wanted, clearing the setting prevents copying, but resource-paths using Windows-shares are changed to UNC-paths when possible. This makes the FMU usable within a company - without increasing its size.
By default, copying external resources to the FMU is not selected.
-
Include source code to include the
source code in the exported FMU.
-
To select what variables to expose in the exported FMU, do any of the
following:
- To expose all variables in the imported FMU, select All
variables, then skip the next step.
Important: "All variables" means all variables filtered, that is, the model description filters are also taken into account. See Step 11. - To specify in detail what variables to expose, click Custom. See next step for selection.
- To expose all variables in the imported FMU, select All
variables, then skip the next step.
-
To specify what variables to expose when you have selected
Custom in the previous step, click
Select variables to display a dialog for
selection.
In the dialog, by default, all variables filtered are selected to be exposed.
-
In the left part of the dialog, select the variables to
hide.
You can:
- Search for variables by typing in the first field.
- Expand and collapse nodes in the tree individually, or all by clicking Expand All or Collapse All.
- Multiselect variables individually, or all by clicking Select All or Select None.
-
Click Hide to hide the selected
variables.
Tip: To instead work with what variables to expose, do the following: - In the left part of the dialog, click Select All.
- Click Hide.
- When you have finalized the selection, click OK to validate the selection and close the dialog box.
-
In the left part of the dialog, select the variables to
hide.
- Optional:
You can store the results in a .mat file.
This option specifies that the FMU should generate a results file
<model id>.mat
when the model is imported and simulated, where<model id>
is given at FMU initialization. This is useful when importing an FMU with parameterallVariables=false
, since it provides a way to still obtain the result for all variables.-
Activate Store result in mat file.
By default, this option is not activated.
Note: This option and Include source code (see above) are mutually exclusive, you can only activate one of them at the same time. -
If the store option is activated, you can specify the result
generation interval when storing simulation results by changing
the Interval.
By default, the interval is specified to 0.001 seconds.
-
Activate Store result in mat file.
-
Select binaries:
- 64-bit binaries if you want to create 64-bit binaries.
- 32-bit binaries if you want to create 32-bit binaries.
-
Linux 64-bit binaries if you want to, on
Windows, create Linux 64-bit binaries.
Note: The option to create Linux binaries can only be activated if:
- "Windows Subsystems for Linux" is installed on your computer.
- You have activated the option Enable WSL using: <path to wsl.exe>, with the correct path specified, from Me > Preferences > App Preferences > 3D Modeling > Systems Modeling and Execution > Dymola Behavior Modeling , the Compiler tab. For more information, see Native Apps Preferences Guide: Compiler.
By default, the first two options are selected.
- Optional:
Select model description filters to control the filtering of the model
description (modelDescription.xml).
-
Exclude Protected variables to filter
away protected Modelica variables.
By default, this option is selected. This corresponds to the flag
Advanced.FMI.xmlIgnoreProtected=true;
. -
Exclude Auxiliary variables to do the
following:
The option works differently in FMI 2.0 and FMI 1.0:
- For FMI version 2.0, to filer away all variables of causality local, except states and derivatives of states.
- For FMI version 1.0, to filter away all variables of causality internal, except the ones with variability parameters.
By default, this option is not selected. This corresponds to the flag
Advanced.FMI.xmlIgnoreLocal=false;
. -
Only Black-box to do the following:
The option works differently in FMI 2.0 and FMI 1.0:
- For FMI version
2.0, to filter away all variables, except the following:
- Variables of causality inputs and outputs.
- Variables required for the model structure. The names are however hidden (concealed).
- For FMI version 1.0, to filter away all variables of causality inputs and outputs.
By default, this option is not selected. This corresponds to the flag
Advanced.FMI.BlackBoxModelDescription=false;
.Note: If you select Only Black-box, the options Exclude Protected variables and Exclude Auxiliary variables are not selectable anymore; they are not relevant in this case. - For FMI version
2.0, to filter away all variables, except the following:
-
Exclude Protected variables to filter
away protected Modelica variables.
- Optional:
You can select to include a model image in the FMU export:
If you select to include an image, it is stored in the exported FMU resources with the name
model.png
.Note: This means that you can yourself replace this image with another image with this name.- None - no image is included. This is the default selection.
- Icon - the icon of the model is included.
- Diagram - the image of the diagram layer is included.
-
Click OK.
The model is exported:
- A progress bar appears.
- The Message Reporting window appears to let you know the export result.
- If the export is successful, the .fmu file containing .dll resources is created in the selected directory.