QCalc

Modelica units based on quantity calculus

Information

QCalc is a free, open-source Modelica library to represent quantities using various units, including but not limited to SI. The approach is based on quantity calculus (hence the name "QCalc").

Usage:

QCalc can be used like this:

    import Q = QCalc.Quantities;
    import U = QCalc.Units;
    Q.Pressure p = U.atm + 50*U.Pa; 

Nonscalar units such as degree Celsius and decibel are also supported. The * and / operators are overloaded to call the unit's transformation (numberquantity) and its inverse, respectively. For example, this will give a value of x = 100:

    Real x = (0*U.degC + 100*U.K)/U.degC;

and this will too:

    Real x = (10/U.dB + 10/U.dB)*U.dB;

since we have multiplied the numbers by adding their logarithms.

The quantities are not directly compatible with the Modelica Standard Library (MSL) since MSL expresses quantities in SI units. To convert between QCalc and MSL, create an adapter with equations like this:

    p = p_SI*U.Pa;

where p is pressure as a quantity (in QCalc), p_SI is pressure in pascal (in MSL), and U.Pa is the pascal from QCalc.Units.

Please see the getting started page for more information. If you wish to use the same approach with Modelica results in Python, please see ModelicaRes and natu.

Extends from Icons.Package (Icon for standard packages (from MSL 3.2.1)).

Package Contents

Name Description
QCalc.UsersGuide UsersGuide User's Guide
QCalc.Blocks Blocks Input/output blocks to convert units
QCalc.Units Units Constants and units of physical measure
QCalc.Quantities Quantities Types to represent physical values
QCalc.Math Math Library of mathematical functions (e.g., sin, cos), where angle is a quantity
QCalc.Icons Icons Package of icons