Cara update Node-RED OEM

Cara Update Node-RED pre-installed (OEM) contoh kasus pada software Ecostruxure Augmented Operator Advisor (AOA) by Schneider Electric.

Update Node.js

  1. update Node.JS bisa mendownload dari https://nodejs.org jangan di install, tapi kalau bisa di extract saja, kemudian cari file Node.exe
  2. copy file tersebut ke lokasi node.exe oem (replace)

Update NPM

setelah node.js di update, maka selanjutnya kita bisa otomatis update NPM ke versi terbaru (terkoneksi internet) caranya:

  1. buka command prompt, kemudian masuk ke folder installasi nodejs OEM untuk kasus ini ada di: C:\Program Files (x86)\Schneider Electric\EcoStruxure Augmented Operator Advisor\node-red
  2. kemudian ketik:
    npm install npm@latest -g

Update Node-RED

Setelah update Node.js dan NPM, maka selanjutnya kita bisa mengupdate Node-RED itu sendiri ke versi yang terbaru. caranya cukup ketik:
npm install -g –unsafe-perm node-red
di folder yang sama dengan sebelumnya

Magelis EdgeBox (Node-Red) to S7 PLC (baca PLC S7-1500)

Berikut adalah langkah langkah yang dilakukan untuk komunikasi ke PLC S7, bisa di implement ke S7-1500 / S7-1200 tanpa harus menggunakan gateway lagi atau merubah/modifikasi di sisi setting PLC.

metode ini juga bisa digunakan untuk menjadikan Magelis Edge Box menjadi gateway dari S7 TCP ke Modbus TCP.

READ MORE

Node-Red ~ Modbus Floating Point Convert (Float32 / Real)

this function script is used to convert your 2 words into Float32bit

/* Converts from an number, string, buffer or array representing an IEEE-754 value
 to a javascript float.
 The following may be given in msg.payload:
 A string representing a number, which may be hex or binary
 examples, "1735" "0x02045789" 0b01000000010010010000111111011011
 An integer value
 A two element array or buffer of 16 bit values, less significant byte first.
 A four element array or buffer of 8 bit values, most significant byte first.
 Source: https://flows.nodered.org/flow/359ead34237b7ab6ec0465ee85a34b62
 */
 // first make a number from the given payload if necessary
 let intValue;
 if (typeof msg.payload === "number") 
{
 intValue = msg.payload;
 } else if (typeof msg.payload === "string") {
 intValue = Number(msg.payload);
 } else if (msg.payload.length == 2) {
 // two int array or buffer
 intValue = (msg.payload[1] << 16) + msg.payload[0];
 } else if (msg.payload.length == 4) {
 // four byte array or buffer
 intValue = (((((msg.payload[0] << 8) + msg.payload[1]) << 8) + msg.payload[2]) <<
 8) + msg.payload[3];
 } else {
 node.warn("Unrecognised payload type or length");
 } 
 msg.payload = Int2Float32(intValue);
 msg.payload = msg.payload.toFixed(1);
 return msg;
 function Int2Float32(bytes) {
 var sign = (bytes & 0x80000000) ? -1 : 1;
 var exponent = ((bytes >> 23) & 0xFF) - 127;
 var significand = (bytes & ~(-1 << 23));
 if (exponent == 128)
 return sign * ((significand) ? Number.NaN : Number.POSITIVE_INFINITY);
 if (exponent == -127) {
 if (significand === 0) return sign * 0.0;
 exponent = -126;
 significand /= (1 << 22);
 } else significand = (significand | (1 << 23)) / (1 << 23);
 return sign * significand * Math.pow(2, exponent);
 }

Modbus-IoT (Modbus over MQTT)

Modbus?? old school protocol (more than 40th years).

when Modbus created, it was created for Serial communication via RS485. after year by year, technology was changing and ethernet / TCP widely used in PLC and industrial control system, then Modbus move their medium to Ethernet and wrap their message in TCP (encapsulated) over ethernet.

Now, when everything going to the cloud or  RTU/PLC are not in the same place with SCADA and it only have internet connection, it will be hard and expensive for Modbus to keep exist in Internet area. because we need at least public IP for each device, or creating VPN.

but with MQTT the message can be send over the broker (on the cloud), so it will be exiting if modbus can be sent through MQTT.

if you’ve heard about Node-red this is cool IoT tools/platform built in NodeJS.

I’m using Node-red to make it’s encapsulation, and Modscan as Modbus Master (or SCADA), and Modsim as Modbus Slave (or  PLC)

READ MORE