angusmax
angusmax

Reputation: 111

Modelica units of measurement with square root

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:

Instead, if I replace (1/2) with:

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?

Upvotes: 7

Views: 274

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 12507

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

Upvotes: 3

Related Questions