1.5.18 • Published 6 years ago

wise-paas-scada v1.5.18

Weekly downloads
98
License
ISC
Repository
github
Last release
6 years ago

wise-paas-scada

wise-paas-scada is a utility node-module for WISE-PaaS SCADA.

Installation

npm install wise-paas-scada

Example

const wisePaasScada = require('wise-paas-scada');

const datastore = wisePaasScada.datastore;
const deviceManager = wisePaasScada.deviceManager;
const waamqp = wisePaasScada.waamqp;

API

datastore

  • datastore.init(mongodbOptions, mqttOptions)
  • datastore.quit()
  • datastore.getRealData(tag array, [callback])
  • datastore.upsertRealData(scadaId, parameters, [callback])
  • datastore.updateRealData(scadaId, parameters, [callback])
  • datastore.deleteRealDataByScadaId(scadaId, [callback])
  • datastore.getHistData()
  • datastore.insertHistData()

datastore.init(mongodbOptions, mqttOptions)

Connects to MongoDB and MQTT broker specified by the given options. You have to specify the following options, for example:

let mongodbConf = {
  host: '127.0.0.1',
  port: 27017,
  username: 'admin',
  password: '1234',
  database: 'mongodb'
};
let mqttConf = {
  host: '127.0.0.1',
  port: 1883,
  username: '',
  password: ''
};

datastore.init(mongodbConf, mqttConf);

datastore#quit()

When no need to use datacore, close the connection.


datastore#getRealData(tag array, callback)

Get real-time tag data by the given tags list, a tag has scadaId and tagName properties. The callback is called when all tag data has been gotten.

For example:

let t1 = {
  scadaId: 'scada1',
  tagName: 'Foo1'
};

let t2 = {
  scadaId: 'scada2',
  tagName: 'Foo2'
};

datastore.getRealData([t1, t2],  (err, response) => {
  if (err) {
    console.error(err);
  } else {
    console.log(response);
  }
});

datastore#upsertRealData(scadaId, parameters, callback)

Update real-time tag value. If tag is not found, tag will be inserted. The callback is called when tag value has been updated.

For example:

let scadaId = 'scada1';
let t1 = {
  tagName: 'Foo1',
  value: 100,
  ts: new Date()
};

datastore.upsertRealData(scadaId, t1,  (err, response)=>  {
  if (err) {
    console.error(err);
  } else {
    console.log('success: ' + response.ok);
  }
});

datastore#updateRealData(scadaId, parameters, callback)

Update real-time tag value. The callback is called when tag value has been updated.

For example:

let scadaId = 'scada1';
let t1 = {
  tagName: 'Foo1',
  value: 100,
  ts: new Date()
};

datastore.updateRealData(scadaId, t1,  (err, response) => {
  if (err) {
    console.error(err);
  } else {
    console.log('success: ' + response.ok);
  }
});

datastore#deleteRealDataByScadaId(scadaId, callback)

Delete real-time tag data record by the given scadaId. The callback is called when tag value has been deleted.

For example:

datastore.deleteRealDataByScadaId('scada1', (err, response) => {
  if (err) {
    console.error(err);
  } else {
    console.log('success: ' + response.ok);
  }
});

datastore#getHistData(parameters, callback)

Get history tag data according to the input parameters. The callback is called when data has been gotten.

For example:

let t1 = {
  scadaId: 'cda43195-7a0a-4903-a533-d333d8c5f9d9',
  deviceId: 'P02_SCADA',
  tagName: 'ATML_PACPRF:CTR',
  startTs: new Date('2015-01-01'),
  endTs: new Date(),
  orderby: -1,
  limit: 10
};

datastore.getHistData(t1, function (err, response) {
  if (err) {
    console.error(err);
  } else {
    console.log(response);
  }
});

datastore#insertHistData(parameters, callback)

Insert history tag data. The callback is called when data has been inserted.

For example:

let t1 = {
  scadaId: 'cda43195-7a0a-4903-a533-d333d8c5f9d9',
  deviceId: 'P02_SCADA',
  tagName: 'ATML_PACPRF:CTR',
  value: 100,
  ts: new Date()
};

datastore.insertHistData(t1, function (err, response) {
  if (err) {
    console.error(err);
  } else {
    console.log('success: ' + response.ok);
  }
});

1.5.18

6 years ago

1.5.17

6 years ago

1.5.16

6 years ago

1.5.15

6 years ago

1.5.14

6 years ago

1.5.13

6 years ago

1.5.12

6 years ago

1.5.11

6 years ago

1.5.10

6 years ago

1.5.9

6 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.5

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.23

6 years ago

1.4.22

6 years ago

1.4.21

6 years ago

1.4.20

6 years ago

1.4.19

6 years ago

1.4.18

6 years ago

1.4.17

6 years ago

1.4.16

6 years ago

1.4.15

6 years ago

1.4.14

6 years ago

1.4.13

7 years ago

1.4.12

7 years ago

1.4.11

7 years ago

1.4.10

7 years ago

1.4.9

7 years ago

1.4.8

7 years ago

1.4.7

7 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.16

7 years ago

1.3.15

7 years ago

1.3.14

7 years ago

1.3.13

7 years ago

1.3.12

7 years ago

1.3.11

7 years ago

1.3.10

7 years ago

1.3.9

7 years ago

1.3.8

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.24

7 years ago

1.2.23

7 years ago

1.2.22

7 years ago

1.2.21

7 years ago

1.2.20

7 years ago

1.2.19

7 years ago

1.2.18

7 years ago

1.2.17

7 years ago

1.2.16

7 years ago

1.2.15

7 years ago

1.2.14

7 years ago

1.2.13

7 years ago

1.2.12

7 years ago

1.2.11

7 years ago

1.2.10

7 years ago

1.2.9

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago