Modelica units of measurement with square root
Asked Answered
G

1

7

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?

Gannet answered 29/9, 2017 at 14:52 Comment(1)
also see: trac.modelica.org/Modelica/ticket/376Fabricate
M
3

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.)

Memorialist answered 29/9, 2017 at 16:23 Comment(2)
Why not use the "squared paramter" with a name "flow_coeff_squared" with units (m³/s)² divided by Pa?Absorption
Here is a helpful example for "squared parameter": unitsofmeasure.org/trac/ticket/51Fabricate

© 2022 - 2024 — McMap. All rights reserved.