Add 125/3 capability to power script + switch to f-strings

This commit is contained in:
2022-05-29 13:03:48 +01:00
parent f6e4486cb4
commit 464f720cdb

View File

@@ -10,6 +10,7 @@ cable_size = {
"16": 2.5,
"32": 6.0,
"63": 16,
"125": 35,
}
single_phase = {
1.5: 31,
@@ -22,6 +23,7 @@ three_phase = {
2.5: 16,
6.0: 6.8,
16: 2.5,
35: 1.1,
}
drop = 0
@@ -30,20 +32,20 @@ if "/3" in cabletype:
else:
drop = single_phase[cable_size[cabletype]]
print("Voltage Drop (per ampere per metre): {}mV/A/m".format(drop))
print(f"Voltage Drop (per ampere per metre): {drop}mV/A/m")
assumed_load = int(sys.argv[2])
length = int(sys.argv[3])
total_drop = drop * assumed_load * length / 1000
print("Total drop at {}A over {}m is: {}V".format(assumed_load, length, total_drop))
print(f"Total drop at {assumed_load}A over {length}m is: {total_drop:.1f}V")
if total_drop > voltage_limit:
print("FAILED: VOLTAGE DROP TOO HIGH")
max_length = (voltage_limit * 1000) / (drop * assumed_load)
print("Maximum length of cable at this load: {}m".format(int(max_length)))
print(f"Maximum length of cable at this load: {int(max_length)}m")
r = total_drop / assumed_load
pfc = 230 / r
print("Estimated PFC is {:.1f}A".format(pfc))
print(f"Estimated PFC is {pfc:.1f}A")