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

Package Content

NameDescription
Modelica.SIunits.Conversions.NonSIunits NonSIunits Type definitions of non SI units
Modelica.SIunits.Conversions.to_degC to_degC Convert from Kelvin to °Celsius
Modelica.SIunits.Conversions.from_degC from_degC Convert from °Celsius to Kelvin
Modelica.SIunits.Conversions.to_degF to_degF Convert from Kelvin to °Fahrenheit
Modelica.SIunits.Conversions.from_degF from_degF Convert from °Fahrenheit to Kelvin
Modelica.SIunits.Conversions.to_degRk to_degRk Convert from Kelvin to °Rankine
Modelica.SIunits.Conversions.from_degRk from_degRk Convert from °Rankine to Kelvin
Modelica.SIunits.Conversions.to_deg to_deg Convert from radian to degree
Modelica.SIunits.Conversions.from_deg from_deg Convert from degree to radian
Modelica.SIunits.Conversions.to_rpm to_rpm Convert from radian per second to revolutions per minute
Modelica.SIunits.Conversions.from_rpm from_rpm Convert from revolutions per minute to radian per second
Modelica.SIunits.Conversions.to_kmh to_kmh Convert from metre per second to kilometre per hour
Modelica.SIunits.Conversions.from_kmh from_kmh Convert from kilometre per hour to metre per second
Modelica.SIunits.Conversions.to_day to_day Convert from second to day
Modelica.SIunits.Conversions.from_day from_day Convert from day to second
Modelica.SIunits.Conversions.to_hour to_hour Convert from second to hour
Modelica.SIunits.Conversions.from_hour from_hour Convert from hour to second
Modelica.SIunits.Conversions.to_minute to_minute Convert from second to minute
Modelica.SIunits.Conversions.from_minute from_minute Convert from minute to second
Modelica.SIunits.Conversions.to_litre to_litre Convert from cubic metre to litre
Modelica.SIunits.Conversions.from_litre from_litre Convert from litre to cubic metre
Modelica.SIunits.Conversions.to_kWh to_kWh Convert from Joule to kilo Watt hour
Modelica.SIunits.Conversions.from_kWh from_kWh Convert from kilo Watt hour to Joule
Modelica.SIunits.Conversions.to_bar to_bar Convert from Pascal to bar
Modelica.SIunits.Conversions.from_bar from_bar Convert from bar to Pascal
Modelica.SIunits.Conversions.to_gps to_gps Convert from kilogram per second to gram per second
Modelica.SIunits.Conversions.from_gps from_gps Convert from gram per second to kilogram per second
Modelica.SIunits.Conversions.ConversionIcon ConversionIcon Base icon for conversion functions
Modelica.SIunits.Conversions.from_Hz from_Hz Convert from Hz to rad/s
Modelica.SIunits.Conversions.to_Hz to_Hz Convert from rad/s to Hz


Modelica.SIunits.Conversions.to_degC Modelica.SIunits.Conversions.to_degC

Convert from Kelvin to °Celsius

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
TemperatureKelvin Kelvin value [K]

Outputs

TypeNameDescription
Temperature_degCCelsiusCelsius 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 Modelica.SIunits.Conversions.from_degC

Convert from °Celsius to Kelvin

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Temperature_degCCelsius Celsius value [degC]

Outputs

TypeNameDescription
TemperatureKelvinKelvin 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 Modelica.SIunits.Conversions.to_degF

Convert from Kelvin to °Fahrenheit

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
TemperatureKelvin Kelvin value [K]

Outputs

TypeNameDescription
Temperature_degFFahrenheitFahrenheit 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 Modelica.SIunits.Conversions.from_degF

Convert from °Fahrenheit to Kelvin

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Temperature_degFFahrenheit Fahrenheit value [degF]

Outputs

TypeNameDescription
TemperatureKelvinKelvin 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 Modelica.SIunits.Conversions.to_degRk

Convert from Kelvin to °Rankine

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
TemperatureKelvin Kelvin value [K]

Outputs

TypeNameDescription
Temperature_degRkRankineRankine 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 Modelica.SIunits.Conversions.from_degRk

Convert from °Rankine to Kelvin

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Temperature_degRkRankine Rankine value [degRk]

Outputs

TypeNameDescription
TemperatureKelvinKelvin 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 Modelica.SIunits.Conversions.to_deg

Convert from radian to degree

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Angleradian radian value [rad]

Outputs

TypeNameDescription
Angle_degdegreedegree 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 Modelica.SIunits.Conversions.from_deg

Convert from degree to radian

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Angle_degdegree degree value [deg]

Outputs

