Files
scripts/power_calcs.py

52 lines
995 B
Python

#!/usr/bin/python
import sys
cabletype = sys.argv[1]
voltage_limit = 11.5
cable_size = {
"13": 1.5,
"16": 2.5,
"32": 6.0,
"63": 16,
"125": 35,
}
single_phase = {
1.5: 31,
2.5: 19,
6.0: 7.9,
16: 2.9,
}
three_phase = {
1.5: 27,
2.5: 16,
6.0: 6.8,
16: 2.5,
35: 1.1,
}
drop = 0
if "/3" in cabletype:
drop = three_phase[cable_size[cabletype[:-2]]]
else:
drop = single_phase[cable_size[cabletype]]
print(f"Voltage Drop (per ampere per metre): {drop}mV/A/m")
assumed_load = float(sys.argv[2])
length = int(sys.argv[3])
total_drop = drop * assumed_load * length / 1000
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(f"Maximum length of cable at this load: {int(max_length)}m")
r = total_drop / assumed_load
pfc = 230 / r
print(f"Estimated PFC is {pfc:.1f}A")