About Units in Neara
Unlike other expression languages, Neara is aware of the types and units of all fields, and how they interact.
For example, if you multiply together two length fields (in units of metres
) then the result will be an area with units of square metres
.
The type of a property field can be specified:
The type of a formula field is automatically computed:
Unit codes
Neara unit code | Unit | Description |
m | m | Meter (length) |
kg | kg | Kilogram (mass) |
celsius | celsius | Degree Celsius (temperature) |
mkg | mkg | Meter-kilogram (momentum, a product of length and mass) |
s | s | Second (time) |
s^2 | s² | Seconds squared (used in acceleration or time-based calculations) |
mkg/s^2 | mkg/s² | Meter-kilogram per second squared (force, equivalent to Newton N) |
N | N | Newton (force, kg⋅m/s2) |
mm | mm | Millimeter (1/1000 of a meter, used for smaller lengths) |
cm | cm | Centimeter (1/100 of a meter, used for medium-length measurements) |
km | km | Kilometer (1000 meters, used for long distances) |
m/s | m/s | Meters per second (velocity, rate of change of position) |
daN | daN | Decanewton (10 Newtons, a larger force unit) |
kN | kN | Kilonewton (1000 Newtons, commonly used in engineering) |
N/m | N/m | Newton per meter (tension or linear force) |
kN/m | kN/m | Kilonewton per meter (stronger linear force or tension) |
Nm | Nm | Newton-meter (torque or rotational force) |
kNm | kNm | Kilonewton-meter (higher torque, often in structural engineering) |
kg/km | kg/km | Kilogram per kilometer (line density, e.g., of a cable or wire) |
kg/m | kg/m | Kilogram per meter (line density, commonly used in materials science) |
m^2 | m² | Square meter (area) |
m^3 | m³ | Cubic meter (volume) |
kg/m^3 | kg/m³ | Kilogram per cubic meter (density, e.g., of a material) |
deltaC | Δ°C | Temperature difference in Celsius (Δ°C) |
x10-6 | x10⁻⁶ | Micro (scientific notation for 10−6, e.g., micrometers) |
x10-6/C | x10⁻⁶/C | Micro per Celsius (thermal expansion coefficient) |
mm^2 | mm² | Square millimeter (area) |
km^2 | km² | Square kilometer (large area) |
cm^2 | cm² | Square centimeter (medium area) |
cm^3 | cm³ | Cubic centimeter (volume, equivalent to milliliter) |
cm^4 | cm⁴ | Fourth power of centimeters (used in moment of inertia calculations) |
kgm | kgm | Kilogram-meter (moment of mass) |
kgm/s^2 | kgm/s² | Kilogram-meter per second squared (force, equivalent to Newton N) |
N/m^2 | N/m² | Newton per square meter (pressure, equivalent to Pascal Pa) |
Pa | Pa | Pascal (pressure, N/m2) |
kPa | kPa | Kilopascal (1000 Pascals, used for higher pressures) |
MPa | MPa | Megapascal (106 Pascals, used for very high pressures) |
GPa | GPa | Gigapascal (109 Pascals, used for extremely high pressures) |
$ | $ | Dollars (currency) |
$/m | $/m | Dollars per meter (cost per unit length) |
ohm | Ω | Unit of electrical resistance (Ω) |
ohm/km | ohm/km | Resistance per kilometer (common in electrical applications) |
V | V | Volt (electrical potential) |
kV | kV | Kilovolt (1000 volts) |
m/kV | m/kV | Meters per kilovolt (clearance specification in electrical systems) |
ms | ms | Millisecond (1/1000 of a second) |
min | min | Minute (60 seconds) |
hr | hr | Hour (3600 seconds) |
kV~ | kV~ | Kilovolt alternating current (AC voltage) |
A | A | Ampere (electric current) |
kA | kA | Kiloampere (1000 amperes) |
VA | VA | Volt-ampere (apparent electrical power) |
kVA | kVA | Kilovolt-ampere (1000 VA) |
W | W | Watt (power, 1 joule/second) |
C | C | Coulomb (electric charge) |
F | F | Farad (capacitance) |
S | S | Siemens (electrical conductance) |
Wb | Wb | Weber (magnetic flux) |
T | T | Tesla (magnetic flux density) |
H | H | Henry (inductance) |
J | J | Joule (energy, 1 Newton·meter) |
Wh | Wh | Watt-hour (energy, power over time) |
kWh | kWh | Kilowatt-hour (1000 watt-hours) |
MWh | MWh | Megawatt-hour (1 million watt-hours) |
$/Wh | $/Wh | Dollars per watt-hour (cost of energy) |
$/kWh | $/kWh | Dollars per kilowatt-hour |
$/MWh | $/MWh | Dollars per megawatt-hour |
% | % | Percentage (fraction of 100) |
degrees | ° | Angular measurement (°) |
bearing | bearing | Compass direction (angular measurement relative to north) |
ft | ft | Foot (12 inches, 0.3048 meters) |
lbf | lbf | Pound-force (force, 4.448 N) |
lb | lb | Pound (mass, 0.453592 kg) |
fahrenheit | fahrenheit | Degree Fahrenheit (temperature scale) |
in | in | Inch (1/12 of a foot, 2.54 cm) |
yd | yd | Yard (3 feet, 0.9144 meters) |
ft/s | ft/s | Feet per second (velocity) |
kft | kft | Kilofeet (1000 feet) |
lb/kft | lb/kft | Pounds per kilofeet (line density) |
lb/ft | lb/ft | Pounds per foot (line density) |
ml | ml | Milliliter (volume, 1/1000 of a liter) |
klbf | klbf | Kilopound-force (1000 pound-forces) |
klbfft | klbfft | Kilopound-force foot (torque) |
lbfft | lbfft | Pound-force foot (torque) |
lbf/ft | lbf/ft | Pound-force per foot (linear force) |
lb/ml | lb/ml | Pounds per milliliter (density) |
ft^2 | ft² | Square foot (area) |
ft^3 | ft³ | Cubic foot (volume) |
lb/ft^3 | lb/ft³ | Pounds per cubic foot (density) |
deltaF | Δ°F | Temperature difference in Fahrenheit (Δ°F) |
x10-6/F | x10⁻⁶/F | Micro per Fahrenheit (thermal expansion coefficient) |
in^2 | in² | Square inch (area) |
in^3 | in³ | Cubic inch (volume) |
in^4 | in⁴ | Fourth power of inches (used in structural engineering, moment of inertia) |
psf | psf | Pounds per square foot (pressure) |
psi | psi | Pounds per square inch (pressure) |
kpsi | kpsi | Kilopounds per square inch (1000 psi) |
Mpsi | Mpsi | Megapounds per square inch (106 psi) |
$/ft | $/ft | Dollars per foot (cost per unit length) |
ohm/ml | ohm/ml | Resistance per milliliter (rare, may refer to a specific application) |
ft/kV | ft/kV | Feet per kilovolt (clearance requirement for electrical systems) |
epoch | epoch | Unix epoch (seconds since 1970-01-01 00:00:00 UTC) |
ml^2 | ml² | Milliliter squared (specific to niche contexts or errors) |
Functions
unit
unit(unit_code)
Generates a 1.0
value of the given unit which can be used in expressions. It is commonly used to transform a dimensionless number. Only relative units are permitted.
To build values of absolute temperatures, coordinates, etc. see unit_value()
and origin()
10 * unit("degrees")
returns10.00 degrees
denoting an angle measurement
unit_value
unit_value(value, unit_code)
Generates a given quantity of the given unit.
Unlike unit(unit_code)
this supports absolute quantities as well as relative quantities, because the quantity is specified.
For example, bearings and absolute tempratures (as opposed to deltas) can be instantiated. For absolute length values (i.e. coordinates) see the origin()
function.
Examples
unit_value(15, "fahrenheit")
unit_value(15, "celsius")
Shorthand
The following are all equivalent:
unit_value(10, "metres")
10 * unit("metres")
10m
Date/time units
See parse_timestamp and epoch_timestamp
Formatting units as text
To convert a number to a textual representation in the given unit, with the unit suffixed, see text_unit