- Group: Integration
The FMI model block enables integration of Functional Mock-up Units (Functional Mock-up Interface models) into pSeven workflows.
The FMI model block is intended to run FMU simulations within a pSeven workflow. The block maps FMU inputs, outputs, parameters, and local variables to its input and output ports, so that the FMU can be evaluated by pSeven. When FMI model runs, it receives values to input ports, sets FMU inputs and parameters, and executes the simulation, updating FMU’s internal state at each time step. The block collects values of FMU outputs and local variables and, when the simulation finishes, outputs a number of result vectors containing these values for each time step.
Usually configuration of a FMI model block requires the following steps:
- Select a FMI model file on the Configuration tab. The path to the selected file is assigned as a value to Model path port. This value can be easily changed in Run if you make the port a parameter.
- Build a model tree.
- Specify the nodes to be mapped to the respective input and output ports.
- Set options to be used in a simulation.
- Specify simulation settings.
The FMI model block supports both Co-Simulation and Model Exchange FMUs.
When integrating a Co-Simulation FMU, use the following input ports to specify simulation settings (all values are in seconds):
- Start time — sets the simulation start time.
- Stop time — sets the simulation end time.
- Time step size — sets the simulation time step size.
Note that you have to provide values for model inputs at every time step.
if the simulation starts at
0.0 and ends at
10.0 with the step of
the block will expect a vector of length
20 as a value to each input port
corresponding to a model input.
When configuring the block to run a Model Exchange FMU, you are also required to set simulation start time, end time, and time step using the ports described above. In this case you can also add external events to the simulation by sending values to the Time port.
For example, suppose that you are running a 10-second simulation of a model that changes its continuous state at the fifth second due to some event. The details of the block’s configuration could be:
- Start time:
- Stop time:
- Time step size:
(0.0, 5.0, 5.0, 8.0).
In this case,
you have to provide 4 values for model inputs,
and the block will output a vector of length
updating the input values at each time step.
If the Time port is empty (no value is set), it means that no events occurred during the simulation and the model remained constant over intervals of time.
Simulation results are output to the ports corresponding to FMU outputs and variables. Each result is a vector containing the sequence of output or variable values, according to simulation time steps. In addition, the sequence of simulation time steps is output as a vector to the Timeline port.
- Error handling behavior — the action to perform if the block encounters an error.
- FMI model — simulation and FMU settings.
Error handling behavior
The action to perform if the block encounters an error.
output defaults and signal, or
output signal only
When set to
stop workflow, the block simply reports an error and the workflow interrupts.
If set to
output defaults and signal, the block suppresses the error. Output ports in this case send values assigned to them (the defaults), and the done port outputs a
Falsevalue (the signal). Note that the block automatically assigns values to output ports that are created when you select model tree nodes. These values are empty (zero length) vectors.
output signal onlybehavior means to output only the
Falsevalue to done; nothing is output to other ports.
FMI model.Include initial value
Include initial values of variables and outputs into result vectors.
False(do not include)
By default, initial values of FMU variables and outputs (the values at \(t_0\)) are not included into result vectors which are output by the block after running the simulation. This option can be used to include initial values to results.
FMI model.External dependency paths
Locations to search for files required by the model, such as external DLLs.
Value: path string Default: empty string (no dependencies)
If the FMU depends on additional files to run, you can use this option to specify the directories where the block will search for these dependencies.
The value of this option is added to the
PATHvariable in the block’s environment. Multiple paths can be specified, separated with semicolon (
In the Linux version of pSeven this option is not yet supported.
In the Windows version of pSeven, the FMI model block cannot start if the path to the pSeven installation directory contains local language characters. You can still add the block to your workflow and configure it, but running this workflow will result in an error. Unfortunately this error cannot be fixed by reconfiguring the Windows system locale. Currently the only possible workaround is to install pSeven to a path which contains only English characters, as recommended by the pSeven Installation Guide, or to the default location suggested by the pSeven installer.