Opened 10 years ago

Closed 10 years ago

#3238 closed defect (fixed)

Export FMI2 with Cpp runtime

Reported by: Rüdiger Franke Owned by: Rüdiger Franke
Priority: high Milestone: 1.9.3
Component: Cpp Run-time Version: trunk
Keywords: Cc: Marcus Walther, Volker Waurich, Niklas Worschech

Description (last modified by Rüdiger Franke)

The FMI export of +simCodeTarget=Cpp needs to be maintained to work again. Moreover it should be upgraded to support FMI2.0.

Find attached an initial version of FMU2 export. It is proposed to be added to the svn trunc besides the existing FMU folder under:

   SimulationRuntime/cpp/Include/FMU2

The code is derived from the existing C++ FMU export. So far it works for simple models, like a double integrator, including repeated evaluations for trajectory optimization and parameter estimation.

It is still a bit cumbersome to create such an FMU. It works with the following steps:

  1. translateModelFMU(<model>, version="2.0") to get the modelDescription.xml file for FMI2.0
  2. setCommandLineOptions("+simCodeTarget=Cpp") and translateModelFMU(<model>, version="2.0") to get the C++ code
  3. generate the regular simulation executable of the Cpp runtime to get the C++ files updated
  4. adapt OMCpp<model>FMU.cpp to include FMU2/FMU2Wrapper.cpp and FMU2/FMU2Interface.cpp and to create an FMU2Wrapper instead of FMU/FMUWrapper.cpp, FMU/FMULibInterface.cpp, FMUWrapper, respectively
  5. fix and extend the generated <model>_FMU.makefile (SUITESPARSE_INCLUDE, see #3232, remove misspelled -l: LDFLAGS, add the four source files OMCpp<model>CalcHelperMain{2,3,4,5}.cpp
  6. more sophisticated models seem to also need more link libraries ... I didn't identify which ones so far

Can someone confirm that this initial version can be added to the svn as a starting point?
Note that the only difference between FMI1 and FMI2 are three names in the generated OMCpp<model>FMU.cpp.

Moreover: help for fixing translateModelFMU so that the result of the above steps is achieved with on call is appreciated. This would also fix the root cause of #3234.

Attachments (1)

FMU2.tgz (13.1 KB ) - added by Rüdiger Franke 10 years ago.

Download all attachments as: .zip

Change History (8)

by Rüdiger Franke, 10 years ago

Attachment: FMU2.tgz added

comment:1 by Niklas Worschech, 10 years ago

that is ok, you can add your modifications to the svn.

comment:2 by Rüdiger Franke, 10 years ago

Owner: changed from Adeel Asghar to Rüdiger Franke
Status: newassigned

comment:3 by Rüdiger Franke, 10 years ago

Description: modified (diff)
Status: assignedaccepted
Summary: Export FMI2 from Cpp runtimeExport FMI2 with Cpp runtime

comment:4 by Rüdiger Franke, 10 years ago

r25191 (corrected with r25192) adds the initial version of FMI 2.0 export with the Cpp runtime. r25195 fixes the LDFLAGS (point 5 above).

comment:5 by Rüdiger Franke, 10 years ago

SVN r25197 generates the appropriate model description (point 1); r25198 adapts the generated model wrapper to the FMI version (point 4); r25200 generates additionally required source files and extends the Makefile (points 3 and 5).

comment:6 by Adeel Asghar, 10 years ago

Component: FMIFMI-CPP

comment:7 by Rüdiger Franke, 10 years ago

Resolution: fixed
Status: acceptedclosed

r25341 solves the last point 6.

Note: See TracTickets for help on using tickets.