Skip to content

Express speeds given in rpm using from_rpm - #4818

Merged
AHaumer merged 2 commits into
modelica:masterfrom
henrikt-ma:units-exposed-by-pi
Oct 13, 2026
Merged

AHaumer merged 2 commits into
modelica:masterfrom
henrikt-ma:units-exposed-by-pi

Conversation

@henrikt-ma

Copy link
Copy Markdown
Contributor

This is the RPM (revolutions per minute) variant of #4817. Since the unit "rev" is not supported by the Modelica specification, the issues addressed by this PR cannot be fixed using unitful literals with unit "rev/min", so instead the Modelica.Units.Conversions.from_rpm function is used.

Unlike #4817, this PR does not require the Modelica 3.7 specification, but I think this is a good time to discuss whether the "rev" = 2π "rad" unit should be added to the additional non-SI units supported by the language specification.

Speeds given in revolutions per minute were converted with expressions like
1440.45*2*pi/60, where the unit only works out because of the unit that pi gets
from the unit of the output of Modelica.Math.asin, and where nothing expresses
that 1440.45 is a number of revolutions per minute.  Using
Modelica.Units.Conversions.from_rpm, which is already used for the same purpose
elsewhere in the library, makes the conversion explicit and unit consistent
regardless of the unit of pi.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The nominal load speed of a few more examples was given as
1440.45*2*pi/60, and is now written Modelica.Units.Conversions.from_rpm(1440.45)
like in the other examples:
- Modelica.Electrical.Machines.Examples.InductionMachines.IMC_InverterDrive
- Modelica.Electrical.Machines.Examples.InductionMachines.IMC_YD
- Modelica.Electrical.PowerConverters.Examples.ACAC.SoftStarter
- Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines.ComparisonPolyphase.IMC_DOL_CommonLeakage

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@HansOlsson HansOlsson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Regarding "rpm" in general. Dymola uses "r" for rotation so "r/min" (as well as "rpm") works.

I know that "r" is now a small SI-prefix ("ronto") - but similarly as "T" being both "Tesla" and "Tera" that shouldn't cause problems.

@mestinso mestinso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good here

@henrikt-ma

Copy link
Copy Markdown
Contributor Author

Regarding "rpm" in general. Dymola uses "r" for rotation so "r/min" (as well as "rpm") works.

I know that "r" is now a small SI-prefix ("ronto") - but similarly as "T" being both "Tesla" and "Tera" that shouldn't cause problems.

The MSL already has:

type AngularVelocity_rpm = Real (final quantity="AngularVelocity", final unit="rev/min")

so "rev" is therefore also the name we use for revolution in System Modeler. The presence in the MSL is also a good reason why it should be recognized by the specification.

@AHaumer AHaumer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine with me
(although as far as I see the discussion about the unit of pi is nit finished)

@AHaumer
AHaumer merged commit fd2d0af into modelica:master Oct 13, 2026
11 checks passed
@henrikt-ma
henrikt-ma deleted the units-exposed-by-pi branch October 15, 2026 12:51
@beutlich
beutlich removed the request for review from casella October 18, 2026 18:46
@beutlich beutlich added this to the MSL4.2.0 milestone Oct 18, 2026
@tobolar

tobolar commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Using displayUnit like variable(displayUnit="rev/min")=Modelica.Units.Conversions.from_rpm(1410)... is somehow strange as the value (1410) is in fact transformed to rad/s. So having displayUnit is misleading.

@henrikt-ma

Copy link
Copy Markdown
Contributor Author

Using displayUnit like variable(displayUnit="rev/min")=Modelica.Units.Conversions.from_rpm(1410)... is somehow strange as the value (1410) is in fact transformed to rad/s. So having displayUnit is misleading.

If I plot that variable, why shouldn't I set displayUnit so that I can recognize the value I entered as 1410?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants