Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
skykep opened this issue Sep 9, 2021 · 5 comments

Comments

@skykep
Copy link

skykep commented Sep 9, 2021

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):
@pcnate
Copy link
Contributor

pcnate commented Sep 9, 2021

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

@skykep
Copy link
Author

skykep commented Sep 9, 2021

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

@pcnate
Copy link
Contributor

pcnate commented Sep 10, 2021

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()
}

@skykep
Copy link
Author

skykep commented Sep 10, 2021

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

Great idea. Appreciate your insight.

@jhenson29
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants