Skip to content

Changes targeting MSL v4.0.0 requiring conversion

Thomas Beutlich edited this page Oct 6, 2020 · 13 revisions

Background

MSL v4.0.0 enables renaming, moving (and removing) of existing classes and components. In order to not break backwards-compatibility of existing user libraries based on MSL v3.x.y, it is required to provide conversion scripts and unit tests.

How to do it

First, make yourself familiar with the conversion scripts. The description, that comes with the MSL explains the four main conversion functions convertClass, convertClassIf, convertModifiers and convertElement.

Secondly, have a look at the changes of #2850, that serve as an example.

Consider also the contributing workflow.

Renaming a class/component name

  1. Rename the actual class/component name.
  2. In the MSL, adapt all references of that class/component/modifier name.

Moving a class

  1. Cut the Modelica text of the actual class and move it to the desired new location.
  2. In the MSL, adapt all references of that class name.

Removing a class

  1. Cut the Modelica text of the obsolete class and move it to the new location in ObsoleteModelica4.mo.
  2. In the MSL, adapt all references of that obsolete class name.

Testing

  1. Add your conversion to the conversion script ConvertModelica_from_3.2.3_to_4.0.0.mos.
  2. Add a simply unit test model to ModelicaTestConversion4.mo relying on the old class/component/modifier name of MSL v3.x.y. Take a look at the existing unit test models ModelicaTestConversion4.Fluid.Dissipation.Issue2780 or ModelicaTestConversion4.Mechanics.MultiBody.Issue2425 for how unit test models should be designed. The unit test model does not need to be physically meaningful, since the only purpose is the test of automatic conversion. If necessary, rebuild the library package structure.
  3. Load MSL v4.0.0 in your Modelica tool, provided it supports conversion.
  4. Load ModelicaTestConversion4 in your Modelica tool and run the conversion. Do not save the converted package ModelicaTestConversion4, since we want to have the original version under test.
  5. Prove that the conversion was succesful by running a model-check, initialization or simulation.
  6. Commit and push your changes to a new branch and open the pull request as usual. (Note, there will be no CI task testing the automatic conversion).