In Modelica I'm trying to define a dedicated data type OrifSizingCoeff
for the sizing coefficient on an hydraulic orifice.
The corresponding physical quantity is a volumetric flow rate divided by the square root of a pressure, therefore:
a) In SI units: m3/s
divided by sqrt(Pa)
;
b) In "practical" units: l/min
divided by sqrt(bar)
.
I defined the data type as follows:
type OrifSizingCoeff = Real(
final quantity="Orifice sizing coefficient",
final unit="m3/(s.Pa(1/2))",
displayUnit="l/(min.bar(1/2))");
I don't get any parsing error but the unit conversion doesn't work (parameter value doesn't change going from one unit to the other); the same happens if I replace (1/2)
with:
0.5
05
Instead, if I replace (1/2)
with:
(0.5)
0,5
(0,5)
^(1/2)
^(0.5)
I get a parsing error. (I tried any crazy thing I could think of).
And, if I replace (1/2)
with 1/2
, a conversion is executed but it's "wrong". (According to Modelica's syntax, Pa1/2
is interpreted as (Pa1)/2 = Pa/2
; same for bar1/2
. Therefore the two units correspond to m3/(s.Pa/2)
and l/(min.bar/2)
, respectively).
Is there a way to correctly define the units I need?
Modelica.Units.SI Library of SI unit definitions Information This package provides predefined types based on the international standard on units. For an introduction to the conventions used in this package, have a look at: Conventions. Extends from Modelica.Icons.Package(Icon for standard packages).
Modelica.Units.SI.OsmoticPressure Parameters Name Value Custom Parameters quantity "Pressure" unit "Pa" displayUnit "bar" min 0 Modelica.Units.SI.StoichiometricNumber Parameters Name Value
Modelica.Units.SI.MassFraction Parameters Name Value Custom Parameters quantity "MassFraction" unit "1" min 0 max 1 Modelica.Units.SI.Concentration
Modelica.Units.SI.MolarVolume Parameters Name Value Custom Parameters quantity "MolarVolume" unit "m3/mol" min 0 Modelica.Units.SI.MolarDensity
Unfortunately, there is no solution according to the Modelica specification, since unit_exponent is defined to be a signed integer (and cannot be in parenthesis and ^ for exponentiation is not allowed) in section 19.1 of Modelica 3.4.
The goal of the unit-definition in Modelica is to conform to "The International System of Units (SI)" and I could not find any decision about non-integer exponents. (And since they are normally written with superscripts it is less of an issue.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With