Seeding for tags updated
This commit is contained in:
@@ -5,7 +5,16 @@
|
||||
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
var getValuesClosestTo = function(dtime){
|
||||
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
latest: function(req, res){
|
||||
Card.find({sort: 'id DESC', limit: 1}).exec(function(err, latestCard){
|
||||
if (err) return res.serverError(err);
|
||||
res.send(latestCard);
|
||||
});
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -21,5 +21,11 @@ module.exports = {
|
||||
address: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
}, seedData: [
|
||||
{
|
||||
id: 0,
|
||||
device_type: 0,
|
||||
address: '192.168.1.10'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -24,10 +24,12 @@ module.exports = {
|
||||
},
|
||||
seedData:[
|
||||
{
|
||||
id: 0,
|
||||
event_class: 'analog',
|
||||
description: 'Analog Alarm'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
event_class: 'bit',
|
||||
description: 'Status Bit'
|
||||
},
|
||||
|
||||
@@ -29,6 +29,9 @@ module.exports = {
|
||||
},
|
||||
event_condition:{
|
||||
type: 'string'
|
||||
}
|
||||
},
|
||||
deviceID: {
|
||||
model:'device'
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,6 +54,7 @@ module.exports = {
|
||||
{
|
||||
name: 'card_type',
|
||||
tag_class: 1,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Card_Type',
|
||||
data_type: 4,
|
||||
change_threshold: 0,
|
||||
@@ -63,6 +64,7 @@ module.exports = {
|
||||
{
|
||||
name: 'card_id',
|
||||
tag_class: 1,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].ID',
|
||||
data_type: 2,
|
||||
change_threshold: 0.5,
|
||||
@@ -71,6 +73,7 @@ module.exports = {
|
||||
{
|
||||
name: 'polished_rod_hp',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Polished_Rod_HP',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -79,6 +82,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_max_load',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_Max_Load.Load',
|
||||
data_type: 1,
|
||||
change_threshold: 400.0,
|
||||
@@ -87,6 +91,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_gross_stroke',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_GrossStroke',
|
||||
data_type: 1,
|
||||
change_threshold: 2.0,
|
||||
@@ -95,6 +100,7 @@ module.exports = {
|
||||
{
|
||||
name: 'spm',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].SPM',
|
||||
data_type: 1,
|
||||
change_threshold: 0.5,
|
||||
@@ -103,6 +109,7 @@ module.exports = {
|
||||
{
|
||||
name: 'fluid_gradient',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Params.Fluid_Gradient',
|
||||
data_type: 1,
|
||||
change_threshold: 0.002,
|
||||
@@ -111,6 +118,7 @@ module.exports = {
|
||||
{
|
||||
name: 'tubing_head_pressure',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Params.Tubing_Head_Pressure',
|
||||
data_type: 1,
|
||||
change_threshold: 25.0,
|
||||
@@ -119,6 +127,7 @@ module.exports = {
|
||||
{
|
||||
name: 'surface_min_load',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Surface_Min.Load',
|
||||
data_type: 1,
|
||||
change_threshold: 400.0,
|
||||
@@ -127,6 +136,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_fluid_load',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_FluidLoad',
|
||||
data_type: 1,
|
||||
change_threshold: 400.0,
|
||||
@@ -135,6 +145,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_max_position',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_Max_Position.Position',
|
||||
data_type: 1,
|
||||
change_threshold: 2.0,
|
||||
@@ -143,6 +154,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_net_stroke',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_NetStroke',
|
||||
data_type: 1,
|
||||
change_threshold: 2.0,
|
||||
@@ -151,6 +163,7 @@ module.exports = {
|
||||
{
|
||||
name: 'fillage_percent',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Fillage_Percent',
|
||||
data_type: 1,
|
||||
change_threshold: 5.0,
|
||||
@@ -159,6 +172,7 @@ module.exports = {
|
||||
{
|
||||
name: 'pump_hp',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Pump_HP',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -167,6 +181,7 @@ module.exports = {
|
||||
{
|
||||
name: 'surface_min_position',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Surface_Min.Position',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -175,6 +190,7 @@ module.exports = {
|
||||
{
|
||||
name: 'pump_intake_pressure',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Pump_Intake_Pressure',
|
||||
data_type: 1,
|
||||
change_threshold: 200.0,
|
||||
@@ -183,6 +199,7 @@ module.exports = {
|
||||
{
|
||||
name: 'surface_max_position',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Surface_Max.Position',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -191,6 +208,7 @@ module.exports = {
|
||||
{
|
||||
name: 'tubing_movement',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Tubing_Movement',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -199,6 +217,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_min_position',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_Min_Position.Position',
|
||||
data_type: 1,
|
||||
change_threshold: 2.0,
|
||||
@@ -207,6 +226,7 @@ module.exports = {
|
||||
{
|
||||
name: 'surface_max_load',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Surface_Max.Load',
|
||||
data_type: 1,
|
||||
change_threshold: 400.0,
|
||||
@@ -215,6 +235,7 @@ module.exports = {
|
||||
{
|
||||
name: 'stuffing_box_friction',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Params.Stuffing_Box_Friction',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -223,6 +244,7 @@ module.exports = {
|
||||
{
|
||||
name: 'dt',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Params.dt',
|
||||
data_type: 1,
|
||||
change_threshold: 0.001,
|
||||
@@ -231,6 +253,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_min_load',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_Min_Load.Load',
|
||||
data_type: 1,
|
||||
change_threshold: 400.0,
|
||||
@@ -239,6 +262,7 @@ module.exports = {
|
||||
{
|
||||
name: 'surface_stroke_length',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Surface_StrokeLength',
|
||||
data_type: 1,
|
||||
change_threshold: 1.0,
|
||||
@@ -247,6 +271,7 @@ module.exports = {
|
||||
{
|
||||
name: 'downhole_adjusted_gross_stroke',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Downhole_AdjustedGrossStroke',
|
||||
data_type: 1,
|
||||
change_threshold: 2.0,
|
||||
@@ -255,6 +280,7 @@ module.exports = {
|
||||
{
|
||||
name: 'fluid_level',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Card_Past[1].Fluid_Above_Pump',
|
||||
data_type: 1,
|
||||
change_threshold: 200.0,
|
||||
@@ -263,6 +289,7 @@ module.exports = {
|
||||
{
|
||||
name: 'stroke_production',
|
||||
tag_class: 2,
|
||||
deviceID: 0,
|
||||
tag: 'Stroke_Production',
|
||||
data_type: 1,
|
||||
change_threshold: 0.005,
|
||||
@@ -271,6 +298,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'electricity_cost',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Electricity_Cost',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -279,6 +307,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'percent_run',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Percent_Run',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -287,6 +316,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'average_spm',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Average_SPM',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -295,6 +325,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'hour',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_DateTime.Hour',
|
||||
// data_type: 'DINT',
|
||||
// change_threshold: 0,
|
||||
@@ -303,6 +334,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'min',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_DateTime.Min',
|
||||
// data_type: 'DINT',
|
||||
// change_threshold: 0,
|
||||
@@ -311,6 +343,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'kwh',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_kWh',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -319,6 +352,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'lifting_cost',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Lifting_Cost',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -327,6 +361,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'polished_rod_hp',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Polished_Rod_HP',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -335,6 +370,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'month',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_DateTime.Month',
|
||||
// data_type: 'DINT',
|
||||
// change_threshold: 0,
|
||||
@@ -343,6 +379,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'inflow_rate',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Inflow_Rate',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -351,6 +388,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'fluid_level',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Fluid_Above_Pump',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -359,6 +397,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'sec',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_DateTime.Sec',
|
||||
// data_type: 'DINT',
|
||||
// change_threshold: 0,
|
||||
@@ -367,6 +406,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'full_card_production',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Full_Card_Production',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -375,6 +415,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'year',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_DateTime.Year',
|
||||
// data_type: 'DINT',
|
||||
// change_threshold: 0,
|
||||
@@ -383,6 +424,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'kwh_regen',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_kWh_regen',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -391,6 +433,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'max_load',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Max_Load',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -399,6 +442,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'pump_intake_pressure',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_pump_intake_pressure',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -407,6 +451,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'day',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_DateTime.Day',
|
||||
// data_type: 'DINT',
|
||||
// change_threshold: 0,
|
||||
@@ -415,6 +460,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'production_calculated',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Production_Calculated',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -423,6 +469,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'min_load',
|
||||
// tag_class: 3,
|
||||
// deviceID: 0,
|
||||
// tag: 'GAUGEOFF_Min_Load',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -431,6 +478,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'v_gas',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.Volume_Gas',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -439,6 +487,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'test_duration',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.Test_Duration',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -447,6 +496,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'v_oil',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.Volume_Oil',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -455,6 +505,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'k_factor',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.k_Factor',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -463,6 +514,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'p_v_water',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.Projected_Volume_Water',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -471,6 +523,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'month',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.DateTime_Complete.Month',
|
||||
// data_type: 'INT',
|
||||
// change_threshold: 0,
|
||||
@@ -479,6 +532,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'sec',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.DateTime_Complete.Sec',
|
||||
// data_type: 'INT',
|
||||
// change_threshold: 0,
|
||||
@@ -487,6 +541,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'v_water',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.Volume_Water',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -495,6 +550,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'year',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.DateTime_Complete.Year',
|
||||
// data_type: 'INT',
|
||||
// change_threshold: 0,
|
||||
@@ -503,6 +559,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'p_v_oil',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.Projected_Volume_Oil',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -511,6 +568,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'day',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.DateTime_Complete.Day',
|
||||
// data_type: 'INT',
|
||||
// change_threshold: 0,
|
||||
@@ -519,6 +577,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'sg_water',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.SG_Water',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -527,6 +586,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'api_oil',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.API_Oil',
|
||||
// data_type: 1,
|
||||
// change_threshold: 0,
|
||||
@@ -535,6 +595,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'hour',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.DateTime_Complete.Hour',
|
||||
// data_type: 'INT',
|
||||
// change_threshold: 0,
|
||||
@@ -543,6 +604,7 @@ module.exports = {
|
||||
// {
|
||||
// name: 'min',
|
||||
// tag_class: 4,
|
||||
// deviceID: 0,
|
||||
// tag: 'Well_Test.DateTime_Complete.Min',
|
||||
// data_type: 'INT',
|
||||
// change_threshold: 0,
|
||||
|
||||
1
sails/config/bootstrap.js
vendored
1
sails/config/bootstrap.js
vendored
@@ -17,6 +17,7 @@ module.exports.bootstrap = function(cb) {
|
||||
async.series([
|
||||
Data_type.seed,
|
||||
Device_type.seed,
|
||||
Device.seed,
|
||||
Tag_class.seed,
|
||||
Event_class.seed,
|
||||
Note_type.seed,
|
||||
|
||||
@@ -44,6 +44,7 @@ module.exports.routes = {
|
||||
* for configuration options and examples. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"card/latest": "CardController.latest",
|
||||
"/tag_val/latest": "Tag_valController.latest",
|
||||
"/tag_val/clear/all": "Tag_valController.clearAllTagData",
|
||||
"/tag_val/clear/:id": "Tag_valController.clearSingleTagData",
|
||||
|
||||
Reference in New Issue
Block a user