Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
58 Views

FMI Fortran Wrapper

Hello,

I am willing to interface an FMU (Functional Mockup Unit) to my Fortran code (IVF 12). The valid path i see would be to create wrappers for each of the C functions (using the C binding) and call from the main Fortran Subroutine.

The FMU in this case represent a time domain simulation model containing continuous and discrete states and projected for Model Exchange (FMI 2.0). This means that the FMU doesn't have the solver inherently and the solver would be written in the Fortran interface.

This is why the Fortran wrappers are needed to load, instantiate/initialize get and set sates/derivatives and advance time

Does anyone have experience with integrating/ FMUs within Fortran programs ?

FMI --> Functional Mockup Interface

Best Regards

KG@weily

 

 

0 Kudos
3 Replies
Highlighted
Beginner
58 Views

Hey Khaled, i just started with a project which seems to have a problem similar to your integration task - just the other way round. The simulation tool i intent to integrate into a simulation environment is written in fortran.

Have you been able to work out the things you described? Did you come across information about Fortran FMI Wrappers during your research? I would be greatful if you share your experience with me in this case. 

Best Regards!

Leif

 

 

 

 

0 Kudos
Highlighted
Beginner
58 Views

Hi Leif,

Thanks for your post.

The FMI generated code need to be wrapped, i.e. initialize model, get/set states and variables, advance time step, etc...

This could be done:

  1. In C/C++, then the main C/C++ function including all this sequence can be called from Fortran
  2. In Fortran, where each of the above functions (i.e. set/get states, etc..) needs to be interfaced to a Fortran subroutine, then those Fortran subroutines are glued to make the sequence required.

There are already python (PyFMI) and Java wrapper

I was seeking experience around which of the two options is most valid/feasible.

So far as i am researching, I didn't come across any similar work done in Fortran.

Since this is not the core of my work (which is more the power system simulation) cooperation maybe an interesting option

Any feedback is very welcome.

Best Regards

Khaled

0 Kudos
Highlighted
Beginner
58 Views

Hi Khaled, 

My project entails doing so. Did you find any FORTRAN wrapper or anyother means to interface FMU with Fortran code?

 

best regards, 

Smruti

 

0 Kudos