## Modelica.SIunits.Conversions

Conversion functions to/from non SI units and type definitions of non SI units

### Information

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:

      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

The following conversion functions are provided. Note, that all of them have one Real input and one Real output argument:

Function | Description
--- | ---
to_degC from_degC | Convert from Kelvin to degree Celsius Convert from degree Celsius to Kelvin
to_degF from_degF | Convert from Kelvin to degree Fahrenheit Convert from degree Fahrenheit to Kelvin
to_degRk from_degRk | Convert from Kelvin to degree Rankine Convert from degree Rankine to Kelvin
to_deg from_deg | Convert from radian to degree Convert from degree to radian
to_rpm from_rpm | Convert from radian per second to revolutions per minute Convert from revolutions per minute to radian per second
to_kmh from_kmh | Convert from metre per second to kilometre per hour Convert from kilometre per hour to metre per second
to_day from_day | Convert from second to day Convert from day to second
to_hour from_hour | Convert from second to hour Convert from hour to second
to_minute from_minute | Convert from second to minute Convert from minute to second
to_litre from_litre | Convert from cubic metre to litre Convert from litre to cubic metre
to_kWh from_kWh | Convert from Joule to kilo Watt hour Convert from kilo Watt hour to Joule
to_bar from_bar | Convert from Pascal to bar Convert from bar to Pascal
to_gps from_gps | Convert from kilogram per second to gram per second Convert from gram per second to kilogram per second

There is the additional partial function ConversionIcon in this package. It contains just the base icon for all the conversion functions.

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

## Modelica.SIunits.Conversions.to_degC

Convert from Kelvin to °Celsius

### Inputs

Name | Default | Description
--- | --- | ---
Kelvin |  | Kelvin value [K]

### Outputs

Name | Default | Description
--- | --- | ---
Celsius |  | Celsius value [degC]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_degC

Convert from °Celsius to Kelvin

### Inputs

Name | Default | Description
--- | --- | ---
Celsius |  | Celsius value [degC]

### Outputs

Name | Default | Description
--- | --- | ---
Kelvin |  | Kelvin value [K]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_degF

Convert from Kelvin to °Fahrenheit

### Inputs

Name | Default | Description
--- | --- | ---
Kelvin |  | Kelvin value [K]

### Outputs

Name | Default | Description
--- | --- | ---
Fahrenheit |  | Fahrenheit value [degF]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_degF

Convert from °Fahrenheit to Kelvin

### Inputs

Name | Default | Description
--- | --- | ---
Fahrenheit |  | Fahrenheit value [degF]

### Outputs

Name | Default | Description
--- | --- | ---
Kelvin |  | Kelvin value [K]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_degRk

Convert from Kelvin to °Rankine

### Inputs

Name | Default | Description
--- | --- | ---
Kelvin |  | Kelvin value [K]

### Outputs

Name | Default | Description
--- | --- | ---
Rankine |  | Rankine value [degRk]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_degRk

Convert from °Rankine to Kelvin

### Inputs

Name | Default | Description
--- | --- | ---
Rankine |  | Rankine value [degRk]

### Outputs

Name | Default | Description
--- | --- | ---
Kelvin |  | Kelvin value [K]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_deg

Convert from radian to degree

### Inputs

Name | Default | Description
--- | --- | ---
radian |  | radian value [rad]

### Outputs

Name | Default | Description
--- | --- | ---
degree |  | degree value [deg]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_deg

Convert from degree to radian

### Inputs

Name | Default | Description
--- | --- | ---
degree |  | degree value [deg]

### Outputs

Name | Default | Description
--- | --- | ---
radian |  | radian value [rad]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_rpm

Convert from radian per second to revolutions per minute

### Inputs

Name | Default | Description
--- | --- | ---
rs |  | radian per second value [rad/s]

### Outputs

Name | Default | Description
--- | --- | ---
rpm |  | revolutions per minute value [rev/min]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_rpm

Convert from revolutions per minute to radian per second

### Inputs

Name | Default | Description
--- | --- | ---
rpm |  | revolutions per minute value [rev/min]

