doctord - As far as using CCW - what would you recommend instead?
Anyway, I think I figured this out. It still involved some other unexpected behavior (meaning behavior that I think is wrong). I *think* the INT ValveState was getting temporarily set to 1 earlier in the program (but then reset to 5 so it would show up as 5, but not in time to trigger setting valve6 to true). It *shouldn't* have been getting set to 1 though.
I'm attaching a screenshot of a revision I made to the part of the code that I think was causing the problem. The intent of rung 2 is that in State 1, if TankSwapping and ManualGasControl are both false, then ValveState gets set to 1. That was originally being done as part of rung 1 (which resets a bunch of booleans to false if State is 1). Previously I had the MOV command for valveState in rung 1, with the two reverse contacts before it. It should have worked the same (for resetting the coils that are still in rung 1 I don't really care about the status of tankSwapping and ManualGasControl, so I just removed those from there). In the test I've been doing, TankSwapping is getting set to true - so that reverse contact should not be passing.
Initially I just removed the MOV command from rung 1 for resetting ValveState to 1 when those conditions were met, and the problem went away. The valves now get set properly. So it seems like ValveState must have been getting set to 1 from that rung - but it *shouldn't* have been because TankSwapping was true.
Am I misunderstanding reverse contacts? I am viewing them as basically like a direct contact except checking to make sure that the boolean is false. So, in what is now rung 2, if State = 1 and both Tankswapping and ManualGasControl are false, then ValveState gets set to 1.
Since I do want ValveState to get set to 1 when TanKSwapping is not true, I made a separate rung to do that, and it still works fine. But from my point of view it's not logically any different than what it was before, when it wasn't working. I just separated out the MOV command (and took the reverse contacts with it, since I don't care about them for the reset coils that are still in rung 1).