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

Revision 1159, 77.4 kB (checked in by dietmarw, 5 weeks ago)

fixes #100 (in maintenance/3.0) by changing the annotation to a vendor specific annotation

From: Dietmar Winkler <Dietmar.Winkler@…>

  • 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 (__Dymola_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 (__Dymola_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 (__Dymola_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 (
226   
227    Invisible=true,
228    Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
229            100}}), graphics={Text(
230          extent={{-63,-13},{45,-67}},
231          lineColor={0,0,0},
232          textString="[kg.m2]")}),
233    Documentation(info="<html>
234<p>This package provides predefined types, such as <i>Mass</i>,
235<i>Angle</i>, <i>Time</i>, based on the international standard
236on units, e.g.,
237</p>
238 
239<pre>   <b>type</b> Angle = Real(<b>final</b> quantity = \"Angle\",
240                     <b>final</b> unit     = \"rad\",
241                     displayUnit    = \"deg\");
242</pre>
243 
244<p>
245as well as conversion functions from non SI-units to SI-units
246and vice versa in subpackage
247<a href=\"Modelica://Modelica.SIunits.Conversions\">Conversions</a>.
248</p>
249 
250<p>
251For an introduction how units are used in the Modelica standard library
252with package SIunits, have a look at:
253<a href=\"Modelica://Modelica.SIunits.UsersGuide.HowToUseSIunits\">How to use SIunits</a>.
254</p>
255 
256<p>
257Copyright &copy; 1998-2008, Modelica Association and DLR.
258</p>
259<p>
260<i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified
261under the terms of the <b>Modelica license</b>, see the license conditions
262and the accompanying <b>disclaimer</b> 
263<a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i>
264</p>
265 
266</html>", revisions="<html>
267<ul>
268<li><i>Dec. 14, 2005</i>
269       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
270       Add User's Guide and removed \"min\" values for Resistance and Conductance.</li>
271<li><i>October 21, 2002</i>
272       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
273       and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
274       Added new package <b>Conversions</b>. Corrected typo <i>Wavelenght</i>.</li>
275<li><i>June 6, 2000</i>
276       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
277       Introduced the following new types<br>
278       type Temperature = ThermodynamicTemperature;<br>
279       types DerDensityByEnthalpy, DerDensityByPressure,
280       DerDensityByTemperature, DerEnthalpyByPressure,
281       DerEnergyByDensity, DerEnergyByPressure<br>
282       Attribute \"final\" removed from min and max values
283       in order that these values can still be changed to narrow
284       the allowed range of values.<br>
285       Quantity=\"Stress\" removed from type \"Stress\", in order
286       that a type \"Stress\" can be connected to a type \"Pressure\".</li>
287<li><i>Oct. 27, 1999</i>
288       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
289       New types due to electrical library: Transconductance, InversePotential,
290       Damping.</li>
291<li><i>Sept. 18, 1999</i>
292       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
293       Renamed from SIunit to SIunits. Subpackages expanded, i.e., the
294       SIunits package, does no longer contain subpackages.</li>
295<li><i>Aug 12, 1999</i>
296       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
297       Type \"Pressure\" renamed to \"AbsolutePressure\" and introduced a new
298       type \"Pressure\" which does not contain a minimum of zero in order
299       to allow convenient handling of relative pressure. Redefined
300       BulkModulus as an alias to AbsolutePressure instead of Stress, since
301       needed in hydraulics.</li>
302<li><i>June 29, 1999</i>
303       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
304       Bug-fix: Double definition of \"Compressibility\" removed
305       and appropriate \"extends Heat\" clause introduced in
306       package SolidStatePhysics to incorporate ThermodynamicTemperature.</li>
307<li><i>April 8, 1998</i>
308       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
309       and Astrid Jaschinski:<br>
310       Complete ISO 31 chapters realized.</li>
311<li><i>Nov. 15, 1997</i>
312       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
313       and <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a>:<br>
314       Some chapters realized.</li>
315</ul>
316</html>"),
317    Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
318            100}}), graphics={
319        Rectangle(
320          extent={{169,86},{349,236}},
321          fillColor={235,235,235},
322          fillPattern=FillPattern.Solid,
323          lineColor={0,0,255}),
324        Polygon(
325          points={{169,236},{189,256},{369,256},{349,236},{169,236}},
326          fillColor={235,235,235},
327          fillPattern=FillPattern.Solid,
328          lineColor={0,0,255}),
329        Polygon(
330          points={{369,256},{369,106},{349,86},{349,236},{369,256}},
331          fillColor={235,235,235},
332          fillPattern=FillPattern.Solid,
333          lineColor={0,0,255}),
334        Text(
335          extent={{179,226},{339,196}},
336          lineColor={160,160,164},
337          fillColor={0,0,0},
338          fillPattern=FillPattern.Solid,
339          textString="Library"),
340        Text(
341          extent={{206,173},{314,119}},
342          lineColor={0,0,0},
343          textString="[kg.m2]"),
344        Text(
345          extent={{163,320},{406,264}},
346          lineColor={255,0,0},
347          textString="Modelica.SIunits")}));
348
349  package Conversions
350    "Conversion functions to/from non SI units and type definitions of non SI units"
351
352    extends Modelica.Icons.Library2;
353
354    annotation (Icon(coordinateSystem(preserveAspectRatio=true,
355                     extent={{-100,-100},{100,100}}), graphics={
356          Text(
357            extent={{-33,-7},{-92,-67}},
358            lineColor={0,0,0},
359            lineThickness=1,
360            textString="°C"),
361          Text(
362            extent={{82,-7},{22,-67}},
363            lineColor={0,0,0},
364            textString="K"),
365          Line(points={{-26,-36},{6,-36}}, color={0,0,0}),
366          Polygon(
367            points={{6,-28},{6,-45},{26,-37},{6,-28}},
368            pattern=LinePattern.None,
369            fillColor={0,0,0},
370            fillPattern=FillPattern.Solid,
371            lineColor={0,0,255})}),
372                              Documentation(info="<HTML>
373<p>This package provides conversion functions from the non SI Units
374defined in package Modelica.SIunits.Conversions.NonSIunits to the
375corresponding SI Units defined in package Modelica.SIunits and vice
376versa. It is recommended to use these functions in the following
377way (note, that all functions have one Real input and one Real output
378argument):</p>
379<pre>
380  <b>import</b> SI = Modelica.SIunits;
381  <b>import</b> Modelica.SIunits.Conversions.*;
382     ...
383  <b>parameter</b> SI.Temperature     T   = from_degC(25);   // convert 25 degree Celsius to Kelvin
384  <b>parameter</b> SI.Angle           phi = from_deg(180);   // convert 180 degree to radian
385  <b>parameter</b> SI.AngularVelocity w   = from_rpm(3600);  // convert 3600 revolutions per minutes
386                                                      // to radian per seconds
387</pre>
388 
389</HTML>
390"));
391
392    package NonSIunits "Type definitions of non SI units"
393
394      extends Modelica.Icons.Library2;
395
396      type Temperature_degC = Real (final quantity="ThermodynamicTemperature",
397            final unit="degC")
398        "Absolute temperature in degree Celsius (for relative temperature use SIunits.TemperatureDifference)"
399                                                                                                            annotation(__Dymola_absoluteValue=true);
400      type Temperature_degF = Real (final quantity="ThermodynamicTemperature",
401            final unit="degF")
402        "Absolute temperature in degree Fahrenheit (for relative temperature use SIunits.TemperatureDifference)"
403                                                                                                            annotation(__Dymola_absoluteValue=true);
404      type Temperature_degRk = Real (final quantity="ThermodynamicTemperature",
405            final unit="degRk")
406        "Absolute temperature in degree Rankine (for relative temperature use SIunits.TemperatureDifference)"
407                                                                                                            annotation(__Dymola_absoluteValue=true);
408      type Angle_deg = Real (final quantity="Angle", final unit="deg")
409        "Angle in degree";
410      type AngularVelocity_rpm = Real (final quantity="AngularVelocity", final unit
411            =    "1/min")
412        "Angular velocity in revolutions per minute. Alias unit names that are outside of the SI system: rpm, r/min, rev/min"
413        annotation (Documentation(info="<html>
414<p>
415 
416</html>"));
417      type Velocity_kmh = Real (final quantity="Velocity", final unit="km/h")
418        "Velocity in kilometers per hour";
419      type Time_day = Real (final quantity="Time", final unit="d")
420        "Time in days";
421      type Time_hour = Real (final quantity="Time", final unit="h")
422        "Time in hours";
423      type Time_minute = Real (final quantity="Time", final unit="min")
424        "Time in minutes";
425      type Volume_litre = Real (final quantity="Volume", final unit="l")
426        "Volume in litres";
427      type Energy_kWh = Real (final quantity="Energy", final unit="kW.h")
428        "Energy in kilo watt hours";
429      type Pressure_bar = Real (final quantity="Pressure", final unit="bar")
430        "Absolute pressure in bar";
431      type MassFlowRate_gps = Real (final quantity="MassFlowRate", final unit=
432              "g/s") "Mass flow rate in gramm per second";
433
434      annotation (Documentation(info="<HTML>
435<p>
436This package provides predefined types, such as <b>Angle_deg</b> (angle in
437degree), <b>AngularVelocity_rpm</b> (angular velocity in revolutions per
438minute) or <b>Temperature_degF</b> (temperature in degree Fahrenheit),
439which are in common use but are not part of the international standard on
440units according to ISO 31-1992 \"General principles concerning quantities,
441units and symbols\" and ISO 1000-1992 \"SI units and recommendations for
442the use of their multiples and of certain other units\".</p>
443<p>If possible, the types in this package should not be used. Use instead
444types of package Modelica.SIunits. For more information on units, see also
445the book of Francois Cardarelli <b>Scientific Unit Conversion - A
446Practical Guide to Metrication</b> (Springer 1997).</p>
447<p>Some units, such as <b>Temperature_degC/Temp_C</b> are both defined in
448Modelica.SIunits and in Modelica.Conversions.NonSIunits. The reason is that these
449definitions have been placed erroneously in Modelica.SIunits although they
450are not SIunits. For backward compatibility, these type definitions are
451still kept in Modelica.SIunits.</p>
452</HTML>
453"), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
454                100}}), graphics={Text(
455              extent={{-66,-13},{52,-67}},
456              lineColor={0,0,0},
457              textString="[km/h]")}));
458    end NonSIunits;
459
460    function to_degC "Convert from Kelvin to °Celsius"
461      extends ConversionIcon;
462      input Temperature Kelvin "Kelvin value";
463      output NonSIunits.Temperature_degC Celsius "Celsius value";
464      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
465                -100},{100,100}}), graphics={Text(
466              extent={{-20,100},{-100,20}},
467              lineColor={0,0,0},
468              textString="K"), Text(
469              extent={{100,-20},{20,-100}},
470              lineColor={0,0,0},
471              textString="°C")}));
472    algorithm
473      Celsius := Kelvin + Modelica.Constants.T_zero;
474    end to_degC;
475
476    function from_degC "Convert from °Celsius to Kelvin"
477      extends ConversionIcon;
478      input NonSIunits.Temperature_degC Celsius "Celsius value";
479      output Temperature Kelvin "Kelvin value";
480      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
481                -100},{100,100}}), graphics={Text(
482              extent={{-20,100},{-100,20}},
483              lineColor={0,0,0},
484              textString="°C"), Text(
485              extent={{100,-20},{20,-100}},
486              lineColor={0,0,0},
487              textString="K")}));
488    algorithm
489      Kelvin := Celsius - Modelica.Constants.T_zero;
490    end from_degC;
491
492    function to_degF "Convert from Kelvin to °Fahrenheit"
493      extends ConversionIcon;
494      input Temperature Kelvin "Kelvin value";
495      output NonSIunits.Temperature_degF Fahrenheit "Fahrenheit value";
496      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
497                -100},{100,100}}), graphics={Text(
498              extent={{-20,100},{-100,20}},
499              lineColor={0,0,0},
500              textString="K"), Text(
501              extent={{100,-20},{20,-100}},
502              lineColor={0,0,0},
503              textString="°F")}));
504    algorithm
505      Fahrenheit := (Kelvin + Modelica.Constants.T_zero)*(9/5) + 32;
506    end to_degF;
507
508    function from_degF "Convert from °Fahrenheit to Kelvin"
509      extends ConversionIcon;
510      input NonSIunits.Temperature_degF Fahrenheit "Fahrenheit value";
511      output Temperature Kelvin "Kelvin value";
512      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
513                -100},{100,100}}), graphics={Text(
514              extent={{-20,100},{-100,20}},
515              lineColor={0,0,0},
516              textString="°F"), Text(
517              extent={{100,-20},{20,-100}},
518              lineColor={0,0,0},
519              textString="K")}));
520    algorithm
521      Kelvin := (Fahrenheit - 32)*(5/9) - Modelica.Constants.T_zero;
522    end from_degF;
523
524    function to_degRk "Convert from Kelvin to °Rankine"
525      extends ConversionIcon;
526      input Temperature Kelvin "Kelvin value";
527      output NonSIunits.Temperature_degRk Rankine "Rankine value";
528      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
529                -100},{100,100}}), graphics={Text(
530              extent={{-20,100},{-100,20}},
531              lineColor={0,0,0},
532              textString="K"), Text(
533              extent={{100,-20},{20,-100}},
534              lineColor={0,0,0},
535              textString="°Rk")}));
536    algorithm
537      Rankine := (9/5)*Kelvin;
538    end to_degRk;
539
540    function from_degRk "Convert from °Rankine to Kelvin"
541      extends ConversionIcon;
542      input NonSIunits.Temperature_degRk Rankine "Rankine value";
543      output Temperature Kelvin "Kelvin value";
544      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
545                -100},{100,100}}), graphics={Text(
546              extent={{-20,100},{-100,20}},
547              lineColor={0,0,0},
548              textString="°Rk"), Text(
549              extent={{100,-20},{20,-100}},
550              lineColor={0,0,0},
551              textString="K")}));
552    algorithm
553      Kelvin := (5/9)*Rankine;
554    end from_degRk;
555
556    function to_deg "Convert from radian to degree"
557      extends ConversionIcon;
558      input Angle radian "radian value";
559      output NonSIunits.Angle_deg degree "degree value";
560      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
561                -100},{100,100}}), graphics={Text(
562              extent={{-20,100},{-100,20}},
563              lineColor={0,0,0},
564              textString="rad"), Text(
565              extent={{100,-20},{20,-100}},
566              lineColor={0,0,0},
567              textString="deg")}));
568    algorithm
569      degree := (180.0/Modelica.Constants.pi)*radian;
570    end to_deg;
571
572    function from_deg "Convert from degree to radian"
573      extends ConversionIcon;
574      input NonSIunits.Angle_deg degree "degree value";
575      output Angle radian "radian value";
576      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
577                -100},{100,100}}), graphics={Text(
578              extent={{-20,100},{-100,20}},
579              lineColor={0,0,0},
580              textString="deg"), Text(
581              extent={{100,-20},{20,-100}},
582              lineColor={0,0,0},
583              textString="rad")}));
584    algorithm
585      radian := (Modelica.Constants.pi/180.0)*degree;
586    end from_deg;
587
588    function to_rpm "Convert from radian per second to revolutions per minute"
589      extends ConversionIcon;
590      input AngularVelocity rs "radian per second value";
591      output NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value";
592      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
593                -100},{100,100}}), graphics={Text(
594              extent={{-20,100},{-100,20}},
595              lineColor={0,0,0},
596              textString="rad/s"), Text(
597              extent={{100,-20},{20,-100}},
598              lineColor={0,0,0},
599              textString="1/min")}));
600    algorithm
601      rpm := (30/Modelica.Constants.pi)*rs;
602    end to_rpm;
603
604    function from_rpm
605      "Convert from revolutions per minute to radian per second"
606      extends ConversionIcon;
607      input NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value";
608      output AngularVelocity rs "radian per second value";
609      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
610                -100},{100,100}}), graphics={Text(
611              extent={{-20,100},{-100,20}},
612              lineColor={0,0,0},
613              textString="1/min"), Text(
614              extent={{100,-20},{20,-100}},
615              lineColor={0,0,0},
616              textString="rad/s")}));
617    algorithm
618      rs := (Modelica.Constants.pi/30)*rpm;
619    end from_rpm;
620
621    function to_kmh "Convert from metre per second to kilometre per hour"
622      extends ConversionIcon;
623      input Velocity ms "metre per second value";
624      output NonSIunits.Velocity_kmh kmh "kilometre per hour value";
625      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
626                -100},{100,100}}), graphics={Text(
627              extent={{-20,100},{-100,20}},
628              lineColor={0,0,0},
629              textString="m/s"), Text(
630              extent={{100,-20},{20,-100}},
631              lineColor={0,0,0},
632              textString="km/h")}));
633    algorithm
634      kmh := 3.6*ms;
635    end to_kmh;
636
637    function from_kmh "Convert from kilometre per hour to metre per second"
638      extends ConversionIcon;
639      input NonSIunits.Velocity_kmh kmh "kilometre per hour value";
640      output Velocity ms "metre per second value";
641      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
642                -100},{100,100}}), graphics={Text(
643              extent={{-20,100},{-100,20}},
644              lineColor={0,0,0},
645              textString="km/h"), Text(
646              extent={{100,-20},{20,-100}},
647              lineColor={0,0,0},
648              textString="m/s")}));
649    algorithm
650      ms := kmh/3.6;
651    end from_kmh;
652
653    function to_day "Convert from second to day"
654      extends ConversionIcon;
655      input Time s "second value";
656      output NonSIunits.Time_day day "day value";
657      annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
658                -100},{100,100}}), graphics={Text(
659              extent={{-20,100},{-100,20}},