Changed channels to RW, added functions for writing values

This commit is contained in:
Patrick McDonagh
2016-03-03 16:03:29 -06:00
parent 2d2455cf6e
commit 9223b250af
3 changed files with 486 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
====
Channels to Update to RW
====
[x] - automode
[x] - dhpressureshutdownenabled
[x] - dhpressureshutdownlimit
[x] - dhpressurestartup
[x] - dhpressurestartupenabled
[x] - dhtempshutdown
[x] - dhtempshutdownenabled
[x] - dhtempstartupenabled
[x] - dhtempstartuplimit
[x] - downholetoolenabled
[x] - handmode
[x] - offmode
[x] - remoteshutdowndisabled
[x] - tubingpressurealarmdelay
[x] - tubingpressurealarmstartupdelay
[x] - tubingpressureeumax
[x] - tubingpressureeumin
[x] - tubingpressurehisp
[x] - tubingpressurelosp
[x] - tubingpressuretransducerenabled
[x] - vfdacceltime
[x] - vfddeceltime
[x] - vfddisabled
[x] - vfdmaxfreq
[x] - vfdminfreq
[x] - vfdmotorpoles
[x] - vfdnameplatefla
[x] - vfdnameplatehp
[x] - vfdnameplatehz
[x] - vfdnameplateolcurrent
[x] - vfdnameplaterpm
[x] - vfdnameplatevolts
[x] - vfdspeedref

View File

