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

Possible for multiple scan rates without creating a "new" controller for each one?

Open skykep opened this issue 2 years ago • 5 comments

Current Behavior

Expected Behavior

Possible Solution (Optional)

Context

Steps to Reproduce (for bugs only)

Your Environment

  • Package version (Use npm list - e.g. 1.0.6):
  • Node Version (Use node --version - e.g. 9.8.0):
  • Operating System and version:
  • Controller Type (eg 1756-L83E/B):
  • Controller Firmware (eg 30.11):

skykep avatar Sep 09 '21 19:09 skykep

I would say yes. Write your own function that performs a read based upon the scan rate timeout you wish to have.

pcnate avatar Sep 09 '21 19:09 pcnate

I meant natively rather than using setInterval to perform individual reads, which is less efficient than subscriptions.

skykep avatar Sep 09 '21 19:09 skykep

I wouldn't use a setInterval. track the last time each tag was read and then get the oldest one most needing to be read. Add several to a tag group and read the tag group is also an option. A feature request for this library may be to add a scan rate to tag groups.


while( true ) {
  await getNextTagThatIsAgedEnough()
  await readThatTag()
  await extraDelayWhenNoTags()
}

pcnate avatar Sep 10 '21 14:09 pcnate

A feature request for this library may be to add a scan rate to tag groups.

Great idea. Appreciate your insight.

skykep avatar Sep 10 '21 14:09 skykep

I always just read tag groups in a loop with a delay, similar to what Nate shows. But I do end up setting up different controllers for each tag group and even run each controller on its own server. Usually 4 total for my standard HMI framework. But some of that may be specific for my application.

jhenson29 avatar Sep 11 '21 01:09 jhenson29