1.9.19 • Published 3 years ago

wise-paas-scada-utility v1.9.19

Weekly downloads
6
License
ISC
Repository
-
Last release
3 years ago

wise-paas-scada-utility

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

Installation

npm install wise-paas-scada-utility

Example

const wisePaasScadaUtil = require('wise-paas-scada-utility');

const datastore = wisePaasScadaUtil.datastore;
const deviceManager = wisePaasScadaUtil.deviceManager;
const waamqp = wisePaasScadaUtil.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.9.19

3 years ago

1.9.18

3 years ago

1.9.17

3 years ago

1.9.16

3 years ago

1.9.15

4 years ago

1.9.14

4 years ago

1.9.13

4 years ago

1.9.12

4 years ago

1.9.11

4 years ago

1.9.10

4 years ago

1.9.9

4 years ago

1.9.8

4 years ago

1.9.7

5 years ago

1.9.6

5 years ago

1.9.5

5 years ago

1.9.4

5 years ago

1.9.3

5 years ago

1.9.2

5 years ago

1.9.1

5 years ago

1.9.0

5 years ago

1.8.39

5 years ago

1.8.38

5 years ago

1.8.37

5 years ago

1.8.36

5 years ago

1.8.35

5 years ago

1.8.34

5 years ago

1.8.33

5 years ago

1.8.32

5 years ago

1.8.31

5 years ago

1.8.30

5 years ago

1.8.29

5 years ago

1.8.28

5 years ago

1.8.27

5 years ago

1.8.26

5 years ago

1.8.25

5 years ago

1.8.24

5 years ago

1.8.23

5 years ago

1.8.22

5 years ago

1.8.21

5 years ago

1.8.20

5 years ago

1.8.19

5 years ago

1.8.18

5 years ago

1.8.17

5 years ago

1.8.16

5 years ago

1.8.15

5 years ago

1.8.14

5 years ago

1.8.13

5 years ago

1.8.12

5 years ago

1.8.11

5 years ago

1.8.10

5 years ago

1.8.9

5 years ago

1.8.8

5 years ago

1.8.7

5 years ago

1.8.6

5 years ago

1.8.5

5 years ago

1.8.4

6 years ago

1.8.3

6 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.6

6 years ago

1.7.5

6 years ago

1.7.4

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.28

6 years ago

1.5.27

6 years ago

1.5.26

6 years ago

1.5.25

6 years ago

1.5.24

6 years ago

1.5.23

6 years ago

1.5.22

6 years ago

1.5.21

6 years ago

1.5.20

6 years ago

1.5.19

6 years ago

1.5.18

6 years ago