chore: switch coding style to JS standard
[e-mobility-charging-stations-simulator.git] / src / utils / ElectricUtils.ts
index b0f8dff412ba6984f5443155339d40f0b4ec5691..47c74d99ad67bc82208f95383cf3b984bb1ba50b 100644 (file)
@@ -7,62 +7,64 @@
 /**
  * Targeted to AC related values calculation.
  */
+// eslint-disable-next-line @typescript-eslint/no-extraneous-class
 export class ACElectricUtils {
-  private constructor() {
+  private constructor () {
     // This is intentional
   }
 
-  static powerTotal(nbOfPhases: number, V: number, Iph: number, cosPhi = 1): number {
-    return nbOfPhases * ACElectricUtils.powerPerPhase(V, Iph, cosPhi);
+  static powerTotal (nbOfPhases: number, V: number, Iph: number, cosPhi = 1): number {
+    return nbOfPhases * ACElectricUtils.powerPerPhase(V, Iph, cosPhi)
   }
 
-  static powerPerPhase(V: number, Iph: number, cosPhi = 1): number {
-    const powerPerPhase = V * Iph * cosPhi;
+  static powerPerPhase (V: number, Iph: number, cosPhi = 1): number {
+    const powerPerPhase = V * Iph * cosPhi
     if (cosPhi === 1) {
-      return powerPerPhase;
+      return powerPerPhase
     }
-    return Math.round(powerPerPhase);
+    return Math.round(powerPerPhase)
   }
 
-  static amperageTotal(nbOfPhases: number, Iph: number): number {
-    return nbOfPhases * Iph;
+  static amperageTotal (nbOfPhases: number, Iph: number): number {
+    return nbOfPhases * Iph
   }
 
-  static amperageTotalFromPower(P: number, V: number, cosPhi = 1): number {
-    const amperage = P / (V * cosPhi);
+  static amperageTotalFromPower (P: number, V: number, cosPhi = 1): number {
+    const amperage = P / (V * cosPhi)
     if (cosPhi === 1 && P % V === 0) {
-      return amperage;
+      return amperage
     }
-    return Math.round(amperage);
+    return Math.round(amperage)
   }
 
-  static amperagePerPhaseFromPower(nbOfPhases: number, P: number, V: number, cosPhi = 1): number {
-    const amperage = ACElectricUtils.amperageTotalFromPower(P, V, cosPhi);
-    const amperagePerPhase = amperage / nbOfPhases;
+  static amperagePerPhaseFromPower (nbOfPhases: number, P: number, V: number, cosPhi = 1): number {
+    const amperage = ACElectricUtils.amperageTotalFromPower(P, V, cosPhi)
+    const amperagePerPhase = amperage / nbOfPhases
     if (amperage % nbOfPhases === 0) {
-      return amperagePerPhase;
+      return amperagePerPhase
     }
-    return Math.round(amperagePerPhase);
+    return Math.round(amperagePerPhase)
   }
 }
 
 /**
  * Targeted to DC related values calculation.
  */
+// eslint-disable-next-line @typescript-eslint/no-extraneous-class
 export class DCElectricUtils {
-  private constructor() {
+  private constructor () {
     // This is intentional
   }
 
-  static power(V: number, I: number): number {
-    return V * I;
+  static power (V: number, I: number): number {
+    return V * I
   }
 
-  static amperage(P: number, V: number): number {
-    const amperage = P / V;
+  static amperage (P: number, V: number): number {
+    const amperage = P / V
     if (P % V === 0) {
-      return amperage;
+      return amperage
     }
-    return Math.round(amperage);
+    return Math.round(amperage)
   }
 }