Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Advice on using FMU with a user interface

Advice on using FMU with a user interface

Hello,

I intend to use OpenModelica for modelling an aircraft and export the model to .fmu. In the simulation, a graphical UI will be used for changing in real-time certain parameters of the aircraft and to output in real-time parameters of the aircraft. The graphical UI will be programmed in C++ and not in OpenModelica.

My question is, how can I send the information provided by the operator through the graphical UI to the FMI? Can I use a network connector e.g. netcat?

I haven't found any clue on the internet and would appreciate to have some ideas. If this is not possible, I will have to program the model of the aircraft in native C which will be troublesome for any future alteration.

Thank you!
Jean

Re: Advice on using FMU with a user interface

Your FMI master algorithm controls all the inputs of the FMU, so you can can change any input signal to whatever you desire.
The master algorithm can be written in any language that can import shared objects, and if this programming languages allows TCP/IP or similar of course you can send signals to the FMU.
You could also integrate the GUI with the FMU master by directly calling the FMI API from GUI.

Re: Advice on using FMU with a user interface

Thank you for your reply.

Do you know an existing FMI that allows to do so? I am currently looking at PyFMI but I haven't got anything concrete yet.

Or do I have to write my own FMI?

Re: Advice on using FMU with a user interface

Always write your own current/smile

PyFMI seems to be able to do what you want though:
check fmu_with_input_function.py - it seems to get the current time as input, so you should be able to read the controls in the GUI from this functions and return the input value to the simulation in progress.

Re: Advice on using FMU with a user interface

I would love to write my own FMI if it is not too time-consuming so that the bugs are more transparent to me. C or Python are my prefered languages.

Do you have in mind a good tutorial or an example code?

There are 0 guests and 0 other users also viewing this topic
You are here: