first commit

This commit is contained in:
2026-04-30 18:22:10 +02:00
commit c3e98af5b6
36 changed files with 4779 additions and 0 deletions
@@ -0,0 +1,29 @@
export interface PowerInput {
quantity: number;
installedPowerPerUnitKw: number;
demandFactor: number;
}
export interface CurrentInput {
demandPowerKw: number;
voltageV: number;
phaseCount: 1 | 3;
powerFactor: number;
}
export function calculateInstalledPowerKw(input: PowerInput): number {
return input.quantity * input.installedPowerPerUnitKw;
}
export function calculateDemandPowerKw(input: PowerInput): number {
return calculateInstalledPowerKw(input) * input.demandFactor;
}
export function calculateCurrentA(input: CurrentInput): number {
const powerW = input.demandPowerKw * 1000;
if (input.phaseCount === 1) {
return powerW / (input.voltageV * input.powerFactor);
}
return powerW / (Math.sqrt(3) * input.voltageV * input.powerFactor);
}