Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » Jay@Play
  • » Profile

Posts

Posts

Jul-16-14 12:39:14
Warnings issued when using non-SI unit "mmHg" and others
Category: Programming

Hi all,


I want to use non-SI units in a Modelica model in a medical context. I am using Modelica in Dymola. Being an engineer I prefer the SI units. But my model parameters are sourced from medical publications and I want to avoid conversion mistakes. Medical units also simplify communication with doctors.

For example, the unit "mmHg" (millimetres of mercury) is used instead of "Pa" for pressure. Pressure variables are defined in the model as follows:

Code:

type Pressure_mmHg = Real (final quantity="Pressure", final unit="mmHg")

Translating the model for simulation yields the following warning for every single non-SI variable in the model (~300 warnings in total):

Code:

Could not decode the unit symbol "mmHg" appearing in the unit string "mmHg"

If changes to the model cause a new warning it is near impossible to detect. Therefore I need to teach Modelica the unit "mmHg".

My current knowledge on the topic:
- Modelica Language Specification 3.3, Chapter 19 Unit Expressions: "It is possible to support user defined unit symbols." However the document does not elaborate on this.
- users may define display units (Real attribute "displayUnit") for use in the simulation GUI, as long as a conversion factor is defined in the "displayunit.mos" file in the Dymola directory as follows:

Code:

defineUnitConversion("Pa", "mmHg", 760/101325);

This is not an option because it diminishes portability of the model. It has to be performed manually on every computer that runs the model and requires administrator rights (which I don't have).

Thanks in advance for your help, it is much appreciated!

  • Index
  • » Users
  • » Jay@Play
  • » Profile
You are here: