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

How to use a *_me_FMU.mo model

How to use a *_me_FMU.mo model

Hello all

I have tested successfully converting a model to FMU for model exchange, opening the FMU and running the simulation. It is very easy just from OMShell:

Code:

loadFile("BouncingBall.mo")

translateModelFMU(BouncingBall)
importFMU("BouncingBall.fmu")
loadFile("BouncingBall_me_FMU.mo")
simulate(BouncingBall_me_FMU, stopTime=3.0)

Do you know how to extend this sample by doing two FMUs, loading them, connecting the variables in a master model and running it all?

The automatically generated model "BouncingBall_me_FMU.mo" is not very easy to understand.

Best regards
Koldo

Re: How to use a *_me_FMU.mo model

Hello all

An idea to load two FMU into a model was that both models would be partial and the linking equations (the equations that link the variables of both FMU models) would be in the master model.

This way it would be possible to do tight coupling of FMU for model exchange from a OM master model.

For example:

Code:

model Master

    FMU_Model1_me_FMU model1;        // Loaded from FMU_Model1_me_FMU.mo
    FMU_Model2_me_FMU model2;        // Loaded from FMU_Model2_me_FMU.mo

equation
    model1.out = model2.in;
end Master;

However translateModelFMU():
- does not permit partial models
- does not permit models with less equations than unknowns

Best regards
Koldo

Re: How to use a *_me_FMU.mo model

The paper "A Generic FMU Interface for Modelica" by Wuzhu Chen, Michaela Huhn and Peter Fritzson, published in the 4th International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools. September, 2011, explains:

- how to load two samples of a FMU in OpenModelica: It does not work current/sad . It is like OpenModelica does not consider replaceable keyword generating an FMU.
This model hangs simulate():

Code:

model FMUMultipleInstance

    BouncingBall_me_FMU model1, model2;
end FMUMultipleInstance;

model BouncingBall_me_FMU
...

- how to load an FMU and mix it with other equations: This works very well current/big_smile . For example:

Code:

model FMUMultipleInstance

    BouncingBall_me_FMU model1;
    Real myVar;
   
equation
    der(myVar) = model1.h + 1;
end FMUMultipleInstance;

model BouncingBall_me_FMU
...

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