Compare commits

...

2 commits

Author SHA1 Message Date
Jeff
793acc9ca7 Minor Updates 2026-01-05 21:48:47 -04:00
Jeff
d5ebf99124 Adding conduit sizing to commandline tools. 2026-01-05 21:12:27 -04:00
4 changed files with 56 additions and 25 deletions

View file

@ -8,11 +8,10 @@ import sys
from .jepl_general import *
from .jeplpv import *
from .jepl_circuits import *
from .jepl_templates import *
from .jepl_safety import *
#print(cec21table1)
# safety still needs to be re-wrote, but I will do it later.
#from .jepl_safety import *
# Templates rely on safety so I will have to fix it too
#from .jepl_templates import *
def Test():
print( "JMK Python Module works! !")

View file

@ -375,7 +375,6 @@ def conduit_size(num_cc,cc_con,bond,insulation="RW90", voltage = 1000, jacketed
#
# Determine the maximum conduit fill
#
import numpy as np
if num_cc == 1:
percent_fill = 0.53
@ -404,28 +403,28 @@ def conduit_size(num_cc,cc_con,bond,insulation="RW90", voltage = 1000, jacketed
#print(conductor_diameter)
cc_dia = conductor_diameter.loc[(conductor_diameter['size'] == cc_con) ]['diameter'].iloc[0]
print(cc_dia)
#print(cc_dia)
bond_dia = conductor_diameter.loc[(conductor_diameter['size'] == bond) ]['diameter'].iloc[0]
print(bond_dia)
#print(bond_dia)
cc_area = math.pi * (cc_dia/2) ** 2
print(cc_area)
#print(cc_area)
bond_area = math.pi * (bond_dia/2) ** 2
print(bond_area)
#print(bond_area)
# Total conductor area
area_conductors = num_cc * cc_area + bond_area
print(area_conductors)
#print(area_conductors)
min_trade_area = area_conductors / percent_fill # The minimum area of the conduit
print(min_trade_area)
#print(min_trade_area)
trade_inner_dia = math.sqrt(min_trade_area/math.pi) * 2
print(trade_inner_dia)
#print(trade_inner_dia)
@ -443,13 +442,13 @@ def conduit_size(num_cc,cc_con,bond,insulation="RW90", voltage = 1000, jacketed
# Retrieve the nearest value using the found index
result_raw = conduit_table['size'].iloc[closest_index]
result_name = result_raw + 'mm ' + material
# Get the new inner diameter
result_inner_dia = conduit_table[material].iloc[closest_index]
result_inner_area = math.pi * (result_inner_dia/2) ** 2
resulting_percent_fill = area_conductors / result_inner_area
return result_raw,result_name,result_inner_dia
return result_raw,result_name,result_inner_dia,resulting_percent_fill
def cable_schedule_naming(conductor_size,conductors,runs = 1,bond='BOND'):

View file

@ -30,7 +30,7 @@ def va(voltage, current,phases=3):
def xfmr_sc(kva, voltage, impedance, phases = 3):
'''i
'''
Calculate the maximum let-through current of a transformer.
Isc = resulant short circuit
@ -46,5 +46,4 @@ def xfmr_sc(kva, voltage, impedance, phases = 3):
else:
Isc = (kva * 1000) / (math.sqrt(3) * voltage * (impedance / 100))
return Isc

View file

@ -181,6 +181,34 @@ def voltagedrop(args):
result = jmk.voltage_drop(voltage, current, size, length, num_phase = num_phase, material = material, num_runs = num_runs, code = code, power_factor = power_factor, raceway = raceway, insul_temp = insul_temp)
print(result)
def conduit_size(args):
if args.insulation == None:
insulation = "RW90"
else:
insulation = args.insulation
if args.voltage == None:
voltage = 1000
else:
voltage = args.voltage
if args.jacketed == None:
jacketed = False
else:
jacketed = args.jacketed
if args.material == None:
material = 'SCH80'
else:
material = args.material
if args.code == None:
code = 'CEC'
else:
code = args.code
result = jmk.conduit_size(args.num_conductors,args.size,args.bond,insulation=insulation, voltage = voltage, jacketed = jacketed,material=material, code = code)
percent_fill = str(round(result[3],2) * 100) + "%" + " fill."
print(percent_fill,result[1])
# Solar
def temp_adj_Voc(args):
@ -278,6 +306,17 @@ try:
voltagedrop_parser.set_defaults(func=voltagedrop)
consize_parser = subparsers.add_parser("conduitsize", help="Calculate the proper conduit size.")
consize_parser.add_argument("num_conductors", type=int, help="Number of current carrying conductors, typically 1 to 4.")
consize_parser.add_argument("size", type=str, help="Size of the current carrying conductors in AWG or kcmil." )
consize_parser.add_argument("bond", type=str, help="Size of the bond conductor, or equipment grounding conductor in AWG or kcmil")
consize_parser.add_argument("-i", "--insulation", type=str, help="Insulation type. default RW90")
consize_parser.add_argument("-v", "--voltage", type=int, help="Voltage rating of the insulation, 600 or 1000")
consize_parser.add_argument("-j", "--jacketed", type=bool, help="Are the conductors jacketed? Default: False")
consize_parser.add_argument("-m", "--material", type=str, help="Material or conduit type, ie EMT, ENT, SCH40, etc. Default SCH80")
consize_parser.add_argument("-c", "--code", type=str, help="Currently this will either be CEC or NEC. default CEC")
consize_parser.set_defaults(func=conduit_size)
@ -304,9 +343,4 @@ try:
except argparse.ArgumentError as e:
#log.error("Error parsing arguments")
raise e
#else:
# print(f"Something clever")
raise e