cmseaton42 / node-ethernet-ip

A Lightweight Ethernet/IP API written to interface with Rockwell ControlLogix/CompactLogix Controllers.
MIT License
263 stars 105 forks source link

Improvement for scan_rate #69

Open PeterChristen577 opened 4 years ago

PeterChristen577 commented 4 years ago

Using ethernet-ip in Node-RED, I did some analysis of the realtime behaviour using Wireshark. There I have seen the real scan rate (320 ms) does not match the setup in the project (200 ms). Before the scan rate set up as the time delay between the last resonse of the PLC and the next request. In case of longer tag list (up to 30 tags), there are two tag groups exchanged. Now there is a timer used that triggers the start of the request more precise.

Description, Motivation, and Context

The use of "delay" does no provide a scan_rate who meets the value setup, even if the tag list is longer as e.g. 30 tags.

How Has This Been Tested?

PLC: CompactLogix L32E Host 1: PC with Windows 10 and Node.js 12.16.2 (x64) Host 2: Raspberry PI with Raspian and Node-RED v1.0.5 Ethernet packet captured with Wireshark.

Screenshots (if appropriate):

image

Types of changes

Checklist:

Related Issue

alex-controlx commented 4 years ago

scan_rate designed to create a safe delay between the scan requests. Also setting an interval on external communications is bad practice. On a poor network it can end up with number of sent requests without responses. Also if I have 1000 tags to scan then request/response time might take longer that setInterval delay which will cause sending another request of 1000 tags without receiving response for the first batch. Also timer variable is created locally. What if I want to pause the scan out of the scan method.

If you need to get the responses faster, I would suggest just to reduce the delay: the scan_rate.

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 152


Totals Coverage Status
Change from base Build 141: 0.1%
Covered Lines: 475
Relevant Lines: 886

đź’› - Coveralls