2 * Targeted to AC related values calculation.
3 * To use for DC, always consider cosPhi = 1 and do not use per phase helpers
5 export default class ElectricUtils
{
6 static ampTotal(nbOfPhases
: number, Iph
: number): number {
7 return nbOfPhases
* Iph
;
10 static powerPerPhase(V
: number, Iph
: number, cosPhi
= 1): number {
11 const powerPerPhase
= V
* Iph
* cosPhi
;
15 return Math.round(powerPerPhase
);
18 static powerTotal(nbOfPhases
: number, V
: number, Iph
: number, cosPhi
= 1): number {
19 return nbOfPhases
* ElectricUtils
.powerPerPhase(V
, Iph
, cosPhi
);
22 static ampTotalFromPower(P
: number, V
: number, cosPhi
= 1): number {
23 const power
= P
/ (V
* cosPhi
);
24 if (cosPhi
=== 1 && P
% V
=== 0) {
27 return Math.round(power
);
30 static ampPerPhaseFromPower(nbOfPhases
: number, P
: number, V
: number, cosPhi
= 1): number {
31 const power
= ElectricUtils
.ampTotalFromPower(P
, V
, cosPhi
);
32 const powerPerPhase
= power
/ nbOfPhases
;
33 if (power
% nbOfPhases
=== 0) {
36 return Math.round(powerPerPhase
);