Rewrite frontend, added rooms, voltage selection per project, startet with todos
This commit is contained in:
@@ -2,8 +2,26 @@ export interface Consumer {
|
||||
id: string;
|
||||
projectId: string;
|
||||
distributionBoardId?: string;
|
||||
circuitListId?: string;
|
||||
roomId?: string;
|
||||
roomNumber?: string;
|
||||
roomName?: string;
|
||||
floorId?: string;
|
||||
floorName?: string;
|
||||
circuitNumber?: string;
|
||||
description?: string;
|
||||
name: string;
|
||||
category?: string;
|
||||
deviceType?: string;
|
||||
phaseType?: string;
|
||||
tradeOrCostGroup?: string;
|
||||
group?: string;
|
||||
protectionType?: string;
|
||||
protectionRatedCurrent?: number;
|
||||
protectionCharacteristic?: string;
|
||||
cableType?: string;
|
||||
cableCrossSection?: string;
|
||||
comment?: string;
|
||||
quantity: number;
|
||||
installedPowerPerUnitKw: number;
|
||||
demandFactor: number;
|
||||
@@ -12,4 +30,3 @@ export interface Consumer {
|
||||
powerFactor?: number;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,20 @@ import type { Consumer } from "../models/consumer.model.js";
|
||||
export interface ConsumerWithCalculatedValues extends Consumer {
|
||||
installedPowerKw: number;
|
||||
demandPowerKw: number;
|
||||
effectiveVoltageV?: number;
|
||||
currentA?: number;
|
||||
}
|
||||
|
||||
export interface ProjectVoltageDefaults {
|
||||
singlePhaseVoltageV: number;
|
||||
threePhaseVoltageV: number;
|
||||
}
|
||||
|
||||
export class PowerBalanceService {
|
||||
enrichConsumer(consumer: Consumer): ConsumerWithCalculatedValues {
|
||||
enrichConsumer(
|
||||
consumer: Consumer,
|
||||
projectVoltageDefaults?: ProjectVoltageDefaults
|
||||
): ConsumerWithCalculatedValues {
|
||||
const installedPowerKw = calculateInstalledPowerKw({
|
||||
quantity: consumer.quantity,
|
||||
installedPowerPerUnitKw: consumer.installedPowerPerUnitKw,
|
||||
@@ -24,11 +33,19 @@ export class PowerBalanceService {
|
||||
demandFactor: consumer.demandFactor,
|
||||
});
|
||||
|
||||
const effectiveVoltageV =
|
||||
consumer.voltageV ??
|
||||
(consumer.phaseCount === 1
|
||||
? projectVoltageDefaults?.singlePhaseVoltageV
|
||||
: consumer.phaseCount === 3
|
||||
? projectVoltageDefaults?.threePhaseVoltageV
|
||||
: undefined);
|
||||
|
||||
let currentA: number | undefined;
|
||||
if (consumer.voltageV && consumer.phaseCount && consumer.powerFactor) {
|
||||
if (effectiveVoltageV && consumer.phaseCount && consumer.powerFactor) {
|
||||
currentA = calculateCurrentA({
|
||||
demandPowerKw,
|
||||
voltageV: consumer.voltageV,
|
||||
voltageV: effectiveVoltageV,
|
||||
phaseCount: consumer.phaseCount,
|
||||
powerFactor: consumer.powerFactor,
|
||||
});
|
||||
@@ -38,8 +55,8 @@ export class PowerBalanceService {
|
||||
...consumer,
|
||||
installedPowerKw,
|
||||
demandPowerKw,
|
||||
effectiveVoltageV,
|
||||
currentA,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user