34 lines
5.1 KiB
Python
34 lines
5.1 KiB
Python
insert_statements = ["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);"]
|
|
|
|
for i in insert_statements:
|
|
good_stuff = i.split(") VALUES (")[1][:-2].replace("'","").split(", ")
|
|
print("{} = Tag('name'='', 'tag_category'='poc', 'tag'='{}', 'device_id'=1, 'description'='', 'data_type'='Floating Point', 'change_threshold'={}, 'min_expected'=0 , 'max_expected'=1000 , 'units'='in', 'guarantee_sec'={})".format(good_stuff[0],good_stuff[2], good_stuff[4], good_stuff[5]))
|
|
print("db.session.add({})".format(good_stuff[0]))
|