# Units of measurement

Unlike many other mathematical modelling programs, ASCEND understands standard **units of measurement** including all base SI units (kg, m, s, etc.) and many non-SI units such as United States customary units and others, and treatment of units, conversion and consistency-checking are all integrated tightly into the ASCEND modelling language and model compiler.

The units-of-measurement system is extensible: the user can define new units of measurement in model files then immediately use those new units of measurement to define values for use in the model's calculations.

Standard units of measurement defined using the UNITS statement, and the standard definitions are in models/measures.a4l. All measures are defined relative to the built-in base units, defined as follows:

Unit | Dim code | Dimension | Source |
---|---|---|---|

kg | M | mass | SI |

mol | Q | amount of substance | SI |

s | T | time | SI |

m | L | length | SI |

K | TMP | temperature | SI |

USD | C | currency | non SI |

A | E | electric current | SI |

cd | LUM | luminous intensity | SI |

rad | P | plane angle | SI suggested |

sr | S | solid angle | SI suggested |

Both the Tcl/Tk and PyGTK GUIs provide means for entering values in any desired (by applicable) unit, and allow the preferred units of measurement for any value-type to be selected and stored for future use.

## Units of Measurement dialog in the PyGTK GUI

The units of measurement dialog can be used in the PyGTK to choose the preferred units of measurement for any type currently available in the library that you have loaded. Normally this means that you are selecting between units defined in models/measures.a4l for types defined in models/atoms.a4l, but this will sometimes be different if you have defined your own atoms/units elsewhere.

convert: unable to open file `/srv/ascend/d/up/f/fa/Image-Preferred-units.png' @ error/png.c/ReadPNGImage/3667.

convert: no images defined `/tmp/transform_35ed236-1.png' @ error/convert.c/ConvertImageCommand/3044.

To access this dialog either use the 'Tools' menu, or right-click a variable in your model that is a real-valued variable.

In this dialog, you can select the type you want to set units for. The list will self-filter if you start typing the name of the type you want. Then the list of available units-of-measurement appears, and you can select the one you want.

You can change the preferred units for as many types as you want, then click 'Apply' or 'Close' to save the changes. If you click 'apply' you can see the changes applied immediately in the main window. which is a simple way of doing quick checks for different units. If you click 'cancel', any changes you have made will be ignored.