summaryrefslogtreecommitdiff
path: root/definitions/units.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'definitions/units.yaml')
-rw-r--r--definitions/units.yaml114
1 files changed, 114 insertions, 0 deletions
diff --git a/definitions/units.yaml b/definitions/units.yaml
new file mode 100644
index 0000000..37ad846
--- /dev/null
+++ b/definitions/units.yaml
@@ -0,0 +1,114 @@
+# Units which are used by Canopied
+#
+# Units have a name, a suffix (for display), and an expression for the unit.
+#
+# Units get to derive from other units, and from the raw units from the
+# internal quantified values system in Canopied.
+#
+# The raw units are each quantified values whose value is 1 and whose quantity
+# is one of voltage, current, temperature, distance, and time.
+#
+# Units may not depend on units which depend on themselves. Instead the
+# dependencies between unit definitions need to be acyclic. During load, units
+# will be checked in-order and thus may only depend on units defined before them
+# in this file.
+
+# The basic units wrappering the raw units
+- id: volt
+ aliases:
+ - volts
+ - voltage
+ suffix: V
+ expr: raw.voltage
+- id: amp
+ aliases:
+ - amps
+ - current
+ suffix: A
+ expr: raw.current
+- id: celsius
+ aliases:
+ - kelvin
+ - centigrade
+ - temp
+ - temperature
+ - c
+ - degc
+ - degree
+ - degrees
+ suffix: °C
+ expr: raw.temperature
+- id: metre
+ aliases:
+ - meter
+ - distance
+ - m
+ suffix: m
+ expr: raw.distance
+- id: second
+ aliases:
+ - seconds
+ - sec
+ - secs
+ - s
+ suffix: s
+ expr: raw.time
+
+# Useful scalar variants of those units
+- id: kilometre
+ aliases:
+ - kilometer
+ - km
+ - kms
+ suffix: km
+ expr: 1000 * m
+- id: mile
+ aliases:
+ - miles
+ - mi
+ suffix: mi
+ expr: 1609.344 * m
+
+- id: minute
+ aliases:
+ - minutes
+ - min
+ - mins
+ suffix: min
+ expr: 60 * s
+- id: hour
+ aliases:
+ - hours
+ - hr
+ - hrs
+ suffix: h
+ expr: 60 * min
+
+# Basic derived units, and scalar variants thereof
+- id: watt
+ aliases:
+ - watts
+ - w
+ - power
+ suffix: W
+ expr: volt * amp
+- id: kilowatt
+ aliases:
+ - kilowatts
+ - kw
+ suffix: kW
+ expr: 1000 * watt
+
+# Useful derived units
+- id: whpermile
+ aliases:
+ - watthourspermile
+ suffix: Wh/mi
+ expr: (watt * hour) / mile
+
+- id: milesperkwh
+ aliases:
+ - miperkwh
+ suffix: mi/kWh
+ expr: mile / (kilowatt * hour)
+