b0f8dff412ba6984f5443155339d40f0b4ec5691
1 // Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
4 * Rationale: https://wiki.piment-noir.org/doku.php/en:cs:modelling_multi-phased_electrical_system_interconnexion
8 * Targeted to AC related values calculation.
10 export class ACElectricUtils
{
11 private constructor() {
12 // This is intentional
15 static powerTotal(nbOfPhases
: number, V
: number, Iph
: number, cosPhi
= 1): number {
16 return nbOfPhases
* ACElectricUtils
.powerPerPhase(V
, Iph
, cosPhi
);
19 static powerPerPhase(V
: number, Iph
: number, cosPhi
= 1): number {
20 const powerPerPhase
= V
* Iph
* cosPhi
;
24 return Math.round(powerPerPhase
);
27 static amperageTotal(nbOfPhases
: number, Iph
: number): number {
28 return nbOfPhases
* Iph
;
31 static amperageTotalFromPower(P
: number, V
: number, cosPhi
= 1): number {
32 const amperage
= P
/ (V
* cosPhi
);
33 if (cosPhi
=== 1 && P
% V
=== 0) {
36 return Math.round(amperage
);
39 static amperagePerPhaseFromPower(nbOfPhases
: number, P
: number, V
: number, cosPhi
= 1): number {
40 const amperage
= ACElectricUtils
.amperageTotalFromPower(P
, V
, cosPhi
);
41 const amperagePerPhase
= amperage
/ nbOfPhases
;
42 if (amperage
% nbOfPhases
=== 0) {
43 return amperagePerPhase
;
45 return Math.round(amperagePerPhase
);
50 * Targeted to DC related values calculation.
52 export class DCElectricUtils
{
53 private constructor() {
54 // This is intentional
57 static power(V
: number, I
: number): number {
61 static amperage(P
: number, V
: number): number {
62 const amperage
= P
/ V
;
66 return Math.round(amperage
);