Create a counter for DC output Operation

Hello,
I apologize for the Novice question but i was hoping someone could help with my situation. I created a program for a wastewater treatment that opens and closes a dump valve based on a flowline sonar level indicator. This system also adds chloring to the system at different intervals. Part of our requirement is to calculate the number of tank dumps in a 24 hour period. Is there a built in counter in the groov epic that i can tie to the command valve closed or do i need an external counter to accomplish this. Hope this makes sense.
Thank you

Hi Adam. Welcome to the OptoForums.

In short. No. We don’t have automagic counters for digital outputs.
(Only for most digital inputs).

So, you will need to keep a variable in your PAC Control strategy updated and decide when you are going to reset it (midnight or 9am etc).

Every time you turn it on: dumpCount = dumpCount + 1
And then in a chart that cycles around, or perhaps you already have a chart that does some scheduling, you will need to check for your reset time.
When the time is right dumpCount = 0

TIP: I always found it easier to deal with seconds than actual time, so I made good use of the command Get Seconds Since Midnight .

If your using Codesys, we can get some ideas on how to do the same thing in there.

Feel free to ask any quesitons on this as you set it up.

Hey Ben,
Thanks for the quick response. I was kind of thinking that but i wanted to reach out and ask.
Pretty much my whole program is built in Optoblock so i will work on creating a variable for this purpose. Thanks again and look forward to hopefully seeing you again next time i can get a training scheduled out there.

1 Like