ModelicaStandardLibrary icon indicating copy to clipboard operation
ModelicaStandardLibrary copied to clipboard

Some types in Units don't specify quantity

Open henrikt-ma opened this issue 2 years ago • 3 comments

Is it intentional that a type like this one doesn't come with a quantity? https://github.com/modelica/ModelicaStandardLibrary/blob/ef08d88cfddd2bd0104b987b6db70327b359abde/Modelica/Units.mo#L346

henrikt-ma avatar Mar 09 '23 11:03 henrikt-ma

Looks to me that only Stress is affected (and some ISO-chapter 4 types).

Is it intentional that a type like this one doesn't come with a quantity?

Yes, according to https://github.com/modelica/ModelicaStandardLibrary/blob/ef08d88cfddd2bd0104b987b6db70327b359abde/Modelica/Units.mo#L1899

Not sure if this reasoning still holds today with more than one Modelica tool supporting Units.

beutlich avatar Jan 16 '24 19:01 beutlich

From the cited line:

Quantity="Stress" removed from type "Stress", in order that a type "Stress" can be connected to a type "Pressure".

Not sure if this reasoning still holds today with more than one Modelica tool supporting Units.

It looks like a completely valid reason, independently of tool. If one really wants to be able to have a connect-equation with a Stress on one side and a Pressure on the other side, the two must not have different quantity. This is the only semantical consequence of specifying quantity in Modelica.

It would be nice to expand on the motivation in the case of Stress, however; why is it relevant to support connect sets that mix Stress with Pressure?

henrikt-ma avatar Jan 16 '24 21:01 henrikt-ma

By the way, whatever the explanation is, I think it belongs in a comment at the definition of Stress rather than in (or as a complement to) the class documentation.

henrikt-ma avatar Jan 16 '24 21:01 henrikt-ma