OpenModelica / OpenModelica

OpenModelica is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.
https://openmodelica.org
Other
802 stars 300 forks source link

OMEdit Sensitivity Analysis and optimization not working, missing libraries #11076

Open fhi2023 opened 12 months ago

fhi2023 commented 12 months ago

Discussed in https://github.com/OpenModelica/OpenModelica/discussions/11039

Originally posted by **fhi2023** August 11, 2023 Hello folks, I have some questions with regards to the integrated sensitivity and optimization module of OMEdit. When trying to solve my model, which lives in my own package, but utilizes some Modelica standard components, I face these errors: "Error: Failed to load package Modelica (default) using MODELICAPATH C:/Users/XXX/SES_EL" --> This is when I set the MODELICAPATH to the path of my own package "Error: Failed to insert class CreepTest_BG within SES_EL.Tests; the available classes were: Modelica.Units.Icons.Conversion Modelica.Units.Icons ..." -->This is when I keep Modelica Path unchanged. The tool seems to be looking for my model in the Modelica Path, but is in a different directory. I've tried different combinations of MODELICAPATH for the standard lib, my custom lib, both... Can anyone tell me how to set it up such that you can optimize a model which: - Lives in your own custom library - Utilizes Modelica standard components Thanks very much in advance!
adrpo commented 12 months ago

Have you tried setting it to: C:/Users/XXX/SES_EL;%APPDATA%/.openmodelica/libraries? You will need to replace %APPDATA% with what it is on your machine.

adrpo commented 12 months ago

Of course you can also load your library by drag-and-drop your Library/package.mo into OMEdit library browser, then you don't need to change your MODELICAPATH.

bilderbuchi commented 12 months ago

I thought one should not directly set MODELICAPATH, but OPENMODELICALIBRARY, as per the OM user guide?

adrpo commented 11 months ago

Nowadays the installer does not set OPENMODELICALIBRARY or OPENMODELICAHOME anymore so users can run several versions of OpenModelica. I thought we use MODELICAPATH if is set but it seems you are right and we do not. Strangely we have some error messages naming it but we don't read it from the environment anywhere as far as I can tell.

Yes, if you set OPENMODELICALIBRARY that will be read by omc and OMEdit via getModelicaPath: https://build.openmodelica.org/Documentation/OpenModelica.Scripting.getModelicaPath.html You can also set it via scripting using: https://build.openmodelica.org/Documentation/OpenModelica.Scripting.setModelicaPath.html