@@ -126,7 +126,168 @@ class start(threading.Thread, deviceBase):
self.device_address = value
return True
def vfdipp_gpsUpdate(self, name, value):
updateGPS()
return True
def vfdipp_dhpressurestartupenabled(self, name, value):
print('trying to set DH_Pressure_Startup_Enabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Pressure_Startup_Enabled', int(value))
def vfdipp_vfddisabled(self, name, value):
print('trying to set VFD_Disabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'VFD_Disabled', int(value))
def vfdipp_vfdnameplatefla(self, name, value):
print('trying to set cfg_NameplateFLA to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_NameplateFLA', float(value))
def vfdipp_dhpressurestartup(self, name, value):
print('trying to set DH_Pressure_Startup to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Pressure_Startup', float(value))
def vfdipp_automode(self, name, value):
print('trying to set Auto_Mode to {0}'.format(value))
return u800.writeMicroTag(addr, 'Auto_Mode', int(value))
def vfdipp_vfdmotorpoles(self, name, value):
print('trying to set cfg_MotorPoles to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_MotorPoles', int(value))
def vfdipp_tubingpressurealarmdelay(self, name, value):
print('trying to set TubingPressure_Alarm_Delay to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_Alarm_Delay', int(value))
def vfdipp_dhtempshutdown(self, name, value):
print('trying to set DH_Temp_Shutdown to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Temp_Shutdown', float(value))
def vfdipp_dhtempstartuplimit(self, name, value):
print('trying to set DH_Temp_Startup to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Temp_Startup', float(value))
def vfdipp_vfdmaxfreq(self, name, value):
print('trying to set cfg_MaxFreq to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_MaxFreq', float(value))
def vfdipp_tubingpressurelosp(self, name, value):
print('trying to set TubingPressure_Lo_SP to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_Lo_SP', float(value))
def vfdipp_vfdacceltime(self, name, value):
print('trying to set VFD_AccelTime to {0}'.format(value))
return u800.writeMicroTag(addr, 'VFD_AccelTime', float(value))
def vfdipp_vfdnameplateolcurrent(self, name, value):
print('trying to set cfg_NameplateOLCurrent to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_NameplateOLCurrent', float(value))
def vfdipp_offmode(self, name, value):
print('trying to set Off_Mode to {0}'.format(value))
return u800.writeMicroTag(addr, 'Off_Mode', int(value))
def vfdipp_tubingpressurealarmstartupdelay(self, name, value):
print('trying to set TubingPressure_Alarm_Startup_Delay to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_Alarm_Startup_Delay', int(value))
def vfdipp_dhpressureshutdownenabled(self, name, value):
print('trying to set DH_Pressure_Shutdown_Enabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Pressure_Shutdown_Enabled', int(value))
def vfdipp_dhtempshutdownenabled(self, name, value):
print('trying to set DH_Temp_Shutdown_Enabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Temp_Shutdown_Enabled', int(value))
def vfdipp_tubingpressureeumin(self, name, value):
print('trying to set TubingPressure_EU_Min to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_EU_Min', float(value))
def vfdipp_vfddeceltime(self, name, value):
print('trying to set VFD_DecelTime to {0}'.format(value))
return u800.writeMicroTag(addr, 'VFD_DecelTime', float(value))
def vfdipp_vfdnameplaterpm(self, name, value):
print('trying to set cfg_NameplateRPM to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_NameplateRPM', float(value))
def vfdipp_vfdspeedref(self, name, value):
print('trying to set VFD_SpeedRef to {0}'.format(value))
return u800.writeMicroTag(addr, 'VFD_SpeedRef', float(value))
def vfdipp_tubingpressureeumax(self, name, value):
print('trying to set TubingPressure_EU_Max to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_EU_Max', float(value))
def vfdipp_handmode(self, name, value):
print('trying to set Hand_Mode to {0}'.format(value))
return u800.writeMicroTag(addr, 'Hand_Mode', int(value))
def vfdipp_tubingpressurehisp(self, name, value):
print('trying to set TubingPressure_Hi_SP to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_Hi_SP', float(value))
def vfdipp_remoteshutdowndisabled(self, name, value):
print('trying to set Remote_Shutdown_Disabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'Remote_Shutdown_Disabled', int(value))
def vfdipp_dhpressureshutdownlimit(self, name, value):
print('trying to set DH_Pressure_Shutdown to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Pressure_Shutdown', float(value))
def vfdipp_vfdnameplatevolts(self, name, value):
print('trying to set cfg_NameplateVolts to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_NameplateVolts', float(value))
def vfdipp_downholetoolenabled(self, name, value):
print('trying to set Downhole_Tool_Enabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'Downhole_Tool_Enabled', int(value))
def vfdipp_vfdnameplatehz(self, name, value):
print('trying to set cfg_NameplateHz to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_NameplateHz', float(value))
def vfdipp_tubingpressuretransducerenabled(self, name, value):
print('trying to set TubingPressure_Transducer_Enabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'TubingPressure_Transducer_Enabled', int(value))
def vfdipp_dhtempstartupenabled(self, name, value):
print('trying to set DH_Temp_Startup_Enabled to {0}'.format(value))
return u800.writeMicroTag(addr, 'DH_Temp_Startup_Enabled', int(value))
def vfdipp_vfdnameplatehp(self, name, value):
print('trying to set cfg_NameplateHP to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_NameplateHP', float(value))
def vfdipp_vfdminfreq(self, name, value):
print('trying to set cfg_MinFreq to {0}'.format(value))
return u800.writeMicroTag(addr, 'cfg_MinFreq', float(value))
def vfdipp_startcommand(self, name, value):
print('trying to set Start_Command to 1')
if u800.writeMicroTag(addr, 'Start_Command', 1):
print("Set Start_Command to 1")
time.sleep(3)
return u800.writeMicroTag(addr, 'Start_Command', 0)
else:
print("Couldn't set Start_Command to 1")
return False
def vfdipp_stopcommand(self, name, value):
print('trying to set Stop_Command to 1')
if u800.writeMicroTag(addr, 'Stop_Command', 1):
print("Set Stop_Command to 1")
time.sleep(3)
return u800.writeMicroTag(addr, 'Stop_Command', 0)
else:
print("Couldn't set Stop_Command to 1")
return False
def vfdipp_vfdclearfault(self, name, value):
print('trying to set VFD_ClearFault to 1')
if u800.writeMicroTag(addr, 'VFD_ClearFault', 1):
print("Set VFD_ClearFault to 1")
time.sleep(3)
return u800.writeMicroTag(addr, 'VFD_ClearFault', 0)
else:
print("Couldn't set VFD_ClearFault to 1")
return False

View File

@@ -0,0 +1,287 @@
import pickle
channels = {
'vfdnameplatehz':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_NameplateHz',
'last_time_uploaded':0,
'last_value':''
},
'dhpressureshutdownlimit':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'DH_Pressure_Shutdown',
'last_time_uploaded':0,
'last_value':''
},
'dhtempstartuplimit':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'DH_Temp_Startup',
'last_time_uploaded':0,
'last_value':''
},
'dhtempstartupenabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'DH_Temp_Startup_Enabled',
'last_time_uploaded':0,
'last_value':''
},
'vfdmotorpoles':{
'data_type':'UINT',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_MotorPoles',
'last_time_uploaded':0,
'last_value':''
},
'vfdnameplatehp':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_NameplateHP',
'last_time_uploaded':0,
'last_value':''
},
'vfdacceltime':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'VFD_AccelTime',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressurealarmdelay':{
'data_type':'UDINT',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'TubingPressure_Alarm_Delay',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressureeumin':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'TubingPressure_EU_Min',
'last_time_uploaded':0,
'last_value':''
},
'offmode':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'Off_Mode',
'last_time_uploaded':0,
'last_value':''
},
'vfddisabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'VFD_Disabled',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressureeumax':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'TubingPressure_EU_Max',
'last_time_uploaded':0,
'last_value':''
},
'vfdspeedref':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'VFD_SpeedRef',
'last_time_uploaded':0,
'last_value':''
},
'dhpressurestartup':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'DH_Pressure_Startup',
'last_time_uploaded':0,
'last_value':''
},
'handmode':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'Hand_Mode',
'last_time_uploaded':0,
'last_value':''
},
'vfdmaxfreq':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_MaxFreq',
'last_time_uploaded':0,
'last_value':''
},
'dhtempshutdownenabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'DH_Temp_Shutdown_Enabled',
'last_time_uploaded':0,
'last_value':''
},
'dhpressureshutdownenabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'DH_Pressure_Shutdown_Enabled',
'last_time_uploaded':0,
'last_value':''
},
'vfdnameplatefla':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_NameplateFLA',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressuretransducerenabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'TubingPressure_Transducer_Enabled',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressurealarmstartupdelay':{
'data_type':'DINT',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'TubingPressure_Alarm_Startup_Delay',
'last_time_uploaded':0,
'last_value':''
},
'automode':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'Auto_Mode',
'last_time_uploaded':0,
'last_value':''
},
'vfdnameplaterpm':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_NameplateRPM',
'last_time_uploaded':0,
'last_value':''
},
'vfdnameplateolcurrent':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_NameplateOLCurrent',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressurehisp':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'TubingPressure_Hi_SP',
'last_time_uploaded':0,
'last_value':''
},
'downholetoolenabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'Downhole_Tool_Enabled',
'last_time_uploaded':0,
'last_value':''
},
'vfdnameplatevolts':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_NameplateVolts',
'last_time_uploaded':0,
'last_value':''
},
'vfdminfreq':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'cfg_MinFreq',
'last_time_uploaded':0,
'last_value':''
},
'dhtempshutdown':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'DH_Temp_Shutdown',
'last_time_uploaded':0,
'last_value':''
},
'vfddeceltime':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'VFD_DecelTime',
'last_time_uploaded':0,
'last_value':''
},
'dhpressurestartupenabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'DH_Pressure_Startup_Enabled',
'last_time_uploaded':0,
'last_value':''
},
'tubingpressurelosp':{
'data_type':'REAL',
'change_amount':0.5,
'max_time_between_uploads':3600,
'tag':'TubingPressure_Lo_SP',
'last_time_uploaded':0,
'last_value':''
},
'remoteshutdowndisabled':{
'data_type':'BOOL',
'change_amount':None,
'max_time_between_uploads':3600,
'tag':'Remote_Shutdown_Disabled',
'last_time_uploaded':0,
'last_value':''
}
}
for ch in channels.keys():
# def vfdipp_dhpressureshutdownlimit(self, name, value):
# print("!!! Trying to set DH_Pressure_Shutdown to {0}".format(value))
# return u800.writeMicroTag(addr, "DH_Pressure_Shutdown", float(value))
print("def vfdipp_{0}(self, name, value):".format(ch))
print(" print('trying to set {0} to <>'.format(value))".format(channels[ch]['tag']))
if channels[ch]['data_type'] == 'REAL':
print(" return u800.writeMicroTag(addr, '{0}', float(value))".format(channels[ch]['tag']))
elif (channels[ch]['data_type'] == 'BOOL') or (channels[ch]['data_type'][-3:] == "INT"):
print(" return u800.writeMicroTag(addr, '{0}', int(value))".format(channels[ch]['tag']))
else:
print("!!!! DIDNT WORK FOR {0}".format(ch))
print("")
print("====\nChannels to Update to RW\n====\n")
for ch in sorted(channels.keys()):
print("[] - {0}".format(ch))