2 * Rationale: https://wiki.piment-noir.org/doku.php/en:cs:modelling_multi-phased_electrical_system_interconnexion
6 * Targeted to AC related values calculation.
8 export class ACElectricUtils
{
9 static amperageTotal(nbOfPhases
: number, Iph
: number): number {
10 return nbOfPhases
* Iph
;
13 static powerPerPhase(V
: number, Iph
: number, cosPhi
= 1): number {
14 const powerPerPhase
= V
* Iph
* cosPhi
;
18 return Math.round(powerPerPhase
);
21 static powerTotal(nbOfPhases
: number, V
: number, Iph
: number, cosPhi
= 1): number {
22 return nbOfPhases
* ACElectricUtils
.powerPerPhase(V
, Iph
, cosPhi
);
25 static amperageTotalFromPower(P
: number, V
: number, cosPhi
= 1): number {
26 const amperage
= P
/ (V
* cosPhi
);
27 if (cosPhi
=== 1 && P
% V
=== 0) {
30 return Math.round(amperage
);
33 static amperagePerPhaseFromPower(nbOfPhases
: number, P
: number, V
: number, cosPhi
= 1): number {
34 const amperage
= ACElectricUtils
.amperageTotalFromPower(P
, V
, cosPhi
);
35 const amperagePerPhase
= amperage
/ nbOfPhases
;
36 if (amperage
% nbOfPhases
=== 0) {
37 return amperagePerPhase
;
39 return Math.round(amperagePerPhase
);
44 * Targeted to DC related values calculation.
46 export class DCElectricUtils
{
47 static power(V
: number, I
: number): number {
51 static amperage(P
: number, V
: number): number {
52 const amperage
= P
/ V
;
56 return Math.round(amperage
);