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.
| Unit | Dimension | Type |
|---|---|---|
mm, m | Length | length |
kg | Mass | mass |
N, kN | Force | force |
Nm | Torque | torque |
MPa | Stress | stress |
kW | Power | power |
rpm | Speed | speed |
h, s | Time | time |
deg | Angle (dimensionless) | angle |
- | Ratio | - |
Dimension rules
+,-,==and the relations need equal dimensions.*and/add and subtract the exponents.^ INTmultiplies them.sqrtandcbrtneed exponents divisible by 2 and 3.x to Uconverts to a unit of the same dimension.- A
let,inorouttype is checked against its expression:
let d: length = cbrt(16 * T / (pi * tau)) to mmInteger values, such as a tooth count, use the type -.
Expressions
| Form | Example |
|---|---|
| Arithmetic | a + b, a * b, a / b, -a, a ^ 2 |
| Parentheses | (a + b) / 2 |
| Constant | pi |
| Call | sqrt(x) |
| Path | shaft2.s1.d |
| Table read | T1."Bảng 10.5"["C45"].tau |
| Conversion | d 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:
| Series | Standard |
|---|---|
standards.d | ISO 15 rolling-bearing bores |
standards.m | ISO 54 gear modules |
standards.r10 | ISO 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.