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

Co-simulation 1.0 in OMEdit

Co-simulation 1.0 in OMEdit

Hello ; can we export a FMI for co-simulation 1.0 with OMEdit ?
Please It's urgent .
Thank you.

Re: Co-simulation 1.0 in OMEdit

We do not have 1.0 co-simulation yet. Just FMI 2.0 and you need a specific version for Windows. Install this one:
https://build.openmodelica.org/omc/buil … 9d33ec.exe

Then you need to write a script to export the FMU. Create a new file translateMyFMU.mos containing:

Code:


loadModel(Modelica); getErrorString();
// load any other models you need
loadFile("MyModel.mo");  getErrorString();
// translate MyModel to FMU for co-simulation
translateModelFMU(Model, "2.0", "cs"); getErrorString();

Then you run omc.exe on the script from the command line:

Code:


> C:\OpenModelica\build\bin\omc.exe translateMyFMU.mos

Edited by: adrpo - Feb-10-16 16:55:38

Re: Co-simulation 1.0 in OMEdit

thank you for your help. I want to use  FMU with a logiciel that accepts only Co-Simulation 1.0 .
I wonder if there is a way to convert the cs2.0 to cs1.0 ?

Re: Co-simulation 1.0 in OMEdit

Hello adrpo;
I think that I did all what you told me to do in your last message . But I get always the same error: I created the file translateMyFMU.mos . And when I tray to  run omc.exe I get this error :
C:\OpenModelica\build\bin\omc.exe translateMyFMU.mos
Error occurred building AST
Syntax Error
[<interactive>:1:2-1:2:writable] Error: Lexer failed to recognize '\OpenModeli'
The omc.exe is actually located in this directory : C:\OpenModelica1.9.4-dev\bin\omc.exe . I tried this command and I I got :
Error occurred building AST
Syntax Error
[<interactive>:1:4-1:4:writable] Error: Lexer failed to recognize '\OpenModeli'
[<interactive>:1:18-1:20:writable] Warning: Treating .9 as 0.9. This is not standard Modelica and only done for compatibility with old code. Support for this feature may be removed in the future.
[<interactive>:1:20-1:22:writable] Warning: Treating .4 as 0.4. This is not standard Modelica and only done for compatibility with old code. Support for this feature may be removed in the future.

What should I do ?

Re: Co-simulation 1.0 in OMEdit

Sorry, it seems that you put some wrong code in file translateMyFMU.mos.

We fixed the FMU generation for Windows in the last 1.9.2-dev.beta2 release, so you can now do it via OMEdit (OpenModelica Connection Editor).
Just install this version:
https://build.openmodelica.org/omc/buil … 9.4/beta2/
And then open your model in OMEdit and right click on it and say Export FMU.

Re: Co-simulation 1.0 in OMEdit

The type of exported FMU depends on what settings you have in Tools->Options->FMI.

Adeel.

Re: Co-simulation 1.0 in OMEdit

Thank you so much ... it finally  works current/smile

Re: Co-simulation 1.0 in OMEdit

Hello, The generation of the fmi for co-simulation 2.0 is successful [1] . But when I try to import a file co-simulation 2.0 to OMEdit I get this error:[2]

[1] 12:09:03 Scripting Notification
The FMU Modelica.Blocks.Logical.Xor.fmu is generated at C:/Users/aer/AppData/Local/Temp/OpenModelica/OMEdit

[2] 13:50:28 Scripting Error
The FMU version is 2.0 and FMU type is CoSimulation. Unsupported FMU type. Only FMI 2.0 ModelExchange is supported.

Besides, I used a simple model (logical block XOR), generated by OMEdit ,with another tool. The importation was perfect but, in the simulation’s beginning, the simulation stops and displays this error:

https://www.openmodelica.org/images/agorapro/attachments/4887/mini_Error-OMEdit.png





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