### Outputs

Name | Default | Description
--- | --- | ---
rs |  | radian per second value [rad/s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_kmh

Convert from metre per second to kilometre per hour

### Inputs

Name | Default | Description
--- | --- | ---
ms |  | metre per second value [m/s]

### Outputs

Name | Default | Description
--- | --- | ---
kmh |  | kilometre per hour value [km/h]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_kmh

Convert from kilometre per hour to metre per second

### Inputs

Name | Default | Description
--- | --- | ---
kmh |  | kilometre per hour value [km/h]

### Outputs

Name | Default | Description
--- | --- | ---
ms |  | metre per second value [m/s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_day

Convert from second to day

### Inputs

Name | Default | Description
--- | --- | ---
s |  | second value [s]

### Outputs

Name | Default | Description
--- | --- | ---
day |  | day value [d]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_day

Convert from day to second

### Inputs

Name | Default | Description
--- | --- | ---
day |  | day value [d]

### Outputs

Name | Default | Description
--- | --- | ---
s |  | second value [s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_hour

Convert from second to hour

### Inputs

Name | Default | Description
--- | --- | ---
s |  | second value [s]

### Outputs

Name | Default | Description
--- | --- | ---
hour |  | hour value [h]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_hour

Convert from hour to second

### Inputs

Name | Default | Description
--- | --- | ---
hour |  | hour value [h]

### Outputs

Name | Default | Description
--- | --- | ---
s |  | second value [s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_minute

Convert from second to minute

### Inputs

Name | Default | Description
--- | --- | ---
s |  | second value [s]

### Outputs

Name | Default | Description
--- | --- | ---
minute |  | minute value [min]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_minute

Convert from minute to second

### Inputs

Name | Default | Description
--- | --- | ---
minute |  | minute value [min]

### Outputs

Name | Default | Description
--- | --- | ---
s |  | second value [s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_litre

Convert from cubic metre to litre

### Inputs

Name | Default | Description
--- | --- | ---
m3 |  | cubic metre value [m3]

### Outputs

Name | Default | Description
--- | --- | ---
litre |  | litre value [l]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_litre

Convert from litre to cubic metre

### Inputs

Name | Default | Description
--- | --- | ---
litre |  | litre value [l]

### Outputs

Name | Default | Description
--- | --- | ---
m3 |  | cubic metre value [m3]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_kWh

Convert from Joule to kilo Watt hour

### Inputs

Name | Default | Description
--- | --- | ---
J |  | Joule value [J]

### Outputs

Name | Default | Description
--- | --- | ---
kWh |  | kWh value [kWh]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_kWh

Convert from kilo Watt hour to Joule

### Inputs

Name | Default | Description
--- | --- | ---
kWh |  | kWh value [kWh]

### Outputs

Name | Default | Description
--- | --- | ---
J |  | Joule value [J]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_bar

Convert from Pascal to bar

### Inputs

Name | Default | Description
--- | --- | ---
Pa |  | Pascal value [Pa]

### Outputs

Name | Default | Description
--- | --- | ---
bar |  | bar value [bar]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_bar

Convert from bar to Pascal

### Inputs

Name | Default | Description
--- | --- | ---
bar |  | bar value [bar]

### Outputs

Name | Default | Description
--- | --- | ---
Pa |  | Pascal value [Pa]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.to_gps

Convert from kilogram per second to gram per second

### Inputs

Name | Default | Description
--- | --- | ---
kgps |  | kg/s value [kg/s]

### Outputs

Name | Default | Description
--- | --- | ---
gps |  | g/s value [g/s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.from_gps

Convert from gram per second to kilogram per second

### Inputs

Name | Default | Description
--- | --- | ---
gps |  | g/s value [g/s]

### Outputs

Name | Default | Description
--- | --- | ---
kgps |  | kg/s value [kg/s]

### Modelica definition

    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;

## Modelica.SIunits.Conversions.ConversionIcon

Base icon for conversion functions

### Modelica definition

    partial function ConversionIcon "Base icon for conversion functions"
    end ConversionIcon;