diff --git a/ui-ngx/src/app/shared/models/unit.models.ts b/ui-ngx/src/app/shared/models/unit.models.ts index 27cca5f603..c2763ff632 100644 --- a/ui-ngx/src/app/shared/models/unit.models.ts +++ b/ui-ngx/src/app/shared/models/unit.models.ts @@ -15,21 +15,59 @@ /// import acceleration, { AccelerationUnits } from '@shared/models/units/acceleration'; +import airQualityIndex, { AirQualityIndexUnits } from '@shared/models/units/air-quality-index'; +import amountOfSubstance, { AmountOfSubstanceUnits } from '@shared/models/units/amount-of-substance'; import angle, { AngleUnits } from '@shared/models/units/angle'; import angularAcceleration, { AngularAccelerationUnits } from '@shared/models/units/angular-acceleration'; import area, { AreaUnits } from '@shared/models/units/area'; +import capacitance, { CapacitanceUnits } from '@shared/models/units/capacitance'; +import catalyticActivity, { CatalyticActivityUnits } from '@shared/models/units/catalytic-activity'; +import catalyticConcentration, { CatalyticConcentrationUnits } from '@shared/models/units/catalytic-concentration'; import charge, { ChargeUnits } from '@shared/models/units/charge'; +import currentDensity, { CurrentDensityUnits } from '@shared/models/units/current-density'; +import dataTransferRate, { DataTransferRateUnits } from '@shared/models/units/data-transfer-rate'; +import density, { DensityUnits } from '@shared/models/units/density'; import digital, { DigitalUnits } from '@shared/models/units/digital'; +import dimensionRatio, { DimensionRatioUnits } from '@shared/models/units/dimension-ratio'; +import dynamicViscosity, { DynamicViscosityUnits } from '@shared/models/units/dynamic-viscosity'; +import earthquakeMagnitude, { EarthquakeMagnitudeUnits } from '@shared/models/units/earthquake-magnitude'; import electricCurrent, { ElectricCurrentUnits } from '@shared/models/units/electric-current'; +import electricDipoleMoment, { ElectricDipoleMomentUnits } from '@shared/models/units/electric-dipole-moment'; +import electricFieldStrength, { ElectricFieldStrengthUnits } from '@shared/models/units/electric-field-strength'; +import electricFlux, { ElectricFluxUnits } from '@shared/models/units/electric-flux'; +import electricPermittivity, { ElectricPermittivityUnits } from '@shared/models/units/electric-permittivity'; +import electricalConductance, { ElectricalConductanceUnits } from '@shared/models/units/electrical-conductance'; +import electricalConductivity, { ElectricalConductivityUnits } from '@shared/models/units/electrical-conductivity'; import energy, { EnergyUnits } from '@shared/models/units/energy'; import force, { ForceUnits } from '@shared/models/units/force'; +import fuelEfficiency, { FuelEfficiencyUnits } from '@shared/models/units/fuel-efficiency'; import frequency, { FrequencyUnits } from '@shared/models/units/frequency'; +import heatCapacity, { HeatCapacityUnits } from '@shared/models/units/heat-capacity'; import illuminance, { IlluminanceUnits } from '@shared/models/units/illuminance'; +import inductance, { InductanceUnits } from '@shared/models/units/inductance'; +import kinematicViscosity, { KinematicViscosityUnits } from '@shared/models/units/kinematic-viscosity'; import length, { LengthUnits } from '@shared/models/units/length'; +import lightExposure, { LightExposureUnits } from '@shared/models/units/light-exposure'; +import linerChargeDensity, { LinerChargeDensityUnits } from '@shared/models/units/liner-charge-density'; +import logarithmicRatio, { LogarithmicRatioUnits } from '@shared/models/units/logarithmic-ratio'; +import luminousEfficacy, { LuminousEfficacyUnits } from '@shared/models/units/luminous-efficacy'; +import luminousFlux, { LuminousFluxUnits } from '@shared/models/units/luminous-flux'; +import luminousIntensity, { LuminousIntensityUnits } from '@shared/models/units/luminous-intensity'; +import magneticFieldGradient, { MagneticFieldGradientUnits } from '@shared/models/units/magnetic-field-gradient'; +import magneticFlux, { MagneticFluxUnits } from '@shared/models/units/magnetic-flux'; +import magneticFluxDensity, { MagneticFluxDensityUnits } from '@shared/models/units/magnetic-flux-density'; +import magneticMoment, { MagneticMomentUnits } from '@shared/models/units/magnetic-moment'; +import magneticPermeability, { MagneticPermeabilityUnits } from '@shared/models/units/magnetic-permeability'; import mass, { MassUnits } from '@shared/models/units/mass'; +import massFraction, { MassFractionUnits } from '@shared/models/units/mass-fraction'; +import molarConcentration, { MolarConcentrationUnits } from '@shared/models/units/molar-concentration'; +import molarEnergy, { MolarEnergyUnits } from '@shared/models/units/molar-energy'; +import molarHeatCapacity, { MolarHeatCapacityUnits } from '@shared/models/units/molar-heat-capacity'; +import molarMass, { MolarMassUnits } from '@shared/models/units/molar-mass'; import partsPer, { PartsPerUnits } from '@shared/models/units/parts-per'; import power, { PowerUnits } from '@shared/models/units/power'; import pressure, { PressureUnits } from '@shared/models/units/pressure'; +import specificHumidity, { SpecificHumidityUnits } from '@shared/models/units/specific-humidity'; import speed, { SpeedUnits } from '@shared/models/units/speed'; import temperature, { TemperatureUnits } from '@shared/models/units/temperature'; import time, { TimeUnits } from '@shared/models/units/time'; @@ -41,21 +79,59 @@ import { TranslateService } from '@ngx-translate/core'; export type AllMeasuresUnits = | AccelerationUnits + | AirQualityIndexUnits + | AmountOfSubstanceUnits | AngleUnits | AngularAccelerationUnits | AreaUnits + | CapacitanceUnits + | CatalyticActivityUnits + | CatalyticConcentrationUnits | ChargeUnits + | CurrentDensityUnits + | DataTransferRateUnits + | DensityUnits | DigitalUnits + | DimensionRatioUnits + | DynamicViscosityUnits + | EarthquakeMagnitudeUnits | ElectricCurrentUnits + | ElectricDipoleMomentUnits + | ElectricFieldStrengthUnits + | ElectricFluxUnits + | ElectricPermittivityUnits + | ElectricalConductanceUnits + | ElectricalConductivityUnits | EnergyUnits | ForceUnits | FrequencyUnits + | FuelEfficiencyUnits + | HeatCapacityUnits | IlluminanceUnits + | InductanceUnits + | KinematicViscosityUnits | LengthUnits + | LightExposureUnits + | LinerChargeDensityUnits + | LogarithmicRatioUnits + | LuminousEfficacyUnits + | LuminousFluxUnits + | LuminousIntensityUnits + | MagneticFieldGradientUnits + | MagneticFluxUnits + | MagneticFluxDensityUnits + | MagneticMomentUnits + | MagneticPermeabilityUnits | MassUnits + | MassFractionUnits + | MolarConcentrationUnits + | MolarEnergyUnits + | MolarHeatCapacityUnits + | MolarMassUnits | PartsPerUnits | PowerUnits | PressureUnits + | SpecificHumidityUnits | SpeedUnits | TemperatureUnits | TimeUnits @@ -66,21 +142,59 @@ export type AllMeasuresUnits = export type AllMeasures = | 'acceleration' + | 'air-quality-index' + | 'amount-of-substance' | 'angle' | 'angular-acceleration' | 'area' + | 'capacitance' + | 'catalytic-activity' + | 'catalytic-concentration' | 'charge' + | 'current-density' + | 'data-transfer-rate' + | 'density' | 'digital' + | 'dimension-ratio' + | 'dynamic-viscosity' + | 'earthquake-magnitude' | 'electric-current' + | 'electric-dipole-moment' + | 'electric-field-strength' + | 'electric-flux' + | 'electric-permittivity' + | 'electrical-conductance' + | 'electrical-conductivity' | 'energy' | 'force' | 'frequency' + | 'fuel-efficiency' + | 'heat-capacity' | 'illuminance' + | 'inductance' + | 'kinematic-viscosity' | 'length' + | 'light-exposure' + | 'linear-charge-density' + | 'logarithmic-ratio' + | 'luminous-efficacy' + | 'luminous-flux' + | 'luminous-intensity' + | 'magnetic-field-gradient' + | 'magnetic-flux' + | 'magnetic-flux-density' + | 'magnetic-moment' + | 'magnetic-permeability' | 'mass' + | 'mass-fraction' + | 'molar-concentration' + | 'molar-energy' + | 'molar-heat-capacity' + | 'molar-mass' | 'parts-per' | 'power' | 'pressure' + | 'specific-humidity' | 'speed' | 'temperature' | 'time' @@ -94,21 +208,59 @@ const allMeasures: Record< TbMeasure > = Object.freeze({ acceleration, + 'air-quality-index': airQualityIndex, + 'amount-of-substance': amountOfSubstance, angle, 'angular-acceleration': angularAcceleration, area, + capacitance, + 'catalytic-activity': catalyticActivity, + 'catalytic-concentration': catalyticConcentration, charge, + 'current-density': currentDensity, + 'data-transfer-rate': dataTransferRate, + density, digital, + 'dimension-ratio': dimensionRatio, + 'dynamic-viscosity': dynamicViscosity, + 'earthquake-magnitude': earthquakeMagnitude, 'electric-current': electricCurrent, + 'electric-dipole-moment': electricDipoleMoment, + 'electric-field-strength': electricFieldStrength, + 'electric-flux': electricFlux, + 'electric-permittivity': electricPermittivity, + 'electrical-conductance': electricalConductance, + 'electrical-conductivity': electricalConductivity, energy, force, frequency, + 'fuel-efficiency': fuelEfficiency, + 'heat-capacity': heatCapacity, illuminance, + inductance, + 'kinematic-viscosity': kinematicViscosity, length, + 'light-exposure': lightExposure, + 'linear-charge-density': linerChargeDensity, + 'logarithmic-ratio': logarithmicRatio, + 'luminous-efficacy': luminousEfficacy, + 'luminous-flux': luminousFlux, + 'luminous-intensity': luminousIntensity, + 'magnetic-field-gradient': magneticFieldGradient, + 'magnetic-flux': magneticFlux, + 'magnetic-flux-density': magneticFluxDensity, + 'magnetic-moment': magneticMoment, + 'magnetic-permeability': magneticPermeability, mass, + 'mass-fraction': massFraction, + 'molar-concentration': molarConcentration, + 'molar-energy': molarEnergy, + 'molar-heat-capacity': molarHeatCapacity, + 'molar-mass': molarMass, 'parts-per': partsPer, power, pressure, + 'specific-humidity': specificHumidity, speed, temperature, time, @@ -143,7 +295,7 @@ export const UnitSystems = Object.values(UnitSystem); export interface Unit { name: string; - tags: string[]; + tags?: string[]; to_anchor: number; anchor_shift?: number; transform?: (value: number) => number; @@ -407,6 +559,9 @@ function buildUnitCache(measures: Record[]) { unit.name = translate.instant(unit.name); + const measureNameTranslation = translate.instant('unit.measures.' + measureName); + unit.tags = unit.tags ?? []; + unit.tags.push(testAbbr, unit.name, measureNameTranslation); unitCache.set(testAbbr, { measure: measureName, system: systemName, diff --git a/ui-ngx/src/app/shared/models/units/Magnetic-permeability.ts b/ui-ngx/src/app/shared/models/units/Magnetic-permeability.ts deleted file mode 100644 index be120c4b15..0000000000 --- a/ui-ngx/src/app/shared/models/units/Magnetic-permeability.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type MagneticPermeabilityMetricUnits = 'H/m'; -export type MagneticPermeabilityImperialUnits = 'G/Oe'; - -export type MagneticPermeabilityUnits = - | MagneticPermeabilityMetricUnits - | MagneticPermeabilityImperialUnits; - -const METRIC: TbMeasureUnits = { - transform: (Hm) => Hm * 795774.715, - units: { - 'H/m': { - name: 'unit.henry-per-meter', - tags: ['magnetic permeability', 'henry per meter', 'H/m'], - to_anchor: 1, - }, - }, -}; - -const IMPERIAL: TbMeasureUnits = { - transform: (GOe) => GOe / 795774.715, - units: { - 'G/Oe': { - name: 'unit.gauss-per-oersted', - tags: ['magnetic field', 'Gauss per Oersted', 'G/Oe'], - to_anchor: 1, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, - IMPERIAL, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/acceleration.ts b/ui-ngx/src/app/shared/models/units/acceleration.ts index 1a39b0b814..a1643020a9 100644 --- a/ui-ngx/src/app/shared/models/units/acceleration.ts +++ b/ui-ngx/src/app/shared/models/units/acceleration.ts @@ -26,22 +26,22 @@ const METRIC: TbMeasureUnits = { units: { 'G': { name: 'unit.g-force', - tags: ['acceleration', 'gravity', 'g-force', 'load', 'G'], + tags: ['gravity', 'g-force', 'load'], to_anchor: 9.80665, }, 'm/s²': { name: 'unit.meters-per-second-squared', - tags: ['peak', 'peak to peak', 'root mean square (RMS)', 'vibration', 'meters per second squared', 'm/s²'], + tags: ['peak', 'peak to peak', 'root mean square (RMS)', 'vibration', 'meters per second squared'], to_anchor: 1, }, 'Gal': { name: 'unit.gal', - tags: ['acceleration', 'gravity', 'g-force', 'Gal'], + tags: ['gravity', 'g-force'], to_anchor: 1, }, 'km/h²': { name: 'unit.kilometer-per-hour-squared', - tags: ['acceleration', 'rate of change of velocity', 'kilometer per hour squared', 'km/h²'], + tags: ['rate of change of velocity', 'kilometer per hour squared'], to_anchor: 1 / 12960, } } diff --git a/ui-ngx/src/app/shared/models/units/air-quality-index.ts b/ui-ngx/src/app/shared/models/units/air-quality-index.ts index 907071b594..9047f86d94 100644 --- a/ui-ngx/src/app/shared/models/units/air-quality-index.ts +++ b/ui-ngx/src/app/shared/models/units/air-quality-index.ts @@ -1,3 +1,19 @@ +/// +/// 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 AirQualityIndexUnits = 'aqi'; @@ -6,7 +22,7 @@ const METRIC: TbMeasureUnits = { units: { aqi: { name: 'unit.aqi', - tags: ['AQI', 'air quality index'], + tags: ['pollutant concentration'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/amount-of-substance.ts b/ui-ngx/src/app/shared/models/units/amount-of-substance.ts index 47f798c388..1601f5d80a 100644 --- a/ui-ngx/src/app/shared/models/units/amount-of-substance.ts +++ b/ui-ngx/src/app/shared/models/units/amount-of-substance.ts @@ -1,34 +1,48 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type AmountOfSubstanceMetricUnits = 'mol' | 'nmol' | 'μmol' | 'mmol' | 'kmol'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type AmountOfSubstanceUnits = AmountOfSubstanceMetricUnits; +export type AmountOfSubstanceUnits = 'mol' | 'nmol' | 'μmol' | 'mmol' | 'kmol'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'mol': { name: 'unit.mole', - tags: ['amount of substance', 'chemical amount', 'mole', 'mol'], + tags: ['chemical amount'], to_anchor: 1, }, 'nmol': { name: 'unit.nanomole', - tags: ['amount of substance', 'nanomole', 'nmol'], + tags: ['chemical amount'], to_anchor: 0.000000001, }, 'μmol': { name: 'unit.micromole', - tags: ['amount of substance', 'micromole', 'μmol'], + tags: ['chemical amount'], to_anchor: 0.000001, }, 'mmol': { name: 'unit.millimole', - tags: ['amount of substance', 'millimole', 'mmol'], + tags: ['chemical amount'], to_anchor: 0.001, }, 'kmol': { name: 'unit.kilomole', - tags: ['amount of substance', 'kilomole', 'kmol'], + tags: ['chemical amount'], to_anchor: 1000, }, }, diff --git a/ui-ngx/src/app/shared/models/units/angle.ts b/ui-ngx/src/app/shared/models/units/angle.ts index 7082e5a986..a92c4cb7a5 100644 --- a/ui-ngx/src/app/shared/models/units/angle.ts +++ b/ui-ngx/src/app/shared/models/units/angle.ts @@ -16,45 +16,43 @@ import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type AngleUnits = AngleMetricUnits; +export type AngleUnits = 'rad' | 'deg' | 'grad' | 'arcmin' | 'arcsec' | 'mrad' | 'rev'; -export type AngleMetricUnits = 'rad' | 'deg' | 'grad' | 'arcmin' | 'arcsec' | 'mrad' | 'rev'; - -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { rad: { name: 'unit.rad', - tags: ['angle', 'radian', 'radians', 'rad'], + tags: ['radians'], to_anchor: 180 / Math.PI, }, deg: { name: 'unit.degree', - tags: ['angle', 'degree', 'degrees', 'deg'], + tags: ['degrees'], to_anchor: 1, }, grad: { name: 'unit.gradian', - tags: ['angle', 'gradian', 'grades', 'grad'], + tags: ['grades'], to_anchor: 9 / 10, }, arcmin: { name: 'unit.arcminute', - tags: ['angle', 'arcminute', 'arcminutes', 'arcmin'], + tags: ['arcminutes'], to_anchor: 1 / 60 }, arcsec: { name: 'unit.arcsecond', - tags: ['angle', 'arcsecond', 'arcseconds', 'arcsec'], + tags: ['arcseconds'], to_anchor: 1 / 3600 }, mrad: { name: 'unit.milliradian', - tags: ['angle', 'military angle', 'angular mil', 'mil'], + tags: ['military angle', 'angular mil', 'mil'], to_anchor: 9 / (50 * Math.PI), }, rev: { name: 'unit.revolution', - tags: ['angle', 'revolution', 'full circle', 'complete turn', 'rev'], + tags: ['full circle', 'complete turn'], to_anchor: 360, }, } diff --git a/ui-ngx/src/app/shared/models/units/angular-acceleration.ts b/ui-ngx/src/app/shared/models/units/angular-acceleration.ts index 4e5085d7bf..d61957ac27 100644 --- a/ui-ngx/src/app/shared/models/units/angular-acceleration.ts +++ b/ui-ngx/src/app/shared/models/units/angular-acceleration.ts @@ -26,7 +26,7 @@ const METRIC: TbMeasureUnits = { units: { 'rad/s²': { name: 'unit.radian-per-second-squared', - tags: ['angular acceleration', 'rotation rate of change', 'rad/s²'], + tags: ['rotation rate of change'], to_anchor: 1, } } @@ -37,7 +37,7 @@ const IMPERIAL: TbMeasureUnits = { units: { 'rpm/s': { name: 'unit.revolutions-per-minute-per-second', - tags: ['angular acceleration', 'rotation rate of change', 'rpm/s'], + tags: ['rotation rate of change'], to_anchor: 1 } } diff --git a/ui-ngx/src/app/shared/models/units/area.ts b/ui-ngx/src/app/shared/models/units/area.ts index 6c36d6d976..b1df9295e2 100644 --- a/ui-ngx/src/app/shared/models/units/area.ts +++ b/ui-ngx/src/app/shared/models/units/area.ts @@ -26,37 +26,37 @@ const METRIC: TbMeasureUnits = { units: { 'mm²': { name: 'unit.square-millimeter', - tags: ['area','lot','zone','space','region','square millimeter','square millimeters','mm²','sq-mm'], + tags: ['lot', 'zone', 'space', 'region', 'square millimeters', 'sq-mm'], to_anchor: 1 / 1000000, }, 'cm²': { name: 'unit.square-centimeter', - tags: ['area','lot','zone','space','region','square centimeter','square centimeters','cm²','sq-cm'], + tags: ['lot', 'zone', 'space', 'region', 'square centimeters', 'sq-cm'], to_anchor: 1 / 10000, }, 'm²': { name: 'unit.square-meter', - tags: ['area','lot','zone','space','region','square meter','square meters','m²','sq-m'], + tags: ['lot', 'zone', 'space', 'region', 'square meters', 'sq-m'], to_anchor: 1, }, a: { name: 'unit.are', - tags: ['area','land measurement','are'], + tags: ['land measurement'], to_anchor: 100, }, ha: { name: 'unit.hectare', - tags: ['area','lot','zone','space','region','hectare','hectares','ha'], + tags: ['lot', 'zone', 'space', 'region', 'hectares'], to_anchor: 10000, }, 'km²': { name: 'unit.square-kilometer', - tags: ['area','lot','zone','space','region','square kilometer','square kilometers','km²','sq-km'], + tags: ['lot', 'zone', 'space', 'region', 'square kilometers', 'sq-km'], to_anchor: 1000000, }, barn: { name: 'unit.barn', - tags: ['cross-sectional area', 'particle physics', 'nuclear physics', 'barn'], + tags: ['cross-sectional area', 'particle physics', 'nuclear physics'], to_anchor: 1e-28, }, } @@ -67,32 +67,32 @@ const IMPERIAL: TbMeasureUnits = { units: { 'in²': { name: 'unit.square-inch', - tags: ['area','lot','zone','space','region','square inch','square inches','in²','sq-in'], + tags: ['lot', 'zone', 'space', 'region', 'square inches', 'sq-in'], to_anchor: 1 / 144, }, 'yd²': { name: 'unit.square-yard', - tags: ['area','lot','zone','space','region','square yard','square yards','yd²','sq-yd'], + tags: ['lot', 'zone', 'space', 'region', 'square yards', 'sq-yd'], to_anchor: 9, }, 'ft²': { name: 'unit.square-foot', - tags: ['area','lot','zone','space','region','square foot','square feet','ft²','sq-ft'], + tags: ['lot', 'zone', 'space', 'region', 'square feet', 'sq-ft'], to_anchor: 1, }, ac: { name: 'unit.acre', - tags: ['area','lot','zone','space','region','acre','acres','a'], + tags: ['lot', 'zone', 'space', 'region', 'acres', 'a'], to_anchor: 43560, }, 'ml²': { name: 'unit.square-mile', - tags: ['area','lot','zone','space','region','square mile','square miles','ml²','sq-mi'], + tags: ['lot', 'zone', 'space', 'region', 'square mile', 'sq-mi'], to_anchor: 27878400, }, cin: { name: 'unit.circular-inch', - tags: ['area','circular measurement','circular inch','circin'], + tags: ['circular measurement', 'circin'], to_anchor: Math.PI / 576 } } diff --git a/ui-ngx/src/app/shared/models/units/blood-glucose.ts b/ui-ngx/src/app/shared/models/units/blood-glucose.ts deleted file mode 100644 index 18b0902591..0000000000 --- a/ui-ngx/src/app/shared/models/units/blood-glucose.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type BloodGlucoseUnits = BloodGlucoseMetricUnits; -export type BloodGlucoseMetricUnits = 'mg/dL'; - -const METRIC: TbMeasureUnits = { - units: { - 'mg/dL': { - name: 'unit.milligrams-per-deciliter', - tags: ['glucose', 'blood sugar', 'glucose level', 'mg/dL'], - to_anchor: 1, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/capacitance.ts b/ui-ngx/src/app/shared/models/units/capacitance.ts index 4999afd536..f4dc13dc97 100644 --- a/ui-ngx/src/app/shared/models/units/capacitance.ts +++ b/ui-ngx/src/app/shared/models/units/capacitance.ts @@ -1,3 +1,19 @@ +/// +/// 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 CapacitanceUnits = 'F' | 'mF' | 'μF' | 'nF' | 'pF' | 'kF' | 'MF' | 'GF' | 'TF'; @@ -6,47 +22,47 @@ const METRIC: TbMeasureUnits = { units: { 'F': { name: 'unit.farad', - tags: ['electric capacitance', 'capacitance', 'farad', 'F'], + tags: ['electric capacitance'], to_anchor: 1, }, 'mF': { name: 'unit.millifarad', - tags: ['electric capacitance', 'capacitance', 'millifarad', 'mF'], + tags: ['electric capacitance'], to_anchor: 1e-3, }, 'μF': { name: 'unit.microfarad', - tags: ['electric capacitance', 'capacitance', 'microfarad', 'μF'], + tags: ['electric capacitance'], to_anchor: 1e-6, }, 'nF': { name: 'unit.nanofarad', - tags: ['electric capacitance', 'capacitance', 'nanofarad', 'nF'], + tags: ['electric capacitance'], to_anchor: 1e-9, }, 'pF': { name: 'unit.picofarad', - tags: ['electric capacitance', 'capacitance', 'picofarad', 'pF'], + tags: ['electric capacitance'], to_anchor: 1e-12, }, 'kF': { name: 'unit.kilofarad', - tags: ['electric capacitance', 'capacitance', 'kilofarad', 'kF'], + tags: ['electric capacitance'], to_anchor: 1e3, }, 'MF': { name: 'unit.megafarad', - tags: ['electric capacitance', 'capacitance', 'megafarad', 'MF'], + tags: ['electric capacitance'], to_anchor: 1e6, }, 'GF': { name: 'unit.gigafarad', - tags: ['electric capacitance', 'capacitance', 'gigafarad', 'GF'], + tags: ['electric capacitance'], to_anchor: 1e9, }, 'TF': { name: 'unit.terafarad', - tags: ['electric capacitance', 'capacitance', 'terafarad', 'TF'], + tags: ['electric capacitance'], to_anchor: 1e12, }, }, diff --git a/ui-ngx/src/app/shared/models/units/catalytic-activity.ts b/ui-ngx/src/app/shared/models/units/catalytic-activity.ts index 7198bf4d9c..c0dc61c2f5 100644 --- a/ui-ngx/src/app/shared/models/units/catalytic-activity.ts +++ b/ui-ngx/src/app/shared/models/units/catalytic-activity.ts @@ -1,18 +1,34 @@ +/// +/// 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 AirQualityIndexUnits = 'kat'; +export type CatalyticActivityUnits = 'kat'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { kat: { name: 'unit.katal', - tags: ['catalytic activity', 'enzyme activity', 'kat'], + tags: ['catalytic activity', 'enzyme activity'], to_anchor: 1, }, }, }; -const measure: TbMeasure = { +const measure: TbMeasure = { METRIC, }; diff --git a/ui-ngx/src/app/shared/models/units/catalytic-concentration.ts b/ui-ngx/src/app/shared/models/units/catalytic-concentration.ts new file mode 100644 index 0000000000..805f4cfc40 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/catalytic-concentration.ts @@ -0,0 +1,35 @@ +/// +/// 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 CatalyticConcentrationUnits = 'kat/m³'; + +const METRIC: TbMeasureUnits = { + units: { + 'kat/m³': { + name: 'unit.katal-per-cubic-metre', + tags: ['enzyme concentration'], + to_anchor: 1, + } + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/charge.ts b/ui-ngx/src/app/shared/models/units/charge.ts index b06a0223d5..2abce39f18 100644 --- a/ui-ngx/src/app/shared/models/units/charge.ts +++ b/ui-ngx/src/app/shared/models/units/charge.ts @@ -24,42 +24,42 @@ const METRIC: TbMeasureUnits = { units: { c: { name: 'unit.coulomb', - tags: ['charge', 'electricity', 'electrostatics', 'Coulomb', 'C'], + tags: ['electricity', 'electrostatics'], to_anchor: 1, }, mC: { name: 'unit.millicoulomb', - tags: ['charge', 'electricity', 'electrostatics', 'millicoulombs', 'mC'], + tags: ['electricity', 'electrostatics'], to_anchor: 1 / 1000, }, μC: { name: 'unit.microcoulomb', - tags: ['charge', 'electricity', 'electrostatics', 'microcoulomb', 'µC'], + tags: [ 'electricity', 'electrostatics'], to_anchor: 1 / 1000000, }, nC: { name: 'unit.nanocoulomb', - tags: ['charge', 'electricity', 'electrostatics', 'nanocoulomb', 'nC'], + tags: ['electricity', 'electrostatics',], to_anchor: 1e-9, }, pC: { name: 'unit.picocoulomb', - tags: ['charge', 'electricity', 'electrostatics', 'picocoulomb', 'pC'], + tags: ['electricity', 'electrostatics'], to_anchor: 1e-12, }, mAh: { name: 'unit.milliampere-hour', - tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'milliampere-hour', 'milliampere-hours', 'mAh'], + tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'milliampere-hours'], to_anchor: 3.6, }, Ah: { name: 'unit.ampere-hours', - tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'ampere', 'ampere-hours', 'Ah'], + tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'ampere'], to_anchor: 3600, }, kAh: { name: 'unit.kiloampere-hours', - tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'kiloampere-hours', 'kiloampere-hour', 'kAh'], + tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'kiloampere-hours'], to_anchor: 3600000, }, } diff --git a/ui-ngx/src/app/shared/models/units/concentration-gradient.ts b/ui-ngx/src/app/shared/models/units/concentration-gradient.ts deleted file mode 100644 index ef406445d2..0000000000 --- a/ui-ngx/src/app/shared/models/units/concentration-gradient.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type ConcentrationMetricUnits = 'mol/m³' | 'mg/mL' | 'mg/m³' | 'µg/m³' | 'particles/mL'; -export type ConcentrationUnits = ConcentrationMetricUnits; - -const METRIC: TbMeasureUnits = { - units: { - 'mol/m³': { - name: 'unit.mole-per-cubic-meter', - tags: ['concentration', 'amount of substance per unit volume', 'mole per cubic meter', 'mol/m³'], - to_anchor: 1, - }, - 'mg/mL': { - name: 'unit.milligram-per-milliliter', - tags: ['concentration', 'mass per unit volume', 'milligram per milliliter', 'mg/mL'], - to_anchor: 1, - }, - 'mg/m³': { - name: 'unit.milligram-per-cubic-meter', - tags: ['concentration', 'mass per unit volume', 'milligram per cubic meter', 'mg/m³'], - to_anchor: 1, - }, - 'µg/m³': { - name: 'unit.micrograms-per-cubic-meter', - tags: ['concentration', 'air quality', 'particulate matter', 'PM2.5', 'PM10', 'micrograms per cubic meter', 'µg/m³'], - to_anchor: 1, - }, - 'particles/mL': { - name: 'unit.particle-density', - tags: ['concentration', 'particle density', 'particles per milliliter', 'particles/mL'], - to_anchor: 1, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/concentration-volume.ts b/ui-ngx/src/app/shared/models/units/concentration-volume.ts deleted file mode 100644 index 94c8050fee..0000000000 --- a/ui-ngx/src/app/shared/models/units/concentration-volume.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type ConcentrationVolumeMetricUnits = - 'mol/m³' - | 'µg/m³' - | 'mg/m³' - | 'g/m³' - | 'mg/L' - | 'mg/mL' - | 'kat/m³' - | '°Bx'; -export type ConcentrationVolumeUnits = ConcentrationVolumeMetricUnits; - -const METRIC: TbMeasureUnits = { - units: { - 'mol/m³': { - name: 'unit.mole-per-cubic-meter', - tags: ['concentration', 'amount of substance', 'mole per cubic meter', 'mol/m³'], - to_anchor: 1, - }, - 'µg/m³': { - name: 'unit.micrograms-per-cubic-meter', - tags: ['coarse particulate matter', 'pm10', 'fine particulate matter', 'pm2.5', 'aqi', 'air quality', 'total volatile organic compounds', 'tvoc', 'micrograms per cubic meter', 'µg/m³'], - to_anchor: 1e-9, - }, - 'mg/m³': { - name: 'unit.milligram-per-cubic-meter', - tags: ['concentration', 'mass per volume', 'mg/m³'], - to_anchor: 1e-6, - }, - 'g/m³': { - name: 'unit.gram-per-cubic-meter', - tags: ['humidity', 'moisture', 'absolute humidity', 'g/m³'], - to_anchor: 1 / 1000, - }, - 'mg/L': { - name: 'unit.mg-per-liter', - tags: ['dissolved oxygen', 'water quality', 'mg/L'], - to_anchor: 1e-6, - }, - 'mg/mL': { - name: 'unit.milligram-per-milliliter', - tags: ['concentration', 'mass per volume', 'mg/mL'], - to_anchor: 1 / 1000, - }, - 'kat/m³': { - name: 'unit.katal-per-cubic-metre', - tags: ['catalytic activity concentration', 'enzyme concentration', 'kat/m³'], - to_anchor: 1, - }, - '°Bx': { - name: 'unit.degrees-brix', - tags: ['sugar content', 'fruit ripeness', 'Bx'], - to_anchor: 10.04 * 1e-3, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/current-density.ts b/ui-ngx/src/app/shared/models/units/current-density.ts index 7b332c57f4..aa5c88b0e9 100644 --- a/ui-ngx/src/app/shared/models/units/current-density.ts +++ b/ui-ngx/src/app/shared/models/units/current-density.ts @@ -1,19 +1,33 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type CurrentDensityMetricUnits = 'µA/cm²' | 'A/m²'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type CurrentDensityUnits = CurrentDensityMetricUnits; +export type CurrentDensityUnits = 'µA/cm²' | 'A/m²'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'µA/cm²': { name: 'unit.microampere-per-square-centimeter', - tags: ['current density', 'microampere per square centimeter', 'µA/cm²'], + tags: ['current per unit area'], to_anchor: 10000, }, 'A/m²': { name: 'unit.ampere-per-square-meter', - tags: ['current density', 'current per unit area', 'ampere per square meter', 'A/m²'], + tags: ['current per unit area'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/data-transfer-rate.ts b/ui-ngx/src/app/shared/models/units/data-transfer-rate.ts index e3b9095700..d952eaf727 100644 --- a/ui-ngx/src/app/shared/models/units/data-transfer-rate.ts +++ b/ui-ngx/src/app/shared/models/units/data-transfer-rate.ts @@ -1,3 +1,19 @@ +/// +/// 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 DataTransferRateUnits = 'bps' | 'kbps' | 'Mbps' | 'Gbps' | 'Tbps' | 'B/s' | 'KB/s' | 'MB/s' | 'GB/s'; @@ -6,47 +22,38 @@ const METRIC: TbMeasureUnits = { units: { 'bps': { name: 'unit.bit-per-second', - tags: ['data transfer rate', 'bps'], to_anchor: 1, }, 'kbps': { name: 'unit.kilobit-per-second', - tags: ['data transfer rate', 'kbps'], to_anchor: 1e3, }, 'Mbps': { name: 'unit.megabit-per-second', - tags: ['data transfer rate', 'Mbps'], to_anchor: 1e6, }, 'Gbps': { name: 'unit.gigabit-per-second', - tags: ['data transfer rate', 'Gbps'], to_anchor: 1e9, }, 'Tbps': { name: 'unit.terabit-per-second', - tags: ['data transfer rate', 'Tbps'], to_anchor: 1e12, }, 'B/s': { name: 'unit.byte-per-second', - tags: ['data transfer rate', 'B/s'], to_anchor: 8, }, 'KB/s': { name: 'unit.kilobyte-per-second', - tags: ['data transfer rate', 'KB/s'], to_anchor: 8e3, }, 'MB/s': { name: 'unit.megabyte-per-second', - tags: ['data transfer rate', 'MB/s'], to_anchor: 8e6, }, 'GB/s': { name: 'unit.gigabyte-per-second', - tags: ['data transfer rate', 'GB/s'], to_anchor: 8e9, }, }, diff --git a/ui-ngx/src/app/shared/models/units/density.ts b/ui-ngx/src/app/shared/models/units/density.ts index 8603de1976..8a501d1638 100644 --- a/ui-ngx/src/app/shared/models/units/density.ts +++ b/ui-ngx/src/app/shared/models/units/density.ts @@ -1,6 +1,22 @@ +/// +/// 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 DensityMetricUnits = 'kg/m³' | 'g/cm³'; +export type DensityMetricUnits = 'kg/m³' | 'g/cm³' | 'mg/dL' | 'g/m³' | 'mg/mL' | 'mg/L' | 'mg/m³' | 'µg/m³'; export type DensityImperialUnits = 'lb/ft³' | 'oz/in³' | 'ton/yd³'; export type DensityUnits = DensityMetricUnits | DensityImperialUnits; @@ -10,13 +26,43 @@ const METRIC: TbMeasureUnits = { units: { 'kg/m³': { name: 'unit.kilogram-per-cubic-meter', - tags: ['density', 'mass per unit volume', 'kg/m³'], - to_anchor: 1, // Base unit: kg/m³ + tags: ['mass per unit volume'], + to_anchor: 1, }, 'g/cm³': { name: 'unit.gram-per-cubic-centimeter', - tags: ['density', 'mass per unit volume', 'g/cm³'], - to_anchor: 1000, // 1 g/cm³ = 10³ kg/m³ + tags: ['mass per unit volume'], + to_anchor: 1000, + }, + 'mg/dL': { + name: 'unit.milligrams-per-deciliter', + tags: ['glucose', 'blood sugar', 'glucose level', 'concentration'], + to_anchor: 0.01, + }, + 'g/m³': { + name: 'unit.gram-per-cubic-meter', + tags: ['humidity', 'moisture', 'absolute humidity', 'concentration'], + to_anchor: 0.001, + }, + 'mg/L': { + name: 'unit.mg-per-liter', + tags: ['dissolved oxygen', 'water quality', 'mg/L', 'concentration'], + to_anchor: 0.001, + }, + 'mg/mL': { + name: 'unit.milligram-per-milliliter', + tags: ['mass per unit volume', 'concentration'], + to_anchor: 1, + }, + 'mg/m³': { + name: 'unit.milligram-per-cubic-meter', + tags: ['mass per unit volume', 'concentration'], + to_anchor: 1e-6, + }, + 'µg/m³': { + name: 'unit.micrograms-per-cubic-meter', + tags: ['coarse particulate matter', 'pm10', 'fine particulate matter', 'pm2.5', 'aqi', 'air quality', 'total volatile organic compounds', 'tvoc', 'concentration'], + to_anchor: 1e-9, }, }, }; @@ -26,17 +72,17 @@ const IMPERIAL: TbMeasureUnits = { units: { 'lb/ft³': { name: 'unit.pound-per-cubic-foot', - tags: ['density', 'mass per unit volume', 'lb/ft³'], + tags: ['mass per unit volume'], to_anchor: 1, }, 'oz/in³': { name: 'unit.ounces-per-cubic-inch', - tags: ['density', 'mass per unit volume', 'oz/in³'], + tags: ['mass per unit volume'], to_anchor: 1728, }, 'ton/yd³': { name: 'unit.tons-per-cubic-yard', - tags: ['density', 'mass per unit volume', 'ton/yd³'], + tags: ['mass per unit volume'], to_anchor: 74.074, }, }, diff --git a/ui-ngx/src/app/shared/models/units/digital.ts b/ui-ngx/src/app/shared/models/units/digital.ts index 54bcceea2f..32f2eed2a7 100644 --- a/ui-ngx/src/app/shared/models/units/digital.ts +++ b/ui-ngx/src/app/shared/models/units/digital.ts @@ -16,60 +16,58 @@ import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type DigitalUnits = DigitalMetricUnits; +export type DigitalUnits = 'bit' | 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'ZB' | 'YB'; -export type DigitalMetricUnits = 'bit' | 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'ZB' | 'YB'; - -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { bit: { name: 'unit.bit', - tags: ['data', 'binary digit', 'information', 'bit'], + tags: ['data', 'binary digit', 'information'], to_anchor: 1.25e-1, }, B: { name: 'unit.byte', - tags: ['data', 'byte', 'information', 'storage', 'memory', 'B'], + tags: ['data', 'information', 'storage', 'memory'], to_anchor: 1 }, KB: { name: 'unit.kilobyte', - tags: ['data', 'kilobyte', 'KB'], + tags: ['data'], to_anchor: 1024, }, MB: { name: 'unit.megabyte', - tags: ['data', 'megabyte', 'MB'], + tags: ['data'], to_anchor: 1024 ** 2, }, GB: { name: 'unit.gigabyte', - tags: ['data', 'gigabyte', 'GB'], + tags: ['data'], to_anchor: 1024 ** 3, }, TB: { name: 'unit.terabyte', - tags: ['data', 'terabyte', 'TB'], + tags: ['data'], to_anchor: 1024 ** 4, }, PB: { name: 'unit.petabyte', - tags: ['data', 'petabyte', 'PB'], + tags: ['data'], to_anchor: 1024 ** 5, }, EB: { name: 'unit.exabyte', - tags: ['data', 'exabyte', 'EB'], + tags: ['data'], to_anchor: 1024 ** 6, }, ZB: { name: 'unit.zettabyte', - tags: ['data', 'zettabyte', 'EB'], + tags: ['data'], to_anchor: 1024 ** 7, }, YB: { name: 'unit.yottabyte', - tags: ['data', 'yottabyte', 'EB'], + tags: ['data'], to_anchor: 1024 ** 8, }, } diff --git a/ui-ngx/src/app/shared/models/units/dimension-ratio.ts b/ui-ngx/src/app/shared/models/units/dimension-ratio.ts new file mode 100644 index 0000000000..3deb60a38f --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/dimension-ratio.ts @@ -0,0 +1,35 @@ +/// +/// 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 DimensionRatioUnits = 'm/m'; + +const METRIC: TbMeasureUnits = { + units: { + 'm/m': { + name: 'unit.meter-per-meter', + tags: ['ratio of length to length'], + to_anchor: 1, + }, + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/dimensionless-ratio.ts b/ui-ngx/src/app/shared/models/units/dimensionless-ratio.ts deleted file mode 100644 index 71972aa6e8..0000000000 --- a/ui-ngx/src/app/shared/models/units/dimensionless-ratio.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type DimensionlessRatioMetricUnits = 'm/m'; - -export type DimensionRatioUnits = DimensionlessRatioMetricUnits; - -const METRIC: TbMeasureUnits = { - units: { - 'm/m': { - name: 'unit.meter-per-meter', - tags: ['ratio of length to length', 'meter per meter', 'm/m'], - to_anchor: 1, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/dynamic-viscosity.ts b/ui-ngx/src/app/shared/models/units/dynamic-viscosity.ts index 272892f9df..e3fe8602b3 100644 --- a/ui-ngx/src/app/shared/models/units/dynamic-viscosity.ts +++ b/ui-ngx/src/app/shared/models/units/dynamic-viscosity.ts @@ -1,3 +1,19 @@ +/// +/// 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 DynamicViscosityMetricUnits = 'Pa·s' | 'cP' | 'P' | 'N·s/m²' | 'dyn·s/cm²' | 'kg/(m·s)'; @@ -10,32 +26,32 @@ const METRIC: TbMeasureUnits = { units: { 'Pa·s': { name: 'unit.pascal-second', - tags: ['dynamic viscosity', 'viscosity', 'fluid mechanics', 'Pa·s'], + tags: ['fluid mechanics'], to_anchor: 1, }, 'cP': { name: 'unit.centipoise', - tags: ['viscosity', 'dynamic viscosity', 'fluid viscosity', 'centipoise', 'cP'], + tags: ['fluid mechanics'], to_anchor: 0.001, }, 'P': { name: 'unit.poise', - tags: ['viscosity', 'dynamic viscosity', 'fluid viscosity', 'poise', 'P'], + tags: ['fluid mechanics'], to_anchor: 0.1, }, 'N·s/m²': { name: 'unit.newton-second-per-square-meter', - tags: ['newton second per square meter', 'N·s/m²'], + tags: ['fluid mechanics'], to_anchor: 1, }, 'dyn·s/cm²': { name: 'unit.dyne-second-per-square-centimeter', - tags: ['dyne second per square centimeter', 'dyn·s/cm²'], + tags: ['fluid mechanics'], to_anchor: 0.1, }, 'kg/(m·s)': { name: 'unit.kilogram-per-meter-second', - tags: ['kilogram per meter-second', 'kg/(m·s)'], + tags: ['fluid mechanics'], to_anchor: 1, }, }, @@ -46,7 +62,7 @@ const IMPERIAL: TbMeasureUnits = { units: { 'lb/(ft·h)': { name: 'unit.pound-per-foot-hour', - tags: ['pound per foot-hour', 'lb/(ft·h)'], + tags: ['fluid mechanics'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/earthquake-magnitude.ts b/ui-ngx/src/app/shared/models/units/earthquake-magnitude.ts index 02658073b5..60b40ec01c 100644 --- a/ui-ngx/src/app/shared/models/units/earthquake-magnitude.ts +++ b/ui-ngx/src/app/shared/models/units/earthquake-magnitude.ts @@ -1,3 +1,19 @@ +/// +/// 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 EarthquakeMagnitudeUnits = 'richter'; @@ -6,7 +22,7 @@ const METRIC: TbMeasureUnits = { units: { richter: { name: 'unit.richter-scale', - tags: ['earthquake', 'seismic activity', 'richter'], + tags: ['seismic activity'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/electric-current.ts b/ui-ngx/src/app/shared/models/units/electric-current.ts index 9025e71c15..fbfb9b888c 100644 --- a/ui-ngx/src/app/shared/models/units/electric-current.ts +++ b/ui-ngx/src/app/shared/models/units/electric-current.ts @@ -16,50 +16,48 @@ import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type ElectricCurrentUnits = ElectricCurrentMetricalUnits; +export type ElectricCurrentUnits = 'A' | 'pA' | 'nA' | 'μA' | 'mA' | 'kA' | 'MA' | 'GA'; -export type ElectricCurrentMetricalUnits = 'A' | 'pA' | 'nA' | 'μA' | 'mA' | 'kA' | 'MA' | 'GA'; - -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { A: { name: 'unit.ampere', - tags: ['electric current', 'current flow', 'flow of electricity', 'electrical flow', 'ampere', 'amperes', 'amperage', 'A'], + tags: ['current flow', 'flow of electricity', 'electrical flow', 'amperes', 'amperage'], to_anchor: 1, }, pA: { name: 'unit.picoampere', - tags: ['current', 'amperes', 'picoampere', 'pA'], + tags: ['picoamperes'], to_anchor: 1e-12, }, nA: { name: 'unit.nanoampere', - tags: ['electric current', 'amperes', 'nanoampere', 'nA'], + tags: ['nanoamperes'], to_anchor: 1e-9, }, μA: { name: 'unit.microampere', - tags: ['electric current', 'microampere', 'microamperes', 'μA'], + tags: ['microamperes'], to_anchor: 1e-6, }, mA: { name: 'unit.milliampere', - tags: ['electric current', 'milliampere', 'milliamperes', 'mA'], + tags: ['milliamperes'], to_anchor: 0.001, }, kA: { name: 'unit.kiloampere', - tags: ['electric current', 'kiloampere', 'kiloamperes', 'kA'], + tags: ['kiloamperes'], to_anchor: 1000, }, MA: { name: 'unit.megaampere', - tags: ['electric current', 'megaampere', 'megaamperes', 'MA'], + tags: ['megaamperes'], to_anchor: 1e6, }, GA: { name: 'unit.gigaampere', - tags: ['electric current', 'gigaampere', 'gigaamperes', 'GA'], + tags: ['gigaamperes'], to_anchor: 1e9, }, } diff --git a/ui-ngx/src/app/shared/models/units/electric-dipole-moment.ts b/ui-ngx/src/app/shared/models/units/electric-dipole-moment.ts new file mode 100644 index 0000000000..b43e08b857 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/electric-dipole-moment.ts @@ -0,0 +1,39 @@ +/// +/// 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 ElectricDipoleMomentUnits = 'C·m' | 'D'; + +const METRIC: TbMeasureUnits = { + units: { + 'C·m': { + name: 'unit.electric-dipole-moment', + to_anchor: 1, + }, + 'D': { + name: 'unit.debye', + tags: ['polarization'], + to_anchor: 3.33564e-30 + }, + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/electric-field-strength.ts b/ui-ngx/src/app/shared/models/units/electric-field-strength.ts index f8d753c401..16a35b963d 100644 --- a/ui-ngx/src/app/shared/models/units/electric-field-strength.ts +++ b/ui-ngx/src/app/shared/models/units/electric-field-strength.ts @@ -1,3 +1,19 @@ +/// +/// 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 ElectricFieldStrengthUnits = 'V/m' | 'mV/m' | 'kV/m'; @@ -6,17 +22,14 @@ const METRIC: TbMeasureUnits = { units: { 'V/m': { name: 'unit.volts-per-meter', - tags: ['electric field strength', 'volts per meter', 'V/m'], to_anchor: 1, }, 'mV/m': { name: 'unit.millivolts-per-meter', - tags: ['electric field strength', 'millivolts per meter', 'mV/m'], to_anchor: 1e-3, }, 'kV/m': { name: 'unit.kilovolts-per-meter', - tags: ['electric field strength', 'kilovolts per meter', 'kV/m'], to_anchor: 1e3, }, }, diff --git a/ui-ngx/src/app/shared/models/units/electric-flux.ts b/ui-ngx/src/app/shared/models/units/electric-flux.ts index ac40a58293..ca4e6c2fe7 100644 --- a/ui-ngx/src/app/shared/models/units/electric-flux.ts +++ b/ui-ngx/src/app/shared/models/units/electric-flux.ts @@ -1,39 +1,47 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type ElectricFluxMetricUnits = 'V·m' | 'kV·m' | 'MV·m' | 'µV·m' | 'mV·m' | 'nV·m'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type ElectricFluxUnits = ElectricFluxMetricUnits; +export type ElectricFluxUnits = 'V·m' | 'kV·m' | 'MV·m' | 'µV·m' | 'mV·m' | 'nV·m'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'V·m': { name: 'unit.volt-meter', - tags: ['electric flux', 'volt-meter', 'V·m'], to_anchor: 1, }, 'kV·m': { name: 'unit.kilovolt-meter', - tags: ['electric flux', 'kilovolt-meter', 'kV·m'], to_anchor: 1000, }, 'MV·m': { name: 'unit.megavolt-meter', - tags: ['electric flux', 'megavolt-meter', 'MV·m'], to_anchor: 1000000, }, 'µV·m': { name: 'unit.microvolt-meter', - tags: ['electric flux', 'microvolt-meter', 'µV·m'], to_anchor: 0.000001, }, 'mV·m': { name: 'unit.millivolt-meter', - tags: ['electric flux', 'millivolt-meter', 'mV·m'], to_anchor: 0.001, }, 'nV·m': { name: 'unit.nanovolt-meter', - tags: ['electric flux', 'nanovolt-meter', 'nV·m'], to_anchor: 0.000000001, }, }, diff --git a/ui-ngx/src/app/shared/models/units/electric-moment.ts b/ui-ngx/src/app/shared/models/units/electric-moment.ts deleted file mode 100644 index 47a8e55830..0000000000 --- a/ui-ngx/src/app/shared/models/units/electric-moment.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type ElectricMomentMetricUnits = 'C·m' | 'D'; - -export type ElectricMomentUnits = ElectricMomentMetricUnits; - -const METRIC: TbMeasureUnits = { - units: { - 'C·m': { - name: 'unit.electric-dipole-moment', - tags: ['electric dipole', 'dipole moment', 'coulomb meter', 'C·m'], - to_anchor: 1, - }, - 'D': { - name: 'unit.debye', - tags: ['polarization', 'electric dipole moment', 'debye', 'D'], - to_anchor: 3.33564e-30 - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/electric-permittivity.ts b/ui-ngx/src/app/shared/models/units/electric-permittivity.ts index d9bea899a7..e116d9e08a 100644 --- a/ui-ngx/src/app/shared/models/units/electric-permittivity.ts +++ b/ui-ngx/src/app/shared/models/units/electric-permittivity.ts @@ -1,14 +1,27 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type ElectricPermittivityMetricUnits = 'F/m'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type ElectricPermittivityUnits = ElectricPermittivityMetricUnits; +export type ElectricPermittivityUnits = 'F/m'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'F/m': { name: 'unit.farad-per-meter', - tags: ['electric permittivity', 'farad per meter', 'F/m'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/electrical-conductance.ts b/ui-ngx/src/app/shared/models/units/electrical-conductance.ts index 0a1fe6bebe..62241d059f 100644 --- a/ui-ngx/src/app/shared/models/units/electrical-conductance.ts +++ b/ui-ngx/src/app/shared/models/units/electrical-conductance.ts @@ -1,3 +1,19 @@ +/// +/// 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 ElectricalConductanceUnits = 'S' | 'mS' | 'μS' | 'kS' | 'MS' | 'GS'; @@ -6,32 +22,26 @@ const METRIC: TbMeasureUnits = { units: { 'S': { name: 'unit.siemens', - tags: ['electrical conductance', 'conductance', 'siemens', 'S'], to_anchor: 1, }, 'mS': { name: 'unit.millisiemens', - tags: ['electrical conductance', 'conductance', 'millisiemens', 'mS'], to_anchor: 1e-3, }, 'μS': { name: 'unit.microsiemens', - tags: ['electrical conductance', 'conductance', 'microsiemens', 'μS'], to_anchor: 1e-6, }, 'kS': { name: 'unit.kilosiemens', - tags: ['electrical conductance', 'conductance', 'kilosiemens', 'kS'], to_anchor: 1e3, }, 'MS': { name: 'unit.megasiemens', - tags: ['electrical conductance', 'conductance', 'megasiemens', 'MS'], to_anchor: 1e6, }, 'GS': { name: 'unit.gigasiemens', - tags: ['electrical conductance', 'conductance', 'gigasiemens', 'GS'], to_anchor: 1e9, }, }, diff --git a/ui-ngx/src/app/shared/models/units/electrical-conductivity.ts b/ui-ngx/src/app/shared/models/units/electrical-conductivity.ts index 9bf7245ff1..aa9aab858f 100644 --- a/ui-ngx/src/app/shared/models/units/electrical-conductivity.ts +++ b/ui-ngx/src/app/shared/models/units/electrical-conductivity.ts @@ -1,23 +1,38 @@ +/// +/// 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 ElectricalConductivityMetricUnits = 'µS/cm' | 'mS/m' | 'S/m'; -export type ElectricalConductivityUnits = ElectricalConductivityMetricUnits; +export type ElectricalConductivityUnits = 'µS/cm' | 'mS/m' | 'S/m'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'S/m': { name: 'unit.siemens-per-meter', - tags: ['Electrical conductivity', 'water quality', 'soil quality', 'siemens per meter', 'S/m'], + tags: [ 'water quality', 'soil quality'], to_anchor: 1, }, 'µS/cm': { name: 'unit.microsiemens-per-centimeter', - tags: ['Electrical conductivity', 'water quality', 'soil quality', 'microsiemens per centimeter', 'µS/cm'], + tags: ['water quality', 'soil quality'], to_anchor: 0.0001, }, 'mS/m': { name: 'unit.millisiemens-per-meter', - tags: ['Electrical conductivity', 'water quality', 'soil quality', 'millisiemens per meter', 'mS/m'], + tags: ['water quality', 'soil quality'], to_anchor: 0.001, }, }, diff --git a/ui-ngx/src/app/shared/models/units/energy.ts b/ui-ngx/src/app/shared/models/units/energy.ts index 2f74091c10..8b81101574 100644 --- a/ui-ngx/src/app/shared/models/units/energy.ts +++ b/ui-ngx/src/app/shared/models/units/energy.ts @@ -40,42 +40,36 @@ const METRIC: TbMeasureUnits = { units: { Wm: { name: 'unit.watt-minute', - tags: ['energy', 'watt-minute', 'watt-minutes', 'Wm'], to_anchor: 60, }, Wh: { name: 'unit.watt-hour', - tags: ['energy', 'watt-hour', 'watt-hours', 'energy usage', 'power consumption', 'energy consumption', 'electricity usage'], + tags: ['energy usage', 'power consumption', 'energy consumption', 'electricity usage'], to_anchor: 3600, }, mWh: { name: 'unit.milliwatt-hour', - tags: ['energy', 'milliwatt-hour', 'milliwatt-hours', 'mWh'], to_anchor: 3.6, }, kWh: { name: 'unit.kilowatt-hour', - tags: ['energy', 'kilowatt-hour', 'kilowatt-hours', 'energy usage', 'power consumption', 'energy consumption', 'electricity usage'], + tags: ['energy usage', 'power consumption', 'energy consumption', 'electricity usage'], to_anchor: 3600000, }, MWh: { name: 'unit.megawatt-hour', - tags: ['energy', 'megawatt-hour', 'megawatt-hours', 'MWh'], to_anchor: 3600000000, }, GWh: { name: 'unit.gigawatt-hour', - tags: ['energy', 'gigawatt-hour', 'gigawatt-hours', 'GWh'], to_anchor: 3600000000000, }, μJ: { name: 'unit.microjoule', - tags: ['energy', 'microjoule', 'microjoules', 'μJ'], to_anchor: 0.000001, }, mJ: { name: 'unit.millijoule', - tags: ['energy', 'millijoule', 'millijoules', 'mJ'], to_anchor: 0.001, }, J: { @@ -85,22 +79,19 @@ const METRIC: TbMeasureUnits = { }, kJ: { name: 'unit.kilojoule', - tags: ['energy', 'kilojoule', 'kilojoules', 'kJ'], to_anchor: 1000, }, MJ: { name: 'unit.megajoule', - tags: ['energy', 'megajoule', 'megajoules', 'MJ'], to_anchor: 1000000, }, GJ: { name: 'unit.gigajoule', - tags: ['energy', 'gigajoule', 'gigajoules', 'GJ'], to_anchor: 1000000000, }, eV: { name: 'unit.electron-volts', - tags: ['energy', 'subatomic particles', 'radiation'], + tags: ['subatomic particles', 'radiation'], to_anchor: 1.602176634e-19, }, }, @@ -111,32 +102,31 @@ const IMPERIAL: TbMeasureUnits = { units: { cal: { name: 'unit.small-calorie', - tags: ['energy', 'small calorie', 'calories', 'cal'], to_anchor: 1, }, Cal: { name: 'unit.calorie', - tags: ['energy', 'food energy', 'Calorie', 'Calories', 'Cal'], + tags: ['food energy'], to_anchor: 1000, }, kcal: { name: 'unit.kilocalorie', - tags: ['energy', 'small calorie', 'kilocalories', 'kcal'], + tags: ['small calorie'], to_anchor: 1000, }, BTU: { name: 'unit.british-thermal-unit', - tags: ['energy', 'heat', 'work done', 'british thermal unit', 'british thermal units', 'BTU'], + tags: ['heat', 'work done'], to_anchor: 252.164401, }, 'ft·lb': { name: 'unit.foot-pound', - tags: ['energy', 'foot-pound', 'foot-pounds', 'ft·lb', 'ft⋅lbf'], + tags: ['ft⋅lbf'], to_anchor: 0.32404875717017, }, thm: { name: 'unit.therm', - tags: ['energy', 'natural gas consumption', 'BTU', 'therm', 'thm'], + tags: ['natural gas consumption', 'BTU'], to_anchor: 25219021.687207, }, }, diff --git a/ui-ngx/src/app/shared/models/units/force.ts b/ui-ngx/src/app/shared/models/units/force.ts index 46ee193829..afc98f626d 100644 --- a/ui-ngx/src/app/shared/models/units/force.ts +++ b/ui-ngx/src/app/shared/models/units/force.ts @@ -26,17 +26,15 @@ const METRIC: TbMeasureUnits = { units: { N: { name: 'unit.newton', - tags: ['force', 'pressure', 'newton', 'newtons', 'N', 'push', 'pull', 'weight', 'gravity', 'N'], + tags: ['pressure', 'push', 'pull', 'weight'], to_anchor: 1, }, kN: { name: 'unit.kilonewton', - tags: ['force', 'kN'], to_anchor: 1000, }, dyn: { name: 'unit.dyne', - tags: ['force', 'dyn'], to_anchor: 0.00001, }, }, @@ -47,27 +45,22 @@ const IMPERIAL: TbMeasureUnits = { units: { lbf: { name: 'unit.pound-force', - tags: ['force', 'lbf'], to_anchor: 1, }, kgf: { name: 'unit.kilogram-force', - tags: ['force', 'kgf'], to_anchor: 2.20462, }, klbf: { name: 'unit.kilopound-force', - tags: ['force', 'klbf'], to_anchor: 1000, }, pdl: { name: 'unit.poundal', - tags: ['force', 'pdl'], to_anchor: 0.031081, }, kip: { name: 'unit.kip', - tags: ['force', 'kip'], to_anchor: 1000, }, }, diff --git a/ui-ngx/src/app/shared/models/units/frequency.ts b/ui-ngx/src/app/shared/models/units/frequency.ts index f677803fe8..4baf86405e 100644 --- a/ui-ngx/src/app/shared/models/units/frequency.ts +++ b/ui-ngx/src/app/shared/models/units/frequency.ts @@ -23,62 +23,61 @@ const METRIC: TbMeasureUnits = { units: { mHz: { name: 'unit.millihertz', - tags: ['frequency', 'cycles per second', 'millihertz', 'mHz'], + tags: ['cycles per second'], to_anchor: 1 / 1000, }, Hz: { name: 'unit.hertz', - tags: ['frequency', 'cycles per second', 'hertz', 'Hz'], + tags: ['cycles per second'], to_anchor: 1, }, kHz: { name: 'unit.kilohertz', - tags: ['frequency', 'cycles per second', 'kilohertz', 'kHz'], + tags: ['cycles per second'], to_anchor: 1000, }, MHz: { name: 'unit.megahertz', - tags: ['frequency', 'cycles per second', 'megahertz', 'MHz'], + tags: ['cycles per second'], to_anchor: 1000 * 1000, }, GHz: { name: 'unit.gigahertz', - tags: ['frequency', 'cycles per second', 'gigahertz', 'GHz'], + tags: ['cycles per second'], to_anchor: 1000 * 1000 * 1000, }, THz: { name: 'unit.terahertz', - tags: ['frequency', 'terahertz', 'THz'], to_anchor: 1000 * 1000 * 1000 * 1000, }, rpm: { name: 'unit.rotation-per-minute', - tags: ['frequency', 'rotation per minute', 'rotations per minute', 'rpm', 'angular velocity'], + tags: ['rotations per minute', 'angular velocity'], to_anchor: 1 / 60, }, RPM: { name: 'unit.rpm', - tags: ['rotational speed', 'angular velocity', 'revolutions per minute', 'RPM'], + tags: ['rotational speed', 'angular velocity'], to_anchor: 1 / 60, }, 'λ': { name: 'unit.lambda', - tags: ['wavelength', 'lambda', 'λ'], + tags: ['wavelength'], to_anchor: 299792458, }, bpm: { name: 'unit.beats-per-minute', - tags: ['heart rate', 'pulse', 'bpm'], + tags: ['heart rate', 'pulse'], to_anchor: 0.0167 }, 'deg/s': { name: 'unit.deg-per-second', - tags: ['angular velocity', 'degrees per second', 'deg/s'], - to_anchor: 1 / 360, // 1 deg/s = 1/360 Hz + tags: ['angular velocity'], + to_anchor: 1 / 360, }, 'rad/s': { name: 'unit.radian-per-second', - tags: ['angular velocity', 'rotation speed', 'rad/s'], + tags: ['angular velocity'], to_anchor: 1 / (Math.PI * 2), }, }, diff --git a/ui-ngx/src/app/shared/models/units/fuel-efficiency.ts b/ui-ngx/src/app/shared/models/units/fuel-efficiency.ts index f097382089..64eb49cfb2 100644 --- a/ui-ngx/src/app/shared/models/units/fuel-efficiency.ts +++ b/ui-ngx/src/app/shared/models/units/fuel-efficiency.ts @@ -1,3 +1,19 @@ +/// +/// 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 FuelEfficiencyMetricUnits = 'km/L' | 'L/100km'; @@ -10,12 +26,10 @@ const METRIC: TbMeasureUnits = { units: { 'km/L': { name: 'unit.kilometers-per-liter', - tags: ['fuel efficiency', 'km/L'], to_anchor: 1, }, 'L/100km': { name: 'unit.liters-per-100-km', - tags: ['fuel efficiency', 'L/100km'], to_anchor: 1, transform: (value) => 100 / value, }, @@ -27,12 +41,10 @@ const IMPERIAL: TbMeasureUnits = { units: { 'mpg': { name: 'unit.miles-per-gallon', - tags: ['fuel efficiency', 'mpg'], to_anchor: 0.425144, }, 'gal/mi': { name: 'unit.gallons-per-mile', - tags: ['fuel efficiency', 'gal/mi'], to_anchor: 2.35214583, }, }, diff --git a/ui-ngx/src/app/shared/models/units/heat-capacity.ts b/ui-ngx/src/app/shared/models/units/heat-capacity.ts index 05b56cd0a7..7c42926bd0 100644 --- a/ui-ngx/src/app/shared/models/units/heat-capacity.ts +++ b/ui-ngx/src/app/shared/models/units/heat-capacity.ts @@ -1,15 +1,29 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type HeatCapacityMetricUnits = 'J/K'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type HeatCapacityUnits = HeatCapacityMetricUnits; +export type HeatCapacityUnits = 'J/K'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'J/K': { name: 'unit.joule-per-kelvin', - tags: ['specific heat capacity', 'heat capacity per unit temperature', 'joule per kelvin', 'J/K'], - to_anchor: 1, // Base unit: J/K + tags: ['heat capacity per unit temperature'], + to_anchor: 1, }, }, }; diff --git a/ui-ngx/src/app/shared/models/units/humidity.ts b/ui-ngx/src/app/shared/models/units/humidity.ts deleted file mode 100644 index 22bf1d6902..0000000000 --- a/ui-ngx/src/app/shared/models/units/humidity.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type HumidityUnits = HumidityMetricUnits; -export type HumidityMetricUnits = 'g/kg'; - -const METRIC: TbMeasureUnits = { - units: { - 'g/kg': { - name: 'unit.gram-per-kilogram', - tags: ['humidity', 'moisture', 'specific humidity', 'g/kg'], - to_anchor: 1, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/illuminance.ts b/ui-ngx/src/app/shared/models/units/illuminance.ts index 6c1ae4d43d..286cd4923d 100644 --- a/ui-ngx/src/app/shared/models/units/illuminance.ts +++ b/ui-ngx/src/app/shared/models/units/illuminance.ts @@ -26,17 +26,17 @@ const METRIC: TbMeasureUnits = { units: { lx: { name: 'unit.lux', - tags: ['illumination', 'light level on a surface', 'illuminance', 'Lux', 'lx'], + tags: ['light level on a surface', 'illuminance', 'Lux', 'lx'], to_anchor: 1, }, 'cd/m²': { name: 'unit.candela-per-square-meter', - tags: ['brightness', 'light level', 'Luminance', 'Candela per square meter', 'cd/m²'], + tags: ['brightness', 'light level', 'Luminance'], to_anchor: 1, }, 'lm/m²': { name: 'unit.lumen-per-square-meter', - tags: ['illumination', 'light level', 'lumen per square meter', 'lm/m²'], + tags: ['light level'], to_anchor: 1, }, }, @@ -47,7 +47,7 @@ const IMPERIAL: TbMeasureUnits = { units: { 'fc': { name: 'unit.foot-candle', - tags: ['illuminance', 'light level', 'foot-candle', 'fc'], + tags: ['illuminance', 'light level'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/inductance.ts b/ui-ngx/src/app/shared/models/units/inductance.ts index 9f0d0bb3eb..0acbab4774 100644 --- a/ui-ngx/src/app/shared/models/units/inductance.ts +++ b/ui-ngx/src/app/shared/models/units/inductance.ts @@ -1,3 +1,19 @@ +/// +/// 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 InductanceMetricUnits = 'H' | 'mH' | 'µH' | 'nH' | 'T·m/A'; diff --git a/ui-ngx/src/app/shared/models/units/kinematic-viscosity.ts b/ui-ngx/src/app/shared/models/units/kinematic-viscosity.ts index 6a9104ff9f..8d2201d456 100644 --- a/ui-ngx/src/app/shared/models/units/kinematic-viscosity.ts +++ b/ui-ngx/src/app/shared/models/units/kinematic-viscosity.ts @@ -1,3 +1,19 @@ +/// +/// 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 KinematicViscosityMetricUnits = 'm²/s' | 'cm²/s' | 'St' | 'cSt'; @@ -10,23 +26,19 @@ const METRIC: TbMeasureUnits = { units: { 'm²/s': { name: 'unit.square-meter-per-second', - tags: ['kinematic viscosity', 'm²/s'], to_anchor: 1, }, 'cm²/s': { name: 'unit.square-centimeter-per-second', - tags: ['kinematic viscosity', 'cm²/s'], to_anchor: 1e-4, }, 'St': { name: 'unit.stoke', - tags: ['kinematic viscosity', 'stokes', 'St'], - to_anchor: 1e-4, // St to m²/s + to_anchor: 1e-4, }, 'cSt': { name: 'unit.centistokes', - tags: ['kinematic viscosity', 'centistokes', 'cSt'], - to_anchor: 1e-6, // cSt to m²/s + to_anchor: 1e-6, }, }, }; @@ -36,12 +48,10 @@ const IMPERIAL: TbMeasureUnits = { units: { 'ft²/s': { name: 'unit.square-foot-per-second', - tags: ['kinematic viscosity', 'ft²/s'], to_anchor: 0.09290304, }, 'in²/s': { name: 'unit.square-inch-per-second', - tags: ['kinematic viscosity', 'in²/s'], to_anchor: 0.00064516, }, }, diff --git a/ui-ngx/src/app/shared/models/units/length.ts b/ui-ngx/src/app/shared/models/units/length.ts index 4a13c73bb1..549a66c3e6 100644 --- a/ui-ngx/src/app/shared/models/units/length.ts +++ b/ui-ngx/src/app/shared/models/units/length.ts @@ -43,42 +43,42 @@ const METRIC: TbMeasureUnits = { units: { nm: { name: 'unit.nanometer', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'nanoscale', 'atomic scale', 'molecular scale', 'nanometer', 'nanometers', 'nm'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'nanoscale', 'atomic scale', 'molecular scale'], to_anchor: 1e-9, }, μm: { name: 'unit.micrometer', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'microns', 'micrometer', 'micrometers', 'µm'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'microns'], to_anchor: 1e-6, }, mm: { name: 'unit.millimeter', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'millimeter', 'millimeters', 'rainfall', 'precipitation', 'displacement', 'position', 'movement', 'transition', 'mm'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'rainfall', 'precipitation', 'displacement', 'position', 'movement', 'transition'], to_anchor: 1e-3, }, cm: { name: 'unit.centimeter', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'centimeter', 'centimeters', 'rainfall', 'precipitation', 'displacement', 'position', 'movement', 'transition', 'cm'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'rainfall', 'precipitation', 'displacement', 'position', 'movement', 'transition'], to_anchor: 1e-2, }, dm: { name: 'unit.decimeter', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'decimeter', 'decimeters', 'dm'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth'], to_anchor: 1e-1, }, m: { name: 'unit.meter', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'meter', 'meters', 'm'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth'], to_anchor: 1, }, km: { name: 'unit.kilometer', - tags: ['distance', 'height', 'length', 'width', 'gap', 'depth', 'kilometer', 'kilometers', 'km'], + tags: ['distance', 'height', 'width', 'gap', 'depth'], to_anchor: 1e3, }, angstrom: { name: 'unit.angstrom', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'atomic scale', 'atomic distance', 'nanoscale', 'angstrom', 'angstroms', 'Å'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'atomic scale', 'atomic distance', 'nanoscale'], to_anchor: 1e-10, }, }, @@ -89,87 +89,87 @@ const IMPERIAL: TbMeasureUnits = { units: { in: { name: 'unit.inch', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'inch', 'inches', 'in'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth'], to_anchor: 1 / 12, }, yd: { name: 'unit.yard', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'yard', 'yards', 'yd'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth'], to_anchor: 3, }, 'ft-us': { name: 'unit.foot-us', - tags: ['length', 'us survey foot', 'us survey feet', 'ft-us', 'surveying'], + tags: ['us survey foot', 'us survey feet', 'ft-us', 'surveying'], to_anchor: 1.000002, }, ft: { name: 'unit.foot', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'foot', 'feet', 'ft'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'feet'], to_anchor: 1, }, fathom: { name: 'unit.fathom', - tags: ['depth', 'nautical measurement', 'fathom'], + tags: ['depth', 'nautical measurement'], to_anchor: 6, }, mi: { name: 'unit.mile', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'mile', 'miles', 'mi'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth'], to_anchor: 5280, }, nmi: { name: 'unit.nautical-mile', - tags: ['level', 'height', 'distance', 'length', 'width', 'gap', 'depth', 'nautical mile', 'nmi'], + tags: ['level', 'height', 'distance', 'width', 'gap', 'depth', 'nautical mile'], to_anchor: 6076.12, }, thou: { name: 'unit.thou', - tags: ['length', 'measurement', 'thou'], + tags: ['measurement'], to_anchor: 0.001 / 12, }, barleycorn: { name: 'unit.barleycorn', - tags: ['length', 'shoe size', 'barleycorn'], + tags: ['shoe size'], to_anchor: 1 / 36, }, hand: { name: 'unit.hand', - tags: ['length', 'horse measurement', 'hand'], + tags: ['horse measurement'], to_anchor: 4 / 12, }, ch: { name: 'unit.chain', - tags: ['length', 'land surveying', 'ch'], + tags: ['land surveying'], to_anchor: 66, }, fur: { name: 'unit.furlong', - tags: ['length', 'land surveying', 'fur'], + tags: ['land surveying'], to_anchor: 660, }, league: { name: 'unit.league', - tags: ['length', 'historical measurement', 'league'], + tags: ['historical measurement'], to_anchor: 3 * 5280, }, link: { name: 'unit.link', - tags: ['length', 'land surveying', 'link'], + tags: ['land surveying'], to_anchor: 0.66, }, rod: { name: 'unit.rod', - tags: ['length', 'land surveying', 'rod'], + tags: ['land surveying'], to_anchor: 16.5, }, cable: { name: 'unit.cable', - tags: ['distance', 'nautical measurement', 'cable'], + tags: ['distance', 'nautical measurement'], to_anchor: 600, }, AU: { name: 'unit.astronomical-unit', - tags: ['distance', 'celestial bodies', 'solar system', 'AU'], + tags: ['distance', 'celestial bodies', 'solar system'], to_anchor: 149597870700 * 3.28084, }, }, diff --git a/ui-ngx/src/app/shared/models/units/light-exposure.ts b/ui-ngx/src/app/shared/models/units/light-exposure.ts index 353cf57a37..72dd8a920b 100644 --- a/ui-ngx/src/app/shared/models/units/light-exposure.ts +++ b/ui-ngx/src/app/shared/models/units/light-exposure.ts @@ -1,14 +1,28 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type LightExposureMetricUnits = 'lx·s'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type LightExposureUnits = LightExposureMetricUnits; +export type LightExposureUnits = 'lx·s'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'lx·s': { name: 'unit.lux-second', - tags: ['light exposure', 'illuminance over time', 'lux-second', 'lx·s'], + tags: ['illuminance over time'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/liner-charge-density.ts b/ui-ngx/src/app/shared/models/units/liner-charge-density.ts index 4a2239b1d7..904257e328 100644 --- a/ui-ngx/src/app/shared/models/units/liner-charge-density.ts +++ b/ui-ngx/src/app/shared/models/units/liner-charge-density.ts @@ -1,14 +1,28 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type LinerChargeDensityMetricUnits = 'C/m'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type LinerChargeDensityUnits = LinerChargeDensityMetricUnits; +export type LinerChargeDensityUnits = 'C/m'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'C/m': { name: 'unit.coulomb-per-meter', - tags: ['electric displacement field per length', 'coulomb per meter', 'C/m'], + tags: ['electric displacement field per length'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/logarithmic-ratio.ts b/ui-ngx/src/app/shared/models/units/logarithmic-ratio.ts new file mode 100644 index 0000000000..cb34632711 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/logarithmic-ratio.ts @@ -0,0 +1,45 @@ +/// +/// 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 LogarithmicRatioUnits = 'dB' | 'B' | 'Np'; + +const METRIC: TbMeasureUnits = { + units: { + 'dB': { + name: 'unit.decibel', + tags: ['noise level', 'sound level', 'volume', 'acoustics'], + to_anchor: 1, + }, + 'B': { + name: 'unit.bel', + tags: ['power ratio', 'intensity ratio'], + to_anchor: 10, + }, + 'Np': { + name: 'unit.neper', + tags: ['gain', 'loss', 'attenuation'], + to_anchor: 8.685889638, + }, + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/logarithmic-units.ts b/ui-ngx/src/app/shared/models/units/logarithmic-units.ts deleted file mode 100644 index ccbfd9af8e..0000000000 --- a/ui-ngx/src/app/shared/models/units/logarithmic-units.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type LogarithmicUnits = 'dB' | 'B' | 'Np'; - -const METRIC: TbMeasureUnits = { - units: { - 'dB': { - name: 'unit.decibel', - tags: ['noise level', 'sound level', 'volume', 'acoustics', 'decibel', 'dB'], - to_anchor: 1, - }, - 'B': { - name: 'unit.bel', - tags: ['logarithmic unit', 'power ratio', 'intensity ratio', 'bel', 'B'], - to_anchor: 10, - }, - 'Np': { - name: 'unit.neper', - tags: ['logarithmic unit', 'ratio', 'gain', 'loss', 'attenuation', 'neper', 'Np'], - to_anchor: 8.685889638, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/luminous-efficacy.ts b/ui-ngx/src/app/shared/models/units/luminous-efficacy.ts index 1aa5c496fb..cacc51132c 100644 --- a/ui-ngx/src/app/shared/models/units/luminous-efficacy.ts +++ b/ui-ngx/src/app/shared/models/units/luminous-efficacy.ts @@ -1,14 +1,28 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type LuminousEfficacyMetricUnits = 'lm/W'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type LuminousEfficacyUnits = LuminousEfficacyMetricUnits; +export type LuminousEfficacyUnits = 'lm/W'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'lm/W': { name: 'unit.lumens-per-watt', - tags: ['luminous efficacy', 'lighting efficiency', 'lumens per watt', 'lm/W'], + tags: ['lighting efficiency'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/luminous-flux.ts b/ui-ngx/src/app/shared/models/units/luminous-flux.ts index ff1b052919..0d91e372e8 100644 --- a/ui-ngx/src/app/shared/models/units/luminous-flux.ts +++ b/ui-ngx/src/app/shared/models/units/luminous-flux.ts @@ -1,14 +1,28 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type LuminousFluxMetricUnits = 'lm'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type LuminousFluxUnits = LuminousFluxMetricUnits; +export type LuminousFluxUnits = 'lm'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'lm': { name: 'unit.lumen', - tags: ['luminous flux', 'total light output', 'lumen', 'lm'], + tags: ['total light output'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/luminous-intensity.ts b/ui-ngx/src/app/shared/models/units/luminous-intensity.ts index 7168aab088..da85631822 100644 --- a/ui-ngx/src/app/shared/models/units/luminous-intensity.ts +++ b/ui-ngx/src/app/shared/models/units/luminous-intensity.ts @@ -1,14 +1,28 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type LuminousIntensityMetricUnits = 'cd'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type LuminousIntensityUnits = LuminousIntensityMetricUnits; +export type LuminousIntensityUnits = 'cd'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'cd': { name: 'unit.candela', - tags: ['luminous intensity', 'light intensity', 'candela', 'cd'], + tags: ['light intensity'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/magnetic-field-gradient.ts b/ui-ngx/src/app/shared/models/units/magnetic-field-gradient.ts index 41e8fade91..c5136698da 100644 --- a/ui-ngx/src/app/shared/models/units/magnetic-field-gradient.ts +++ b/ui-ngx/src/app/shared/models/units/magnetic-field-gradient.ts @@ -1,18 +1,31 @@ +/// +/// 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 MagneticFieldGradientUnits = MagneticFieldGradientMetricUnits; -export type MagneticFieldGradientMetricUnits = 'T/m' | 'G/cm'; +export type MagneticFieldGradientUnits = 'T/m' | 'G/cm'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'T/m': { name: 'unit.tesla-per-meter', - tags: ['magnetic field', 'tesla per meter', 'T/m'], to_anchor: 1, }, 'G/cm': { name: 'unit.gauss-per-centimeter', - tags: ['magnetic field', 'gauss per centimeter', 'G/cm'], to_anchor: 0.01, }, }, diff --git a/ui-ngx/src/app/shared/models/units/magnetic-field.ts b/ui-ngx/src/app/shared/models/units/magnetic-field.ts deleted file mode 100644 index 8996c7911b..0000000000 --- a/ui-ngx/src/app/shared/models/units/magnetic-field.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; - -export type MagneticFieldMetricUnits = 'T' | 'mT' | 'μT' | 'nT' | 'kT' | 'MT' | 'G' | 'kG' | 'γ' | 'A/m' | 'Oe'; - -export type MagneticFieldUnits = MagneticFieldMetricUnits; - -const METRIC: TbMeasureUnits = { - units: { - 'T': { - name: 'unit.tesla', - tags: ['magnetic field', 'magnetic field strength', 'tesla', 'T', 'magnetic flux density'], - to_anchor: 1, - }, - 'mT': { - name: 'unit.millitesla', - tags: ['magnetic field', 'magnetic field strength', 'millitesla', 'mT'], - to_anchor: 0.001, - }, - 'μT': { - name: 'unit.microtesla', - tags: ['magnetic field', 'magnetic field strength', 'microtesla', 'μT'], - to_anchor: 0.000001, - }, - 'nT': { - name: 'unit.nanotesla', - tags: ['magnetic field', 'magnetic field strength', 'nanotesla', 'nT'], - to_anchor: 0.000000001, - }, - 'kT': { - name: 'unit.kilotesla', - tags: ['magnetic field', 'magnetic field strength', 'kilotesla', 'kT'], - to_anchor: 1000, - }, - 'MT': { - name: 'unit.megatesla', - tags: ['magnetic field', 'magnetic field strength', 'megatesla', 'MT'], - to_anchor: 1000000, - }, - 'G': { - name: 'unit.gauss', - tags: ['magnetic field', 'magnetic field strength', 'gauss', 'G', 'magnetic flux density'], - to_anchor: 0.0001, - }, - 'kG': { - name: 'unit.kilogauss', - tags: ['magnetic field', 'magnetic field strength', 'kilogauss', 'kG', 'magnetic flux density'], - to_anchor: 0.1, - }, - 'γ': { - name: 'unit.gamma', - tags: ['magnetic flux density', 'gamma', 'γ'], - to_anchor: 0.000000001, - }, - 'A/m': { - name: 'unit.ampere-per-meter', - tags: ['magnetic field strength', 'magnetic field intensity', 'ampere per meter', 'A/m'], - to_anchor: 0.00000125663706143591, - }, - 'Oe': { - name: 'unit.oersted', - tags: ['magnetic field', 'oersted', 'Oe'], - to_anchor: 0.0001, - }, - }, -}; - -const measure: TbMeasure = { - METRIC, -}; - -export default measure; diff --git a/ui-ngx/src/app/shared/models/units/magnetic-flux-density.ts b/ui-ngx/src/app/shared/models/units/magnetic-flux-density.ts new file mode 100644 index 0000000000..4f93ead1be --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/magnetic-flux-density.ts @@ -0,0 +1,84 @@ +/// +/// 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 MagneticFluxDensityUnits = 'T' | 'mT' | 'μT' | 'nT' | 'kT' | 'MT' | 'G' | 'kG' | 'γ' | 'A/m' | 'Oe'; + +const METRIC: TbMeasureUnits = { + units: { + T: { + name: 'unit.tesla', + tags: ['magnetic field strength'], + to_anchor: 1, + }, + mT: { + name: 'unit.millitesla', + tags: ['magnetic field strength'], + to_anchor: 0.001, + }, + μT: { + name: 'unit.microtesla', + tags: ['magnetic field strength'], + to_anchor: 0.000001, + }, + nT: { + name: 'unit.nanotesla', + tags: ['magnetic field strength'], + to_anchor: 0.000000001, + }, + kT: { + name: 'unit.kilotesla', + tags: ['magnetic field strength'], + to_anchor: 1000, + }, + MT: { + name: 'unit.megatesla', + tags: ['magnetic field strength'], + to_anchor: 1000000, + }, + G: { + name: 'unit.gauss', + tags: ['magnetic field strength'], + to_anchor: 0.0001, + }, + kG: { + name: 'unit.kilogauss', + tags: ['magnetic field strength'], + to_anchor: 0.1, + }, + γ: { + name: 'unit.gamma', + to_anchor: 0.000000001, + }, + 'A/m': { + name: 'unit.ampere-per-meter', + tags: ['magnetic field strength', 'magnetic field intensity'], + to_anchor: 0.00000125663706143591, + }, + Oe: { + name: 'unit.oersted', + tags: ['magnetic field strength'], + to_anchor: 0.0001, + }, + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/magnetic-flux.ts b/ui-ngx/src/app/shared/models/units/magnetic-flux.ts index 467d317d7a..d503f92627 100644 --- a/ui-ngx/src/app/shared/models/units/magnetic-flux.ts +++ b/ui-ngx/src/app/shared/models/units/magnetic-flux.ts @@ -1,37 +1,48 @@ +/// +/// 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 MagneticFluxUnits = 'Wb' | 'µWb' | 'mWb' | 'Mx' | 'G·cm²' | 'kG·cm²'; const METRIC: TbMeasureUnits = { units: { - 'Wb': { + Wb: { name: 'unit.weber', - tags: ['magnetic flux', 'weber', 'Wb'], to_anchor: 1, }, - 'µWb': { + µWb: { name: 'unit.microweber', - tags: ['magnetic flux', 'microweber', 'µWb'], to_anchor: 1e-6, }, - 'mWb': { + mWb: { name: 'unit.milliweber', - tags: ['magnetic flux', 'milliweber', 'mWb'], to_anchor: 1e-3, }, - 'Mx': { + Mx: { name: 'unit.maxwell', - tags: ['magnetic flux', 'magnetic field', 'maxwell', 'Mx'], + tags: ['magnetic field'], to_anchor: 1e-8, }, 'G·cm²': { name: 'unit.gauss-square-centimeter', - tags: ['magnetic flux', 'gauss-square centimeter', 'G·cm²'], to_anchor: 1e-8, }, 'kG·cm²': { name: 'unit.kilogauss-square-centimeter', - tags: ['magnetic flux', 'kilogauss-square centimeter', 'kG·cm²'], to_anchor: 1e-5, }, }, diff --git a/ui-ngx/src/app/shared/models/units/magnetic-moment.ts b/ui-ngx/src/app/shared/models/units/magnetic-moment.ts index d7771bdf33..670a88a400 100644 --- a/ui-ngx/src/app/shared/models/units/magnetic-moment.ts +++ b/ui-ngx/src/app/shared/models/units/magnetic-moment.ts @@ -1,19 +1,33 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type MagneticMomentMetricUnits = 'A·m²' | 'μB'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type MagneticMomentUnits = MagneticMomentMetricUnits; +export type MagneticMomentUnits = 'A·m²' | 'μB'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'A·m²': { name: 'unit.magnetic-dipole-moment', - tags: ['magnetic dipole', 'dipole moment', 'ampere square meter', 'A·m²'], + tags: ['magnetic dipole moment'], to_anchor: 1, }, - 'μB': { + μB: { name: 'unit.bohr-magneton', - tags: ['atomic physics', 'magnetic moment', 'bohr magneton', 'μB'], + tags: ['atomic physics'], to_anchor: 9.274e-24, }, }, diff --git a/ui-ngx/src/app/shared/models/units/magnetic-permeability.ts b/ui-ngx/src/app/shared/models/units/magnetic-permeability.ts new file mode 100644 index 0000000000..73052db8d9 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/magnetic-permeability.ts @@ -0,0 +1,40 @@ +/// +/// 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 MagneticPermeabilityUnits = 'H/m' | 'G/Oe'; + +const METRIC: TbMeasureUnits = { + units: { + 'H/m': { + name: 'unit.henry-per-meter', + to_anchor: 1, + }, + 'G/Oe': { + name: 'unit.gauss-per-oersted', + tags: ['magnetic field'], + to_anchor: 1/ 795774.715, + }, + }, +}; + + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/mass-fraction.ts b/ui-ngx/src/app/shared/models/units/mass-fraction.ts new file mode 100644 index 0000000000..23136c2447 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/mass-fraction.ts @@ -0,0 +1,35 @@ +/// +/// 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 MassFractionUnits = '°Bx'; + +const METRIC: TbMeasureUnits = { + units: { + '°Bx': { + name: 'unit.degrees-brix', + tags: ['sugar content', 'fruit ripeness'], + to_anchor: 1, + }, + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/mass.ts b/ui-ngx/src/app/shared/models/units/mass.ts index fbed798da3..75d1d578a6 100644 --- a/ui-ngx/src/app/shared/models/units/mass.ts +++ b/ui-ngx/src/app/shared/models/units/mass.ts @@ -26,37 +26,37 @@ const METRIC: TbMeasureUnits = { units: { ng: { name: 'unit.nanogram', - tags: ['mass', 'weight', 'heaviness', 'load', 'nanogram', 'nanograms', 'ng'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1e-9, }, mcg: { name: 'unit.microgram', - tags: ['mass', 'weight', 'heaviness', 'load', 'μg', 'microgram'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1e-6, }, mg: { name: 'unit.milligram', - tags: ['mass', 'weight', 'heaviness', 'load', 'milligram', 'miligrams', 'mg'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1e-3, }, g: { name: 'unit.gram', - tags: ['mass', 'weight', 'heaviness', 'load', 'gram', 'grams', 'g'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1, }, kg: { name: 'unit.kilogram', - tags: ['mass', 'weight', 'heaviness', 'load', 'kilogram', 'kilograms', 'kg'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1000, }, t: { name: 'unit.tonne', - tags: ['mass', 'weight', 'heaviness', 'load', 'tonne', 'tons', 't'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1000000, }, Da: { name: 'unit.dalton', - tags: ['atomic mass unit', 'AMU', 'unified atomic mass unit', 'dalton', 'Da'], + tags: ['atomic mass unit', 'AMU', 'unified atomic mass unit'], to_anchor: 1.66053906660e-24, }, ct: { @@ -72,47 +72,47 @@ const IMPERIAL: TbMeasureUnits = { units: { oz: { name: 'unit.ounce', - tags: ['mass', 'weight', 'heaviness', 'load', 'ounce', 'ounces', 'oz'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1 / 16, }, lb: { name: 'unit.pound', - tags: ['mass', 'weight', 'heaviness', 'load', 'pound', 'pounds', 'lb'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 1, }, st: { name: 'unit.stone', - tags: ['mass', 'weight', 'heaviness', 'load', 'stone', 'stones', 'st'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 14, }, 'short tons': { name: 'unit.short-tons', - tags: ['mass', 'weight', 'heaviness', 'load', 'short ton', 'short tons'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 2000, }, gr: { name: 'unit.grain', - tags: ['mass', 'measurement', 'grain', 'gr'], + tags: ['measurement'], to_anchor: 1 / 7000, }, dr: { name: 'unit.drachm', - tags: ['mass', 'measurement', 'drachm', 'dr'], + tags: ['measurement'], to_anchor: 1 / 256, }, qr: { name: 'unit.quarter', - tags: ['mass', 'measurement', 'quarter', 'qr'], + tags: ['measurement'], to_anchor: 28, }, cwt: { name: 'unit.hundredweight-count', - tags: ['mass', 'weight', 'heaviness', 'load', 'hundredweight count', 'cwt'], + tags: ['weight', 'heaviness', 'load'], to_anchor: 100, }, slug: { name: 'unit.slug', - tags: ['mass', 'measurement', 'slug'], + tags: ['measurement'], to_anchor: 32.174, }, }, diff --git a/ui-ngx/src/app/shared/models/units/molar-concentration.ts b/ui-ngx/src/app/shared/models/units/molar-concentration.ts new file mode 100644 index 0000000000..e0d3c1ef30 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/molar-concentration.ts @@ -0,0 +1,35 @@ +/// +/// 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 MolarConcentrationUnits = 'mol/m³'; + +const METRIC: TbMeasureUnits = { + units: { + 'mol/m³': { + name: 'unit.mole-per-cubic-meter', + tags: ['amount of substance per unit volume'], + to_anchor: 1, + } + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/app/shared/models/units/molar-energy.ts b/ui-ngx/src/app/shared/models/units/molar-energy.ts index 41e7b5a75e..99162d314f 100644 --- a/ui-ngx/src/app/shared/models/units/molar-energy.ts +++ b/ui-ngx/src/app/shared/models/units/molar-energy.ts @@ -1,14 +1,27 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type MolarEnergyMetricUnits = 'J/mol'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type MolarEnergyUnits = MolarEnergyMetricUnits; +export type MolarEnergyUnits = 'J/mol'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'J/mol': { name: 'unit.joule-per-mole', - tags: ['molar energy', 'joule per mole', 'J/mol'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/molar-heat-capacity.ts b/ui-ngx/src/app/shared/models/units/molar-heat-capacity.ts index 104a44b3de..ee2b4b1752 100644 --- a/ui-ngx/src/app/shared/models/units/molar-heat-capacity.ts +++ b/ui-ngx/src/app/shared/models/units/molar-heat-capacity.ts @@ -1,14 +1,27 @@ -import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; +/// +/// 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. +/// -export type MolarHeatCapacityMetricUnits = 'J/(mol·K)'; +import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models'; -export type MolarHeatCapacityUnits = MolarHeatCapacityMetricUnits; +export type MolarHeatCapacityUnits = 'J/(mol·K)'; -const METRIC: TbMeasureUnits = { +const METRIC: TbMeasureUnits = { units: { 'J/(mol·K)': { name: 'unit.joule-per-mole-kelvin', - tags: ['molar heat capacity', 'joule per mole-kelvin', 'J/(mol·K)'], to_anchor: 1, }, }, diff --git a/ui-ngx/src/app/shared/models/units/molar-mass.ts b/ui-ngx/src/app/shared/models/units/molar-mass.ts index c9a6b89639..9bbb4ab9e3 100644 --- a/ui-ngx/src/app/shared/models/units/molar-mass.ts +++ b/ui-ngx/src/app/shared/models/units/molar-mass.ts @@ -1,3 +1,19 @@ +/// +/// 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 MolarMassUnits = 'kg/mol' | 'g/mol' | 'mg/mol'; @@ -6,17 +22,14 @@ const METRIC: TbMeasureUnits = { units: { 'g/mol': { name: 'unit.gram-per-mole', - tags: ['molar mass', 'gram per mole', 'g/mol'], to_anchor: 1, }, 'kg/mol': { name: 'unit.kilogram-per-mole', - tags: ['molar mass', 'kilogram per mole', 'kg/mol'], to_anchor: 1e3, }, 'mg/mol': { name: 'unit.milligram-per-mole', - tags: ['molar mass', 'milligram per mole', 'mg/mol'], to_anchor: 1e-3, }, }, diff --git a/ui-ngx/src/app/shared/models/units/specific-humidity.ts b/ui-ngx/src/app/shared/models/units/specific-humidity.ts new file mode 100644 index 0000000000..82f12b26e2 --- /dev/null +++ b/ui-ngx/src/app/shared/models/units/specific-humidity.ts @@ -0,0 +1,35 @@ +/// +/// 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 SpecificHumidityUnits = 'g/kg'; + +const METRIC: TbMeasureUnits = { + units: { + 'g/kg': { + name: 'unit.gram-per-kilogram', + tags: ['humidity', 'moisture', 'specific humidity', 'g/kg'], + to_anchor: 1, + }, + }, +}; + +const measure: TbMeasure = { + METRIC, +}; + +export default measure; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index c685b6171e..c6e2d31cbc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5866,18 +5866,54 @@ }, "measures": { "acceleration": "Acceleration", + "air-quality-index": "Air quality index", + "amount-of-substance": "Amount of substance", "angle": "Angle", "angular-acceleration": "Angular acceleration", "area": "Area", + "capacitance": "Capacitance", + "catalytic-activity": "Catalytic activity", + "catalytic-concetration": "Catalytic concetration", "charge": "Charge", + "current-density": "Current density", + "data-transfer-rate": "Data transfer rate", "digital": "Digital", + "dimension-ratio": "Dimension ratio", + "dynamic-viscosity": "Dynamic viscosity", + "earthquake-magnitude": "Earthquake magnitude", "electric-current": "Electric current", + "electric-dipole-moment": "Electric dipole moment", + "electric-field-strength": "Electric field strength", + "electric-flux": "Electric flux", + "electric-permittivity": "Electric permittivity", + "electrical-conductance": "Electrical conductance", + "electrical-conductivity": "Electrical conductivity", "energy": "Energy", "force": "Force", "frequency": "Frequency", + "fuel-efficiency": "fuel efficiency", + "heat-capacity": "Heat capacity", "illuminance": "Illuminance", + "inductance": "Inductance", + "kinematic-viscosity": "Kinematic viscosity", "length": "Length", + "light-exposure": "Light exposure", + "logarithmic-ratio": "Logarithmic ratio", + "luminous-efficacy": "Luminous efficacy", + "luminous-flux": "Luminous flux", + "luminous-intensity": "Luminous intensity", + "magnetic-field-gradient": "Magnetic field gradient", + "magnetic-flux": "Magnetic flux", + "magnetic-flux-density": "Magnetic flux density", + "magnetic-moment": "Magnetic moment", + "magnetic-permeability": "Magnetic permeability", "mass": "Mass", + "mass-fraction": "Mass fraction", + "molar-concetration": "Molar concetration", + "molar-energy": "Molar energy", + "molar-heat-capacity": "Molar heat capacity", + "molar-mass": "Molar mass", + "specific-humidity": "Specific humidity", "temperature": "Temperature", "time": "Time" },