drbitboy
Lifetime Supporting Member
Using bit 0 as a proxy for even/odd is "creative?" Am I that non-normative ?
Assuming @robertmee has it correct (a/c alternating b/c until last day of schedule, then c only until the reset after day 7). I agree it can be done either way i.e. with [CTU C5:n] or [ONS ADD N7:n]. So the choice should be which is easier to debug.
ONS+ADD integer pro/CTU con
The logic to choose the pump is far more concise with niceties like /DN of the CTU and bit 0 for even/odd (left), but the brute force approach is still quite readable without them (right).
Assuming @robertmee has it correct (a/c alternating b/c until last day of schedule, then c only until the reset after day 7). I agree it can be done either way i.e. with [CTU C5:n] or [ONS ADD N7:n]. So the choice should be which is easier to debug.
ONS+ADD integer pro/CTU con
- 1-based logic for days 1-7
- No need to know the number of days in the schedule to know if the schedule is past, as rotary discrete inputs can be used directly (see second image below) when comparing the integers to choose A vs. B.
- the oneshot is built in
- The CTU also provides the /DN bit, so simple XIC/XIO are used instead of integers compare
- CTU keeps counting after /DN becomes 1; CTU can have its preset be the number of days in the schedule, but CTU does not reset until it reach 7; then A/C or B/C when XIO C5:n/DN is much cleaner than all of those complex EQUs:
The logic to choose the pump is far more concise with niceties like /DN of the CTU and bit 0 for even/odd (left), but the brute force approach is still quite readable without them (right).