initial commit
This commit is contained in:
parent
041dd80640
commit
c0bf00eba6
3 changed files with 109 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
/tests/
|
||||||
|
test*
|
||||||
|
__pycache__
|
||||||
74
jepl.py
Normal file
74
jepl.py
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
'''
|
||||||
|
JMK Engineering Inc. Python Library for design and such.
|
||||||
|
by: Jeff MacKinnon
|
||||||
|
|
||||||
|
email: jeff@jmkengineering.com
|
||||||
|
'''
|
||||||
|
|
||||||
|
import math
|
||||||
|
import tables as tables
|
||||||
|
|
||||||
|
|
||||||
|
def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway = True, ambient = 30, max = 500):
|
||||||
|
|
||||||
|
'''
|
||||||
|
The default temp column will be the 75C column as most terminals are rated for this.
|
||||||
|
The default code is CEC as that is where I am.
|
||||||
|
|
||||||
|
I still need to incorporate ambient temperature deratings, but that will be a future improvement
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
material = material.upper()
|
||||||
|
code = code.upper()
|
||||||
|
max = str(max)
|
||||||
|
valid_temp = [60,75,90]
|
||||||
|
valid_temp_str = [str(x) for x in valid_temp]
|
||||||
|
valid_code = ['CEC',
|
||||||
|
]
|
||||||
|
valid_material = ['CU',
|
||||||
|
'AL',
|
||||||
|
]
|
||||||
|
|
||||||
|
#check to make sure that the values are valid
|
||||||
|
if temp not in valid_temp:
|
||||||
|
return print(temp + " is not valid. The valid temps are "+ str(valid_temp_str))
|
||||||
|
if code not in valid_code:
|
||||||
|
return print(code + " is not a valid code. The valid codes are "+ str(valid_code))
|
||||||
|
if material not in valid_material:
|
||||||
|
return print(material + " is not a valid material. I should be 'al' or 'cu'.")
|
||||||
|
|
||||||
|
# select the correct code table
|
||||||
|
if (code == 'CEC') & (material == 'CU') & (raceway == False):
|
||||||
|
#code_table = tables.CEC_table1
|
||||||
|
return (' I haven\'t created this table yet')
|
||||||
|
elif (code == 'CEC') & (material == 'CU') & (raceway == True):
|
||||||
|
code_table = tables.CEC_table2
|
||||||
|
elif (code =='CEC') & (material =='AL') & (raceway == False):
|
||||||
|
#code_table = tables.CEC_table3
|
||||||
|
return (' I haven\'t created this table yet')
|
||||||
|
elif (code =='CEC') & (material =='AL') & (raceway == True):
|
||||||
|
#code_table = tables.CEC_table4
|
||||||
|
return (' I haven\'t created this table yet')
|
||||||
|
elif (code =='NEC') & (material =='CU'):
|
||||||
|
return (' I haven\'t created this table yet')
|
||||||
|
elif (code =='NEC') & (material =='AL'):
|
||||||
|
return (' I haven\'t created this table yet')
|
||||||
|
else:
|
||||||
|
return ('The variables were\'t right, but I\'m a loss to why.')
|
||||||
|
|
||||||
|
temp = str(temp)
|
||||||
|
|
||||||
|
max_current_loc = code_table.loc[code_table['size'] == max][str(temp)]
|
||||||
|
max_current = max_current_loc.iloc[0]
|
||||||
|
|
||||||
|
num_parallel = math.ceil(current / max_current)
|
||||||
|
con_current = current / num_parallel
|
||||||
|
|
||||||
|
size = code_table[code_table[temp].ge(con_current)]['size'].iloc[0]
|
||||||
|
|
||||||
|
return [size,num_parallel]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
32
tables.py
Normal file
32
tables.py
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
CEC21_table2 = pd.DataFrame([['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],
|
||||||
|
['0',125,150,170],
|
||||||
|
['00',145,175,195],
|
||||||
|
['000',165,200,225],
|
||||||
|
['0000',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]
|
||||||
|
|
||||||
|
],
|
||||||
|
columns = ['size','60','75','90']
|
||||||
|
)
|
||||||
|
|
||||||
|
CEC_table2 = CEC21_table2
|
||||||
Loading…
Add table
Reference in a new issue