diff --git a/jepl/Tables/CEC21Tables.py b/jepl/Tables/CEC21Tables.py index 31a10d4..170e3ac 100644 --- a/jepl/Tables/CEC21Tables.py +++ b/jepl/Tables/CEC21Tables.py @@ -1,7 +1,7 @@ -# CEC 2021, Table 1 +# CEC 2021, Tables -table1 = [ +cec21table1 = [ #['size', '60', '75', '90'], ['14', 25, 30, 35], ['12', 30, 35, 40], @@ -30,4 +30,94 @@ table1 = [ ['1500', 985, 1175, 1325], ['1750', 1070, 1280, 1445], ['2000', 1160, 1385, 1560] + ] +cec21table2 = [ + #['size', '60', '75', '90'], + ['14', 15, 20, 25], + ['12', 20, 25, 30], + ['10', 30, 35, 40], + ['8', 40, 50, 55], + ['6', 40, 50, 55], + ['4', 70, 85, 95], + ['3', 85, 100, 115], + ['2', 95, 115, 130], + ['1', 110, 130, 145], + ['1/0', 125, 150, 170], + ['2/0', 145, 175, 195], + ['3/0', 165, 200, 225], + ['4/0', 195, 230, 260], + ['250', 215, 255, 290], + ['300', 240, 285, 320], + ['350', 260, 310, 350], + ['400', 280, 335, 380], + ['500', 320, 380, 430], + ['600', 350, 420, 475], + ['700', 385, 460, 520], + ['750', 400, 475, 535], + ['800', 410, 490, 555], + ['900', 435, 520, 585], + ['1000', 455, 545, 615], + ['1250', 495, 590, 615], + ['1500', 525, 625, 705], + ['1750', 545, 650, 735], + ['2000', 555, 665, 750] + ] +cec21table3 = [ + #['size', '60', '75', '90'], + ['12', 25, 30, 35], + ['10', 35, 40, 45], + ['8', 45, 55, 60], + ['4', 65, 75, 85], + ['3', 95, 115, 130], + ['2', 115, 135, 150], + ['1', 134, 155, 175], + ['1/0', 150, 180, 205], + ['2/0', 175, 210, 235], + ['3/0', 200, 240, 270], + ['4/0', 235, 280, 315], + ['250', 265, 315, 355], + ['300', 295, 350, 395], + ['350', 330, 395, 445], + ['400', 355, 425, 480], + ['500', 405, 485, 545], + ['600', 455, 545, 615], + ['700', 500, 595, 670], + ['750', 520, 620, 700], + ['800', 540, 645, 725], + ['900', 585, 700, 790], + ['1000', 630, 750, 845], + ['1250', 715, 855, 965], + ['1500', 795, 950, 1070], + ['1750', 880, 1050, 1185], + ['2000', 965, 1150, 1295] + ] +cec21table4 = [ + #['size', '60', '75', '90'], + ['12', 15, 20, 25], + ['10', 25, 30, 35], + ['8', 35, 40, 45], + ['6', 40, 50, 55], + ['4', 55, 65, 75], + ['3', 65, 75, 85], + ['2', 75, 90, 100], + ['1', 85, 100, 115], + ['1/0', 100, 120, 165], + ['2/0', 115, 165, 150], + ['3/0', 160, 155, 175], + ['4/0', 150, 180, 205], + ['250', 170, 205, 230], + ['300', 195, 230, 260], + ['350', 210, 250, 280], + ['400', 225, 270, 305], + ['500', 260, 310, 350], + ['600', 285, 340, 385], + ['700', 315, 375, 425], + ['750', 320, 385, 435], + ['800', 330, 395, 445], + ['900', 355, 425, 480], + ['1000', 375, 445, 500], + ['1250', 405, 485, 545], + ['1500', 435, 520, 585], + ['1750', 455, 545, 615], + ['2000', 470, 560, 630] ] \ No newline at end of file diff --git a/jepl/jepl.py b/jepl/jepl.py index fdde28e..cdd4aad 100644 --- a/jepl/jepl.py +++ b/jepl/jepl.py @@ -11,6 +11,9 @@ from .jepl_circuits import * from .jepl_templates import * from .jepl_safety import * + +#print(cec21table1) + def Test(): print( "JMK Python Module works! !") diff --git a/jepl/jepl_circuits.py b/jepl/jepl_circuits.py index dfa40ac..42b69f1 100644 --- a/jepl/jepl_circuits.py +++ b/jepl/jepl_circuits.py @@ -13,6 +13,9 @@ import math import sqlite3 import bisect +# Need to add the various table files here. +from .Tables.CEC21Tables import * + def vd(current,length,resistance,runs=1): @@ -237,16 +240,15 @@ def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway = # Seclect the proper table - - if (code == 'CEC'): - import jepl.Tables.CEC21Tables as cec21tables # This isn't as clean as I want it. - - if (material == 'CU') & (raceway == False): - df = pd.DataFrame(cec21tables.table1, columns=['size', '60C', '75C', '90C']) - - elif (material == 'CU') & (raceway == True): - df = pd.DataFrame(cec21tables.table3, columns=['size', '60C', '75C', '90C']) - + + if (code == 'CEC') & (material == 'CU') & (raceway == False): + df = pd.DataFrame(cec21table1, columns=['size', '60C', '75C', '90C']) + elif (code == 'CEC') & (material == 'CU') & (raceway == True): + df = pd.DataFrame(cec21table2, columns=['size', '60C', '75C', '90C']) + elif (code == 'CEC') & (material == 'AL') & (raceway == False): + df = pd.DataFrame(cec21table3, columns=['size', '60C', '75C', '90C']) + elif (code == 'CEC') & (material == 'AL') & (raceway == True): + df = pd.DataFrame(cec21table4, columns=['size', '60C', '75C', '90C']) elif (code =='NEC') & (material =='CU'): return (' I haven\'t created this table yet') elif (code =='NEC') & (material =='AL'): @@ -304,15 +306,14 @@ def conductor_ampacity(conductor, temp = 75, material = 'cu', code = 'CEC', race else: column = '60C' - if (code == 'CEC') & (material == 'CU') & (raceway == False): # CEC Table 1 - df = pd.DataFrame(cec21tables.table1, columns=['size', '60C', '75C', '90C']) - - elif (code == 'CEC') & (material == 'CU') & (raceway == True): # CEC Table 2 - df = pd.DataFrame(cec21tables.table2, columns=['size', '60C', '75C', '90C']) - - elif (code =='CEC') & (material =='AL') & (raceway == False): # CEC Table 3 - df = pd.DataFrame(cec21tables.table3, columns=['size', '60C', '75C', '90C']) - + if (code == 'CEC') & (material == 'CU') & (raceway == False): + df = pd.DataFrame(cec21table1, columns=['size', '60C', '75C', '90C']) + elif (code == 'CEC') & (material == 'CU') & (raceway == True): + df = pd.DataFrame(cec21table2, columns=['size', '60C', '75C', '90C']) + elif (code == 'CEC') & (material == 'AL') & (raceway == False): + df = pd.DataFrame(cec21table3, columns=['size', '60C', '75C', '90C']) + elif (code == 'CEC') & (material == 'AL') & (raceway == True): + df = pd.DataFrame(cec21table4, columns=['size', '60C', '75C', '90C']) elif (code =='NEC') & (material =='CU'): return (' I haven\'t created this table yet') elif (code =='NEC') & (material =='AL'): diff --git a/tools.py b/tools.py index 8936840..7f3c099 100644 --- a/tools.py +++ b/tools.py @@ -72,6 +72,34 @@ def condsize(args): result = jmk.conductor_size(args.current, temp = temp, material = material, code = code, raceway = raceway, max = maxsize, load_type = loadtype ) print(result) +def condamp(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 + result = jmk.conductor_ampacity(args.conductor, temp = temp, material = material, code = code, raceway = raceway) + print(result) + + + # Solar def temp_adj_Voc(args): @@ -127,6 +155,15 @@ try: condsize_parser.add_argument("--type",type=str, help="Load type {}'normal','xfmr','xfmrp','xfmrs','motor',None}, default: None") condsize_parser.set_defaults(func=condsize) + condamp_parser = subparsers.add_parser("condamp", help="Determine the ampacity of a conductor.") + condamp_parser.add_argument("conductor", type=str, help="TThe conductor size in AWG/kcmil") + condamp_parser.add_argument("-t", "--temp", type=int, help="The temperature rating for the insulation, if none included is 60C. default: 60" ) + condamp_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.") + condamp_parser.add_argument("-c", "--code", type=str, help="Currently this will either be CEC or NEC. default CEC") + condamp_parser.add_argument("-r", "--raceway", type=str, help="If the conductors are in a raceway use y for yes and n for no.") + condamp_parser.add_argument("-a", "--ambient", type=float, help="Ambient temperature in celsious. default: 30") + condamp_parser.set_defaults(func=condamp) + #