TypeNameDescription
Angleradianradian 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 Modelica.SIunits.Conversions.to_rpm

Convert from radian per second to revolutions per minute

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
AngularVelocityrs radian per second value [rad/s]

Outputs

TypeNameDescription
AngularVelocity_rpmrpmrevolutions per minute value [1/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 Modelica.SIunits.Conversions.from_rpm

Convert from revolutions per minute to radian per second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
AngularVelocity_rpmrpm revolutions per minute value [1/min]

Outputs

TypeNameDescription
AngularVelocityrsradian 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 Modelica.SIunits.Conversions.to_kmh

Convert from metre per second to kilometre per hour

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Velocityms metre per second value [m/s]

Outputs

TypeNameDescription
Velocity_kmhkmhkilometre 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 Modelica.SIunits.Conversions.from_kmh

Convert from kilometre per hour to metre per second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Velocity_kmhkmh kilometre per hour value [km/h]

Outputs

TypeNameDescription
Velocitymsmetre 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 Modelica.SIunits.Conversions.to_day

Convert from second to day

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Times second value [s]

Outputs

TypeNameDescription
Time_daydayday 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 Modelica.SIunits.Conversions.from_day

Convert from day to second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Time_dayday day value [d]

Outputs

TypeNameDescription
Timessecond 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 Modelica.SIunits.Conversions.to_hour

Convert from second to hour

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Times second value [s]

Outputs

TypeNameDescription
Time_hourhourhour 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 Modelica.SIunits.Conversions.from_hour

Convert from hour to second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Time_hourhour hour value [h]

Outputs

TypeNameDescription
Timessecond 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 Modelica.SIunits.Conversions.to_minute

Convert from second to minute

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Times second value [s]

Outputs

TypeNameDescription
Time_minuteminuteminute 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 Modelica.SIunits.Conversions.from_minute

Convert from minute to second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Time_minuteminute minute value [min]

Outputs

TypeNameDescription
Timessecond 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 Modelica.SIunits.Conversions.to_litre

Convert from cubic metre to litre

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Volumem3 cubic metre value [m3]

Outputs

TypeNameDescription
Volume_litrelitrelitre 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 Modelica.SIunits.Conversions.from_litre

Convert from litre to cubic metre

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Volume_litrelitre litre value [l]

Outputs

TypeNameDescription
Volumem3cubic 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 Modelica.SIunits.Conversions.to_kWh

Convert from Joule to kilo Watt hour

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
EnergyJ Joule value [J]

Outputs

TypeNameDescription
Energy_kWhkWhkWh value [kW.h]

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 Modelica.SIunits.Conversions.from_kWh

Convert from kilo Watt hour to Joule

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Energy_kWhkWh kWh value [kW.h]

Outputs

TypeNameDescription
EnergyJJoule 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 Modelica.SIunits.Conversions.to_bar

Convert from Pascal to bar

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
PressurePa Pascal value [Pa]

Outputs

TypeNameDescription
Pressure_barbarbar 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 Modelica.SIunits.Conversions.from_bar

Convert from bar to Pascal

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Pressure_barbar bar value [bar]

Outputs

TypeNameDescription
PressurePaPascal 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 Modelica.SIunits.Conversions.to_gps

Convert from kilogram per second to gram per second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
MassFlowRatekgps kg/s value [kg/s]

Outputs

TypeNameDescription
MassFlowRate_gpsgpsg/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 Modelica.SIunits.Conversions.from_gps

Convert from gram per second to kilogram per second

Information

Extends from ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
MassFlowRate_gpsgps g/s value [g/s]

Outputs

TypeNameDescription
MassFlowRatekgpskg/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 Modelica.SIunits.Conversions.ConversionIcon

Base icon for conversion functions

Modelica definition

partial function ConversionIcon "Base icon for conversion functions"

end ConversionIcon;

Modelica.SIunits.Conversions.from_Hz Modelica.SIunits.Conversions.from_Hz

Convert from Hz to rad/s

Information

Extends from Modelica.SIunits.Conversions.ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
Frequencyf frequency [Hz]

Outputs

TypeNameDescription
AngularVelocitywangular velocity [rad/s]

Modelica definition

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;

Modelica.SIunits.Conversions.to_Hz Modelica.SIunits.Conversions.to_Hz

Convert from rad/s to Hz

Information

Extends from Modelica.SIunits.Conversions.ConversionIcon (Base icon for conversion functions).

Inputs

TypeNameDefaultDescription
AngularVelocityw angular velocity [rad/s]

Outputs

TypeNameDescription
Frequencyffrequency [Hz]

Modelica definition

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;

HTML-documentation generated by Dymola Sun Jan 17 21:12:48 2010.