User manual
40
This argument, default being true, can be set to false to disable the prompting before
replacing any existing Modelica model that was the result from a previous import. This is
useful for scripting.
Import of FMUs for Co-Simulation
1
The Co-Simulation FMU import is enabled by setting the input argument
integrate of the
function
importFMU to false. The macro step size can be set as the parameter
fmi_CommuncationStepSize in the FMI tab in the parameter dialog of the generated
Modelica model. The default macro step size is (stop time – start time)/500. Refer to the
next section for details.
Validating FMUs
Once the dynamic behavior of a model is verified and it is ready to be exported as FMU, one
would like to verify that this behavior can be repeated on the targeted simulation
environment. For model exchange, which is dependent on the solver of the target, this is
naturally less straight-forward than for co-simulation, where the solver is built into the
FMU. We focus this discussion on the co-simulation case, although all is possible for model
exchange as well.
Normally, the FMU contains inputs that need to be connected to signal generators (sources)
before this validation can be commenced. Since this is model and test dependent and hard to
automate, we will assume the model inputs have been connected to necessary sources
beforehand. The result is a test model with no disconnected inputs. After the validation,
these sources are of course removed before the final FMU is created.
Since Dymola supports FMU import, it becomes natural to re-import the FMU in Dymola
and compare its simulation with the original model. We demonstrate this for the demo
model CoupledClutches. For brevity and since not all import options are yet available in the
GUI, we use a scripting perspective. First, export as FMU with, say, both model exchange
and co-simulation support:
translateModelFMU(
"Modelica.Mechanics.Rotational.Examples.CoupledClutches",
false, "", "1", "all");
Re-import, in a non-interactive mode, the FMU for co-simulation:
importFMU(
"Modelica_Mechanics_Rotational_Examples_CoupledClutches.fmu",
true, false, false);
Simulate the model being the result of the import:
simulateModel(
"Modelica_Mechanics_Rotational_Examples_CoupledClutches_fmu",
stopTime=1.5, method="dassl");
1
The import of FMUs for Co-Simulation functionality is currently intended for validating export of Co-Simulation
FMUs created in Dymola by re-importing them to Dymola. Importing Co-Simulation FMUs from other vendors has
not been tested due to no such FMUs being currently available.