Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/shared/foundation-shared-domain/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export * from "./messages";
export * from "./playlists";
export * from "./roles";
export * from "./times";
export * from "./units";
export * from "./users";
export * from "./widgetTemplates";
export * from "./reports";
174 changes: 174 additions & 0 deletions src/shared/foundation-shared-domain/enums/units.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
export enum UnitPrefix {
None = "",
Nano = "n",
Micro = "µ",
Milli = "m",
Kilo = "k",
Mega = "M",
Giga = "G",
Tera = "T",
Peta = "P"
}

export enum UnitFamily {
Energy = "energy",
Power = "power",
Volume = "volume",
GasVolume = "gasVolume",
WaterFlow = "waterFlow",
GasFlow = "gasFlow",
Pressure = "pressure",
Temperature = "temperature",
Speed = "speed",
Distance = "distance",
Mass = "mass",
MassFlow = "massFlow",
Frequency = "frequency",
Voltage = "voltage",
Current = "current",
Resistance = "resistance",
Percentage = "percentage",
Capacity = "capacity",
SnowProduction = "snowProduction",
Efficiency = "efficiency"
}


export enum EnergyUnit {
Wh = "Wh",
kWh = "kWh",
MWh = "MWh",
GWh = "GWh",
TWh = "TWh",
}

export enum PowerUnit {
W = "W",
kW = "kW",
MW = "MW",
GW = "GW",
TW = "TW",
}

export enum VolumeUnit {
mL = "mL",
L = "L",
m3 = "m3",
dam3 = "dam3",
}

export enum GasVolumeUnit {
Nm3 = "Nm3",
kNm3 = "kNm3",
MNm3 = "MNm3",
GNm3 = "GNm3",
}

export enum WaterFlowUnit {
mL_s = "mL/s",
L_s = "L/s",
m3_s = "m3/s",
L_min = "L/min",
m3_h = "m3/h",
}

export enum GasFlowUnit {
Nm3_h = "Nm3/h",
kNm3_h = "kNm3/h",
MNm3_h = "MNm3/h",
}

export enum PressureUnit {
Pa = "Pa",
kPa = "kPa",
MPa = "MPa",
GPa = "GPa",
bar = "bar",
mbar = "mbar",
}

export enum TemperatureUnit {
Celsius = "°C",
Kelvin = "K",
Fahrenheit = "°F",
}

export enum SpeedUnit {
m_s = "m/s",
km_h = "km/h",
knot = "kn",
}

export enum DistanceUnit {
mm = "mm",
cm = "cm",
m = "m",
km = "km",
}

export enum MassUnit {
mg = "mg",
g = "g",
kg = "kg",
t = "t",
kt = "kt",
Mt = "Mt",
}

export enum MassFlowUnit {
g_s = "g/s",
kg_s = "kg/s",
t_s = "t/s",
kg_h = "kg/h",
t_h = "t/h",
}

export enum FrequencyUnit {
Hz = "Hz",
kHz = "kHz",
MHz = "MHz",
GHz = "GHz",
rpm = "rpm",
}

export enum VoltageUnit {
mV = "mV",
V = "V",
kV = "kV",
MV = "MV",
}

export enum CurrentUnit {
mA = "mA",
A = "A",
kA = "kA",
}

export enum ResistanceUnit {
mΩ = "mΩ",
Ω = "Ω",
kΩ = "kΩ",
MΩ = "MΩ",
}

export enum PercentageUnit {
Percent = "%",
RelativeHumidity = "%RH",
}

export enum CapacityUnit {
pers = "pers",
pers_h = "pers/h",
}

export enum SnowProductionUnit {
m3_neige_h = "m3_neige/h",
}

export enum EfficiencyUnit {
kWh_m3 = "kWh/m3",
kWh_kg = "kWh/kg",
}



1 change: 1 addition & 0 deletions src/shared/foundation-shared-domain/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export * from "./permissions";
export * from "./terminals";
export * from "./timeZones";
export * from "./translations";
export * from "./units";
export * from "./userLegalInformations";
export * from "./users";
2 changes: 2 additions & 0 deletions src/shared/foundation-shared-domain/models/units/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./unitDetails";
export * from "./unitsRegistry";
22 changes: 22 additions & 0 deletions src/shared/foundation-shared-domain/models/units/unitDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { UnitFamily } from "@dative-gpi/foundation-shared-domain/enums";

export type UnitScaleStep = { unit: string; ratioToParent: number };

export type UnitConversion = {
sourceUnit: string;
targetUnit: string;
conversionRate: number;
minThreshold?: number;
};

export interface UnitDefinition {
symbol: string;
precision: number;
family?: UnitFamily;
factor?: number;
conversions?: Array<{
targetUnit: string;
conversionRate: number;
minThreshold?: number;
}>;
}
Loading
Loading