3d76b8dba34c1f6d728c3690240dfba21cdccf04
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
, Iph
) {
7 return nbOfPhases
* Iph
;
10 static powerPerPhase(V
, Iph
, cosPhi
= 1) {
11 const powerPerPhase
= V
* Iph
* cosPhi
;
15 return Math
.round(powerPerPhase
);
18 static powerTotal(nbOfPhases
, V
, Iph
, cosPhi
= 1) {
19 return nbOfPhases
* ElectricUtils
.powerPerPhase(V
, Iph
, cosPhi
);
22 static ampTotalFromPower(P
, V
, cosPhi
= 1) {
23 const power
= P
/ (V
* cosPhi
);
24 if (cosPhi
=== 1 && P
% V
=== 0) {
27 return Math
.round(power
);
30 static ampPerPhaseFromPower(nbOfPhases
, P
, V
, cosPhi
= 1) {
31 const power
= ElectricUtils
.ampTotalFromPower(P
, V
, cosPhi
);
32 const powerPerPhase
= power
/ nbOfPhases
;
33 if (power
% nbOfPhases
=== 0) {
36 return Math
.round(powerPerPhase
);