Opened 4 years ago

Closed 4 years ago

#6274 closed enhancement (fixed)

Handling MSL 3.2.3 and MSL 4.0.0 in OpenModelica 1.17.0

Reported by: Francesco Casella Owned by: Adeel Asghar
Priority: blocker Milestone: 1.17.0
Component: Installation program Version: v1.17.0-dev
Keywords: Cc:

Description

The Modelica Standard Library 4.0.0 was released in June 2020. Other Modelica tools are starting to support it, and so should OpenModelica. In fact, OpenModelica can already run the majority of test cases in the MSL 4.0.0 library successfully, see report.

However, full support of MSL 4.0.0 requires the ability to upgrade existing models and libraries using MSL 3.2.3 to use it, as well as to upgrade existing models and libraries to use updated versions of other libraries that switched to MSL 4.0.0. This in turn requires full support of conversion scripts (#5297) and integration of the package manager in OMEdit (#6020). This is planned for v. 1.18.0, due July 2021.

However, in 1.17.0 we should already make it possible to:

  • Develop new libraries that use MSL 4.0.0 from the beginning
  • Work with libraries and models that were converted to MSL 4.0.0 or started in MSL 4.0.0 with other Modelica tools

This will actually possible by using the Tools | Options | Library settings. If you are mostly or exclusively using MSL 4.0.0 for your work, you will set Modelica 4.0.0 as a system library. If you are using both 4.0.0 and 3.2.3 for different projects, then you can remove the default loaded Modelica library, and rely on the uses annotations to load the appropriate version of the MSL when you open the project-specific libraries. Of course that requires to manually open one of the two MSL versions when you start a new project, based on your needs.

This requires some adjustments to the Windows installer, basically

  • shipping the core libraries only with the installer
  • making sure that the package manager can be used with minimal effort (absent a proper, full-fledged GUI) to install libraries other than the core ones

This functionality is planned for 1.17.0

Attachments (1)

libraries.png (59.0 KB ) - added by Francesco Casella 4 years ago.

Download all attachments as: .zip

Change History (31)

comment:1 by Francesco Casella, 4 years ago

Milestone: 1.17.01.16.2

comment:2 by anonymous, 4 years ago

Could you please change the subject to match the milestone.

comment:3 by Francesco Casella, 4 years ago

Summary: Handling MSL 3.2.3 and MSL 4.0.0 in OpenModelica 1.17.0Handling MSL 3.2.3 and MSL 4.0.0 in OpenModelica 1.16.2

Sure.

comment:4 by Adrian Pop, 4 years ago

This didn't make it in 1.16.2.

comment:5 by Francesco Casella, 4 years ago

Milestone: 1.16.21.17.0
Summary: Handling MSL 3.2.3 and MSL 4.0.0 in OpenModelica 1.16.2Handling MSL 3.2.3 and MSL 4.0.0 in OpenModelica 1.17.0

OK, changing back to 1.17.0

comment:6 by Adrian Pop, 4 years ago

MSL 4.0.0 is now installed also via the Windows installer:
https://github.com/OpenModelica/OpenModelicaSetup/pull/12

comment:7 by Francesco Casella, 4 years ago

Unless this is complicated for some reason, I would put both 3.2.3 and 4.0.0 among the system libraries that are installed by default. It is definitely too early to put 3.2.3 as "optional"

comment:8 by Francesco Casella, 4 years ago

Also, I'd like to understand well how the libraries are set in OMEdit. We have to be very careful not to put newbies in akward situations, where they could then hate us forever.

Currently, when you start OMEdit in the default configuration, you already get a Modelica library pre-loaded. I understand you can change that default in Tools | Options | Libraries

Q1: Which should be the default loaded library?

I understand that PR 12 now makes 4.0.0. This means that any new user that starts doing stuff will do so using MSL 4.0.0. This may be ok, since MSL 4.0.0 has been out for 6 months now. However, it is likely he or she may realize at some point that he needs to use some other library that is only available under 3.2.3, and we still do not provide the conversion scripts. This would be a very bad situatio, because at this point, basically you have to throw away everyting and restart from scratch.

So, I would be inclined to keep 3.2.3 as the default for 1.17.0. We can change it in June to 4.0.0, when more libraries will have been converted to that version of MSL and we'll have proper version management and conversion scripts. Doing it now seems too risky to me.

Q2: What happens if I want to load a library that uses a different version of MSL

As I understand, the current behaviour would be a mess. If I start OMC with 4.0.0 default, when I load a library using MSL 3.2.3 I'll get some warning that MSL 4.0.0 is loaded already and that I may have problems of compatibility. In fact, I will definitely have them, because Modelica.SIunits was moved to Modelica.Units, so pretty much everything will be broken. This would really be annoying and convey a bad impression of the tool.

The other way round would be equally bad. If I have 3.2.3 by default, and I load a library using MSL 4.0.0, there will be other warnings, and nothing will work for the same reason as above.

I'm not sure what is the best way to handle this. It must be very intuitive, because people don't read the manuals, and then they will get angry if the get into bad or unexplainable situations.

comment:9 by Francesco Casella, 4 years ago

I just loaded the latest 1.18.0-dev nigthly. I loaded both versions of the MSL. When I start OMEdit, I get two errors up front

[1] 22:45:18 Scripting Error
Failed to load package Modelica (default) using MODELICAPATH C:/Program Files/OpenModelica1.17.0-dev-64bit/lib/omlibrary.

[2] 22:45:18 Scripting Error
Failed to load package ModelicaReference (default) using MODELICAPATH C:/Program Files/OpenModelica1.17.0-dev-64bit/lib/omlibrary.

This needs to be fixed ASAP, so we can put it in 1.17.0, where we promised some MSL 4.0.0 support.

comment:10 by Francesco Casella, 4 years ago

Additionally, if I then open Tools|Options|Libraries, double-clicking on Modelica opens a dialog where I cannot set the name of the library.

Opening any library with the uses annotation also fails.

So, basically, no way to use any model that uses the MSL in OMEdit on the current nightly...

comment:11 by Francesco Casella, 4 years ago

OK, @adrpo, I guess you forgot to change the MODELICAPATH default for 1.18.0, it still refers to 1.17.0

comment:12 by Adrian Pop, 4 years ago

Owner: changed from Adrian Pop to Adeel Asghar
Status: newassigned

Do you still have OPENMODELICALIBRARY define in the environment variables after you installed 1.18.0?
@adeas31 added code in 1.18.0 to remove it from the environment variables.
The package manager will not work if is set and even worse if is set to the old installation which was removed.

Version 0, edited 4 years ago by Adrian Pop (next)

in reply to:  12 comment:13 by Francesco Casella, 4 years ago

Replying to adrpo:

Do you still have OPENMODELICALIBRARY defined in the environment variables after you installed 1.18.0?

Apparently not. If I run cmd.exe and type set, I only see

OPENMODELICAHOME=C:\Program Files\OpenModelica1.18.0-dev-64bit\

@adeas31 added code in 1.18.0 to remove it from the environment variables.

Seems it worked fine.

The package manager will not work if is set and even worse if is set to the old installation which was removed.

I'm not using the package manager at the moment. I assume that if anybody installs 1.18.0 he/she will not need to do something esoteric from the command line to get the MSL. That would be weird.

comment:14 by Adeel Asghar, 4 years ago

How does Tools|Options|Libraries looks like?

by Francesco Casella, 4 years ago

Attachment: libraries.png added

comment:15 by Francesco Casella, 4 years ago

See attachment. Seeing "default" doesn't really help, is it 3.2.3 or 4.0.0?

The first time I opened OMEdit after installation, I had no MSL loaded, and that window misfunctioned, i.e. I couldn't see the name of the libraries in the dialogs when double-clicking on Modelica.

Then I manually loaded MSL 3.2.3 from the installation directory to do some stuff.

After that, I automatically get MSL 4.0.0 loaded when I start OMEdit. It is not clear how to get 3.2.3.

I tried to uncheck "Force loading of Modelica Standard Library", but I still get it loaded by default.

comment:16 by Adeel Asghar, 4 years ago

Everything looks perfectly fine. Weird that error message says "MODELICAPATH C:/Program Files/OpenModelica1.17.0-dev-64bit/lib/omlibrary" even though in the screenshot it points to the correct installation version.

comment:17 by Francesco Casella, 4 years ago

Everything looks perfectly fine

I still don't understand "default". What does that mean?

BTW, now I no longer get the red lines, I get

[1] 13:20:55 Scripting Notification
Automatically loaded package Complex 4.0.0 due to uses annotation.

[2] 13:20:55 Scripting Notification
Automatically loaded package ModelicaServices 4.0.0 due to uses annotation.

Not sure which uses annotation does OMEdit refer to. I am not loading any library.

I can uninstall this, reinstall an old 1.17.0 nightly, then uninstall that and install 1.18.0 again to see if I can reproduce the problem. That would take some time, though.

comment:18 by Francesco Casella, 4 years ago

I guess we have to have a session after the devmeeting where you explain me the rationale.

Currently I am not able to figure out a mental model that explains how the MSL is handled in OMEdit.

in reply to:  17 comment:19 by Martin Sjölund, 4 years ago

Replying to casella:

Not sure which uses annotation does OMEdit refer to. I am not loading any library.

If it is loading Modelica 4.0.0, it has uses annotations for Services and Complex (and will load those).

in reply to:  17 comment:20 by Francesco Casella, 4 years ago

Replying to casella:

I can uninstall this, reinstall an old 1.17.0 nightly, then uninstall that and install 1.18.0 again to see if I can reproduce the problem. That would take some time, though.

I confirm I can reproduce the problem, I get again

[1] 14:10:17 Scripting Error
Failed to load package Modelica (default) using MODELICAPATH C:/Program Files/OpenModelica1.17.0-dev-64bit/lib/omlibrary.

[2] 14:10:17 Scripting Error
Failed to load package ModelicaReference (default) using MODELICAPATH C:/Program Files/OpenModelica1.17.0-dev-64bit/lib/omlibrary.

I'll keep it like that, so we can investigate together what is going on.

comment:21 by Francesco Casella, 4 years ago

When you run the installer and then start OMEdit, it still uses the old env variables. Those should be changed explicitly

comment:22 by Francesco Casella, 4 years ago

Please also add MSL 4.0.0 to the Modelica Library set

comment:23 by Adeel Asghar, 4 years ago

PR#13 fixes the above two comments.

in reply to:  23 comment:24 by Francesco Casella, 4 years ago

Replying to adeas31:

PR#13 fixes the above two comments.

I just installed 1.18.0 after uninstalling 1.16.3, and I still got

[1] 19:51:43 Scripting Errore
Failed to load package ModelicaReference (default) using MODELICAPATH .

Maybe we should simply remove the option of starting the newly installed OMEdit from the installation program, just in case?

comment:25 by Adeel Asghar, 4 years ago

@casella I just tested the latest nightly build and the library loading issue is solved by PR#14.

comment:26 by Francesco Casella, 4 years ago

Excellent!

Can you please back-port it to maintenance/1.17, so we get it in 1.17.0 as well?

Thanks!

comment:27 by Adeel Asghar, 4 years ago

Not sure if we have a maintenance branch for installer. I will check and back-port it if we have one.

comment:28 by Francesco Casella, 4 years ago

Let's just make sure that this also gets in 1.17.0

comment:29 by Adeel Asghar, 4 years ago

Sure. See PR#15.

comment:30 by Francesco Casella, 4 years ago

Resolution: fixed
Status: assignedclosed

The installer is now fixed. We need to take care of the library settings, see #6379

Note: See TracTickets for help on using tickets.