From 0bfc55c880a76d3e5d5b532806efea6145215b3f Mon Sep 17 00:00:00 2001 From: Jeff MacKinnon Date: Thu, 19 Dec 2024 10:09:04 -0400 Subject: [PATCH] Added cable schedule naming and general tidying. --- jepl/jepl_circuits.py | 48 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/jepl/jepl_circuits.py b/jepl/jepl_circuits.py index cbaa393..b036cc2 100644 --- a/jepl/jepl_circuits.py +++ b/jepl/jepl_circuits.py @@ -35,7 +35,7 @@ def percentvd(vd,nominal): return percent -def voltage_drop(nominal_voltage, current, conductor_size, material ='cu', num_runs = 1, code = 'CEC'): +def voltage_drop(nominal_voltage, current, conductor_size, length,material ='cu', num_runs = 1, code = 'CEC'): ''' This function will return the drop in voltage and in percent of the supply. @@ -87,7 +87,7 @@ def voltage_drop(nominal_voltage, current, conductor_size, material ='cu', num_r else: return (print("error, choose material as cu or al")) - voltage = vd(nominal_voltage,current,resistance,num_runs) + voltage = vd(current,length,resistance,num_runs) percent = percentvd(voltage,nominal_voltage) return [voltage, percent] @@ -149,7 +149,7 @@ def voltage_drop_conductors(voltage,current,distance,v_drop_percent = 0.03,runs with sqlite3.connect("jepl-cable.db") as con: cur = con.cursor() cur.execute('SELECT "Conductor Size" FROM "SW-Spec 25055" WHERE "Conductor Number" = 3 AND "AC Resistance" ? ', (current,)) - conductor_size = cur.fetchone()[0] + conductor_size = str(cur.fetchone()[0]) #print(conductor_size) @@ -367,5 +377,29 @@ def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway = return [conductor_size,num_parallel] +def cable_schedule_naming(conductor_size,conductors,runs = 1,bond='BOND'): + ''' + Converts the conductor size from the above functions to something that can be added to a database/schedule. + ''' + + if conductor_size == '1/0' or conductor_size == '2/0' or conductor_size == '3/0' or conductor_size == '4/0': + unit = "AWG" + elif int(conductor_size) > 24: + unit = 'kcmil' + else: + unit = 'AWG' + + if bond == 'BOND': + bondtext = bond + elif int(bond_size) > 24: + bondtext = '#' + str(bond) + 'kcmil' + else: + bondtext = '#' + str(bond) + 'AWG' + + if runs > 1: + cable_text = str(runs) + "x " + str(conductors) + "C #" + str(conductor_size) + unit + " + " + bondtext + else: + cable_text = str(conductors) + "C #" + str(conductor_size) + unit + " + " + bondtext + return cable_text