@@ -29,24 +29,23 @@ def shunt_capacitor_power_factor_correction(
2929 ...
3030 ValueError: voltage is zero no excitation
3131 """
32-
3332
3433 if (
3534 not isinstance (current_power_factor , (int , float ))
3635 or not isinstance (expected_power_factor , (int , float ))
37- or current_power_factor < - 1
38- or current_power_factor > 1
36+ or current_power_factor < - 1
37+ or current_power_factor > 1
3938 or expected_power_factor < - 1
40- or expected_power_factor > 1
39+ or expected_power_factor > 1
4140 ):
4241 raise ValueError ("power_factor must be a valid float value between -1 and 1." )
43-
42+
4443 if frequency == 0 :
4544 raise ValueError ("frequency is zero dc circuit" )
4645
4746 if voltage == 0 :
4847 raise ValueError ("voltage is zero no excitation" )
49-
48+
5049 current_theta = math .acos (current_power_factor )
5150 expected_theta = math .acos (expected_power_factor )
5251
@@ -64,7 +63,6 @@ def shunt_capacitor_power_factor_correction(
6463 return change_reactive_power / (2 * math .pi * frequency * (voltage ** 2 ))
6564
6665
67-
6866def shunt_inductor_power_factor_correction (
6967 voltage : float ,
7068 frequency : float ,
@@ -90,14 +88,14 @@ def shunt_inductor_power_factor_correction(
9088 ...
9189 ValueError: voltage is zero no excitation
9290 """
93-
91+
9492 if (
9593 not isinstance (current_power_factor , (int , float ))
9694 or not isinstance (expected_power_factor , (int , float ))
97- or current_power_factor < - 1
98- or current_power_factor > 1
95+ or current_power_factor < - 1
96+ or current_power_factor > 1
9997 or expected_power_factor < - 1
100- or expected_power_factor > 1
98+ or expected_power_factor > 1
10199 ):
102100 raise ValueError ("power_factor must be a valid float value between -1 and 1." )
103101
@@ -121,11 +119,10 @@ def shunt_inductor_power_factor_correction(
121119 """
122120 change_reactive_power = current_reactive_power - expected_reactive_power
123121
124- return (voltage ** 2 ) / ( 2 * math .pi * frequency * change_reactive_power )
125-
122+ return (voltage ** 2 ) / (2 * math .pi * frequency * change_reactive_power )
126123
127124
128125if __name__ == "__main__" :
129126 import doctest
130-
127+
131128 doctest .testmod ()
0 commit comments