AngeliqueR
AngeliqueR

Reputation: 123

issue with unit «knot» / «kn» with Dymola

I'm not sure but when switching to the last dymola version 2024x Refresh 1, I've lost the fact Dymola recognise the unit «kn» or «knot» (nautical mile per hour). The 2024x version used to recognise it.

I basically define the new unit as :

type Velocity_knots = Real (final unit="kn",final quantity="Velocity")

I also run a displayunit.mos script which has the following lines in it:

defineUnitConversion("m/s", "kn", 1/(1852/3600));

when checking with 2024x Refresh 1, I got the warning:

/!\ Could not decode the unit symbol "kn" appearing in the unit string "kn"

I didn't have such an error with the previous 2024x version. Did I miss something that make Dymola fails to recognise my unit ?

----- EDIT:

Following your comments I made further tests. I found the issue is not related to 2024x Refresh 1 nor previous ones, but rather to changes in the code that were made, that I did not notice at first - my mistake, my appologies.

Here are further tests :

package TestPackage
  model ATest
    type NewType = Real (final unit="kn", final quantity="Velocity");
    parameter NewType v_nt=4;
    parameter TestPackage.NewType v_ntp=5;
  end ATest;

  type NewType = Real (final unit="kn", final quantity="Velocity");
end TestPackage;

when checking with Dymola:

One comment about why I found I need to define unit="kn". All my models equations are in SI units. But when it comes to user to enter data in tables, for example maps such as z=f(x,y) using for example MSL CombiTables models, then, I did not find a proper way for non-SIunits to be displayed for entry in the table. Thus I prefer the user to enter data with its own usual nonSI units in the table and then the code uses hard coded converters functions to convert back to SI units. I define the user-nonSI units by using a new Type with unit="kn" for example, for clarity and assurance quality purpose. Has anyone an alternative best practice ?

Upvotes: 2

Views: 101

Answers (1)

Dag B
Dag B

Reputation: 649

The simple explanation is the unit for calculation should be "m/s" and you should just use an alternative display unit "kn".

Upvotes: 0

Related Questions