Added safety module for boundaries
This commit is contained in:
parent
3679f73988
commit
91f54d7439
5 changed files with 258 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -722,7 +722,130 @@
|
|||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
"source": [
|
||||
"# Electrical Safety Module\n",
|
||||
"\n",
|
||||
"This module helps calculate various approach boundaries, etc based on voltage information. It will be expanded in the future.\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'3'"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#limitedApproach(voltage,fixed=False,DC=False,unitsSI=True,year=2015)\n",
|
||||
"\n",
|
||||
"jmk.limitedApproach(199)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'0.3'"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#restrictedApproach(voltage,DC=False,unitsSI=True,year=2015)\n",
|
||||
"\n",
|
||||
"jmk.restrictedApproach(190)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'00'"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#def gloveClass(voltage,DC=False)\n",
|
||||
"\n",
|
||||
"jmk.gloveClass(600)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"jmk.gloveClass(600,DC=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Templates \n",
|
||||
"\n",
|
||||
"This module is used to write out labels, results for reports, etc in LaTeX, RestructuredText, Markdown, etc."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from jepl.jepl_templates import *\n",
|
||||
"#af_label(equipment,working_distance,incident_energy,af_boundary,energy_level,voltage,limited_approach,restricted_approach, glove_class,author=\"Jeff MacKinnon\",warning=\"warning\",project=\"Arc Flash Warning Label\",project_num=\"####\")\n",
|
||||
"af_label(\"equipnum\",\"3 ft\",3,\"36 in\",\"B\",\"480 Vac\",\"10 ft\",\"1 ft\", \"00\",author=\"Jeff MacKinnon\",warning=\"warning\",project=\"Arc Flash Warning Label\",project_num=\"####\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"from jinja2 import Environment, FileSystemLoader\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"environment = Environment( block_start_string = '\\BLOCK{',\n",
|
||||
" block_end_string = '}',\n",
|
||||
" variable_start_string = '\\VAR((',\n",
|
||||
" variable_end_string = '))',\n",
|
||||
" comment_start_string = '\\#{',\n",
|
||||
" comment_end_string = '}',\n",
|
||||
" line_comment_prefix = '%#',\n",
|
||||
" loader=FileSystemLoader(\"jepl/templates/\")\n",
|
||||
" )\n",
|
||||
"template = environment.get_template(\"template-label-ArcFlash.tex\")\n",
|
||||
"#print(environment.loader)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Voltage,Movable LA SI,Movable LA Imperial,Fixed LA SI,Fixed LA Imperial,Restricted SI,Restricted Imperial
|
||||
50,N/A,N/A,N/A,N/A,N/A,N/A
|
||||
50,Not Specified,Not Specified,Not Specified,Not Specified,Not Specified,Not Specified
|
||||
150,3,120,1,42,0,0
|
||||
750,3,120,1,42,0.3,12
|
||||
15000,3,120,1.5,60,0.7,26
|
||||
|
|
|
|||
|
|
|
@ -1,5 +1,5 @@
|
|||
Voltage,Movable LA SI,Movable LA Imperial,Fixed LA SI,Fixed LA Imperial,Restricted SI,Restricted Imperial
|
||||
50,N/A,N/A,N/A,N/A,N/A,N/A
|
||||
50,Not Specified,Not Specified,Not Specified,Not Specified,Not Specified,Not Specified
|
||||
300,3,120,1,42,0,0
|
||||
1000,3,120,1,42,0.3,12
|
||||
5000,3,120,1.5,60,0.4,17
|
||||
|
|
|
|||
|
|
|
@ -8,6 +8,8 @@ import sys
|
|||
from .jepl_general import *
|
||||
from .jeplpv import *
|
||||
from .jepl_circuits import *
|
||||
from .jepl_templates import *
|
||||
from .jepl_safety import *
|
||||
|
||||
def Test():
|
||||
print( "JMK Python Module works! !")
|
||||
|
|
|
|||
129
jepl/jepl_safety.py
Normal file
129
jepl/jepl_safety.py
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
'''
|
||||
JMK Engineering Inc. Python Library for design and such.
|
||||
by: Jeff MacKinnon
|
||||
|
||||
email: jeff@jmkengineering.com
|
||||
|
||||
Electrical Safety
|
||||
|
||||
These functions are used to calculate boundaries, etc.
|
||||
|
||||
'''
|
||||
|
||||
import sqlite3
|
||||
|
||||
def limitedApproach(voltage,fixed=False,DC=False,unitsSI=True,year=2015):
|
||||
|
||||
if year == 2015:
|
||||
database = "jepl-z46215.db"
|
||||
|
||||
if DC == True:
|
||||
try:
|
||||
with sqlite3.connect(database) as con:
|
||||
cur = con.cursor()
|
||||
|
||||
cur.execute('SELECT * FROM "Table1B" WHERE "Voltage" > ? ', (voltage,))
|
||||
row = cur.fetchone()
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
else:
|
||||
try:
|
||||
with sqlite3.connect(database) as con:
|
||||
cur = con.cursor()
|
||||
|
||||
cur.execute('SELECT * FROM "Table1A" WHERE "Voltage" > ? ', (voltage,))
|
||||
row = cur.fetchone()
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
|
||||
if (fixed == False) & (unitsSI == True):
|
||||
column = 1
|
||||
elif (fixed == False) & (unitsSI == False):
|
||||
column = 2
|
||||
elif (fixed == True) & (unitsSI == True):
|
||||
column = 3
|
||||
elif (fixed == True) & (unitsSI == False):
|
||||
column = 4
|
||||
|
||||
distance = row[column]
|
||||
return(distance)
|
||||
|
||||
def restrictedApproach(voltage,DC=False,unitsSI=True,year=2015):
|
||||
|
||||
if year == 2015:
|
||||
database = "jepl-z46215.db"
|
||||
|
||||
if DC == True:
|
||||
try:
|
||||
with sqlite3.connect(database) as con:
|
||||
cur = con.cursor()
|
||||
|
||||
cur.execute('SELECT * FROM "Table1B" WHERE "Voltage" > ? ', (voltage,))
|
||||
row = cur.fetchone()
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
else:
|
||||
try:
|
||||
with sqlite3.connect(database) as con:
|
||||
cur = con.cursor()
|
||||
|
||||
cur.execute('SELECT * FROM "Table1A" WHERE "Voltage" > ? ', (voltage,))
|
||||
row = cur.fetchone()
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
print(e)
|
||||
|
||||
|
||||
if (unitsSI == True):
|
||||
column = 5
|
||||
else:
|
||||
column = 6
|
||||
|
||||
distance = row[column]
|
||||
return(distance)
|
||||
|
||||
|
||||
|
||||
def gloveClass(voltage,DC=False):
|
||||
'''
|
||||
The glove class is based on the ASTM standard D120.
|
||||
'''
|
||||
|
||||
if DC == True:
|
||||
if voltage <= 750:
|
||||
gloveclass = '00'
|
||||
elif voltage <= 1500:
|
||||
gloveclass = '0'
|
||||
elif voltage <= 11250:
|
||||
gloveclass = '1'
|
||||
elif voltage <= 25500:
|
||||
gloveclass = '2'
|
||||
elif voltage <= 39750:
|
||||
gloveclass = '3'
|
||||
elif voltage <= 54000:
|
||||
gloveclass = '4'
|
||||
else:
|
||||
gloveclass = "Voltage too High"
|
||||
|
||||
|
||||
else:
|
||||
if voltage <= 500:
|
||||
gloveclass = '00'
|
||||
elif voltage <= 1000:
|
||||
gloveclass = '0'
|
||||
elif voltage <= 7500:
|
||||
gloveclass = '1'
|
||||
elif voltage <= 17000:
|
||||
gloveclass = '2'
|
||||
elif voltage <= 26500:
|
||||
gloveclass = '3'
|
||||
elif voltage <= 36000:
|
||||
gloveclass = '4'
|
||||
else:
|
||||
gloveclass = "Voltage too High"
|
||||
|
||||
return(gloveclass)
|
||||
Loading…
Add table
Reference in a new issue