Opened 5 years ago

Last modified 3 years ago

#5809 new enhancement

Allow multiple installations on the same Windows PC

Reported by: massimo ceraolo Owned by: Adeel Asghar
Priority: high Milestone:
Component: Installation program Version:
Keywords: Cc:

Description (last modified by massimo ceraolo)

I have a production model (a three-phase PWM inverter) that works perfectly, i.e. without warnings or messages and with correct results, on a relatively old OM version (1.14.0-dev234).

It doesn't work anymore with recent nightly builds. When asked to run this model, they issue several runtime errors and then stop simulating.

Instead of creating a ticket on this issue, I would like to first by-section to help developers to understand what change spoiled the previous correct behavior.

At present, to test several OM versions one should either

  • have many PCs and install one OMEdit per PC
  • un-install and re-install versions several times,
  • create several virtual machines, each of them containing an OM.

All of these options are either very costly and/or complicated and/or time-consuming so that to discourage any attempt.

In case it is possible to install several OM versions on the same PC, the procedure would be greatly simplified. Today's hard disks are so large that it is not too demanding to have dozens of versions installed.

Attachments (2)

OMEDIT.png (45.4 KB ) - added by massimo ceraolo 5 years ago.
OMEDIT screenshot.png (45.4 KB ) - added by massimo ceraolo 5 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 by Adrian Pop, 5 years ago

As far as I know you can install different versions on the same PC in different directories.
The only thing you need to do to switch between versions is to edit environment variables:
OPENMODELICAHOME and OPENMODELICALIBRARY.
You can even have .bat files to start different OMEdits:

Save it as OMEdit_1.14.bat on desktop.

REM OMEdit_1.14.bat 
set OPENMODELICAHOME="C:\Path\To\OpenModelica1.14\"
set OPENMODELICALIBRARY="C:\Path\To\OpenModelica1.14\lib\omlibrary"
"%OPENMODELICAHOME%"\bin\OMEdit.exe

Save it as OMEdit_1.15.bat on desktop.

REM OMEdit_1.15.bat 
set OPENMODELICAHOME="C:\Path\To\OpenModelica1.15\"
set OPENMODELICALIBRARY="C:\Path\To\OpenModelica1.15\lib\omlibrary"
"%OPENMODELICAHOME%"\bin\OMEdit.exe

Save it as OMEdit_1.16.bat on desktop.

REM OMEdit_1.16.bat
set OPENMODELICAHOME="C:\Path\To\OpenModelica1.16\"
set OPENMODELICALIBRARY="C:\Path\To\OpenModelica1.16\lib\omlibrary"
"%OPENMODELICAHOME%"\bin\OMEdit.exe
Last edited 5 years ago by Adrian Pop (previous) (diff)

comment:2 by Adeel Asghar, 5 years ago

No with the current installer it is not possible to install multiple versions. This was done as part of giving the option so user can uninstall OpenModelica before installing a new one. We read a registry item to check if OM is already installed or not. If you want to be able to install multiple versions of OM you need to manually clear the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenModelica\UninstallString. The key points to the uninstaller executable. Give an empty value to the key and run the new installer.

Note that the new installer will update the registry key again. Also I think you can't use the Windows control panel uninstall option if you clear the key but you can always manually run the uninstaller.

in reply to:  2 comment:3 by massimo ceraolo, 5 years ago

Replying to adeas31:

No with the current installer it is not possible to install multiple versions. [...]

So, to install multiple versions needs tampering with the registry.
This could in principle be acceptable once what to do is very clear.

But how, then, to switch from an installation to another? If also switching requires to change registry keys, I'm afraid the whole process is too complex (and risky), for just the purpose to find which version caused a regression.

comment:4 by Adeel Asghar, 5 years ago

But how, then, to switch from an installation to another? If also switching requires to change registry keys, I'm afraid the whole process is too complex (and risky), for just the purpose to find which version caused a regression.

The registry change is only required to install multiple versions. So for each new version to install you have to modify the registry key.
To switch from one to another installation use the scripts Adrian posted above.

Normally the registry change is not risky if you know what you are doing. In our case we are just tricking the installer to think that there is no OM installed on the machine. The registry key that you have to change is just the path to the uninstallation executable.

comment:5 by Adrian Pop, 5 years ago

I think we should look at the registry key and ask the user if he wants to uninstall, if not then just install the new version, don't force any uninstallation.

I need to check but it might even work to not specify any OPENMODELICAHOME/OPENMODELICALIBRARY, just run any OM program from the installation directory. So if you delete these environment variables the OM programs would just work fine. This happens like this on Linux but I'm unsure about Windows.

in reply to:  5 comment:6 by Francesco Casella, 5 years ago

Replying to adrpo:

I need to check but it might even work to not specify any OPENMODELICAHOME/OPENMODELICALIBRARY, just run any OM program from the installation directory. So if you delete these environment variables the OM programs would just work fine. This happens like this on Linux but I'm unsure about Windows.

I support some exploration in this direction. Dymola always allowed to install different versions at the same time, and I found this opportunity very handy a number of times. I guess it should be possible to get the same behaviour on OMC without too much trouble.

comment:7 by massimo ceraolo, 5 years ago

Description: modified (diff)

comment:8 by massimo ceraolo, 5 years ago

I used hint on comment2 to install a new version; I installed it and worked.
Then, I used a bat like the one in comment 1 to switch back to the previously installed version (my latest) It failed: it seems that MSL is not loaded. My bat is as follows:

REM Paths to latest OMEdit latest on my PC
set OPENMODELICAHOME="C:\Programmi\OpenModelica\"
set OPENMODELICALIBRARY="C:\Programmi\OpenModelica\lib\omlibrary"
"%OPENMODELICAHOME%"\bin\OMEdit.exe

I attach the screenshot of the opened OMEdit.

by massimo ceraolo, 5 years ago

Attachment: OMEDIT.png added

by massimo ceraolo, 5 years ago

Attachment: OMEDIT screenshot.png added

comment:9 by Adrian Pop, 5 years ago

Try without the quotes " for the paths for the set commands, leave it when calling OMEdit.

Last edited 5 years ago by Adrian Pop (previous) (diff)

comment:10 by Adrian Pop, 5 years ago

REM Paths to latest OMEdit latest on my PC
set OPENMODELICAHOME=C:\Programmi\OpenModelica\
set OPENMODELICALIBRARY=C:\Programmi\OpenModelica\lib\omlibrary
"%OPENMODELICAHOME%"\bin\OMEdit.exe

comment:11 by massimo ceraolo, 5 years ago

It worked!
Thank you

comment:12 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:13 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:14 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

comment:15 by Francesco Casella, 3 years ago

Note: See TracTickets for help on using tickets.