Merge branch 'main' of https://git.jmkengineering.com/JMK_Engineering_Inc/JEPL
This commit is contained in:
commit
627c1db037
4 changed files with 349 additions and 8 deletions
|
|
@ -7,7 +7,11 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"import jepl.jepl as jmk # import the module. If this file is located further up the file tree it may look like \"resources.JEPL.jepl.jepl\"\n",
|
||||
<<<<<<< HEAD
|
||||
"#%run jepl/jeplinit.py jepl/ # This is needed to initialize the databases. Again if you are running this from a different location the run command will look like %run jeplinit.py resources/JEPL/jepl/ "
|
||||
=======
|
||||
"%run jepl/jeplinit.py jepl/ # This is needed to initilize the databases. Again if you are running this from a different location the run command will look like %run jeplinit.py resources/JEPL/jepl/ "
|
||||
>>>>>>> 619a53650e4a613fb57eade5024967e76c5a0bd7
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -530,13 +534,90 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"And this is what the list looks like in a dataframe. You can then export this dataframe to a CSV or excel format to datalink to a table in your drawings."
|
||||
"If you know the conductor size, this function will return the ampacity."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"30"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"jmk.conductor_ampacity(12, temp = 75, material = 'al', code = 'CEC', raceway = False, ambient = 30)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'10'"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"jmk.bonding_conductor(jmk.conductor_ampacity(12, temp = 75, material = 'al', code = 'CEC', raceway = False, ambient = 30),bus=False,material='al',code = 'CEC')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The Conduit sizing module is designed to size conduits based on the CEC values for the various conductor sizes with insulation.\n",
|
||||
"\n",
|
||||
"It returns two values, the trade size (diameter) in mm and the text for a cable/conduit schedule"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"16 is the trade size\n",
|
||||
"16mm SCH80 is the value you can use in your cable/conduit schedule.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"conduit_size = jmk.conduit_size(4,'12','12')\n",
|
||||
"\n",
|
||||
"print(str(conduit_size[0]) + \" is the trade size\")\n",
|
||||
"print(conduit_size[1] + \" is the value you can use in your cable/conduit schedule.\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"And this is what the list looks like in a dataframe. You can then export this dataframe to a CSV or excel format to datalink to a table in your drawings."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
|
|
@ -646,7 +727,7 @@
|
|||
"6 P106 3C #2AWG + BOND 3C #1/0AWG + BOND conduit "
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -674,7 +755,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -683,7 +764,7 @@
|
|||
"37"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -701,7 +782,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -710,6 +791,7 @@
|
|||
"33"
|
||||
]
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
|
|
@ -833,6 +915,15 @@
|
|||
"source": [
|
||||
"from jepl.jepl_templates import *\n",
|
||||
"af_labels('testresults_labels.csv')"
|
||||
=======
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"jmk.panels_per_string(1500,40,beta=-0.5,temp = 2)"
|
||||
>>>>>>> 619a53650e4a613fb57eade5024967e76c5a0bd7
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
|||
15
jepl/Tables/CEC-Tables/CEC21-table9.csv
Normal file
15
jepl/Tables/CEC-Tables/CEC21-table9.csv
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
Trade Size,RMC,FMC,RPVC,EB1,DB2,LTMC,LTNMC,EMT,ENT,SCH40,SCH80
|
||||
12,,71,,,,119,114,,,,
|
||||
16,202,198,167,,,196,188,186,167,169,128
|
||||
21,354,334,307,,,341,328,330,304,307,246
|
||||
27,573,507,507,,,549,527,539,506,507,418
|
||||
35,985,792,792,,,965,937,940,894,898,760
|
||||
41,1336,1140,1140,,,1257,1257,1288,1230,1233,1054
|
||||
53,2199,2027,2027,2027,2027,2068,2098,2132,2057,2057,1796
|
||||
63,3139,3167,2951,,,3116,,3783,,2935,2549
|
||||
78,4839,4560,4560,4560,4560,4776,,5701,,4553,4002
|
||||
91,6458,6207,6138,6138,6138,6207,,7451,,,
|
||||
103,8311,8107,7870,7870,7870,8107,,9503,,7895,7023
|
||||
129,13039,,12439,12538,12538,,,,,12451,11169
|
||||
155,18811,,17613,17613,17613,,,,,18027,16029
|
||||
200,,,31225,,,,,,,31303,
|
||||
|
|
|
@ -376,12 +376,247 @@ def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway =
|
|||
|
||||
return [conductor_size,num_parallel]
|
||||
|
||||
def conductor_ampacity(conductor, temp = 75, material = 'cu', code = 'CEC', raceway = True, ambient = 30):
|
||||
|
||||
'''
|
||||
Calculates the ampacity of a conductor size and material using code tables.
|
||||
|
||||
'''
|
||||
|
||||
material = material.upper()
|
||||
code = code.upper()
|
||||
valid_temp = [60,75,90]
|
||||
valid_temp_str = [str(x) for x in valid_temp]
|
||||
valid_code = ['CEC',
|
||||
]
|
||||
valid_material = ['CU',
|
||||
'AL',
|
||||
]
|
||||
|
||||
if temp == 90:
|
||||
conductor_current_index = 3
|
||||
elif temp == 75:
|
||||
conductor_current_index = 2
|
||||
else:
|
||||
conductor_current_index = 1
|
||||
|
||||
if (code == 'CEC') & (material == 'CU') & (raceway == False): # CEC Table 1
|
||||
try:
|
||||
with sqlite3.connect("jepl-cec21.db") as con:
|
||||
cur = con.cursor()
|
||||
cur.execute('SELECT * FROM "Table1" WHERE "size" = ? ', (conductor,))
|
||||
max_conductor_current = cur.fetchone()
|
||||
conductor_ampacity = max_conductor_current[conductor_current_index]
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
elif (code == 'CEC') & (material == 'CU') & (raceway == True): # CEC Table 2
|
||||
try:
|
||||
with sqlite3.connect("jepl-cec21.db") as con:
|
||||
cur = con.cursor()
|
||||
cur.execute('SELECT * FROM "Table2" WHERE "size" = ? ', (conductor,))
|
||||
max_conductor_current = cur.fetchone()
|
||||
conductor_ampacity = max_conductor_current[conductor_current_index]
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
elif (code =='CEC') & (material =='AL') & (raceway == False): # CEC Table 3
|
||||
try:
|
||||
with sqlite3.connect("jepl-cec21.db") as con:
|
||||
cur = con.cursor()
|
||||
cur.execute('SELECT * FROM "Table3" WHERE "size" = ? ', (conductor,))
|
||||
max_conductor_current = cur.fetchone()
|
||||
conductor_ampacity = max_conductor_current[conductor_current_index]
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
elif (code =='CEC') & (material =='AL') & (raceway == True): # CEC Table 4
|
||||
try:
|
||||
with sqlite3.connect("jepl-cec21.db") as con:
|
||||
cur = con.cursor()
|
||||
cur.execute('SELECT * FROM "Table4" WHERE "size" = ? ', (conductor,))
|
||||
max_conductor_current = cur.fetchone()
|
||||
conductor_ampacity = max_conductor_current[conductor_current_index]
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
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.')
|
||||
|
||||
return conductor_ampacity
|
||||
|
||||
def bonding_conductor(conductor_ampacity,bus=False,material='cu',code = 'CEC'):
|
||||
|
||||
'''
|
||||
This function
|
||||
|
||||
'''
|
||||
|
||||
material = material.upper()
|
||||
code = code.upper()
|
||||
valid_code = ['CEC',
|
||||
]
|
||||
valid_material = ['CU',
|
||||
'AL',
|
||||
]
|
||||
|
||||
if (material == 'CU') & (bus == False):
|
||||
db_index = 1
|
||||
elif (material == 'AL') & (bus == False):
|
||||
db_index = 3
|
||||
elif (material == 'CU') & (bus == True):
|
||||
db_index = 2
|
||||
elif (material == 'AL') & (bus == True):
|
||||
db_index = 4
|
||||
else:
|
||||
return ('The variables were\'t right, but I\'m a loss to why.')
|
||||
|
||||
if (code == 'CEC'):
|
||||
try:
|
||||
with sqlite3.connect("jepl-cec21.db") as con:
|
||||
cur = con.cursor()
|
||||
cur.execute('SELECT * FROM "Table16" WHERE "current" >= ? ', (conductor_ampacity,))
|
||||
bond_result = cur.fetchone()
|
||||
bond_size = bond_result[db_index]
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
else:
|
||||
return ('The variables were\'t right, but I\'m a loss to why.')
|
||||
|
||||
return bond_size
|
||||
|
||||
|
||||
## This doesn't work yet, but its getting
|
||||
def conduit_size(num_cc,cc_con,bond,material='SCH80'):
|
||||
|
||||
# Calculate fill requirements based on Table 8
|
||||
|
||||
valid_material = ['RMC', # Rigid Metal Conduit
|
||||
'FMC', # Flexible Metal Conduit
|
||||
'RPVC', # Rigid PVC
|
||||
'EB1', # Type EB1
|
||||
'DB2', # Type DB2
|
||||
'LTMC', # Liquid Tight Metal Conduit
|
||||
'LTNMC', # Liquid Tight non-metallic conduit
|
||||
'EMT', # electrical metallic tubing
|
||||
'ENT', # electrical non-metallic tubing
|
||||
'SCH40', # HDPE Schedule 40
|
||||
'SCH80', # HDPE Schedule 80
|
||||
#'DR9', # HDPE DR9
|
||||
#'DR11', # HDPE DR11
|
||||
#'DR135', # HDPE DR13.5
|
||||
#'DR155' # HDPE DR15.5
|
||||
]
|
||||
|
||||
|
||||
|
||||
if material not in valid_material:
|
||||
return print(material + " is not a valid material. I should be 'al' or 'cu'.")
|
||||
|
||||
import numpy as np
|
||||
x = np.array(valid_material)
|
||||
db_result_index = np.where(x == material)[0][0]
|
||||
|
||||
if num_cc == 1:
|
||||
percent_fill = 0.53
|
||||
elif num_cc == 2:
|
||||
percent_fill = 0.31
|
||||
else:
|
||||
percent_fill = 0.4
|
||||
|
||||
# Wire Size and diameter
|
||||
|
||||
wire_size = [
|
||||
# ['tradesize',area mm^2]
|
||||
['14',2.08],
|
||||
['12',3.31],
|
||||
['10',5.26],
|
||||
['8',8.37],
|
||||
['6',13.3],
|
||||
['4',21.2],
|
||||
['3',26.7],
|
||||
['2',33.6],
|
||||
['1',42.4],
|
||||
['1/0',53.5],
|
||||
['2/0',67.4],
|
||||
['3/0',85],
|
||||
['4/0',107],
|
||||
['250',127],
|
||||
['300',152],
|
||||
['350',177],
|
||||
['400',203],
|
||||
['500',253],
|
||||
['600',304],
|
||||
['700',355],
|
||||
['800',405],
|
||||
['900',456],
|
||||
['1000',507],
|
||||
['1250',633],
|
||||
['1500',760],
|
||||
['1750',887],
|
||||
['2000',1010]
|
||||
]
|
||||
|
||||
# Calculate the area of current carrying conductors
|
||||
|
||||
x = np.array(wire_size)
|
||||
row = np.where(x == cc_con)[0][0]
|
||||
current_carrying_conductor_area = wire_size[row][1]
|
||||
cc_area = current_carrying_conductor_area * num_cc
|
||||
|
||||
# Bond Area
|
||||
|
||||
row = np.where(x == bond)[0][0]
|
||||
bond_area = wire_size[row][1]
|
||||
|
||||
# Total conductor area
|
||||
|
||||
area_conductors = cc_area + bond_area
|
||||
#print(area_conductors)
|
||||
|
||||
min_trade_area = area_conductors / percent_fill # The minimum area of the conduit
|
||||
#print(min_trade_area)
|
||||
|
||||
|
||||
parameter = ' WHERE ' + material + ' > ' + str(min_trade_area)
|
||||
|
||||
try:
|
||||
with sqlite3.connect("jepl-cec21.db") as con:
|
||||
cur = con.cursor()
|
||||
cur.execute('SELECT "Trade Size" from "Table9"'+ parameter )
|
||||
table = cur.fetchone()
|
||||
conduit = table
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
|
||||
|
||||
result_raw = conduit[0]
|
||||
result_name = str(conduit[0]) + 'mm ' + material
|
||||
|
||||
|
||||
return result_raw,result_name
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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"
|
||||
|
|
@ -392,7 +627,7 @@ def cable_schedule_naming(conductor_size,conductors,runs = 1,bond='BOND'):
|
|||
|
||||
if bond == 'BOND':
|
||||
bondtext = bond
|
||||
elif int(bond_size) > 24:
|
||||
elif int(bond) > 24:
|
||||
bondtext = '#' + str(bond) + 'kcmil'
|
||||
else:
|
||||
bondtext = '#' + str(bond) + 'AWG'
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ CEC21_database = [
|
|||
['jepl-cec21.db','Table2',location+'Tables/CEC-Tables/CEC21-table2.csv'],
|
||||
['jepl-cec21.db','Table3',location+'Tables/CEC-Tables/CEC21-table3.csv'],
|
||||
['jepl-cec21.db','Table4',location+'Tables/CEC-Tables/CEC21-table4.csv'],
|
||||
['jepl-cec21.db','Table9',location+'Tables/CEC-Tables/CEC21-table9.csv'],
|
||||
['jepl-cec21.db','Table16',location+'Tables/CEC-Tables/CEC21-table16.csv'],
|
||||
]
|
||||
create_database('jepl-cec21.db',CEC21_database)
|
||||
|
|
@ -68,7 +69,6 @@ create_database('jepl-z46215.db',Z46215_database)
|
|||
cable_database = [
|
||||
['jepl-cable.db','SW-Spec 25055',location+'Tables/Manufacturer/SW-Spec-25055.csv'],
|
||||
['jepl-cable.db','SW-Spec 25051',location+'Tables/Manufacturer/SW-Spec-25051.csv'],
|
||||
|
||||
]
|
||||
create_database('jepl-cable.db',cable_database)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue