1. NAME

feelpp_fmi_fmu - a tool to load and run FMU in Feel++

2. SYNOPSIS

{manmanual} --config-file <file>.cfg  (1)
            --fmu.<option>=<value>    (2)
1 gather command line options in a .cfg file
2 set fmu options, see below

3. DESCRIPTION

feelpp_fmi_fmu is an application which can

  • load an Functional Mockup Unit(FMU) using the Functional Mockup Interface(FMI)

  • print same information about the model and the variables

  • simulate the FMU over a span of time

3.1. Options

feelpp_fmi_fmu requires some options.

Table 1. Table of command-line feelpp_fmi_fmu options
Prefix Name Description Type Default value

fmu

filename

name of the FMU file with absolute path

std::string

""

fmu

display-variables-info

Display the list of variables and description after loading FMU

boolean

false

fmu

verbose

Run with verbosity

boolean

true

fmu

solver.time-step

Time step for FMU Solver

double

0.1

fmu

solver.rtol

Relative tolerance for FMU Solver

double

1e-4

fmu

time-initial

inital time for the simulation. Default is taken from the model

double

-1

fmu

time-final

Final time for the simulation. Default is taken from the model

double

-1

fmu

exported-variables

List of variables which have to be exported

std::vector<std::string>

empty

fmu

export-directory

Location of the exported data. Default is the app directory

std::string

""

4. EXAMPLES

We are now using the feelpp/feelpp:latest docker images as described in book.feelpp.org/user-manual/#getting_started to demonstrate feelpp_fmi_fmu usage. We use the meshes in src/feelpp/data/gmsh/primitives in the docker image.

Starting the docker feelpp/feelpp:latest
docker run --rm -ti -v $HOME/feel:/feel feelpp/feelpp

4.1. Running a FMU

command line to run fmu stored in girder
./feelpp_fmi_fmu --config-file="github:{repo:feelpp,path:feelpp/tools/fmi/fmus/bouncingball.cfg}"

The cfg file is downloaded, it contains the option fmu.filename which points to a file stored publicly on our girder server. The output should look like

Reading /home/<user>/feel/downloads/feelpp_fmi_fmu/cfgs/bouncingball.cfg...
[ Starting Feel++ ] application feelpp_fmi_fmu version 0.1 date 2019-Dec-02
 . feelpp_fmi_fmu files are stored in /home/<user>/feel/feelpp_fmi_fmu/np_1
 .. logfiles :/home/<user>/feel/feelpp_fmi_fmu/np_1/logs
/home/<user>/feel/downloads/feelpp_fmi_fmu/fmus/fmi2cs.fmu
FMU Model loaded : name=BouncingBall, guid={f57105f2-ee2b-45c4-a1ef-b23bedcd600e}, kind=CS, id=fmi2cs
Version returned from FMU = 2.0
=================================================================
FMU Model BouncingBall : list of variables
=================================================================
Name                          Alias Type      Description
_D_whenCondition1             0     bool      h < 0.0
der(h)                        0     double    der(Height)
der(v)                        0     double    der(Velocity)
e                             0     double    Coefficient of restitution
h                             0     double    Height
h0                            0     double    Initial height
v                             0     double    Velocity
=================================================================
[env] Time : 0.16095s
[ Stopping Feel++ ] application feelpp_fmi_fmu execution time 0.16095s

The cfg file uses fmu.exported-variables to define a list of variables to export. The variables are h and v by default.

The results are stored in /home/<user>/feel/feelpp_fmi_fmu/np_1/fmu_values.csv and it should contain the following:

csv file generated by feelpp_fmi_fmu
t,h,v
0.000000,1,0
0.100000,1,-0.981
0.200000,0.9019,-1.962
0.300000,0.7057,-2.943
0.400000,0.4114,-3.924
0.500000,0.019,-4.905
0.600000,-0.4715,4.7088
0.700000,-0.00062,3.7278
0.800000,0.37216,2.7468
0.900000,0.64684,1.7658
1.000000,0.82342,0.7848
1.100000,0.9019,-0.1962

6. COPYING

Copyright (C) 2017-2024 Feel++ Consortium.
Free use of this software is granted under the terms of the GPLv3 License.