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

Clarification to use FMU and a third simulator together

Clarification to use FMU and a third simulator together

Hi fellows,

I am reading about Modelica and FMU and I think it will fit to my ambitions to use a complex algorithm (Modelica as FMU) in my flight simulator during all simulation time (real-time).

I know modelica can do the job to simulate my electrical system and I know that, I can export the simulation equations in C code (library) to be imported in FMU standardization and load  through my plugin (also writed in C) to run all the math and post results at the end, BUT and here are the great but, how can I load a FMU, input data to t0 and run the first iteration, recovery outputs, write to my simulator and request a new iteration to do everything again, in loop, without a stop time defined. Then FMU must to run until I want, when I send a signal to stop e free all?

Please I am a student and I want to do my Monograph about this, integration of functional mock-up interfaces to another environment to simulate in real-time and interfacing with a person for training or testing propose, so I need a explanation and material to read with specific aplication and examples, codes, etc. Thanks for helping and sorry my English.

Re: Clarification to use FMU and a third simulator together

You can have a look at fmuChecker:
https://github.com/modelica-tools/FMUCo … r/src/FMI2
which uses (as far as I know) FMIL library to load/simulate/check an FMU.

Re: Clarification to use FMU and a third simulator together

As far as I know you can simulate forever, for FMI CS, just call doStep with currentTime+stepSize. I guess the boundary is DBL_MAX (the max for double).

Re: Clarification to use FMU and a third simulator together

adrpo wrote:


As far as I know you can simulate forever, for FMI CS, just call doStep with currentTime+stepSize. I guess the boundary is DBL_MAX (the max for double).

Great news... In Co-Simulated do we can ignore stop time, or do we need to manipulate this parameters? Do we need to refill inputs and any other data to proceed with doStep?

Re: Clarification to use FMU and a third simulator together

Reading fmusdk 2.0 cs main.c file we have:

Code:

/ enter the simulation loop

    time = tStart;
    while (time < tEnd) {
        // check not to pass over end time
        if (h > tEnd - time) {
            hh = tEnd - time;
        }

What will happen if we pass over end time? Can we ignore this parameter? It is only a suggestion? We can change " while (time < tEnd)" to a every true loop and break when I want to?

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