You want logic to control three pieces of logic:
- the first piece chooses the numberof pumps that should be running
- if there are only two pumps, and at most one should be running at any time, then this is a simple start/stop circuit pattern logic, which you probably already know, controlling the value of one bit, let's call that bit Run
- the second piece chooses which pump should run when the number of pumps that should be running is not zero
- if there are only two pumps, then this is modeled with a single bit
- Let's call that bit Pump2_is_Lead
- When that bit's value is 1, then Pump 2 is the lead pump, and Pump 1 is the lag pump (and will not run)
- When that bit's value is 0, then Pump 1 is the lead pump, and Pump 2 is the lag pump (and will not run)
- Changing that bit a simple flip/flop circuit that responds to the rising edge (one-shot) of an HMI button press
- see this thread: One Input, Alternating two outputs, RSLogix 5000,
- or search the forum for Alternating Outputs, flip-flop, wig-wag, etc.
- for the rising edge/one-shot, the best way to do that is the "Set-and-Forget HMI/PLC" pattern i.e. have the HMI only write a 1 to a PLC memory bit from the HMI on a button press, and, after the PLC uses that 1 to trigger the flip-flop, have the PLC always write a 0 to that same bit
- The third piece actually runs one of the pumps:
- if the value of bit Run is 1, and the value of bit Pump2_is_Lead is 1, then run Pump 2, and don't run Pump 1
- if the value of bit Run is 1, and the value of bit Pump2_is_Lead is 0, then run Pump 1, and don't run Pump 2
- if the value of bit Run is 0, then don't run either pump
- That is pretty trivial logic, and is left as an exercise
The trick here is "separation of concerns" i.e. isolating
- control of when to run any pump, from
- control of which pump to run
And then combining those isolated models to actually run a pump