chanmin0723's picture
Initial obcon SCADA deploy
e4bf523
Raw
History Blame Contribute Delete
8.02 kB
'use strict'
/**
* Copyright (c) 2017~2023, OBCon Inc.
* All rights reserved.
*/
/**
* @file
* @copyright 2017~2023, OBCon Inc.
* @author gye hyun james kim [pnuskgh@gmail.com]
*/
const Model = utils.getClass('include', 'model.js');
class DevicedataBsModel extends Model {
constructor() {
super();
this._title = '정압기 압력 자동 조절 장치';
this._database = db.db_scada;
this._tableName = 'devicedataB';
this._define = config.databases.scada.define;
this._timestamps = false; //--- createdAt, updatedAt 필드를 사용하지 않는다.
}
get fieldDesc() {
const fieldDescribes = Object.assign({
siteKey: {
type: 'string', len: 8,
allowNull: false,
defaultValue: '',
validate: {},
title: '사이트',
strType: 'string'
},
type: {
type: 'string', len: 2,
allowNull: false,
defaultValue: 'B',
validate: {},
title: '단말기 타입',
strType: 'select',
enum: this.getTypeEnum()
},
deviceKey: {
type: 'string', len: 8,
allowNull: false,
defaultValue: '',
validate: {},
title: '아이디',
strType: 'string'
},
dataCycle: {
type: 'integer', len: 2,
allowNull: false,
defaultValue: 1,
validate: {},
title: '수집 주기',
strType: 'integer'
},
dataCycleUnit: {
type: 'string', len: 1,
allowNull: false,
defaultValue: '2',
validate: {},
title: '수집 주기 단위',
strType: 'select',
enum: [ ['1', '초'], ['2', '분'], ['3', '시'] ]
},
networkCycle: {
type: 'integer', len: 2,
allowNull: false,
defaultValue: 1,
validate: {},
title: '통신 주기',
strType: 'integer'
},
networkCycleUnit: {
type: 'string', len: 1,
allowNull: false,
defaultValue: '2',
validate: {},
title: '통신 주기 단위',
strType: 'select',
enum: [ ['1', '초'], ['2', '분'], ['3', '시'] ]
},
statusDatetime: {
type: 'string', len: 14,
allowNull: false,
defaultValue: '',
validate: {},
title: '발생일자', //--- YYYYMMDDHHmmss
strType: 'string'
},
operationStatus: {
type: 'string', len: 1,
allowNull: false,
defaultValue: '0',
validate: {},
title: '운전 상태',
strType: 'select',
enum: [ ['0', '정지'], ['1', '설정 운전'], ['2', '자동 운전'] ] //--- 3. AI 운전 (Reserved)
},
PTcur: {
type: 'float', len: 4,
allowNull: false,
defaultValue: 0.0,
validate: {},
title: '현재 압력',
strType: 'float'
},
PTb_datetime: {
type: 'string', len: 14,
allowNull: false,
defaultValue: '',
validate: {},
title: '직전 압력 일자', //--- YYYYMMDDHHmmss
strType: 'string'
},
PTb: {
type: 'float', len: 4,
allowNull: false,
defaultValue: 0.0,
validate: {},
title: '직전 압력',
strType: 'float'
},
Pcon_datetime: {
type: 'string', len: 8,
allowNull: false,
defaultValue: '',
validate: {},
title: '설정 압력 일자', //--- YYYYMMDD
strType: 'string'
},
Pcon_init: {
type: 'float', len: 4,
allowNull: false,
defaultValue: 0.0,
validate: {},
title: '초기 설정 압력',
strType: 'float'
},
Pcon: {
type: 'float', len: 4,
allowNull: false,
defaultValue: 0.0,
validate: {},
title: '설정 압력',
strType: 'float'
},
PEcur: {
type: 'float', len: 5,
allowNull: false,
defaultValue: 0.0,
validate: {},
title: '연산 압력',
strType: 'float'
},
operation: {
type: 'string', len: 1,
allowNull: false,
defaultValue: '2',
validate: {},
title: '제어 활동',
strType: 'select',
enum: [ ['1', '활동 없음'], ['2', '승압중'], ['3', '감압중'] ]
},
remainTimeMinutes: {
type: 'integer', len: 2,
allowNull: false,
defaultValue: 0,
validate: {},
title: '잔여 대기시간 (분)',
strType: 'integer'
},
remainTimeSeconds: {
type: 'integer', len: 2,
allowNull: false,
defaultValue: 0,
validate: {},
title: '잔여 대기시간 (초)',
strType: 'integer'
},
statusCode: {
type: 'integer', len: 2,
allowNull: false,
defaultValue: 0,
validate: {},
title: '상태 코드',
strType: 'integer'
}
// alarmDatetime: {
// type: 'string', len: 14,
// allowNull: false,
// defaultValue: '',
// validate: {},
// title: '알람 일시', //--- YYYYMMDDHHmmss
// strType: 'string'
// },
// alarmType: {
// type: 'string', len: 1,
// allowNull: false,
// defaultValue: '2',
// validate: {},
// title: '알람 타입',
// strType: 'select',
// enum: [ ['1', 'ppp'], ['2', 'ppp'], ['3', 'ppp'], ['4', 'ppp'], ['5', 'ppp'], ['6', 'ppp'] ]
// },
// alarmMessage: {
// type: 'string', len: 80,
// allowNull: false,
// defaultValue: '',
// validate: {},
// title: '알람 메시지',
// strType: 'string'
// }
}, super.fieldDesc);
return fieldDescribes;
}
}
module.exports = DevicedataBsModel;