Started tag logic to store tags in database
This commit is contained in:
@@ -103,6 +103,24 @@ CREATE TABLE IF NOT EXISTS card_history_dates(
|
||||
first_id INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tag_classes(
|
||||
id INTEGER PRIMARY KEY,
|
||||
tag_class TEXT,
|
||||
description TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tags(
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
class INTEGER,
|
||||
tag TEXT,
|
||||
data_type TEXT,
|
||||
change_threshold REAL,
|
||||
guarantee_sec INTEGER,
|
||||
map_function TEXT
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tag_vals(
|
||||
id INTEGER PRIMARY KEY,
|
||||
dtime TIMESTAMP,
|
||||
@@ -122,3 +140,17 @@ CREATE TABLE IF NOT EXISTS run_status(
|
||||
dtime TIMESTAMP,
|
||||
status TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS alarm_classes(
|
||||
id INTEGER PRIMARY KEY,
|
||||
alarm_class INTEGER,
|
||||
description TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS alarms(
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
class INTEGER,
|
||||
tag TEXT,
|
||||
condition TEXT
|
||||
);
|
||||
|
||||
@@ -15,6 +15,7 @@ from pycomm.ab_comm.clx import Driver as ClxDriver
|
||||
import traceback
|
||||
|
||||
con = lite.connect("/mnt/usb/data.db")
|
||||
# con = lite.connect("/Users/patrickjmcd/Desktop/data.db")
|
||||
PLC_IP_ADDRESS = "192.168.1.10"
|
||||
PLC_TYPE = "VFD"
|
||||
|
||||
@@ -36,6 +37,7 @@ def readTag(addr, tag):
|
||||
# format="%(levelname)-10s %(asctime)s %(message)s",
|
||||
# level=logging.DEBUG
|
||||
# )
|
||||
time.sleep(0.01)
|
||||
c = ClxDriver()
|
||||
if c.open(addr):
|
||||
try:
|
||||
@@ -159,7 +161,7 @@ class AnalogAlarm():
|
||||
self.lastWarningCheckVal = False
|
||||
|
||||
def checkStatus(self, stroke_number):
|
||||
global readTag, PLC_IP_ADDRESS, conditionMap, con
|
||||
global readTag, PLC_IP_ADDRESS, maps, con
|
||||
condition = ''
|
||||
|
||||
self.alarm = readTag(PLC_IP_ADDRESS, '{}.Alarm'.format(self.tag))[0] > 0
|
||||
@@ -169,7 +171,7 @@ class AnalogAlarm():
|
||||
warningChanged = not (self.warning == self.lastWarningCheckVal)
|
||||
|
||||
if (alarmChanged and self.alarm) or (warningChanged and self.warning):
|
||||
condition = conditionMap[readTag(PLC_IP_ADDRESS, '{}.Alarm_Code'.format(self.tag))[0]]
|
||||
condition = maps['conditionMap'][readTag(PLC_IP_ADDRESS, '{}.Alarm_Code'.format(self.tag))[0]]
|
||||
value = readTag(PLC_IP_ADDRESS, '{}.Alarm_Value'.format(self.tag))[0]
|
||||
triggerType = "Alarm"
|
||||
if warningChanged:
|
||||
@@ -219,24 +221,23 @@ class bitAlarm():
|
||||
|
||||
|
||||
# ---------- MAP FUNCTIONS ---------- #
|
||||
modeMap = {
|
||||
maps = {
|
||||
'modeMap':{
|
||||
0: "Error",
|
||||
1: "Auto",
|
||||
2: "POC",
|
||||
3: "Timer",
|
||||
4: "Manual",
|
||||
5: "DH PID"
|
||||
}
|
||||
|
||||
card_type_map = {
|
||||
},
|
||||
'card_type_map': {
|
||||
0: "Normal",
|
||||
1: "Shutdown",
|
||||
2: "Alarm",
|
||||
3: "Startup",
|
||||
4: "Low Fillage"
|
||||
}
|
||||
|
||||
statusMap = {
|
||||
},
|
||||
'statusMap': {
|
||||
0: 'Stopped',
|
||||
1: 'Running',
|
||||
2: 'Pumped Off',
|
||||
@@ -246,9 +247,8 @@ statusMap = {
|
||||
100: 'Read Error',
|
||||
1000: 'PLC Error',
|
||||
9999: 'No Response'
|
||||
}
|
||||
|
||||
conditionMap = {
|
||||
},
|
||||
'conditionMap': {
|
||||
20: "Low",
|
||||
21: "High",
|
||||
24: "LoLo",
|
||||
@@ -259,135 +259,83 @@ conditionMap = {
|
||||
17: "Failure to Start",
|
||||
18: "Drive Fault"
|
||||
}
|
||||
|
||||
}
|
||||
# ---------- TAGS ---------- #
|
||||
stroke_tags = {
|
||||
'card_id': Tag('card_id', 'Card_Past[1].ID', 'DINT', 25, 3600),
|
||||
'card_type': Tag('card_type', 'Card_Past[1].Card_Type', 'STRING', 0, 3600, mapFn=card_type_map)
|
||||
}
|
||||
stroke_tags = {} # Tags stored for every single stroke
|
||||
history_tags = {} # Tags stored on value change or age
|
||||
gaugeoff_tags = {} # Tags stored at gauge off
|
||||
welltest_tags = {} # Tags stored at well test submit
|
||||
bit_tags = {}
|
||||
safety_tags = {}
|
||||
status = Status('run_status', 'Pump.Run_Status', 'STRING', 0, 3600, mapFn=maps['statusMap'])
|
||||
|
||||
status = Status('run_status', 'Pump.Run_Status', 'STRING', 0, 3600, mapFn=statusMap)
|
||||
def setupTags():
|
||||
with con:
|
||||
cur = con.cursor()
|
||||
query = "SELECT t.name as name, c.tag_class as class, t.tag as tag, t.data_type as data_type, t.change_threshold as change_threshold, t.guarantee_sec as guarantee_sec, t.map_function as map_function FROM tags t JOIN tag_classes c ON c.id = t.class;"
|
||||
cur.execute(query)
|
||||
tags = cur.fetchall()
|
||||
# 0: name, 1: class, 2: tag, 3: data_type, 4: change_threshold, 5: guarantee_sec, 6: map_function
|
||||
for x in tags:
|
||||
if str(x[1]) == 'stroke':
|
||||
if x[6]:
|
||||
stroke_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]), mapFn=maps[str(x[6])])
|
||||
else:
|
||||
stroke_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]))
|
||||
elif str(x[1]) == 'history':
|
||||
if x[6]:
|
||||
history_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]), mapFn=maps[str(x[6])])
|
||||
else:
|
||||
history_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]))
|
||||
elif str(x[1]) == 'gaugeoff':
|
||||
if x[6]:
|
||||
gaugeoff_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]), mapFn=maps[str(x[6])])
|
||||
else:
|
||||
gaugeoff_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]))
|
||||
elif str(x[1]) == 'welltest':
|
||||
if x[6]:
|
||||
welltest_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]), mapFn=maps[str(x[6])])
|
||||
else:
|
||||
welltest_tags[x[0]] = Tag(str(x[0]), str(x[2]), str(x[3]), str(x[4]), str(x[5]))
|
||||
|
||||
history_tags = {
|
||||
'torque_reference': Tag('torque_reference', 'PF755_Drive:O.TrqRefAStpt', 'REAL', 1.0, 3600),
|
||||
'speed_reference': Tag('speed_reference', 'Pump_PF755.PSet_SpeedRef', 'REAL', 10.0, 3600),
|
||||
'downhole_adjusted_gross_stroke': Tag('downhole_adjusted_gross_stroke', 'Card_Past[1].Downhole_AdjustedGrossStroke', 'REAL', 2.0, 3600),
|
||||
'downhole_fluid_load': Tag('downhole_fluid_load', 'Card_Past[1].Downhole_FluidLoad', 'REAL', 400.0, 3600),
|
||||
'downhole_gross_stroke': Tag('downhole_gross_stroke', 'Card_Past[1].Downhole_GrossStroke', 'REAL', 2.0, 3600),
|
||||
'downhole_max_load': Tag('downhole_max_load', 'Card_Past[1].Downhole_Max_Load.Load', 'REAL', 400.0, 3600),
|
||||
'downhole_max_position': Tag('downhole_max_position', 'Card_Past[1].Downhole_Max_Position.Position', 'REAL', 2.0, 3600),
|
||||
'downhole_min_load': Tag('downhole_min_load', 'Card_Past[1].Downhole_Min_Load.Load', 'REAL', 400.0, 3600),
|
||||
'downhole_min_position': Tag('downhole_min_position', 'Card_Past[1].Downhole_Min_Position.Position', 'REAL', 2.0, 3600),
|
||||
'downhole_net_stroke': Tag('downhole_net_stroke', 'Card_Past[1].Downhole_NetStroke', 'REAL', 2.0, 3600),
|
||||
'drive_torque_mode': Tag('drive_torque_mode', 'DriveTorqueMode', 'BOOL', 1.0, 3600),
|
||||
'fillage_percent': Tag('fillage_percent', 'Card_Past[1].Fillage_Percent', 'REAL', 5.0, 3600),
|
||||
'fluid_gradient': Tag('fluid_gradient', 'Card_Past[1].Params.Fluid_Gradient', 'REAL', 0.002, 3600),
|
||||
'fluid_level': Tag('fluid_level', 'Card_Past[1].Fluid_Above_Pump', 'REAL', 100.0, 3600),
|
||||
'polished_rod_hp': Tag('polished_rod_hp', 'Card_Past[1].Polished_Rod_HP', 'REAL', 1.0, 3600),
|
||||
'pump_hp': Tag('pump_hp', 'Card_Past[1].Pump_HP', 'REAL', 1.0, 3600),
|
||||
'pump_intake_pressure': Tag('pump_intake_pressure', 'Card_Past[1].Pump_Intake_Pressure', 'REAL', 200.0, 3600),
|
||||
'spm': Tag('spm', 'Card_Past[1].SPM', 'REAL', 0.5, 3600),
|
||||
'stroke_production': Tag('stroke_production', 'Stroke_Production', 'REAL', 0.005, 3600),
|
||||
'stuffing_box_friction': Tag('stuffing_box_friction', 'Card_Past[1].Params.Stuffing_Box_Friction', 'REAL', 1.0, 3600),
|
||||
'surface_max_load': Tag('surface_max_load', 'Card_Past[1].Surface_Max.Load', 'REAL', 400.0, 3600),
|
||||
'surface_max_position': Tag('surface_max_position', 'Card_Past[1].Surface_Max.Position', 'REAL', 1.0, 3600),
|
||||
'surface_min_load': Tag('surface_min_load', 'Card_Past[1].Surface_Min.Load', 'REAL', 400.0, 3600),
|
||||
'surface_min_position': Tag('surface_min_position', 'Card_Past[1].Surface_Min.Position', 'REAL', 1.0, 3600),
|
||||
'surface_stroke_length': Tag('surface_stroke_length', 'Card_Past[1].Surface_StrokeLength', 'REAL', 1.0, 3600),
|
||||
'tubing_head_pressure': Tag('tubing_head_pressure', 'Card_Past[1].Params.Tubing_Head_Pressure', 'REAL', 25.0, 3600),
|
||||
'tubing_movement': Tag('tubing_movement', 'Card_Past[1].Tubing_Movement', 'REAL', 1.0, 3600),
|
||||
'dt': Tag('dt', 'Card_Past[1].Params.dt', 'REAL', 0.001, 3600),
|
||||
}
|
||||
with con:
|
||||
cur = con.cursor()
|
||||
query = "SELECT c.alarm_class as class, a.name as name, a.tag as tag, a.condition as condition FROM alarms a JOIN alarm_classes c ON a.class = c.id;"
|
||||
cur.execute(query)
|
||||
alarms = cur.fetchall()
|
||||
for x in alarms:
|
||||
# 0: class, 1: name, 2: tag, 3: condition
|
||||
if str(x[0]) == 'analog':
|
||||
safety_tags[x[1]] = AnalogAlarm(str(x[1]), str(x[2]))
|
||||
elif str(x[0]) == 'bit':
|
||||
bit_tags[x[1]] = bitAlarm(str(x[1]), str(x[2]), str(x[3]))
|
||||
|
||||
gaugeoff_tags = {
|
||||
'year': Tag('year', 'GAUGEOFF_DateTime.Year', 'DINT', 0, 0),
|
||||
'month': Tag('month', 'GAUGEOFF_DateTime.Month', 'DINT', 0, 0),
|
||||
'day': Tag('day', 'GAUGEOFF_DateTime.Day', 'DINT', 0, 0),
|
||||
'hour': Tag('hour', 'GAUGEOFF_DateTime.Hour', 'DINT', 0, 0),
|
||||
'min': Tag('min', 'GAUGEOFF_DateTime.Min', 'DINT', 0, 0),
|
||||
'sec': Tag('sec', 'GAUGEOFF_DateTime.Sec', 'DINT', 0, 0),
|
||||
'percent_run': Tag('percent_run', 'GAUGEOFF_Percent_Run', 'REAL', 0, 0),
|
||||
'kwh': Tag('kwh', 'GAUGEOFF_kWh', 'REAL', 0, 0),
|
||||
'electricity_cost': Tag('electricity_cost', 'GAUGEOFF_Electricity_Cost', 'REAL', 0, 0),
|
||||
'max_load': Tag('max_load', 'GAUGEOFF_Max_Load', 'REAL', 0, 0),
|
||||
'min_load': Tag('min_load', 'GAUGEOFF_Min_Load', 'REAL', 0, 0),
|
||||
'average_spm': Tag('average_spm', 'GAUGEOFF_Average_SPM', 'REAL', 0, 0),
|
||||
'production_calculated': Tag('production_calculated', 'GAUGEOFF_Production_Calculated', 'REAL', 0, 0),
|
||||
'full_card_production': Tag('full_card_production', 'GAUGEOFF_Full_Card_Production', 'REAL', 0, 0),
|
||||
'polished_rod_hp': Tag('polished_rod_hp', 'GAUGEOFF_Polished_Rod_HP', 'REAL', 0, 0),
|
||||
'lifting_cost': Tag('lifting_cost', 'GAUGEOFF_Lifting_Cost', 'REAL', 0, 0),
|
||||
'fluid_level': Tag('fluid_level', 'GAUGEOFF_Fluid_Above_Pump', 'REAL', 0, 0),
|
||||
'pump_intake_pressure': Tag('pump_intake_pressure', 'GAUGEOFF_pump_intake_pressure', 'REAL', 0, 0),
|
||||
'kwh_regen': Tag('kwh_regen', 'GAUGEOFF_kWh_regen', 'REAL', 0, 0),
|
||||
'inflow_rate': Tag('inflow_rate', 'GAUGEOFF_Inflow_Rate', 'REAL', 0, 0)
|
||||
}
|
||||
print('===== STROKE TAGS =====')
|
||||
for t in stroke_tags:
|
||||
print(t)
|
||||
|
||||
welltest_tags = {
|
||||
'year': Tag('year', "Well_Test.DateTime_Complete.Year", "INT", 0, 0),
|
||||
'month': Tag('month', "Well_Test.DateTime_Complete.Month", "INT", 0, 0),
|
||||
'day': Tag('day', "Well_Test.DateTime_Complete.Day", "INT", 0, 0),
|
||||
'hour': Tag('hour', "Well_Test.DateTime_Complete.Hour", "INT", 0, 0),
|
||||
'min': Tag('min', "Well_Test.DateTime_Complete.Min", "INT", 0, 0),
|
||||
'sec': Tag('sec', "Well_Test.DateTime_Complete.Sec", "INT", 0, 0),
|
||||
'test_duration': Tag('test_duration', "Well_Test.Test_Duration", "REAL", 0, 0),
|
||||
'v_water': Tag('v_water', "Well_Test.Volume_Water", "REAL", 0, 0),
|
||||
'v_oil': Tag('v_oil', "Well_Test.Volume_Oil", "REAL", 0, 0),
|
||||
'v_gas': Tag('v_gas', "Well_Test.Volume_Gas", "REAL", 0, 0),
|
||||
'p_v_water': Tag('p_v_water', "Well_Test.Projected_Volume_Water", "REAL", 0, 0),
|
||||
'p_v_oil': Tag('p_v_oil', "Well_Test.Projected_Volume_Oil", "REAL", 0, 0),
|
||||
'k_factor': Tag('k_factor', "Well_Test.k_Factor", "REAL", 0, 0),
|
||||
'api_oil': Tag('api_oil', "Well_Test.API_Oil", "REAL", 0, 0),
|
||||
'sg_water': Tag('sg_water', "Well_Test.SG_Water", "REAL", 0, 0)
|
||||
}
|
||||
print('===== HISTORY TAGS =====')
|
||||
for t in history_tags:
|
||||
print(t)
|
||||
|
||||
print('===== WELLTEST TAGS =====')
|
||||
for t in welltest_tags:
|
||||
print(t)
|
||||
|
||||
print('===== GAUGEOFF TAGS =====')
|
||||
for t in gaugeoff_tags:
|
||||
print(t)
|
||||
|
||||
print('===== BIT SAFETIES =====')
|
||||
for t in bit_tags:
|
||||
print(t)
|
||||
|
||||
print('===== ANALOG SAFETIES =====')
|
||||
for t in safety_tags:
|
||||
print(t)
|
||||
|
||||
|
||||
# setpoint_tags = {
|
||||
# 'mode': {'Mode', "Pump.Mode", "INT", 0.5, 3600, mapFn=modeMap},
|
||||
# 'speed_setpoint_spm': {'Speed_Setpoint_SPM', "Pump.Speed_Setpoint_SPM", "REAL", 0.5, 3600},
|
||||
# 'speed_max': {'Speed_Max', "Pump.Speed_Max", "REAL", 0.5, 3600},
|
||||
# 'speed_min': {'Speed_Min', "Pump.Speed_Min", "REAL", 0.5, 3600},
|
||||
# 'auto_speed_startpoint_spm': {'Auto-Speed_Startpoint_SPM', "Pump.Speed_Startpoint_SPM_Auto", "REAL", 0.5, 3600},
|
||||
# 'auto_percentage_ramp_down': {'Auto-Percentage_Ramp_Down', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_increment_ramp_down': {'Auto-Increment_Ramp_Down', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_percent_ramp_up': {'Auto-Percent_Ramp_Up', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_percent_ramp_down': {'Auto-Percent_Ramp_Down', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_min_speed_strokes': {'Auto-Min_Speed_Strokes', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_percent_ramp_up': {'Auto-Percent_Ramp_Up', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_poc_startup_ignore_cards': {'Auto-POC-Startup_Ignore_Cards', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'auto_poc_card_quantity': {'Auto-POC-Card_Quantity', "Pump.Mode", "REAL", 1.0, 3600},
|
||||
# 'poc_percent_pumpoff': {'POC-Percent_Pumpoff', "Pump.Mode", "REAL", 1.0, 3600}
|
||||
# }
|
||||
|
||||
bit_tags = {
|
||||
'Pump Off (Auto Mode)': bitAlarm('Pump Off (Auto Mode)', 'Pump.Auto_Stop', 'Unit Stop'),
|
||||
'Pump Off (POC Mode)': bitAlarm('Pump Off (POC Mode)', 'Pump.POC_Stop', 'Unit Stop'),
|
||||
'Pump Off (Timer Mode)': bitAlarm('Pump Off (Timer Mode)', 'Pump.Timed_Stop', 'Unit Stop'),
|
||||
'User Initiated Stop': bitAlarm('User Initiated Stop', 'Pump.Stop', 'Unit Stop'),
|
||||
'Peak Energy Stop': bitAlarm('Peak Energy Stop', 'PeakEnergy.Stop', 'Unit Stop'),
|
||||
'User Initiated Start': bitAlarm('User Initiated Start', 'Pump.Start', 'Unit Start'),
|
||||
'Restart (POC Mode)': bitAlarm('Restart (POC Mode)', 'Pump.POC_Restart', 'Unit Start'),
|
||||
'Restart (Timer Mode)': bitAlarm('Restart (Timer Mode)', 'Pump.Timed_Restart', 'Unit Start'),
|
||||
'Restart (Auto Mode)': bitAlarm('Restart (Auto Mode)', 'Pump.Auto_Restart', 'Unit Start'),
|
||||
'Peak Energy Restart': bitAlarm('Peak Energy Restart', 'PeakEnergy.Restart', 'Unit Start'),
|
||||
'Unit Jogged': bitAlarm('Unit Jogged', 'Pump.Jog', 'Unit Jog')
|
||||
|
||||
}
|
||||
|
||||
|
||||
safety_tags = {
|
||||
'Casing Pressure': AnalogAlarm('Casing Pressure', 'Safety_Casing_Pressure'),
|
||||
'Flow Line Pressure': AnalogAlarm('Flow Line Pressure', 'Safety_Flow_Line_Pressure'),
|
||||
'Flowmeter': AnalogAlarm('Flowmeter', 'Safety_Flowmeter'),
|
||||
'Fluid Load': AnalogAlarm('Fluid Load', 'Safety_Fluid_Load'),
|
||||
'Inclinometer': AnalogAlarm('Inclinometer', 'Safety_Inclinometer'),
|
||||
'Load HiHi': AnalogAlarm('Load HiHi', 'Safety_Load_HiHi'),
|
||||
'Load Hi': AnalogAlarm('Load Hi', 'Safety_Load_Hi'),
|
||||
'Load Lo': AnalogAlarm('Load Lo', 'Safety_Load_Lo'),
|
||||
'Load LoLo': AnalogAlarm('Load LoLo', 'Safety_Load_LoLo'),
|
||||
'Speed': AnalogAlarm('Speed', 'Safety_Speed'),
|
||||
'Tubing Pressure': AnalogAlarm('Tubing Pressure', 'Safety_Tubing_Pressure')
|
||||
}
|
||||
|
||||
setupTags()
|
||||
|
||||
def readPoints():
|
||||
global PLC_IP_ADDRESS
|
||||
|
||||
100
tagSetup.sql
Normal file
100
tagSetup.sql
Normal file
@@ -0,0 +1,100 @@
|
||||
INSERT INTO tag_classes (id, tag_class, description) VALUES (1, 'stroke', 'Stroke Information');
|
||||
INSERT INTO tag_classes (id, tag_class, description) VALUES (2, 'history', 'Historical Data');
|
||||
INSERT INTO tag_classes (id, tag_class, description) VALUES (3, 'gaugeoff', 'Gauge Off Data');
|
||||
INSERT INTO tag_classes (id, tag_class, description) VALUES (4, 'welltest', 'Well Test Data');
|
||||
|
||||
INSERT INTO alarm_classes(id, alarm_class, description) VALUES (1, 'analog', 'Analog Alarms');
|
||||
INSERT INTO alarm_classes(id, alarm_class, description) VALUES (2, 'bit', 'Bit Statuses');
|
||||
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec, map_function) VALUES ('card_type', 1, 'Card_Past[1].Card_Type', 'STRING', 0, 3600, 'card_type_map');
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('card_id', 1, 'Card_Past[1].ID', 'DINT', 25, 3600);
|
||||
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('polished_rod_hp', 2, 'Card_Past[1].Polished_Rod_HP', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('drive_torque_mode', 2, 'DriveTorqueMode', 'BOOL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_max_load', 2, 'Card_Past[1].Downhole_Max_Load.Load', 'REAL', 400.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_gross_stroke', 2, 'Card_Past[1].Downhole_GrossStroke', 'REAL', 2.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('spm', 2, 'Card_Past[1].SPM', 'REAL', 0.5, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('fluid_gradient', 2, 'Card_Past[1].Params.Fluid_Gradient', 'REAL', 0.002, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('tubing_head_pressure', 2, 'Card_Past[1].Params.Tubing_Head_Pressure', 'REAL', 25.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('surface_min_load', 2, 'Card_Past[1].Surface_Min.Load', 'REAL', 400.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_fluid_load', 2, 'Card_Past[1].Downhole_FluidLoad', 'REAL', 400.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_max_position', 2, 'Card_Past[1].Downhole_Max_Position.Position', 'REAL', 2.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_net_stroke', 2, 'Card_Past[1].Downhole_NetStroke', 'REAL', 2.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('fillage_percent', 2, 'Card_Past[1].Fillage_Percent', 'REAL', 5.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('pump_hp', 2, 'Card_Past[1].Pump_HP', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('surface_min_position', 2, 'Card_Past[1].Surface_Min.Position', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('pump_intake_pressure', 2, 'Card_Past[1].Pump_Intake_Pressure', 'REAL', 200.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('surface_max_position', 2, 'Card_Past[1].Surface_Max.Position', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('tubing_movement', 2, 'Card_Past[1].Tubing_Movement', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('speed_reference', 2, 'Pump_PF755.PSet_SpeedRef', 'REAL', 10.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_min_position', 2, 'Card_Past[1].Downhole_Min_Position.Position', 'REAL', 2.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('surface_max_load', 2, 'Card_Past[1].Surface_Max.Load', 'REAL', 400.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('stuffing_box_friction', 2, 'Card_Past[1].Params.Stuffing_Box_Friction', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('dt', 2, 'Card_Past[1].Params.dt', 'REAL', 0.001, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_min_load', 2, 'Card_Past[1].Downhole_Min_Load.Load', 'REAL', 400.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('torque_reference', 2, 'PF755_Drive:O.TrqRefAStpt', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('surface_stroke_length', 2, 'Card_Past[1].Surface_StrokeLength', 'REAL', 1.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('downhole_adjusted_gross_stroke', 2, 'Card_Past[1].Downhole_AdjustedGrossStroke', 'REAL', 2.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('fluid_level', 2, 'Card_Past[1].Fluid_Above_Pump', 'REAL', 200.0, 3600);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('stroke_production', 2, 'Stroke_Production', 'REAL', 0.005, 3600);
|
||||
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('electricity_cost', 3, 'GAUGEOFF_Electricity_Cost', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('percent_run', 3, 'GAUGEOFF_Percent_Run', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('average_spm', 3, 'GAUGEOFF_Average_SPM', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('hour', 3, 'GAUGEOFF_DateTime.Hour', 'DINT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('min', 3, 'GAUGEOFF_DateTime.Min', 'DINT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('kwh', 3, 'GAUGEOFF_kWh', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('lifting_cost', 3, 'GAUGEOFF_Lifting_Cost', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('polished_rod_hp', 3, 'GAUGEOFF_Polished_Rod_HP', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('month', 3, 'GAUGEOFF_DateTime.Month', 'DINT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('inflow_rate', 3, 'GAUGEOFF_Inflow_Rate', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('fluid_level', 3, 'GAUGEOFF_Fluid_Above_Pump', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('sec', 3, 'GAUGEOFF_DateTime.Sec', 'DINT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('full_card_production', 3, 'GAUGEOFF_Full_Card_Production', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('year', 3, 'GAUGEOFF_DateTime.Year', 'DINT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('kwh_regen', 3, 'GAUGEOFF_kWh_regen', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('max_load', 3, 'GAUGEOFF_Max_Load', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('pump_intake_pressure', 3, 'GAUGEOFF_pump_intake_pressure', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('day', 3, 'GAUGEOFF_DateTime.Day', 'DINT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('production_calculated', 3, 'GAUGEOFF_Production_Calculated', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('min_load', 3, 'GAUGEOFF_Min_Load', 'REAL', 0, 0);
|
||||
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('v_gas', 4, 'Well_Test.Volume_Gas', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('test_duration', 4, 'Well_Test.Test_Duration', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('v_oil', 4, 'Well_Test.Volume_Oil', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('k_factor', 4, 'Well_Test.k_Factor', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('p_v_water', 4, 'Well_Test.Projected_Volume_Water', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('month', 4, 'Well_Test.DateTime_Complete.Month', 'INT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('sec', 4, 'Well_Test.DateTime_Complete.Sec', 'INT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('v_water', 4, 'Well_Test.Volume_Water', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('year', 4, 'Well_Test.DateTime_Complete.Year', 'INT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('p_v_oil', 4, 'Well_Test.Projected_Volume_Oil', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('day', 4, 'Well_Test.DateTime_Complete.Day', 'INT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('sg_water', 4, 'Well_Test.SG_Water', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('api_oil', 4, 'Well_Test.API_Oil', 'REAL', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('hour', 4, 'Well_Test.DateTime_Complete.Hour', 'INT', 0, 0);
|
||||
INSERT INTO tags (name, class, tag, data_type, change_threshold, guarantee_sec) VALUES ('min', 4, 'Well_Test.DateTime_Complete.Min', 'INT', 0, 0);
|
||||
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Flow Line Pressure', 1, 'Safety_Flow_Line_Pressure');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Load HiHi', 1, 'Safety_Load_HiHi');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Load Lo', 1, 'Safety_Load_Lo');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Tubing Pressure', 1, 'Safety_Tubing_Pressure');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Load Hi', 1, 'Safety_Load_Hi');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Casing Pressure', 1, 'Safety_Casing_Pressure');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Fluid Load', 1, 'Safety_Fluid_Load');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Flowmeter', 1, 'Safety_Flowmeter');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Speed', 1, 'Safety_Speed');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Load LoLo', 1, 'Safety_Load_LoLo');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Inclinometer', 1, 'Safety_Inclinometer');
|
||||
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Unit Jogged', 2, 'Pump.Jog', 'Unit Jog');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Restart (Auto Mode)', 2, 'Pump.Auto_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Pump Off (POC Mode)', 2, 'Pump.POC_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Restart (Timer Mode)', 2, 'Pump.Timed_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Restart (POC Mode)', 2, 'Pump.POC_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Pump Off (Auto Mode)', 2, 'Pump.Auto_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Peak Energy Restart', 2, 'PeakEnergy.Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Peak Energy Stop', 2, 'PeakEnergy.Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('User Initiated Start', 2, 'Pump.Start', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('User Initiated Stop', 2, 'Pump.Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Pump Off (Timer Mode)', 2, 'Pump.Timed_Stop', 'Unit Stop');
|
||||
Reference in New Issue
Block a user