c4fdfa10142c1d7fde8a1fdb685686813f20d91d
1 // Copyright Jerome Benoit. 2021-2024. 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 // eslint-disable-next-line @typescript-eslint/no-extraneous-class
11 export class ACElectricUtils
{
12 private constructor () {
13 // This is intentional
16 static powerTotal (nbOfPhases
: number, V
: number, Iph
: number, cosPhi
= 1): number {
17 return nbOfPhases
* ACElectricUtils
.powerPerPhase(V
, Iph
, cosPhi
)
20 static powerPerPhase (V
: number, Iph
: number, cosPhi
= 1): number {
21 const powerPerPhase
= V
* Iph
* cosPhi
25 return Math.round(powerPerPhase
)
28 static amperageTotal (nbOfPhases
: number, Iph
: number): number {
29 return nbOfPhases
* Iph
32 static amperageTotalFromPower (P
: number, V
: number, cosPhi
= 1): number {
33 const amperage
= P
/ (V
* cosPhi
)
34 if (cosPhi
=== 1 && P
% V
=== 0) {
37 return Math.round(amperage
)
40 static amperagePerPhaseFromPower (nbOfPhases
: number, P
: number, V
: number, cosPhi
= 1): number {
41 const amperage
= ACElectricUtils
.amperageTotalFromPower(P
, V
, cosPhi
)
42 const amperagePerPhase
= amperage
/ nbOfPhases
43 if (amperage
% nbOfPhases
=== 0) {
44 return amperagePerPhase
46 return Math.round(amperagePerPhase
)
51 * Targeted to DC related values calculation.
53 // eslint-disable-next-line @typescript-eslint/no-extraneous-class
54 export class DCElectricUtils
{
55 private constructor () {
56 // This is intentional
59 static power (V
: number, I
: number): number {
63 static amperage (P
: number, V
: number): number {
64 const amperage
= P
/ V
68 return Math.round(amperage
)