Opened 8 years ago

Closed 8 years ago

#5366 closed defect (invalid)

FMU Import in OMEdit for BouncingBall failes

Reported by: Andreas Heuermann Owned by: Adeel Asghar
Priority: blocker Milestone: 1.14.0
Component: OMEdit Version: v1.14.0-dev-nightly
Keywords: fmu import code generation Cc: v1.14.0-dev-136-g482cb0e7e, (64-bit)

Description

When importing a FMU generatet for BouncingBall model

model BouncingBallFMI20
  parameter Real e=0.7 "coefficient of restitution";
  parameter Real g=9.81 "gravity acceleration";
  Real h(start=1) "height of ball";
  Real v "velocity of ball";
  Real v_new;
equation
  der(v) = -g;
  der(h) = v;

  when h <= 0.0 then
    v_new = -e*pre(v);
    reinit(v, v_new);
  end when;

end BouncingBallFMI20;

with omc the imported Model in OMEdit is not simulatable.

I imported and simulate the FMU with OMEdit and got the error message
[BouncingBallFMI20_me_FMU: 64:7-64:37]: Operator reinit may only be used in the body of a when equation.
See the attached file BouncingBallFMI20_me_FMU. I also included the previously generated FMU.

When importing and simulating with omc from shell no error is returned (since there is a test for that in testsuite\openmodelica\fmi\ModelExchange\2.0\BouncingBall.mos).

I was testing this on Windows, but hte problem should be the same on other OS.

OMEdit v1.14.0-dev-47-g29420dd9 (64-bit)
Connected to v1.14.0-dev-135-gba5885721 (64-bit)
omc Version used for generating FMU: v1.14.0-dev-136-g482cb0e7e (64-bit)

Attachments (2)

BouncingBallFMI20.fmu​ (1.3 MB ) - added by Andreas Heuermann 8 years ago.
Bouncing Ball FMU
BouncingBallFMI20_me_FMU.mo​ (13.6 KB ) - added by Andreas Heuermann 8 years ago.
Generated model by OMEdit import

Download all attachments as: .zip

Change History (8)

by Andreas Heuermann, 8 years ago

Attachment: BouncingBallFMI20.fmu​ added

Bouncing Ball FMU

by Andreas Heuermann, 8 years ago

Attachment: BouncingBallFMI20_me_FMU.mo​ added

Generated model by OMEdit import

comment:1 by Adeel Asghar, 8 years ago

I wonder what is the difference between your model and FMU compared to the ​BouncingBall test.

Anyway even if we fix this error, the FMU import in general is very crappy and we decided to kill it completely and use OMSimulator. See #5345.

comment:2 by Andreas Heuermann, 8 years ago

It is the same model, I just copied it. I was wondering, what OMEdit does different than the MOS script in the testsuite.

comment:3 by Adeel Asghar, 8 years ago

It looks like an error during the translation phase. Do you have some special Compiler flags on?

comment:4 by Adeel Asghar, 8 years ago

Btw on my machine the test script fails (maybe my OpenModelica needs a rebuild),

true
""
"C:/Users/adeas31/Desktop/BouncingBall/BouncingBallFMI20.fmu"
"Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
"
"BouncingBallFMI20_me_FMU.mo"
""
true
""
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 3.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'BouncingBallFMI20_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "Simulation execution failed for model: BouncingBallFMI20_me_FMU
assert            | debug   | The model was not compiled with -g=Optimica and the corresponding goal function. The optimization solver cannot be used.
module = BouncingBallFMI20, log level = ERROR: [logFmi2Call][FMU status:Error] fmi2EnterInitializationMode: terminated by an assertion.
assert            | debug   | fmi2ExitInitializationMode failed with status : Error
assert            | info    | simulation terminated by an assertion at initialization
",
    timeFrontend = 0.04419483443838641,
    timeBackend = 0.01471718286880644,
    timeSimCode = 0.047226181413153,
    timeTemplates = 0.06309735563728794,
    timeCompile = 12.94070733511891
end SimulationResult;
""

And I get the same in OMEdit as well. So at least the translation is fine, just the simulation is not working.

in reply to:  3 comment:5 by Andreas Heuermann, 8 years ago

Replying to adeas31:

It looks like an error during the translation phase. Do you have some special Compiler flags on?

That was the problem. I had -d=initialization,backenddaeinfo,newInst on. Removing newInst solved the problem.

comment:6 by Andreas Heuermann, 8 years ago

Resolution: → invalid
Status: new → closed
Note: See TracTickets for help on using tickets.