node-ethernet-ip icon indicating copy to clipboard operation
node-ethernet-ip copied to clipboard

Changed Event is missed for previously written tags

Open PeterChristen577 opened this issue 4 years ago • 0 comments

Changed Event is missed for previously written tags.

Current Behavior

When a tag is written to the PLC, in the following read cycles is no Changed Event produced.

Expected Behavior

A Changed Event is also produced for tags previously written to the PLC.

Possible Solution (Optional)

In file /src/tag/index.js remove line (574):

    unstageWriteRequest() {
        const { tag } = this.state;
        tag.stage_write = false;
        //tag.controllerValue = tag.value;
    }

Context

If node-ethernet-ip is used in Node-RED and eth-ip in and eth-ip out nodes are connected to the same PLC tag, the value is properly written to the PLC but cannot be read back. The reasons for this behaviour are:

  1. In unstageWriteRequest the value of tag.controllerValue is already updated to the new value.
  2. In controller_value the comparison (line 239) if (newValue !== this.state.tag.controllerValue) does not see a difference and there no Changed Event has been emitted.
  3. In Node-RED no message is generated at eth-ip in node.

Steps to Reproduce (for bugs only)

  1. In Node-Red, create a small flow consisting in: numeric to eth-ip in and eth-ip out to text. Both eth-ip nodes are linked to the same PLC DINT tag. Screenshot: Flow
  2. Run it and change the value of numeric node (input) on the dashboard.
  3. Check if the value for the text node (output), it does not change. Dashboard

Your Environment

  • Package version (Use npm list - e.g. 1.0.6): 1.2.5
  • Node Version (Use node --version - e.g. 9.8.0): 12.16.2
  • Operating System and version: Linux raspberrypi 4.19.97-v7+
  • Controller Type (eg 1756-L83E/B): 1769-L32E
  • Controller Firmware (eg 30.11): 20.14

PeterChristen577 avatar May 16 '20 21:05 PeterChristen577