This package provides conversion functions from the non SI Units defined in package Modelica.SIunits.Conversions.NonSIunits to the corresponding SI Units defined in package Modelica.SIunits and vice versa. It is recommended to use these functions in the following way (note, that all functions have one Real input and one Real output argument):
import SI = Modelica.SIunits; import Modelica.SIunits.Conversions.*; ... parameter SI.Temperature T = from_degC(25); // convert 25 degree Celsius to Kelvin parameter SI.Angle phi = from_deg(180); // convert 180 degree to radian parameter SI.AngularVelocity w = from_rpm(3600); // convert 3600 revolutions per minutes // to radian per seconds
Extends from Modelica.Icons.Library2 (Icon for library where additional icon elements shall be added).
Name | Description |
---|---|
NonSIunits | Type definitions of non SI units |
to_degC | Convert from Kelvin to °Celsius |
from_degC | Convert from °Celsius to Kelvin |
to_degF | Convert from Kelvin to °Fahrenheit |
from_degF | Convert from °Fahrenheit to Kelvin |
to_degRk | Convert from Kelvin to °Rankine |
from_degRk | Convert from °Rankine to Kelvin |
to_deg | Convert from radian to degree |
from_deg | Convert from degree to radian |
to_rpm | Convert from radian per second to revolutions per minute |
from_rpm | Convert from revolutions per minute to radian per second |
to_kmh | Convert from metre per second to kilometre per hour |
from_kmh | Convert from kilometre per hour to metre per second |
to_day | Convert from second to day |
from_day | Convert from day to second |
to_hour | Convert from second to hour |
from_hour | Convert from hour to second |
to_minute | Convert from second to minute |
from_minute | Convert from minute to second |
to_litre | Convert from cubic metre to litre |
from_litre | Convert from litre to cubic metre |
to_kWh | Convert from Joule to kilo Watt hour |
from_kWh | Convert from kilo Watt hour to Joule |
to_bar | Convert from Pascal to bar |
from_bar | Convert from bar to Pascal |
to_gps | Convert from kilogram per second to gram per second |
from_gps | Convert from gram per second to kilogram per second |
ConversionIcon | Base icon for conversion functions |
from_Hz | Convert from Hz to rad/s |
to_Hz | Convert from rad/s to Hz |
Type | Name | Default | Description |
---|---|---|---|
Temperature | Kelvin | Kelvin value [K] |
Type | Name | Description |
---|---|---|
Temperature_degC | Celsius | Celsius value [degC] |
function to_degC "Convert from Kelvin to °Celsius" extends ConversionIcon; input Temperature Kelvin "Kelvin value"; output NonSIunits.Temperature_degC Celsius "Celsius value"; algorithm Celsius := Kelvin + Modelica.Constants.T_zero;end to_degC;
Type | Name | Default | Description |
---|---|---|---|
Temperature_degC | Celsius | Celsius value [degC] |
Type | Name | Description |
---|---|---|
Temperature | Kelvin | Kelvin value [K] |
function from_degC "Convert from °Celsius to Kelvin" extends ConversionIcon; input NonSIunits.Temperature_degC Celsius "Celsius value"; output Temperature Kelvin "Kelvin value"; algorithm Kelvin := Celsius - Modelica.Constants.T_zero;end from_degC;
Type | Name | Default | Description |
---|---|---|---|
Temperature | Kelvin | Kelvin value [K] |
Type | Name | Description |
---|---|---|
Temperature_degF | Fahrenheit | Fahrenheit value [degF] |
function to_degF "Convert from Kelvin to °Fahrenheit" extends ConversionIcon; input Temperature Kelvin "Kelvin value"; output NonSIunits.Temperature_degF Fahrenheit "Fahrenheit value"; algorithm Fahrenheit := (Kelvin + Modelica.Constants.T_zero)*(9/5) + 32;end to_degF;
Type | Name | Default | Description |
---|---|---|---|
Temperature_degF | Fahrenheit | Fahrenheit value [degF] |
Type | Name | Description |
---|---|---|
Temperature | Kelvin | Kelvin value [K] |
function from_degF "Convert from °Fahrenheit to Kelvin" extends ConversionIcon; input NonSIunits.Temperature_degF Fahrenheit "Fahrenheit value"; output Temperature Kelvin "Kelvin value"; algorithm Kelvin := (Fahrenheit - 32)*(5/9) - Modelica.Constants.T_zero;end from_degF;
Type | Name | Default | Description |
---|---|---|---|
Temperature | Kelvin | Kelvin value [K] |
Type | Name | Description |
---|---|---|
Temperature_degRk | Rankine | Rankine value [degRk] |
function to_degRk "Convert from Kelvin to °Rankine" extends ConversionIcon; input Temperature Kelvin "Kelvin value"; output NonSIunits.Temperature_degRk Rankine "Rankine value"; algorithm Rankine := (9/5)*Kelvin;end to_degRk;
Type | Name | Default | Description |
---|---|---|---|
Temperature_degRk | Rankine | Rankine value [degRk] |
Type | Name | Description |
---|---|---|
Temperature | Kelvin | Kelvin value [K] |
function from_degRk "Convert from °Rankine to Kelvin" extends ConversionIcon; input NonSIunits.Temperature_degRk Rankine "Rankine value"; output Temperature Kelvin "Kelvin value"; algorithm Kelvin := (5/9)*Rankine;end from_degRk;
Type | Name | Default | Description |
---|---|---|---|
Angle | radian | radian value [rad] |
Type | Name | Description |
---|---|---|
Angle_deg | degree | degree value [deg] |
function to_deg "Convert from radian to degree" extends ConversionIcon; input Angle radian "radian value"; output NonSIunits.Angle_deg degree "degree value"; algorithm degree := (180.0/Modelica.Constants.pi)*radian;end to_deg;
Type | Name | Default | Description |
---|---|---|---|
Angle_deg | degree | degree value [deg] |
Type | Name | Description |
---|---|---|
Angle | radian | radian value [rad] |
function from_deg "Convert from degree to radian" extends ConversionIcon; input NonSIunits.Angle_deg degree "degree value"; output Angle radian "radian value"; algorithm radian := (Modelica.Constants.pi/180.0)*degree;end from_deg;
Type | Name | Default | Description |
---|---|---|---|
AngularVelocity | rs | radian per second value [rad/s] |
Type | Name | Description |
---|---|---|
AngularVelocity_rpm | rpm | revolutions per minute value [1/min] |
function to_rpm "Convert from radian per second to revolutions per minute" extends ConversionIcon; input AngularVelocity rs "radian per second value"; output NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value"; algorithm rpm := (30/Modelica.Constants.pi)*rs;end to_rpm;
Type | Name | Default | Description |
---|---|---|---|
AngularVelocity_rpm | rpm | revolutions per minute value [1/min] |
Type | Name | Description |
---|---|---|
AngularVelocity | rs | radian per second value [rad/s] |
function from_rpm "Convert from revolutions per minute to radian per second" extends ConversionIcon; input NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value"; output AngularVelocity rs "radian per second value"; algorithm rs := (Modelica.Constants.pi/30)*rpm;end from_rpm;
Type | Name | Default | Description |
---|---|---|---|
Velocity | ms | metre per second value [m/s] |
Type | Name | Description |
---|---|---|
Velocity_kmh | kmh | kilometre per hour value [km/h] |
function to_kmh "Convert from metre per second to kilometre per hour" extends ConversionIcon; input Velocity ms "metre per second value"; output NonSIunits.Velocity_kmh kmh "kilometre per hour value"; algorithm kmh := 3.6*ms;end to_kmh;
Type | Name | Default | Description |
---|---|---|---|
Velocity_kmh | kmh | kilometre per hour value [km/h] |
Type | Name | Description |
---|---|---|
Velocity | ms | metre per second value [m/s] |
function from_kmh "Convert from kilometre per hour to metre per second" extends ConversionIcon; input NonSIunits.Velocity_kmh kmh "kilometre per hour value"; output Velocity ms "metre per second value"; algorithm ms := kmh/3.6;end from_kmh;
Type | Name | Default | Description |
---|---|---|---|
Time | s | second value [s] |
Type | Name | Description |
---|---|---|
Time_day | day | day value [d] |
function to_day "Convert from second to day" extends ConversionIcon; input Time s "second value"; output NonSIunits.Time_day day "day value"; algorithm day := s/86400;end to_day;
Type | Name | Default | Description |
---|---|---|---|
Time_day | day | day value [d] |
Type | Name | Description |
---|---|---|
Time | s | second value [s] |
function from_day "Convert from day to second" extends ConversionIcon; input NonSIunits.Time_day day "day value"; output Time s "second value"; algorithm s := 86400*day;end from_day;
Type | Name | Default | Description |
---|---|---|---|
Time | s | second value [s] |
Type | Name | Description |
---|---|---|
Time_hour | hour | hour value [h] |
function to_hour "Convert from second to hour" extends ConversionIcon; input Time s "second value"; output NonSIunits.Time_hour hour "hour value"; algorithm hour := s/3600;end to_hour;
Type | Name | Default | Description |
---|---|---|---|
Time_hour | hour | hour value [h] |
Type | Name | Description |
---|---|---|
Time | s | second value [s] |
function from_hour "Convert from hour to second" extends ConversionIcon; input NonSIunits.Time_hour hour "hour value"; output Time s "second value"; algorithm s := 3600*hour;end from_hour;
Type | Name | Default | Description |
---|---|---|---|
Time | s | second value [s] |
Type | Name | Description |
---|---|---|
Time_minute | minute | minute value [min] |
function to_minute "Convert from second to minute" extends ConversionIcon; input Time s "second value"; output NonSIunits.Time_minute minute "minute value"; algorithm minute := s/60;end to_minute;
Type | Name | Default | Description |
---|---|---|---|
Time_minute | minute | minute value [min] |
Type | Name | Description |
---|---|---|
Time | s | second value [s] |
function from_minute "Convert from minute to second" extends ConversionIcon; input NonSIunits.Time_minute minute "minute value"; output Time s "second value"; algorithm s := 60*minute;end from_minute;
Type | Name | Default | Description |
---|---|---|---|
Volume | m3 | cubic metre value [m3] |
Type | Name | Description |
---|---|---|
Volume_litre | litre | litre value [l] |
function to_litre "Convert from cubic metre to litre" extends ConversionIcon; input Volume m3 "cubic metre value"; output NonSIunits.Volume_litre litre "litre value"; algorithm litre := 1000*m3;end to_litre;
Type | Name | Default | Description |
---|---|---|---|
Volume_litre | litre | litre value [l] |
Type | Name | Description |
---|---|---|
Volume | m3 | cubic metre value [m3] |
function from_litre "Convert from litre to cubic metre" extends ConversionIcon; input NonSIunits.Volume_litre litre "litre value"; output Volume m3 "cubic metre value"; algorithm m3 := litre/1000;end from_litre;
Type | Name | Default | Description |
---|---|---|---|
Energy | J | Joule value [J] |
Type | Name | Description |
---|---|---|
Energy_kWh | kWh | kWh value [kW.h] |
function to_kWh "Convert from Joule to kilo Watt hour" extends ConversionIcon; input Energy J "Joule value"; output NonSIunits.Energy_kWh kWh "kWh value"; algorithm kWh := J/3.6e6;end to_kWh;
Type | Name | Default | Description |
---|---|---|---|
Energy_kWh | kWh | kWh value [kW.h] |
Type | Name | Description |
---|---|---|
Energy | J | Joule value [J] |
function from_kWh "Convert from kilo Watt hour to Joule" extends ConversionIcon; input NonSIunits.Energy_kWh kWh "kWh value"; output Energy J "Joule value"; algorithm J := 3.6e6*kWh;end from_kWh;
Type | Name | Default | Description |
---|---|---|---|
Pressure | Pa | Pascal value [Pa] |
Type | Name | Description |
---|---|---|
Pressure_bar | bar | bar value [bar] |
function to_bar "Convert from Pascal to bar" extends ConversionIcon; input Pressure Pa "Pascal value"; output NonSIunits.Pressure_bar bar "bar value"; algorithm bar := Pa/1e5;end to_bar;
Type | Name | Default | Description |
---|---|---|---|
Pressure_bar | bar | bar value [bar] |
Type | Name | Description |
---|---|---|
Pressure | Pa | Pascal value [Pa] |
function from_bar "Convert from bar to Pascal" extends ConversionIcon; input NonSIunits.Pressure_bar bar "bar value"; output Pressure Pa "Pascal value"; algorithm Pa := 1e5*bar;end from_bar;
Type | Name | Default | Description |
---|---|---|---|
MassFlowRate | kgps | kg/s value [kg/s] |
Type | Name | Description |
---|---|---|
MassFlowRate_gps | gps | g/s value [g/s] |
function to_gps "Convert from kilogram per second to gram per second" extends ConversionIcon; input MassFlowRate kgps "kg/s value"; output NonSIunits.MassFlowRate_gps gps "g/s value"; algorithm gps := 1000*kgps;end to_gps;
Type | Name | Default | Description |
---|---|---|---|
MassFlowRate_gps | gps | g/s value [g/s] |
Type | Name | Description |
---|---|---|
MassFlowRate | kgps | kg/s value [kg/s] |
function from_gps "Convert from gram per second to kilogram per second" extends ConversionIcon; input NonSIunits.MassFlowRate_gps gps "g/s value"; output MassFlowRate kgps "kg/s value"; algorithm kgps := gps/1000;end from_gps;
partial function ConversionIcon "Base icon for conversion functions"end ConversionIcon;
Type | Name | Default | Description |
---|---|---|---|
Frequency | f | frequency [Hz] |
Type | Name | Description |
---|---|---|
AngularVelocity | w | angular velocity [rad/s] |
function from_Hz "Convert from Hz to rad/s" extends Modelica.SIunits.Conversions.ConversionIcon; input Modelica.SIunits.Frequency f "frequency"; output Modelica.SIunits.AngularVelocity w "angular velocity"; algorithm w := 2*Modelica.Constants.pi*f;end from_Hz;
Type | Name | Default | Description |
---|---|---|---|
AngularVelocity | w | angular velocity [rad/s] |
Type | Name | Description |
---|---|---|
Frequency | f | frequency [Hz] |
function to_Hz "Convert from rad/s to Hz" extends Modelica.SIunits.Conversions.ConversionIcon; input Modelica.SIunits.AngularVelocity w "angular velocity"; output Modelica.SIunits.Frequency f "frequency"; algorithm f := w/(2*Modelica.Constants.pi);end to_Hz;