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

Discrete event simulation with FMU Model exchange

Discrete event simulation with FMU Model exchange

I'm using the FMU SDK to test the generated FMU on OM.

I test this example :

model DiscreteTimeObj
    parameter Real sample_interval = 0.1;
    Real x(start=5.0);
    Real y;
equation
    der(x) = -x;
    when sample(0, sample_interval) then
        y = x;
    end when;
end DiscreteTimeObj;


using the command (binary of the FMU sdk to test the fmu) :

fmusim_me.exe DiscreteTimeObj.fmu 1.0 0.01

that is to say with startTime = 0.0 stopTime=1.0 with a time step imposed to 0.01.
When I plot y, it remains constant to 5.0. This example works on OM : y decreases and has constant values
in the intervals of length 0.1.

Is it a limitation of the generated FMU that doesn't support the directive sample or is it the code of
the fmu testing program work ?

Thank you for the help.

Re: Discrete event simulation with FMU Model exchange

You mean it works in OM and not in FMU SDK?

Adeel.

Re: Discrete event simulation with FMU Model exchange

The simulation using the binary produced by Open Modelica give the right results but then the model is exported in FMU and executed in FMU
SDK, the results are different.

Re: Discrete event simulation with FMU Model exchange

Hello Fnoel

FMU SDK includes a sample with a simple Euler solver. You can run your model in OpenModelica and choose "euler" solver to know if it is enough for you. It it does not work in OpenModelica you can see this post (https://www.openmodelica.org/index.php/ … c?id=1173)

Best regards
Koldo

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