The Units page is reserved for those adventurous enough to try and add support for new and exotic units to MoQu.

Out of the box MoQu supports length dimensions including areas and volumes, weight, temperature, time and energy, in the International System (SI) of units and some alternate system such as Imperial.

Units Parsing in MoQu

MoQu detects and parses units in 3 parts: a Prefix, a Unit and an Exponent, e.g. [km2]: kilo/k Prefix, meter/m Unit and square/2 Exponent.

Additionally some leading Exponent syntax are supported such as [sqmm]: square/sq Exponent, m/milli Prefix, m/meter Unit. Exponent also support caret '^' and doubled multiplication '**'.

When parsing an attribute value, MoQu looks for blocks combining numbers (the Quantity) followed by text (the Unit), with or without spaces, and tries to parse each [Quantity Unit] block.

  • If the text part of a bock contains unknown Prefix, Unit or Exponent, the whole value is rejected and considered not parsable.
  • If all blocks are parsed successfully, they are added together to calculate a decimal result in the major Unit, the Unit with the highest magnitude in the SI, e.g. [3ft6in] -> [3.5ft]
  • Blocks are added together as long as they have compatible Dimension (e.g. ft, in, m, cm etc. are all lengths related to the SI m/meter and can be added up)
  • If any block represents a different Dimension or Exponent from the other blocks in the value, the whole value is rejected and the attribute considered not parsable, e.g. [5m 3m2] -> rejected
  • Fractional quantities are supported and converted, e.g. [5 1/4 ft] -> [5.25ft]
  • Attribute values longer than 25 characters in length are not considered parsable
  • blocks separated by multiplication '*' or division '/' are multiplied accordingly, e.g. [5m * 2m] -> [10m2]; [12N / 2 in2] ->[6 N*in-2]

Add Support for a New Unit

To add support for a new Unit, navigate to the Units page, and click Add Unit.

Type in a Label that is the exact text the Unit appears as in attribute values, minus any Prefix or Exponent.

Specify a SI Factor and Dimension. the Dimension is the International System of Unit that matches your new Unit, the SI Factor is the multiplier to convert from the new Unit to the SI Dimension.


For example, to add support for imperial ft/feet (note that this is an example, and ft is already supported):





This automatically adds support for ft, ft2, sqft, ft3 etc, addition and subtraction to any other m/meter Dimension Unit as well as division and multiplication.

Repeat this operation to support other spelling of a Unit such as feet, foot etc.

Next

Versioning | Advanced Processes