From 5739c465ff5e67f10afce31000934f2945f6a46b Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 12 Jun 2023 22:56:04 -0700 Subject: [PATCH] Added units --- buildscript/units.toml | 146 ++++++++++++++++++++++++++++++++++++++++- units.md | 44 +++++-------- 2 files changed, 163 insertions(+), 27 deletions(-) diff --git a/buildscript/units.toml b/buildscript/units.toml index 6515cfe..399daa6 100644 --- a/buildscript/units.toml +++ b/buildscript/units.toml @@ -241,6 +241,16 @@ base_value = "201.17" base_units = [ { u = "Meter", p = 1} ] +[[unit]] +enum_name = "Rod" +print = "rod" +parse = ["rod", "rods"] + +base_value_type = "exact" +base_value = "5.0292" +base_units = [ { u = "Meter", p = 1} ] + + [[unit]] enum_name = "Mile" @@ -568,6 +578,29 @@ base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = +[[unit]] +enum_name = "Calorie" +print = "cal" +parse = ["calorie", "calories"] +parse_with_prefix = "cal" + +base_value_type = "exact" +base_value = "4184" +base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = 2} ] + + + +[[unit]] +enum_name = "BTU" +print = "BTU" +parse = ["btu", "BTU"] + +base_value_type = "exact" +base_value = "1055100" +base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = 2} ] + + + [[unit]] enum_name = "Hertz" print = "Hz" @@ -684,4 +717,115 @@ parse_with_prefix = "Wb" base_value_type = "exact" base_value = "1000" -base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Second", p = -2}, { u = "Ampere", p = -1} ] \ No newline at end of file +base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Second", p = -2}, { u = "Ampere", p = -1} ] + + + + +# Mass and Force + + +[[unit]] +enum_name = "Tonne" +print = "t" +parse = ["t", "tonne", "tonnes", "ton", "tons"] + +base_value_type = "exact" +base_value = "1000000" +base_units = [ { u = "Gram", p = 1} ] + + + +[[unit]] +enum_name = "Ounce" +print = "oz" +parse = ["oz", "ounce", "ounces"] + +base_value_type = "exact" +base_value = "28.349523125" +base_units = [ { u = "Gram", p = 1} ] + + + +[[unit]] +enum_name = "Pound" +print = "lb" +parse = ["lb", "lbs", "pound", "pounds"] + +base_value_type = "exact" +base_value = "453.59237" +base_units = [ { u = "Gram", p = 1} ] + + + +[[unit]] +enum_name = "PoundForce" +print = "lbf" +parse = ["lbf", "poundforce"] + +base_value_type = "exact" +base_value = "4448.2216152605" +base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 1}, { u = "Second", p = -2} ] + + + +[[unit]] +enum_name = "Newton" +print = "N" +parse = ["newton", "newtons"] +parse_with_prefix = "N" + +base_value_type = "exact" +base_value = "1000" +base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 1}, { u = "Second", p = -2} ] + + + + +# Misc Units + +[[unit]] +enum_name = "Katal" +print = "kat" +parse = ["katal"] +parse_with_prefix = "kat" + +base_value_type = "exact" +base_value = "1" +base_units = [ { u = "Mole", p = 1}, { u = "Second", p = -1} ] + + + + +# Radioactivity + +[[unit]] +enum_name = "Becquerel" +print = "Bq" +parse = ["becquerel"] +parse_with_prefix = "Bq" + +base_value_type = "exact" +base_value = "1" +base_units = [ { u = "Second", p = -1} ] + + +[[unit]] +enum_name = "Gray" +print = "Gy" +parse = ["gray"] +parse_with_prefix = "Gy" + +base_value_type = "exact" +base_value = "1" +base_units = [ { u = "Meter", p = 2}, { u = "Second", p = -2} ] + + +[[unit]] # Not radian, radioactivity unit +enum_name = "Rad" +print = "rad" +parse_with_prefix = "rad" + +base_value_type = "exact" +base_value = "0.01" +base_units = [ { u = "Meter", p = 2}, { u = "Second", p = -2} ] \ No newline at end of file diff --git a/units.md b/units.md index c1eb3f1..37b9c01 100644 --- a/units.md +++ b/units.md @@ -6,29 +6,6 @@ | [DPI](https://en.wikipedia.org/wiki/Dots_per_inch) | `dpi` | | [Dot](https://en.wikipedia.org/wiki/Dots_per_inch) | `dots`, `dot` | | [Frame](https://en.wikipedia.org/wiki/Film_frame) | `frames`, `frame` | - -flops -kWh abbreviations - - - | [Tonne](https://en.wikipedia.org/wiki/Tonne) | `tonnes`, `tonne`, `tons`, `ton`, `t` | - | [Ounce](https://en.wikipedia.org/wiki/Ounce) | `ounces`, `ounce`, `oz` | - | [Newton](https://en.wikipedia.org/wiki/Newton_(unit)) | `newton`, `N` | - | [Pound](https://en.wikipedia.org/wiki/Pound_(mass)) | `pounds`, `pound`, `lb` | - | [Pound-force](https://en.wikipedia.org/wiki/Pound_%28force%29) | `pound_force`, `lbf` | - - - - | [Becquerel](https://en.wikipedia.org/wiki/Becquerel) | `becquerel`, `Bq` | - | [Bel](https://en.wikipedia.org/wiki/Decibel) | `bel` | - | [British thermal unit](https://en.wikipedia.org/wiki/British_thermal_unit) | `BTU` | - | [Calorie](https://en.wikipedia.org/wiki/Calorie) | `calories`, `calorie`, `cal` | - | [Degree](https://en.wikipedia.org/wiki/Degree_(angle)) | `degrees`, `degree`, `deg`, `°` | - | [Euro](https://en.wikipedia.org/wiki/Euro) | `euros`, `euro`, `EUR`, `€` | - | [Gray](https://en.wikipedia.org/wiki/Gray_(unit)) | `gray`, `Gy` | - | [Katal](https://en.wikipedia.org/wiki/Katal) | `katal`, `kat` | - | [Lumen](https://en.wikipedia.org/wiki/Lumen_(unit)) | `lumen`, `lm` | - | [Lux](https://en.wikipedia.org/wiki/Lux) | `lux`, `lx` | | [PPI](https://en.wikipedia.org/wiki/Pixels_per_inch) | `ppi` | | [Parts-per-million](https://en.wikipedia.org/wiki/Parts-per_notation) | `ppm` | | [Parts-per-billion](https://en.wikipedia.org/wiki/Parts-per_notation) | `ppb` | @@ -37,6 +14,21 @@ kWh abbreviations | [Percent](https://en.wikipedia.org/wiki/Parts-per_notation) | `percent`, `pct` | | [Person](https://en.wiktionary.org/wiki/person) | `persons`, `person`, `people` | | [Piece](https://en.wiktionary.org/wiki/piece) | `pieces`, `piece` | - | [RPM](https://en.wikipedia.org/wiki/RPM) | `RPM`, `rpm` | - | [Radian](https://en.wikipedia.org/wiki/Radian) | `radians`, `radian`, `rad` | - | [Rod](https://en.wikipedia.org/wiki/Rod_(unit)) | `rods`, `rod` | \ No newline at end of file + | [RPM](https://en.wikipedia.org/wiki/RPM) | `RPM`, `rpm` | + + + + | [Lumen](https://en.wikipedia.org/wiki/Lumen_(unit)) | `lumen`, `lm` | + | [Lux](https://en.wikipedia.org/wiki/Lux) | `lux`, `lx` | + | [Bel](https://en.wikipedia.org/wiki/Decibel) | `bel` + + +flops +kWh abbreviations +selective prefixes: tonne (k M G) +selective prefix: calorie +print units with powers, no division sign + + | [Degree](https://en.wikipedia.org/wiki/Degree_(angle)) | `degrees`, `degree`, `deg`, `°` | + + | [Radian](https://en.wikipedia.org/wiki/Radian) | `radians`, `radian`, `rad` | \ No newline at end of file