Skip to content
Archee Docs

Units and expressions

The unit table, dimension checks, expression syntax, the standard functions and tolerance classes.

Units

A quantity is a number and an optional unit: 7.5 kW, 20000 h. A number with no unit is dimensionless. The compiler stores values in millimetres, kilograms and seconds, and prints them in the declared unit.

UnitDimensionType
mm, mLengthlength
kgMassmass
N, kNForceforce
NmTorquetorque
MPaStressstress
kWPowerpower
rpmSpeedspeed
h, sTimetime
degAngle (dimensionless)angle
-Ratio-

Dimension rules

  • +, -, == and the relations need equal dimensions.
  • * and / add and subtract the exponents. ^ INT multiplies them.
  • sqrt and cbrt need exponents divisible by 2 and 3.
  • x to U converts to a unit of the same dimension.
  • A let, in or out type is checked against its expression:
let d: length = cbrt(16 * T / (pi * tau)) to mm

Integer values, such as a tooth count, use the type -.

Expressions

FormExample
Arithmetica + b, a * b, a / b, -a, a ^ 2
Parentheses(a + b) / 2
Constantpi
Callsqrt(x)
Pathshaft2.s1.d
Table readT1."Bảng 10.5"["C45"].tau
Conversiond to mm
Relation<=, <, >=, >, ==

Functions

The standard functions are sqrt cbrt hypot abs min max ceil floor round sin cos tan pow up down near interp. hypot(x, y) returns the magnitude of two quantities with the same dimension, and pow(x, y) calculates a dimensionless power.

up(x, S) rounds up to the next member of a standard series. down and near round down and to the nearest. The series live in the library archee.standards:

SeriesStandard
standards.dISO 15 rolling-bearing bores
standards.mISO 54 gear modules
standards.r10ISO 3 preferred numbers R10
use standards = lib archee.standards
let d1: length = up(d_min, standards.d)

Tolerance classes

A class after a length makes it a fit: 40 k6 is a nominal length of 40 mm with class k6. H7 alone is a tolerance class. A port field such as d = d1 k6 carries both. A fit works wherever a length does, with its nominal.

fit.upper(x) and fit.lower(x) return the signed deviations from the ISO 286 table.

Assumed values

A literal with no citation is allowed. The compiler reports it as assumed (code A01, information), so you see which values rest on your own choice.

The standards formulas also use Nmm for torque, mm3 for volume or section modulus, mps for linear speed, kgpm for linear density, Hz for frequency and rad for angle.