Comments (11)
Also, I recommend doing the following as it will limit the number of payloads to the PLC though I don't think it will fix your issue.
const { Controller, Tag, TagGroup } = require("ethernet-ip");
const fs = require("graceful-fs");
const delay = require("delay");
const PLC = new Controller();
const voltajeLineaAN = new Tag("TDLOW_PQMII.VOL_VAN");
const voltajeLineaBN = new Tag("TDLOW_PQMII.VOL_VBN");
const voltajeLineaCN = new Tag("TDLOW_PQMII.VOL_VCN");
const voltajeFaseAB = new Tag("TDLOW_PQMII.VOL_VAB");
const voltajeFaseBC = new Tag("TDLOW_PQMII.VOL_VBC");
const voltajeFaseCA = new Tag("TDLOW_PQMII.VOL_VCA");
const energiaReal = new Tag("TDLOW_PQMII.ENY_POS_REAL");
// Use Tag Group
const group = new TagGroup();
group.add(voltajeLineaAN);
group.add(voltajeLineaBN);
group.add(voltajeLineaCN);
group.add(voltajeFaseAB);
group.add(voltajeFaseBC);
group.add(voltajeFaseCA);
group.add(energiaReal);
console.log("Tablero - TD_LOW_1");
const fecha = new Date().toISOString();
const fila = `VOLTEJE-AB;VOTEJE-BC;VOLTEJE-CA;VOLTAJE-AN;VOLTEJE-BN;VOLTAJE-CN;ENERGIA\n`;
fs.appendFileSync(`${__dirname}/archivos/${fecha}.txt`, fila);
PLC.connect("172.30.0.85", 0).then(async () => {
while (true) {
try {
await PLC.readTagGroup(group);
let fila = `${voltajeFaseAB.value};${voltajeFaseBC.value};${voltajeFaseCA.value};${
voltajeLineaAN.value
};${voltajeLineaBN.value};${voltajeLineaCN.value};${energiaReal.value}\n`;
await fs.appendFile(`${__dirname}/archivos/${fecha}.txt`, fila);
} catch (error) {
console.log("error", error);
}
await delay(100);
}
});
from node-ethernet-ip.
The incorrect values were produced by a fault in the sensor that is connected to the PLC, now it works perfectly, I am also testing it in another PLC and so far everything works fine
from node-ethernet-ip.
Can you post a snippet of your code?
from node-ethernet-ip.
const { Controller, Tag } = require('ethernet-ip')
const fs = require('graceful-fs')
const delay = require('delay')
const PLC = new Controller()
const voltajeLineaAN = new Tag('TDLOW_PQMII.VOL_VAN')
const voltajeLineaBN = new Tag('TDLOW_PQMII.VOL_VBN')
const voltajeLineaCN = new Tag('TDLOW_PQMII.VOL_VCN')
const voltajeFaseAB = new Tag('TDLOW_PQMII.VOL_VAB')
const voltajeFaseBC = new Tag('TDLOW_PQMII.VOL_VBC')
const voltajeFaseCA = new Tag('TDLOW_PQMII.VOL_VCA')
const energiaReal = new Tag('TDLOW_PQMII.ENY_POS_REAL')
console.log('Tablero - TD_LOW_1')
const fecha = new Date().toISOString()
const fila = `VOLTEJE-AB;VOTEJE-BC;VOLTEJE-CA;VOLTAJE-AN;VOLTEJE-BN;VOLTAJE-CN;ENERGIA\n`
fs.appendFileSync(`${__dirname}/archivos/${fecha}.txt`,fila)
PLC.connect('172.30.0.85', 0).then(async () => {
while (true) {
try {
await PLC.readTag(voltajeLineaAN)
await PLC.readTag(voltajeLineaBN)
await PLC.readTag(voltajeLineaCN)
await PLC.readTag(voltajeFaseAB)
await PLC.readTag(voltajeFaseBC)
await PLC.readTag(voltajeFaseCA)
await PLC.readTag(energiaReal)
let fila = `${voltajeFaseAB.value};${voltajeFaseBC.value};${voltajeFaseCA.value};${voltajeLineaAN.value};${voltajeLineaBN.value};${voltajeLineaCN.value};${energiaReal.value}\n`
await fs.appendFile(`${__dirname}/archivos/${fecha}.txt`, fila)
// console.log('Voltaje AN', voltajeLineaAN.value)
// console.log('Voltaje BN', voltajeLineaBN.value)
// console.log('Voltaje CN', voltajeLineaCN.value)
// console.log('Voltaje AB', voltajeFaseAB.value)
// console.log('Voltaje BC', voltajeFaseBC.value)
// console.log('Voltaje CA', voltajeFaseCA.value)
// console.log('Energia Real', energiaReal.value)
} catch (error) {
console.log('error', error)
}
await delay(100)
}
})
from node-ethernet-ip.
Have you verified that the values in the PLC aren’t actually doing this?
from node-ethernet-ip.
I am comparing the values with those that scada cimplicity throws at me, and that does not happen there.
Maybe it's because the scada cimplicity is already getting information
from node-ethernet-ip.
does the spike happen consistently, say after every 8th scan? or is it random? Also, is simplicity scanning at roughly the same rate you are?
from node-ethernet-ip.
The value you get is very suspicious: 16187392r10 = F70000r16. The underlying protocol just reads the bytes in the tag. I am not familiar with how node-ethernet-ip is handling those. JavaScript is not the most fun language in which to handle binary data.
Based on the value in hex, I would be looking at the PLC program or the sensors first.
from node-ethernet-ip.
Thanks for answering
The peak occurs randomly and of varying magnitude. And yes I scan at the same speed as simplicity, but when I slow down the scan the same thing happens
I'm going to try another plc with a slower scan speed, I think that plc has problems because by checking I found that there are some memory overflows but I don't know exactly where they are, I'm going to keep investigating
from node-ethernet-ip.
What are the underlying datatypes of the tags? PLC scan time shouldnt matter I dont think but overflowing memory in the PLC could be your issue. If you are using COP
or CPS
anywhere in your PLC program, then you may be overrunning whatever you are copying data to and writing to the value of your target tag.
from node-ethernet-ip.
Awesome, glad you got it figured out. I'm gonna go ahead and close this issue. :)
from node-ethernet-ip.
Related Issues (20)
- Class1 Implicit message
- TCP connection leaking on closing connection HOT 1
- Add an option to configure the timeout of "Unconnected Send" messages HOT 1
- Changed Event is missed for previously written tags
- Waht is the max Size of a TagGroup? HOT 2
- Decimal precision is not correct HOT 4
- Question: Can I get tag descriptions? HOT 3
- High PLC CPU utilization and large number of connection errors. HOT 14
- Can't Read Tag by using attribute ID HOT 1
- Error: TIMEOUT occurred while reading Controller Props. - Micrologix 1100 HOT 5
- tag.generateReadMessageRequest is not a function
- Error connecting to PLC: Error: TIMEOUT occurred while reading Controller Props. HOT 4
- Is this Project Still Maintained? HOT 4
- Possible for multiple scan rates without creating a "new" controller for each one? HOT 5
- Preferred disconnection or unsubscribe method?
- String Tags in Compact Logix / Control Logix HOT 1
- Micro820 PLC , Error: <SCAN_GROUP> TIMEOUT occurred while writing Reading Tag Group HOT 1
- PLC.foreach() doesn't work HOT 1
- Software name HOT 1
- Micro Queue is already full at size of 100 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-ethernet-ip.