root/branches/maintenance/2.2.2/Modelica/SIunits.mo

Revision 732, 71.1 kB (checked in by otter, 10 months ago)

Changed "r/min" back to the original "rev/min", since a simple unit check
in connecors (whether unit strings are identical) will result in an error
with this change, if user models used "rev/min" already.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1within Modelica;
2package SIunits
3  "Library of type and unit definitions based on SI units according to ISO 31-1992" 
4package UsersGuide "User's Guide of SIunits Library" 
5   
6  annotation (DocumentationClass=true, Documentation(info="<HTML>
7<p>
8Library <b>SIunits</b> is a <b>free</b> Modelica package providing
9predefined types, such as <i>Mass</i>,
10<i>Length</i>, <i>Time</i>, based on the international standard
11on units.</p>
12 
13</HTML>"));
14   
15  class HowToUseSIunits "How to use SIunits" 
16     
17    annotation (DocumentationClass=true, Documentation(info="<html>
18<p>
19When implementing a Modelica model, every variable needs to
20be declared. Physical variables should be declared with a unit.
21The basic approach in Modelica is that the unit attribute of
22a variable is the <b>unit</b> in which the <b>equations</b> are <b>written</b>,
23for example:
24</p>
25 
26<pre>   <b>model</b> MassOnGround
27     <b>parameter</b> Real m(quantity=\"Mass\", unit=\"kg\") \"Mass\";
28     <b>parameter</b> Real f(quantity=\"Force\", unit=\"N\") \"Driving force\";
29     Real s(unit=\"m\") \"Position of mass\";
30     Real v(unit=\"m/s\") \"Velocity of mass\";
31   <b>equation</b>
32     <b>der</b>(s) = v;
33     m*<b>der</b>(v) = f;
34   <b>end</b> MassOnGround;
35</pre>
36 
37<p>
38This means that the equations in the equation section are only correct
39for the specified units. A different issue is the user interface, i.e.,
40in which unit the variable is presented to the user in graphical
41user interfaces, both for input (e.g., parameter menu), as well as
42for output (e.g., in the plot window). Preferably, the Modelica tool
43should provide a list of units from which the user can select, e.g.,
44\"m\", \"cm\", \"km\", \"inch\" for quantity \"Length\". When storing the value in
45the model as a Modelica modifier, it has to be converted to the unit defined
46in the declaration. Additionally, the unit used in the graphical
47user interface has to be stored. In order to have a standardized way
48of doing this, Modelica provides the following three attributs
49for a variable of type Real:
50</p>
51 
52<ul>
53<li><b>quantity</b> to define the physical quantity (e.g. \"Length\", or \"Energy\").</li>
54<li><b>unit</b> to define the unit that has to be used
55    in order that the equations are correct (e.g. \"N.m\").</li>
56<li><b>displayUnit</b> to define the unit used in the graphical
57    user interface as default display unit for input and/or output.</li>
58</ul>
59 
60<p>
61Note, a unit, such as \"N.m\", is not sufficient to define uniquely the
62physical quantity, since, e.g., \"N.m\" might be either \"torque\" or
63\"energy\". The \"quantity\" attribute might therefore be used by a tool
64to select the corresponding menu from which the user can select
65a unit for the corresponding variable.
66</p>
67 
68<p>
69For example, after providing a value for \"m\" and \"f\" in a parameter
70menu of an instance of MassOnGround, a tool might generate the following code:
71</p>
72 
73<pre>
74   MassOnGround myObject(m(displayUnit=\"g\")=2, f=3);
75</pre>
76 
77<p>
78The meaning is that in the equations a value of \"2\" is used
79and that in the graphical user interface a value of \"2000\" should be used,
80together with the unit \"g\" from the unit set \"Mass\" (= the quantity name).
81Note, according to the Modelica specification
82a tool might ignore the \"displayUnit\" attribute.
83</p>
84 
85<p>
86In order to help the Modelica model developer, the Modelica.SIunits
87library provides about 450 predefined type names,
88together with values for the attributes <b>quantity</b>, <b>unit</b> and sometimes
89<b>displayUnit</b> and <b>min</b>. The unit is always selected as SI-unit according to the
90ISO standard. The type and the quantity names are the
91quantity names used in the ISO standard. \"quantity\" and \"unit\" are defined
92as \"<b>final</b>\" in order that they cannot be modified. Attributes \"displayUnit\"
93and \"min\" can, however, be changed in a model via a modification. The example above,
94might therefore be alternatively also defined as:
95</p>
96 
97<pre>   <b>model</b> MassOnGround
98     <b>parameter</b> Modelica.SIunits.Mass  m \"Mass\";
99     <b>parameter</b> Modelica.SIunits.Force f \"Driving force\";
100     ...
101   <b>end</b> MassOnGround;
102</pre>
103 
104<p>
105or in a short hand notation as
106</p>
107 
108<pre>
109   <b>model</b> MassOnGround
110     <b>import</b> SI = Modelica.SIunits;
111     <b>parameter</b> SI.Mass  m \"Mass\";
112     <b>parameter</b> SI.Force f \"Driving force\";
113     ...
114   <b>end</b> MassOnGround;
115</pre>
116 
117<p>
118For some often
119used Non SI-units (like hour), some additional type definitions are
120present as Modelica.SIunits.Conversions.NonSIunits. If this is not sufficient,
121the user has to define its own types or use the attributes directly
122in the declaration as in the example at the beginning.
123</p>
124 
125</html>"));
126     
127  end HowToUseSIunits;
128   
129  class Conventions "Conventions" 
130     
131    annotation (DocumentationClass=true, Documentation(info="<html>
132<p>The following conventions are used in package SIunits:</p>
133<ul>
134<li>Modelica quantity names are defined according to the recommendations
135    of ISO 31. Some of these name are rather long, such as
136    \"ThermodynamicTemperature\". Shorter alias names are defined, e.g.,
137    \"type Temp_K = ThermodynamicTemperature;\".</li>
138<li>Modelica units are defined according to the SI base units without
139    multiples (only exception \"kg\").</li>
140<li>For some quantities, more convenient units for an engineer are
141    defined as \"displayUnit\", i.e., the default unit for display
142    purposes (e.g., displayUnit=\"deg\" for quantity=\"Angle\").</li>
143<li>The type name is identical to the quantity name, following
144    the convention of type names.</li>
145<li>All quantity and unit attributes are defined as final in order
146    that they cannot be redefined to another value.</li>
147<li>Similiar quantities, such as \"Length, Breadth, Height, Thickness,
148    Radius\" are defined as the same quantity (here: \"Length\").</li>
149<li>The ordering of the type declarations in this package follows ISO 31:
150<pre>
151  Chapter  1: <b>Space and Time</b>
152  Chapter  2: <b>Periodic and Related Phenomena</b>
153  Chapter  3: <b>Mechanics</b>
154  Chapter  4: <b>Heat</b>
155  Chapter  5: <b>Electricity and Magnetism</b>
156  Chapter  6: <b>Light and Related Electro-Magnetic Radiations</b>
157  Chapter  7: <b>Acoustics</b>
158  Chapter  8: <b>Physical Chemistry</b>
159  Chapter  9: <b>Atomic and Nuclear Physics</b>
160  Chapter 10: <b>Nuclear Reactions and Ionizing Radiations</b>
161  Chapter 11: (not defined in ISO 31-1992)
162  Chapter 12: <b>Characteristic Numbers</b>
163  Chapter 13: <b>Solid State Physics</b>
164</pre>
165</li>
166<li>Conversion functions between SI and non-SI units are available in subpackage
167    <b>Conversions</b>.</li>
168</ul>
169</html>"));
170     
171  end Conventions;
172   
173  class Literature "Literature" 
174     
175    annotation (Documentation(info="<html>
176<p> This package is based on the following references
177</p>
178 
179<dl>
180<dt>ISO 31-1992:</dt>
181<dd> <b>General principles concerning
182    quantities, units and symbols</b>.<br>&nbsp;</dd>
183 
184<dt>ISO 1000-1992:</dt>
185<dd> <b>SI units and recommendations for the use
186    of their multiples and of certain other units</b>.<br>&nbsp;</dd>
187 
188<dt>Cardarelli F.:</dt>
189<dd> <b>Scientific Unit Conversion - A Practical
190     Guide to Metrication</b>. Springer 1997.</dd>
191</dl>
192 
193</html>
194"));
195  end Literature;
196   
197  class Contact "Contact" 
198     
199    annotation (Documentation(info="<html>
200<dl>
201<dt><b>Main Author:</b>
202<dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
203    Deutsches Zentrum f&uuml;r Luft und Raumfahrt e.V. (DLR)<br>
204    Institut f&uuml;r Robotik und Mechatronik<br> 
205    Abteilung f&uuml;r Entwurfsorientierte Regelungstechnik<br>
206    Postfach 1116<br>
207    D-82230 Wessling<br>
208    Germany<br>
209    email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
210</dl>
211 
212 
213<p><b>Acknowledgements:</b></p>
214<ul>
215<li> Astrid Jaschinski, Hubertus Tummescheit and Christian Schweiger
216     contributed to the implementation of this package.</li>
217</ul>
218</html>
219"));
220  end Contact;
221   
222end UsersGuide;
223  extends Modelica.Icons.Library2;
224 
225  annotation(preferedView="info",
226    Window(
227      x=0.08,
228      y=0.04,
229      width=0.58,
230      height=0.84,
231      library=1,
232      autolayout=1),
233    Invisible=true,
234    Icon(Text(
235        extent=[-63, -13; 45, -67],
236        string="[kg.m2]",
237        style(color=0))),
238    Documentation(info="<html>
239<p>This package provides predefined types, such as <i>Mass</i>,
240<i>Angle</i>, <i>Time</i>, based on the international standard
241on units, e.g.,
242</p>
243 
244<pre>   <b>type</b> Angle = Real(<b>final</b> quantity = \"Angle\",
245                     <b>final</b> unit     = \"rad\",
246                     displayUnit    = \"deg\");
247</pre>
248 
249<p>
250as well as conversion functions from non SI-units to SI-units
251and vice versa in subpackage
252<a href=\"Modelica://Modelica.SIunits.Conversions\">Conversions</a>.
253</p>
254 
255<p>
256For an introduction how units are used in the Modelica standard library
257with package SIunits, have a look at:
258<a href=\"Modelica://Modelica.SIunits.UsersGuide.HowToUseSIunits\">How to use SIunits</a>.
259</p>
260 
261<p>
262Copyright &copy; 1998-2007, Modelica Association and DLR.
263</p>
264<p>
265<i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified
266under the terms of the <b>Modelica license</b>, see the license conditions
267and the accompanying <b>disclaimer</b> 
268<a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i>
269</p>
270 
271</html>", revisions="<html>
272<ul>
273<li><i>Dec. 14, 2005</i>
274       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
275       Add User's Guide and removed \"min\" values for Resistance and Conductance.</li>
276<li><i>October 21, 2002</i>
277       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
278       and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
279       Added new package <b>Conversions</b>. Corrected typo <i>Wavelenght</i>.</li>
280<li><i>June 6, 2000</i>
281       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
282       Introduced the following new types<br>
283       type Temperature = ThermodynamicTemperature;<br>
284       types DerDensityByEnthalpy, DerDensityByPressure,
285       DerDensityByTemperature, DerEnthalpyByPressure,
286       DerEnergyByDensity, DerEnergyByPressure<br>
287       Attribute \"final\" removed from min and max values
288       in order that these values can still be changed to narrow
289       the allowed range of values.<br>
290       Quantity=\"Stress\" removed from type \"Stress\", in order
291       that a type \"Stress\" can be connected to a type \"Pressure\".</li>
292<li><i>Oct. 27, 1999</i>
293       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
294       New types due to electrical library: Transconductance, InversePotential,
295       Damping.</li>
296<li><i>Sept. 18, 1999</i>
297       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
298       Renamed from SIunit to SIunits. Subpackages expanded, i.e., the
299       SIunits package, does no longer contain subpackages.</li>
300<li><i>Aug 12, 1999</i>
301       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
302       Type \"Pressure\" renamed to \"AbsolutePressure\" and introduced a new
303       type \"Pressure\" which does not contain a minimum of zero in order
304       to allow convenient handling of relative pressure. Redefined
305       BulkModulus as an alias to AbsolutePressure instead of Stress, since
306       needed in hydraulics.</li>
307<li><i>June 29, 1999</i>
308       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
309       Bug-fix: Double definition of \"Compressibility\" removed
310       and appropriate \"extends Heat\" clause introduced in
311       package SolidStatePhysics to incorporate ThermodynamicTemperature.</li>
312<li><i>April 8, 1998</i>
313       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
314       and Astrid Jaschinski:<br>
315       Complete ISO 31 chapters realized.</li>
316<li><i>Nov. 15, 1997</i>
317       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
318       and <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a>:<br>
319       Some chapters realized.</li>
320</ul>
321</html>"),
322    Diagram(
323      Rectangle(extent=[169, 86; 349, 236], style(fillColor=30, fillPattern=1)),
324      Polygon(points=[169, 236; 189, 256; 369, 256; 349, 236; 169, 236], style(
325            fillColor=30, fillPattern=1)),
326      Polygon(points=[369, 256; 369, 106; 349, 86; 349, 236; 369, 256], style(
327            fillColor=30, fillPattern=1)),
328      Text(
329        extent=[179, 226; 339, 196],
330        string="Library",
331        style(
332          color=9,
333          fillColor=0,
334          fillPattern=1)),
335      Text(
336        extent=[206, 173; 314, 119],
337        string="[kg.m2]",
338        style(color=0)),
339      Text(
340        extent=[163, 320; 406, 264],
341        string="Modelica.SIunits",
342        style(color=1))));
343 
344  package Conversions
345    "Conversion functions to/from non SI units and type definitions of non SI units" 
346   
347    extends Modelica.Icons.Library2;
348   
349    annotation(preferedView="info", Icon(
350        Text(
351          extent=[-33, -7; -92, -67],
352          string="°C",
353          style(color=0, thickness=4)),
354        Text(
355          extent=[82, -7; 22, -67],
356          string="K",
357          style(color=0)),
358        Line(points=[-26, -36; 6, -36], style(color=0)),
359        Polygon(points=[6, -28; 6, -45; 26, -37; 6, -28], style(pattern=0,
360              fillColor=0))), Documentation(info="<HTML>
361<p>This package provides conversion functions from the non SI Units
362defined in package Modelica.SIunits.Conversions.NonSIunits to the
363corresponding SI Units defined in package Modelica.SIunits and vice
364versa. It is recommended to use these functions in the following
365way (note, that all functions have one Real input and one Real output
366argument):</p>
367<pre>
368  <b>import</b> SI = Modelica.SIunits;
369  <b>import</b> Modelica.SIunits.Conversions.*;
370     ...
371  <b>parameter</b> SI.Temperature     T   = from_degC(25);   // convert 25 degree Celsius to Kelvin
372  <b>parameter</b> SI.Angle           phi = from_deg(180);   // convert 180 degree to radian
373  <b>parameter</b> SI.AngularVelocity w   = from_rpm(3600);  // convert 3600 revolutions per minutes
374                                                      // to radian per seconds
375</pre>
376 
377</HTML>
378"));
379   
380    package NonSIunits "Type definitions of non SI units" 
381     
382      extends Modelica.Icons.Library2;
383     
384      type Temperature_degC = Real (final quantity="ThermodynamicTemperature",
385            final unit="degC") 
386        "Absolute temperature in degree Celsius (for relative temperature use SIunits.TemperatureDifference)"
387                                                                                                            annotation(absoluteValue=true);
388      type Temperature_degF = Real (final quantity="ThermodynamicTemperature",
389            final unit="degF") 
390        "Absolute temperature in degree Fahrenheit (for relative temperature use SIunits.TemperatureDifference)"
391                                                                                                            annotation(absoluteValue=true);
392      type Temperature_degRk = Real (final quantity="ThermodynamicTemperature",
393            final unit="degRk") 
394        "Absolute temperature in degree Rankine (for relative temperature use SIunits.TemperatureDifference)"
395                                                                                                            annotation(absoluteValue=true);
396      type Angle_deg = Real (final quantity="Angle", final unit="deg") 
397        "Angle in degree";
398      type AngularVelocity_rpm = Real (final quantity="AngularVelocity", final unit
399            =    "rev/min") "Angular velocity in revolutions per minute";
400      type Velocity_kmh = Real (final quantity="Velocity", final unit="km/h") 
401        "Velocity in kilometers per hour";
402      type Time_day = Real (final quantity="Time", final unit="d") 
403        "Time in days";
404      type Time_hour = Real (final quantity="Time", final unit="h") 
405        "Time in hours";
406      type Time_minute = Real (final quantity="Time", final unit="min") 
407        "Time in minutes";
408      type Volume_litre = Real (final quantity="Volume", final unit="l") 
409        "Volume in litres";
410      type Energy_kWh = Real (final quantity="Energy", final unit="kW.h") 
411        "Energy in kilo watt hours";
412      type Pressure_bar = Real (final quantity="Pressure", final unit="bar") 
413        "Absolute pressure in bar";
414      type MassFlowRate_gps = Real (final quantity="MassFlowRate", final unit=
415              "g/s") "Mass flow rate in gramm per second";
416     
417      annotation(preferedView="info", Documentation(info="<HTML>
418<p>
419This package provides predefined types, such as <b>Angle_deg</b> (angle in
420degree), <b>AngularVelocity_rpm</b> (angular velocity in revolutions per
421minute) or <b>Temperature_degF</b> (temperature in degree Fahrenheit),
422which are in common use but are not part of the international standard on
423units according to ISO 31-1992 \"General principles concerning quantities,
424units and symbols\" and ISO 1000-1992 \"SI units and recommendations for
425the use of their multiples and of certain other units\".</p>
426<p>If possible, the types in this package should not be used. Use instead
427types of package Modelica.SIunits. For more information on units, see also
428the book of Francois Cardarelli <b>Scientific Unit Conversion - A
429Practical Guide to Metrication</b> (Springer 1997).</p>
430<p>Some units, such as <b>Temperature_degC/Temp_C</b> are both defined in
431Modelica.SIunits and in Modelica.Conversions.NonSIunits. The reason is that these
432definitions have been placed erroneously in Modelica.SIunits although they
433are not SIunits. For backward compatibility, these type definitions are
434still kept in Modelica.SIunits.</p>
435</HTML>
436"), Icon(Text(
437            extent=[-66, -13; 52, -67],
438            string="[rev/min]",
439            style(color=0))));
440    end NonSIunits;
441   
442    function to_degC "Convert from Kelvin to °Celsius" 
443      extends ConversionIcon;
444      input Temperature Kelvin "Kelvin value";
445      output NonSIunits.Temperature_degC Celsius "Celsius value";
446      annotation (Icon(Text(
447            extent=[-20, 100; -100, 20],
448            style(color=0),
449            string="K"), Text(
450            extent=[100, -20; 20, -100],
451            style(color=0),
452            string="°C")));
453    algorithm 
454      Celsius := Kelvin + Modelica.Constants.T_zero;
455    end to_degC;
456   
457    function from_degC "Convert from °Celsius to Kelvin" 
458      extends ConversionIcon;
459      input NonSIunits.Temperature_degC Celsius "Celsius value";
460      output Temperature Kelvin "Kelvin value";
461      annotation (Icon(Text(
462            extent=[-20, 100; -100, 20],
463            style(color=0),
464            string="°C"), Text(
465            extent=[100, -20; 20, -100],
466            style(color=0),
467            string="K")));
468    algorithm 
469      Kelvin := Celsius - Modelica.Constants.T_zero;
470    end from_degC;
471   
472    function to_degF "Convert from Kelvin to °Fahrenheit" 
473      extends ConversionIcon;
474      input Temperature Kelvin "Kelvin value";
475      output NonSIunits.Temperature_degF Fahrenheit "Fahrenheit value";
476      annotation (Icon(Text(
477            extent=[-20, 100; -100, 20],
478            style(color=0),
479            string="K"), Text(
480            extent=[100, -20; 20, -100],
481            style(color=0),
482            string="°F")));
483    algorithm 
484      Fahrenheit := (Kelvin + Modelica.Constants.T_zero)*(9/5) + 32;
485    end to_degF;
486   
487    function from_degF "Convert from °Fahrenheit to Kelvin" 
488      extends ConversionIcon;
489      input NonSIunits.Temperature_degF Fahrenheit "Fahrenheit value";
490      output Temperature Kelvin "Kelvin value";
491      annotation (Icon(Text(
492            extent=[-20, 100; -100, 20],
493            style(color=0),
494            string="°F"), Text(
495            extent=[100, -20; 20, -100],
496            style(color=0),
497            string="K")));
498    algorithm 
499      Kelvin := (Fahrenheit - 32)*(5/9) - Modelica.Constants.T_zero;
500    end from_degF;
501   
502    function to_degRk "Convert from Kelvin to °Rankine" 
503      extends ConversionIcon;
504      input Temperature Kelvin "Kelvin value";
505      output NonSIunits.Temperature_degRk Rankine "Rankine value";
506      annotation (Icon(Text(
507            extent=[-20, 100; -100, 20],
508            style(color=0),
509            string="K"), Text(
510            extent=[100, -20; 20, -100],
511            style(color=0),
512            string="°Rk")));
513    algorithm 
514      Rankine := (9/5)*Kelvin;
515    end to_degRk;
516   
517    function from_degRk "Convert from °Rankine to Kelvin" 
518      extends ConversionIcon;
519      input NonSIunits.Temperature_degRk Rankine "Rankine value";
520      output Temperature Kelvin "Kelvin value";
521      annotation (Icon(Text(
522            extent=[-20, 100; -100, 20],
523            style(color=0),
524            string="°Rk"), Text(
525            extent=[100, -20; 20, -100],
526            style(color=0),
527            string="K")));
528    algorithm 
529      Kelvin := (5/9)*Rankine;
530    end from_degRk;
531   
532    function to_deg "Convert from radian to degree" 
533      extends ConversionIcon;
534      input Angle radian "radian value";
535      output NonSIunits.Angle_deg degree "degree value";
536      annotation (Icon(Text(
537            extent=[-20, 100; -100, 20],
538            style(color=0),
539            string="rad"), Text(
540            extent=[100, -20; 20, -100],
541            style(color=0),
542            string="deg")));
543    algorithm 
544      degree := (180.0/Modelica.Constants.pi)*radian;
545    end to_deg;
546   
547    function from_deg "Convert from degree to radian" 
548      extends ConversionIcon;
549      input NonSIunits.Angle_deg degree "degree value";
550      output Angle radian "radian value";
551      annotation (Icon(Text(
552            extent=[-20, 100; -100, 20],
553            style(color=0),
554            string="deg"), Text(
555            extent=[100, -20; 20, -100],
556            style(color=0),
557            string="rad")));
558    algorithm 
559      radian := (Modelica.Constants.pi/180.0)*degree;
560    end from_deg;
561   
562    function to_rpm "Convert from radian per second to revolutions per minute" 
563      extends ConversionIcon;
564      input AngularVelocity rs "radian per second value";
565      output NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value";
566      annotation (Icon(Text(
567            extent=[-20, 100; -100, 20],
568            style(color=0),
569            string="rad/s"), Text(
570            extent=[100, -20; 20, -100],
571            style(color=0),
572            string="rev/min")));
573    algorithm 
574      rpm := (30/Modelica.Constants.pi)*rs;
575    end to_rpm;
576   
577    function from_rpm
578      "Convert from revolutions per minute to radian per second" 
579      extends ConversionIcon;
580      input NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value";
581      output AngularVelocity rs "radian per second value";
582      annotation (Icon(Text(
583            extent=[-20, 100; -100, 20],
584            style(color=0),
585            string="rev/min"), Text(
586            extent=[100, -20; 20, -100],
587            style(color=0),
588            string="rad/s")));
589    algorithm 
590      rs := (Modelica.Constants.pi/30)*rpm;
591    end from_rpm;
592   
593    function to_kmh "Convert from metre per second to kilometre per hour" 
594      extends ConversionIcon;
595      input Velocity ms "metre per second value";
596      output NonSIunits.Velocity_kmh kmh "kilometre per hour value";
597      annotation (Icon(Text(
598            extent=[-20, 100; -100, 20],
599            style(color=0),
600            string="m/s"), Text(
601            extent=[100, -20; 20, -100],
602            style(color=0),
603            string="km/h")));
604    algorithm 
605      kmh := 3.6*ms;
606    end to_kmh;
607   
608    function from_kmh "Convert from kilometre per hour to metre per second" 
609      extends ConversionIcon;
610      input NonSIunits.Velocity_kmh kmh "kilometre per hour value";
611      output Velocity ms "metre per second value";
612      annotation (Icon(Text(
613            extent=[-20, 100; -100, 20],
614            style(color=0),
615            string="km/h"), Text(
616            extent=[100, -20; 20, -100],
617            style(color=0),
618            string="m/s")));
619    algorithm 
620      ms := kmh/3.6;
621    end from_kmh;
622   
623    function to_day "Convert from second to day" 
624      extends ConversionIcon;
625      input Time s "second value";
626      output NonSIunits.Time_day day "day value";
627      annotation (Icon(Text(
628            extent=[-20, 100; -100, 20],
629            style(color=0),
630            string="s"), Text(
631            extent=[100, -20; 20, -100],
632            style(color=0),
633            string="day")));
634    algorithm 
635      day := s/86400;
636    end to_day;
637   
638    function from_day "Convert from day to second" 
639      extends ConversionIcon;
640      input NonSIunits.Time_day day "day value";
641      output Time s "second value";
642      annotation (Icon(Text(
643            extent=[-20, 100; -100, 20],
644            style(color=0),
645            string="day"), Text(
646            extent=[100, -20; 20, -100],
647            style(color=0),
648            string="s")));
649    algorithm 
650      s := 86400*day;
651    end from_day;
652   
653    function to_hour "Convert from second to hour" 
654      extends ConversionIcon;
655      input Time s "second value";
656      output NonSIunits.Time_hour hour "hour value";
657      annotation (Icon(Text(
658            extent=[-20, 100; -100, 20],
659            style(color=0),
660            string="s"), Text(
661            extent=[100, -20; 20, -100],
662            style(color=0),
663            string="hour")));
664    algorithm 
665      hour := s/3600;
666    end to_hour;
667   
668    function from_hour "Convert from hour to second" 
669      extends ConversionIcon;
670      input NonSIunits.Time_hour hour "hour value";
671      output Time s "second value";
672      annotation (Icon(Text(
673            extent=[-20, 100; -100, 20],
674            style(color=0),
675            string="hour"), Text(
676            extent=[100, -20; 20, -100],
677            style(color=0),
678            string="s")));
679    algorithm 
680      s := 3600*hour;
681    end from_hour;
682   
683    function to_minute "Convert from second to minute" 
684      extends ConversionIcon;
685      input Time s "second value";
686      output NonSIunits.Time_minute minute "minute value";
687      annotation (Icon(Text(
688            extent=[-20, 100; -100, 20],
689            style(color=0),
690            string="s"), Text(
691            extent=[100, -20; 20, -100],
692            style(color=0),
693            string="minute")));
694    algorithm 
695      minute := s/60;
696    end to_minute;
697   
698    function from_minute "Convert from minute to second" 
699      extends ConversionIcon;
700      input NonSIunits.Time_minute minute "minute value";
701      output Time s "second value";
702      annotation (Icon(Text(
703            extent=[-20, 100; -100, 20],
704            style(color=0),
705            string="minute"), Text(
706            extent=[100, -20; 20, -100],