I see that you found a solution to your problem, but I figured I’d post since this seems to come up often in the forms.
Your issue is you have X number of boilers that you need to alternate and you need to do so in such a way that if a boiler is faulted that you don’t try to use that boiler, but instead move on to the next boiler. Here’s an example that I use for pumps that you can apply.
First, I break up my logic into separate programs. I have a program for my Request logic, this is generally part of my Tank program because that’s the object that needs water. I have separate programs for each of my pumps. And I have a program for the Alternator.
Each pump program has a rung that determines if that pump is Available. In my case that rung is – If pump’s HOA is in Auto, and pump is not in Alarm, and pump is not RemoteDisable then pump is Available. RemoteDisable comes from some other logic in the program, it is used to say no matter what don’t run this pump, it is generally used for low level lock-outs and such.
On to the Alternator program. Basically you use counters to determine which pumps (or boilers) to use. There is a counter for each request, so if you have a Lead and Lag request then you need two counters. If you have a Lead, Lead2, Lag, Lag2, Lag3, Lag4, Lag5, and Lag6 then you would use 8 counters. From there we have logic to determine when to increment the counters and logic to determine which pump(s) the Alternator is calling for. The Alternator program is broken down into sections; counters section, increment delays section, increments sections, and pump requests sections.
Here’s the AlternateDelay and counters rungs. I alternate the Alternator 60 seconds after there is no Lead request, this prevents a quick Lead request going Off then back On from causing the Alternator from alternating all the pumps. I also “lock in” the other counters used for the lag pumps at this time. I say “lock in” because once the Lead counter is set, all the other Lag counters are also set. I continue to use the same Lag pumps as long as the Lead request is active, I do not alternate the Lag pumps when the Lag request turns on and off. I also say “lock in” because if a pump becomes not Available, the Alternator will switch the counters which is shown in the logic below. You might be asking why is the UP rung on the AltLag and AltLag2 counters turned off, how do they change then? Those counters’ values are changed with Increment statements below, they are use more as a value holding location. Then why bother using a counter at all? Because it’s one rung that is used to hold a value and reset the value at a preset.
Here’s the number of pumps available and increment delay rungs. The MATH statement is used to determine the number of pumps available. This is used to determine if it’s ok to increment a counter, if you have 8 counters but only 7 available pumps then there’s no need to increment the 8th counter since there’s no pump available for it to use anyways. The increment pump delay timers are used to delay the changing of the counters. If the Alternator is running Pump 1 and it becomes not Available, then I don’t want to immediately start the next available pump, I want the Alternator to delay grabbing the next available pump.
Lead Counter Increment rung. This rung says - If at least one pump is available, and if PumpX is not Available (IncrementDelayTimer.Done) and the Lead counter is asking for PumpX then Increment the Lead counter. So what’s happening is, in the top of the program we use the Lead request to increment the Lead counter (normal Lead request on and off), this rung here is used to increment the Lead counter if it is on a pump that is not Available.
Lag Counter Increment rung. Remember in the first image where all the Lag counter’s UP rungs were turned off, well this is how the Lag counter’s values changes. Here we say – If at least two pumps are available, and if PumpX is not Available and the Lag counter is asking for PumpX then Increment the Lag counter. The last part of the OR is how the Lag counter usually changes to the next pump, it says if the Lag counter is on the same pump as the Lead counter then increment the Lag counter. So, under normal situations (all pumps are available) what happens is the Lead request increments the Lead counter on rung 3 to say pump 1, when we get to this rung and the Lag counter is on pump 1 then the Lag counter will get incremented to pump 2.
Lag 2 Counter Increment rung. This is very similar to the Lag Counter Increment rung except for two things. 1) We check to make sure that there are at least 3 pumps available to use and 2) there’s an additional rung in the OR which checks to make sure the Lag 2 counter isn’t asking for the same pump as the Lag counter. So back to the under normal situations, the Lead request increment the Lead counter on rung 3 to say pump 1, the Lag Counter Increment rung will increment the Lag counter to pump 2 and this rung will increment the Lag 2 counter to pump 3.