You can decide which one to start by comparing the total amount of time each pump has run. That's a job for a totalizer.
Here are two key things to know about totalizing with Opto 22's SNAP PAC System:
- First, both analog and digital totalizers are built-in features in SNAP PAC I/O processors (brains and rack-mounted controllers). So there's no need to buy one.
- Second, totalizer commands are built into PAC Control, so you can easily use them in your control strategy running on a SNAP PAC controller.
So how do we begin? We start by wiring the four pumps to a 4-point SNAP digital input module, like the SNAP-IAC5. (We choose a 4-point module, not a high-density digital module, so the totalizer feature is available.)
When we configure the four points in PAC Control, we make sure to choose Totalizer as a point feature. Once the feature is configured, the brain automatically begins tracking the total amount of time the point is on and the total amount of time the point is off. These values continue to increase for 4.97 days, at which point they roll over and start again at zero.
Now on to our control strategy. In this application we're interested in how long the pumps have been on, so the commands Get On-Time Totalizer and Get & Restart On-Time Totalizer are the ones to look at. (There are also commands for off-time totalizers, which could help indicate down-time. But that's another issue.)
The command details in the Command Help or PAC Control Command Reference show us that the brain returns to the controller a float representing seconds, with a resolution of 100 microseconds. For our pump application that maximum duration of 4.97 days might be a problem.
So we'll use Get & Restart On-Time Totalizer to read the totalized values for each pump every minute and reset them to zero. Then for each point we add the new value we just read to a variable that holds the cumulative total. These variables we keep in a float table, and we make the table persistent so the values can't be lost, even if power to the controller is lost.
Once we compare these totalized values for each pump, we can determine which one to start.
A recent OptoForum post provides some sample code to help you build this kind of logic in your own strategy. Take a look, and add your own refinements to the Forum.