first commit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user