Added conductor size and updated circuits

This commit is contained in:
Jeff 2025-12-28 23:58:45 -04:00
parent d6ad53abe2
commit 4a93da354a
2 changed files with 63 additions and 5 deletions

View file

@ -239,7 +239,7 @@ def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway =
# Seclect the proper table # Seclect the proper table
if (code == 'CEC'): if (code == 'CEC'):
import Tables.CEC21Tables import jepl.Tables.CEC21Tables as cec21tables # This isn't as clean as I want it.
if (material == 'CU') & (raceway == False): if (material == 'CU') & (raceway == False):
df = pd.DataFrame(cec21tables.table1, columns=['size', '60C', '75C', '90C']) df = pd.DataFrame(cec21tables.table1, columns=['size', '60C', '75C', '90C'])
@ -260,7 +260,7 @@ def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway =
''' '''
# Determine the ampacity of the max conductor size # Determine the ampacity of the max conductor size
max_df = df.loc[df['size'] == max_wire,column] max_df = df.loc[df['size'] == max,column]
max_current = max_df.item() max_current = max_df.item()
#print(max_current) #print(max_current)

View file

@ -31,10 +31,49 @@ def va(args):
print(args.phases) print(args.phases)
# Circuits
def condsize(args):
if args.temp == None:
temp = 60
else:
temp = args.temp
if args.material == None:
material = 'cu'
else:
material = args.material
if args.code == None:
code = 'CEC'
else:
code = args.code
if args.raceway == None:
raceway = True
elif args.raceway == 'n':
raceway = False
else:
raceway = True
if args.ambient == None:
ambient = 30
else:
ambient = args.ambient
if args.maxsize == None:
maxsize = 500
else:
maxsize = 500
if args.type == None:
loadtype = None
else:
valid_load_type = ['normal','xfmr','xfmrp','xfmrs','motor',None]
if args.type not in valid_load_type:
print(args.type + " is not a valid load_type.")
else:
loadtype = args.type
result = jmk.conductor_size(args.current, temp = temp, material = material, code = code, raceway = raceway, max = maxsize, load_type = loadtype )
print(result)
# Solar # Solar
def temp_adj_Voc(args): def temp_adj_Voc(args):
if args.beta == None: if args.beta == None:
beta = -0.5 beta = -0.5
@ -55,7 +94,8 @@ def temp_adj_Voc(args):
try: try:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers( subparsers = parser.add_subparsers(
title="tools", help="Commandline Functions" title="tools",
help="Commandline Functions"
) )
# #
@ -71,6 +111,24 @@ try:
va_parser.set_defaults(func=va) va_parser.set_defaults(func=va)
#
# Circuit Tools
#
condsize_parser = subparsers.add_parser("condsize", help="Determine the conductor size for a defined current and load type.")
condsize_parser.add_argument("current", type=float, help="The current of the circuit.")
condsize_parser.add_argument("-t", "--temp", type=int, help="The temperature rating for the insulation, if none included is 60C. default: 60" )
condsize_parser.add_argument("-m", "--material", type=str, help="This should be cu or al, for copper or aluminum. If none defined cu will be used.")
condsize_parser.add_argument("-c", "--code", type=str, help="Currently this will either be CEC or NEC. default CEC")
condsize_parser.add_argument("-r", "--raceway", type=str, help="If the conductors are in a raceway use y for yes and n for no.")
condsize_parser.add_argument("-a", "--ambient", type=float, help="Ambient temperature in celsious. default: 30")
condsize_parser.add_argument("-x", "--maxsize", type=str, help="Maximum conductor size in AWG/kcmil. default: 500")
condsize_parser.add_argument("--type",type=str, help="Load type {}'normal','xfmr','xfmrp','xfmrs','motor',None}, default: None")
condsize_parser.set_defaults(func=condsize)
# #
# Solar Tools # Solar Tools
# #