13 changed files with 845 additions and 8 deletions
@ -0,0 +1,41 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type PartsPerUnits = PartsPerMetricUnits; |
|||
export type PartsPerMetricUnits = 'ppm' | 'ppb'; |
|||
|
|||
const METRIC: TbMeasureUnits<PartsPerMetricUnits> = { |
|||
units: { |
|||
ppm: { |
|||
name: 'unit.ppm', |
|||
tags: ['carbon dioxide', 'co²', 'carbon monoxide', 'co', 'aqi', 'air quality', 'total volatile organic compounds', 'tvoc', 'ppm'], |
|||
to_anchor: 1, |
|||
}, |
|||
ppb: { |
|||
name: 'unit.ppb', |
|||
tags: ['ozone', 'o³', 'nitrogen dioxide', 'no²', 'sulfur dioxide', 'so²', 'aqi', 'air quality', 'tvoc', 'ppb'], |
|||
to_anchor: 0.001, |
|||
} |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<PartsPerUnits> = { |
|||
METRIC, |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,96 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type PowerUnits = PowerMetricUnits | PowerImperialUnits; |
|||
|
|||
export type PowerMetricUnits = 'W' | 'μW' | 'mW' | 'kW' | 'MW' | 'GW' | 'PS'; |
|||
export type PowerImperialUnits = 'BTU/s' | 'ft-lb/s' | 'hp' | 'BTU/h'; |
|||
|
|||
const METRIC: TbMeasureUnits<PowerMetricUnits> = { |
|||
ratio: 0.737562149, |
|||
units: { |
|||
W: { |
|||
name: 'unit.watt', |
|||
tags: ['power', 'horsepower', 'performance', 'watt', 'watts', 'electricity', 'W'], |
|||
to_anchor: 1, |
|||
}, |
|||
μW: { |
|||
name: 'unit.microwatt', |
|||
tags: ['power', 'horsepower', 'performance', 'microwatt', 'microwatts', 'electricity', 'μW'], |
|||
to_anchor: 0.000001, |
|||
}, |
|||
mW: { |
|||
name: 'unit.milliwatt', |
|||
tags: ['power', 'horsepower', 'performance', 'milliwatt', 'milliwatts', 'electricity', 'mW'], |
|||
to_anchor: 0.001, |
|||
}, |
|||
kW: { |
|||
name: 'unit.kilowatt', |
|||
tags: ['power', 'horsepower', 'performance', 'kilowatt', 'kilowatts', 'electricity', 'kW'], |
|||
to_anchor: 1000, |
|||
}, |
|||
MW: { |
|||
name: 'unit.megawatt', |
|||
tags: ['power', 'horsepower', 'performance', 'megawatt', 'megawatts', 'electricity', 'MW'], |
|||
to_anchor: 1000000, |
|||
}, |
|||
GW: { |
|||
name: 'unit.gigawatt', |
|||
tags: ['power', 'horsepower', 'performance', 'gigawatt', 'gigawatts', 'electricity', 'GW'], |
|||
to_anchor: 1000000000, |
|||
}, |
|||
PS: { |
|||
name: 'unit.metric-horsepower', |
|||
tags: ['power', 'performance', 'metric horsepower', 'PS'], |
|||
to_anchor: 735.49875, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const IMPERIAL: TbMeasureUnits<PowerImperialUnits> = { |
|||
ratio: 1 / 0.737562149, |
|||
units: { |
|||
'BTU/s': { |
|||
name: 'unit.btu-per-second', |
|||
tags: ['power', 'heat transfer', 'thermal energy', 'british thermal unit per second', 'Btu/s'], |
|||
to_anchor: 778.16937, |
|||
}, |
|||
'ft-lb/s': { |
|||
name: 'unit.foot-pound-per-second', |
|||
tags: ['power', 'foot-pound per second', 'foot-pounds per second', 'ft-lb/s', 'mechanical power'], |
|||
to_anchor: 1, |
|||
}, |
|||
hp: { |
|||
name: 'unit.horsepower', |
|||
tags: ['power', 'horsepower', 'performance', 'electricity', 'horsepowers', 'hp'], |
|||
to_anchor: 550, |
|||
}, |
|||
'BTU/h': { |
|||
name: 'unit.btu-per-hour', |
|||
tags: ['power', 'heat transfer', 'thermal energy', 'HVAC', 'BTU/h'], |
|||
to_anchor: 0.216158, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<PowerUnits> = { |
|||
METRIC, |
|||
IMPERIAL |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,175 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type PressureUnits = PressureMetricUnits | PressureImperialUnits; |
|||
|
|||
export type PressureMetricUnits = |
|||
| 'Pa' |
|||
| 'kPa' |
|||
| 'MPa' |
|||
| 'GPa' |
|||
| 'hPa' |
|||
| 'mb' |
|||
| 'mbar' |
|||
| 'bar' |
|||
| 'kbar' |
|||
| 'Torr' |
|||
| 'mmHg' |
|||
| 'atm' |
|||
| 'Pa/m²' |
|||
| 'N/mm²' |
|||
| 'N/m²' |
|||
| 'kN/m²' |
|||
| 'kgf/m²' |
|||
| 'Pa/cm²'; |
|||
|
|||
export type PressureImperialUnits = 'psi' | 'ksi' | 'inHg' | 'psi/in²' | 'tonf/in²'; |
|||
|
|||
const METRIC: TbMeasureUnits<PressureMetricUnits> = { |
|||
ratio: 0.00014503768078, |
|||
units: { |
|||
Pa: { |
|||
name: 'unit.pascal', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'pascal', 'pascals', 'Pa', 'atmospheric pressure', 'air pressure', 'weather', 'altitude', 'flight'], |
|||
to_anchor: 0.001, // 1 Pa = 0.001 kPa
|
|||
}, |
|||
kPa: { |
|||
name: 'unit.kilopascal', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'kilopascal', 'kilopascals', 'kPa'], |
|||
to_anchor: 1, |
|||
}, |
|||
MPa: { |
|||
name: 'unit.megapascal', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'megapascal', 'megapascals', 'MPa'], |
|||
to_anchor: 1000, |
|||
}, |
|||
GPa: { |
|||
name: 'unit.gigapascal', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'gigapascal', 'gigapascals', 'GPa'], |
|||
to_anchor: 1000000, |
|||
}, |
|||
hPa: { |
|||
name: 'unit.hectopascal', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'hectopascal', 'hectopascals', 'hPa', 'atmospheric pressure'], |
|||
to_anchor: 0.1, |
|||
}, |
|||
mbar: { |
|||
name: 'unit.millibar', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'millibar', 'millibars', 'mbar'], |
|||
to_anchor: 0.1, |
|||
}, |
|||
mb: { |
|||
name: 'unit.millibar', |
|||
tags: ['atmospheric pressure', 'air pressure', 'weather', 'altitude', 'flight', 'mb'], |
|||
to_anchor: 0.1, |
|||
}, |
|||
bar: { |
|||
name: 'unit.bar', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'bar', 'bars'], |
|||
to_anchor: 100, |
|||
}, |
|||
kbar: { |
|||
name: 'unit.kilobar', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'kilobar', 'kilobars', 'kbar'], |
|||
to_anchor: 100000, |
|||
}, |
|||
Torr: { |
|||
name: 'unit.torr', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'vacuum pressure', 'torr'], |
|||
to_anchor: 101325 / 760000, |
|||
}, |
|||
mmHg: { |
|||
name: 'unit.millimeters-of-mercury', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'millimeter of mercury', 'millimeters of mercury', 'mmHg', 'vacuum pressure'], |
|||
to_anchor: 0.133322, |
|||
}, |
|||
atm: { |
|||
name: 'unit.atmospheres', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'atmosphere', 'atmospheres', 'atmospheric pressure', 'atm'], |
|||
to_anchor: 101.325, |
|||
}, |
|||
'Pa/m²': { |
|||
name: 'unit.pascal-per-square-meter', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'pascal per square meter', 'Pa/m²'], |
|||
to_anchor: 0.001, |
|||
}, |
|||
'N/mm²': { |
|||
name: 'unit.newton-per-square-millimeter', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'newton per square millimeter', 'N/mm²'], |
|||
to_anchor: 1000, |
|||
}, |
|||
'N/m²': { |
|||
name: 'unit.newton-per-square-meter', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'newton per square meter', 'N/m²'], |
|||
to_anchor: 0.001, |
|||
}, |
|||
'kN/m²': { |
|||
name: 'unit.kilonewton-per-square-meter', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'kilonewton per square meter', 'kN/m²'], |
|||
to_anchor: 1, |
|||
}, |
|||
'kgf/m²': { |
|||
name: 'unit.kilogram-force-per-square-meter', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'kilogram-force per square meter', 'kgf/m²'], |
|||
to_anchor: 0.00980665, |
|||
}, |
|||
'Pa/cm²': { |
|||
name: 'unit.pascal-per-square-centimeter', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'pascal per square centimeter', 'Pa/cm²'], |
|||
to_anchor: 0.1, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const IMPERIAL: TbMeasureUnits<PressureImperialUnits> = { |
|||
ratio: 1 / 0.00014503768078, |
|||
units: { |
|||
psi: { |
|||
name: 'unit.pounds-per-square-inch', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'pounds per square inch', 'psi'], |
|||
to_anchor: 0.001, |
|||
}, |
|||
ksi: { |
|||
name: 'unit.kilopound-per-square-inch', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'kilopound per square inch', 'kilopounds per square inch', 'ksi'], |
|||
to_anchor: 1, |
|||
}, |
|||
inHg: { |
|||
name: 'unit.inch-of-mercury', |
|||
tags: ['pressure', 'force', 'compression', 'tension', 'vacuum pressure', 'inHg', 'atmospheric pressure', 'barometric pressure'], |
|||
to_anchor: 0.000491154, |
|||
}, |
|||
'psi/in²': { |
|||
name: 'unit.pound-per-square-inch', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'pound per square inch', 'psi/in²'], |
|||
to_anchor: 0.001, |
|||
}, |
|||
'tonf/in²': { |
|||
name: 'unit.ton-force-per-square-inch', |
|||
tags: ['pressure', 'stress', 'mechanical strength', 'ton-force per square inch', 'tonf/in²'], |
|||
to_anchor: 2, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<PressureUnits> = { |
|||
METRIC, |
|||
IMPERIAL |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,81 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type SpeedUnits = SpeedMetricUnits | SpeedImperialUnits; |
|||
|
|||
export type SpeedMetricUnits = 'm/s' | 'km/h' | 'mm/min'; |
|||
export type SpeedImperialUnits = 'mph' | 'kt' | 'ft/s' | 'ft/min' | 'in/h'; |
|||
|
|||
const METRIC: TbMeasureUnits<SpeedMetricUnits> = { |
|||
ratio: 1 / 1.609344, |
|||
units: { |
|||
'm/s': { |
|||
name: 'unit.meter-per-second', |
|||
tags: ['speed', 'velocity', 'pace', 'meter per second', 'm/s', 'peak', 'peak to peak', 'root mean square (RMS)', 'vibration', 'wind speed', 'weather'], |
|||
to_anchor: 3.6, |
|||
}, |
|||
'km/h': { |
|||
name: 'unit.kilometer-per-hour', |
|||
tags: ['speed', 'velocity', 'pace', 'kilometer per hour', 'km/h'], |
|||
to_anchor: 1, |
|||
}, |
|||
'mm/min': { |
|||
name: 'unit.millimeters-per-minute', |
|||
tags: ['feed rate', 'cutting feed rate', 'millimeters per minute', 'mm/min'], |
|||
to_anchor: 0.06, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const IMPERIAL: TbMeasureUnits<SpeedImperialUnits> = { |
|||
ratio: 1.609344, |
|||
units: { |
|||
mph: { |
|||
name: 'unit.mile-per-hour', |
|||
tags: ['speed', 'velocity', 'pace', 'mile per hour', 'mph'], |
|||
to_anchor: 1, |
|||
}, |
|||
kt: { |
|||
name: 'unit.knot', |
|||
tags: ['speed', 'velocity', 'pace', 'knot', 'knots', 'kt'], |
|||
to_anchor: 1.150779, |
|||
}, |
|||
'ft/s': { |
|||
name: 'unit.foot-per-second', |
|||
tags: ['speed', 'velocity', 'pace', 'foot per second', 'ft/s'], |
|||
to_anchor: 0.681818, // 1 ft/s ≈ 0.681818 mph
|
|||
}, |
|||
'ft/min': { |
|||
name: 'unit.foot-per-minute', |
|||
tags: ['speed', 'velocity', 'pace', 'foot per minute', 'ft/min'], |
|||
to_anchor: 0.0113636, |
|||
}, |
|||
'in/h': { |
|||
name: 'unit.inch-per-hour', |
|||
tags: ['speed', 'velocity', 'pace', 'inch per hour', 'in/h'], |
|||
to_anchor: 0.00001578, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<SpeedUnits> = { |
|||
METRIC, |
|||
IMPERIAL, |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,56 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type TorqueUnits = TorqueMetricUnits | TorqueImperialUnits; |
|||
|
|||
export type TorqueMetricUnits = 'Nm'; |
|||
export type TorqueImperialUnits = 'lbf-ft' | 'in·lbf'; |
|||
|
|||
const METRIC: TbMeasureUnits<TorqueMetricUnits> = { |
|||
ratio: 1 / 1.355818, |
|||
units: { |
|||
Nm: { |
|||
name: 'unit.newton-meter', |
|||
tags: ['torque', 'rotational force', 'newton meter', 'Nm'], |
|||
to_anchor: 1, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const IMPERIAL: TbMeasureUnits<TorqueImperialUnits> = { |
|||
ratio: 1.355818, |
|||
units: { |
|||
'lbf-ft': { |
|||
name: 'unit.foot-pounds', |
|||
tags: ['torque', 'rotational force', 'foot-pound', 'foot-pounds', 'ft·lbf'], |
|||
to_anchor: 1, |
|||
}, |
|||
'in·lbf': { |
|||
name: 'unit.inch-pounds', |
|||
tags: ['torque', 'rotational force', 'inch-pounds', 'inch-pound', 'in·lbf'], |
|||
to_anchor: 1 / 12, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<TorqueUnits> = { |
|||
METRIC, |
|||
IMPERIAL, |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,66 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type VoltageUnits = VoltageMetricUnits; |
|||
export type VoltageMetricUnits = 'pV' | 'nV' | 'μV' | 'mV' | 'V' | 'kV' | 'MV'; |
|||
|
|||
const METRIC: TbMeasureUnits<VoltageMetricUnits> = { |
|||
units: { |
|||
pV: { |
|||
name: 'unit.picovolt', |
|||
tags: ['voltage', 'volts', 'picovolt', 'pV'], |
|||
to_anchor: 1e-12, |
|||
}, |
|||
nV: { |
|||
name: 'unit.nanovolt', |
|||
tags: ['voltage', 'volts', 'nanovolt', 'nV'], |
|||
to_anchor: 1e-9, |
|||
}, |
|||
μV: { |
|||
name: 'unit.microvolt', |
|||
tags: ['electric potential', 'electric tension', 'voltage', 'microvolt', 'microvolts', 'μV'], |
|||
to_anchor: 1e-6, |
|||
}, |
|||
mV: { |
|||
name: 'unit.millivolt', |
|||
tags: ['electric potential', 'electric tension', 'voltage', 'millivolt', 'millivolts', 'mV'], |
|||
to_anchor: 0.001, // 1 mV = 1e-3 V
|
|||
}, |
|||
V: { |
|||
name: 'unit.volt', |
|||
tags: ['electric potential', 'electric tension', 'voltage', 'volt', 'volts', 'V', 'power source', 'battery', 'battery level'], |
|||
to_anchor: 1, |
|||
}, |
|||
kV: { |
|||
name: 'unit.kilovolt', |
|||
tags: ['electric potential', 'electric tension', 'voltage', 'kilovolt', 'kilovolts', 'kV'], |
|||
to_anchor: 1000, |
|||
}, |
|||
MV: { |
|||
name: 'unit.megavolt', |
|||
tags: ['electric potential', 'electric tension', 'voltage', 'megavolt', 'megavolts', 'MV'], |
|||
to_anchor: 1e6, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<VoltageUnits> = { |
|||
METRIC, |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,114 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type VolumeFlowRateUnits = VolumeFlowRateMetricUnits | VolumeFlowRateImperialUnits; |
|||
|
|||
export type VolumeFlowRateMetricUnits = |
|||
| 'dm³/s' |
|||
| 'mL/min' |
|||
| 'L/s' |
|||
| 'L/min' |
|||
| 'L/hr' |
|||
| 'm³/s' |
|||
| 'm³/hr'; |
|||
|
|||
export type VolumeFlowRateImperialUnits = |
|||
| 'fl-oz/s' |
|||
| 'ft³/s' |
|||
| 'ft³/min' |
|||
| 'gal/hr' |
|||
| 'GPM'; |
|||
|
|||
const METRIC: TbMeasureUnits<VolumeFlowRateMetricUnits> = { |
|||
ratio: 33.8140227, |
|||
units: { |
|||
'dm³/s': { |
|||
name: 'unit.cubic-decimeter-per-second', |
|||
tags: ['volume flow', 'cubic decimeter per second', 'dm3/s'], |
|||
to_anchor: 1, |
|||
}, |
|||
'mL/min': { |
|||
name: 'unit.milliliters-per-minute', |
|||
tags: ['volume flow', 'flow rate', 'fluid dynamics', 'milliliters per minute', 'mL/min'], |
|||
to_anchor: 1 / 60000, |
|||
}, |
|||
'L/s': { |
|||
name: 'unit.liter-per-second', |
|||
tags: ['volume flow', 'airflow', 'ventilation', 'HVAC', 'gas flow rate', 'liter per second', 'L/s'], |
|||
to_anchor: 1, |
|||
}, |
|||
'L/min': { |
|||
name: 'unit.liter-per-minute', |
|||
tags: ['volume flow', 'airflow', 'ventilation', 'HVAC', 'gas flow rate', 'liter per minute', 'L/min'], |
|||
to_anchor: 1 / 60, |
|||
}, |
|||
'L/hr': { |
|||
name: 'unit.liters-per-hour', |
|||
tags: ['volume flow', 'fuel consumption', 'liter per hour', 'L/hr'], |
|||
to_anchor: 1 / 3600, |
|||
}, |
|||
'm³/s': { |
|||
name: 'unit.cubic-meters-per-second', |
|||
tags: ['volume flow', 'airflow', 'ventilation', 'HVAC', 'gas flow rate', 'cubic meters per second', 'm³/s'], |
|||
to_anchor: 1000, |
|||
}, |
|||
'm³/hr': { |
|||
name: 'unit.cubic-meters-per-hour', |
|||
tags: ['volume flow', 'airflow', 'ventilation', 'HVAC', 'gas flow rate', 'cubic meters per hour', 'm³/hr'], |
|||
to_anchor: 5 / 18, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const IMPERIAL: TbMeasureUnits<VolumeFlowRateImperialUnits> = { |
|||
ratio: 1 / 33.8140227, |
|||
units: { |
|||
'fl-oz/s': { |
|||
name: 'unit.fluid-ounce-per-second', |
|||
tags: ['volume flow', 'fluid ounce per second', 'fl-oz/s'], |
|||
to_anchor: 1, |
|||
}, |
|||
'ft³/s': { |
|||
name: 'unit.cubic-foot-per-second', |
|||
tags: ['volume flow', 'flow rate', 'fluid flow', 'cubic foot per second', 'cubic feet per second', 'ft³/s'], |
|||
to_anchor: 957.506, |
|||
}, |
|||
'ft³/min': { |
|||
name: 'unit.cubic-foot-per-minute', |
|||
tags: ['volume flow', 'airflow', 'ventilation', 'HVAC', 'gas flow rate', 'CFM', 'flow rate', 'fluid flow', 'cubic foot per minute', 'ft³/min'], |
|||
to_anchor: 957.506 / 60, |
|||
}, |
|||
'gal/hr': { |
|||
name: 'unit.gallons-per-hour', |
|||
tags: ['volume flow', 'fuel consumption', 'gallons per hour', 'gal/hr'], |
|||
to_anchor: 128 / 3600, |
|||
}, |
|||
'GPM': { |
|||
name: 'unit.gallons-per-minute', |
|||
tags: ['volume flow', 'airflow', 'ventilation', 'HVAC', 'gas flow rate', 'gallons per minute', 'GPM'], |
|||
to_anchor: 128 / 60, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<VolumeFlowRateUnits> = { |
|||
METRIC, |
|||
IMPERIAL, |
|||
}; |
|||
|
|||
export default measure; |
|||
@ -0,0 +1,168 @@ |
|||
///
|
|||
/// Copyright © 2016-2025 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; |
|||
|
|||
export type VolumeUnits = VolumeMetricUnits | VolumeImperialUnits; |
|||
|
|||
export type VolumeMetricUnits = |
|||
| 'mm³' |
|||
| 'cm³' |
|||
| 'µL' |
|||
| 'mL' |
|||
| 'L' |
|||
| 'hL' |
|||
| 'm³' |
|||
| 'km³'; |
|||
|
|||
export type VolumeImperialUnits = |
|||
| 'tsp' |
|||
| 'tbsp' |
|||
| 'in³' |
|||
| 'fl-oz' |
|||
| 'cup' |
|||
| 'pt' |
|||
| 'qt' |
|||
| 'gal' |
|||
| 'ft³' |
|||
| 'yd³' |
|||
| 'bbl' |
|||
| 'gi' |
|||
| 'hhd'; |
|||
|
|||
const METRIC: TbMeasureUnits<VolumeMetricUnits> = { |
|||
ratio: 33.8140226, |
|||
units: { |
|||
'mm³': { |
|||
name: 'unit.cubic-millimeter', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic millimeter', 'mm³'], |
|||
to_anchor: 1 / 1000000, |
|||
}, |
|||
'cm³': { |
|||
name: 'unit.cubic-centimeter', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic centimeter', 'cubic centimeters', 'cm³'], |
|||
to_anchor: 1 / 1000, |
|||
}, |
|||
µL: { |
|||
name: 'unit.microliter', |
|||
tags: ['volume', 'liquid measurement', 'microliter', 'µL'], |
|||
to_anchor: 0.000001, |
|||
}, |
|||
mL: { |
|||
name: 'unit.milliliter', |
|||
tags: ['volume', 'capacity', 'extent', 'milliliter', 'milliliters', 'mL'], |
|||
to_anchor: 1 / 1000, |
|||
}, |
|||
L: { |
|||
name: 'unit.liter', |
|||
tags: ['volume', 'capacity', 'extent', 'liter', 'liters', 'l'], |
|||
to_anchor: 1, |
|||
}, |
|||
hL: { |
|||
name: 'unit.hectoliter', |
|||
tags: ['volume', 'capacity', 'extent', 'hectoliter', 'hectoliters', 'hl'], |
|||
to_anchor: 100, |
|||
}, |
|||
'm³': { |
|||
name: 'unit.cubic-meter', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic meter', 'cubic meters', 'm³'], |
|||
to_anchor: 1000, |
|||
}, |
|||
'km³': { |
|||
name: 'unit.cubic-kilometer', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic kilometer', 'cubic kilometers', 'km³'], |
|||
to_anchor: 1000000000000, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const IMPERIAL: TbMeasureUnits<VolumeImperialUnits> = { |
|||
ratio: 1 / 33.8140226, |
|||
units: { |
|||
tsp: { |
|||
name: 'unit.teaspoon', |
|||
tags: ['volume', 'cooking measurement', 'tsp'], |
|||
to_anchor: 1 / 6, |
|||
}, |
|||
tbsp: { |
|||
name: 'unit.tablespoon', |
|||
tags: ['volume', 'cooking measurement', 'tbsp'], |
|||
to_anchor: 1 / 2, |
|||
}, |
|||
'in³': { |
|||
name: 'unit.cubic-inch', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic inch', 'cubic inches', 'in³'], |
|||
to_anchor: 0.55411, |
|||
}, |
|||
'fl-oz': { |
|||
name: 'unit.fluid-ounce', |
|||
tags: ['volume', 'capacity', 'extent', 'fluid ounce', 'fluid ounces', 'fl-oz'], |
|||
to_anchor: 1, |
|||
}, |
|||
cup: { |
|||
name: 'unit.cup', |
|||
tags: ['volume', 'cooking measurement', 'cup'], |
|||
to_anchor: 8, |
|||
}, |
|||
pt: { |
|||
name: 'unit.pint', |
|||
tags: ['volume', 'capacity', 'extent', 'pint', 'pints', 'pt'], |
|||
to_anchor: 16, |
|||
}, |
|||
qt: { |
|||
name: 'unit.quart', |
|||
tags: ['volume', 'capacity', 'extent', 'quart', 'quarts', 'qt'], |
|||
to_anchor: 32, |
|||
}, |
|||
gal: { |
|||
name: 'unit.gallon', |
|||
tags: ['volume', 'capacity', 'extent', 'gallon', 'gallons', 'gal'], |
|||
to_anchor: 128, |
|||
}, |
|||
'ft³': { |
|||
name: 'unit.cubic-foot', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic foot', 'cubic feet', 'ft³'], |
|||
to_anchor: 957.506, |
|||
}, |
|||
'yd³': { |
|||
name: 'unit.cubic-yard', |
|||
tags: ['volume', 'capacity', 'extent', 'cubic yard', 'cubic yards', 'yd³'], |
|||
to_anchor: 25852.7, |
|||
}, |
|||
bbl: { |
|||
name: 'unit.oil-barrels', |
|||
tags: ['volume', 'capacity', 'extent', 'oil barrel', 'oil barrels', 'bbl'], |
|||
to_anchor: 5376, |
|||
}, |
|||
gi: { |
|||
name: 'unit.gill', |
|||
tags: ['volume', 'liquid measurement', 'gi'], |
|||
to_anchor: 4, |
|||
}, |
|||
hhd: { |
|||
name: 'unit.hogshead', |
|||
tags: ['volume', 'liquid measurement', 'hhd'], |
|||
to_anchor: 8064, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
const measure: TbMeasure<VolumeUnits> = { |
|||
METRIC, |
|||
IMPERIAL, |
|||
}; |
|||
|
|||
export default measure; |
|||
Loading…
Reference in new issue