So, the statement that all OTEs and TONs will be reset during a power-up prescan is true no matter if said instructions' routines are called-up within a Program or not...Hmmm...Isn't it?...
No. It's a common misconception that OTE's only hold "on" while they're actively being scanned. It's not the case. Try not to think of an OTE as a relay coil - as much as that's how all of us probably learned, that's not actually the case.
With a relay coil, if the power is cut to it because you turn the panel off (shut the PLC down) or simply pick it up and put it on the shelf (put it in an unused routine), then yes, a physical relay coil will turn off.
But an OTE is not a relay coil. Nor is it a bit. An OTE is an
instruction, with two functions, that
acts on a single BOOL.
The two functions:
1. If the OTE is executed with a TRUE rung-in condition: set the associated BOOL to 1
2. If the OTE is executed with a FALSE rung-in condition: set the associated BOOL to 0
(obviously, prescan is a special case, but I think we've covered that).
The BOOL itself is
not linked to the OTE. Well, I mean, it is, because you've created the OTE instruction and told it to act on that particular BOOL tag. But the BOOL just sits there being either one or zero, indefinitely, unless the OTE (or some other instruction) acts on it to make it something else.
Try it out - if you have an OTE addressing a coil that is turned on, cut-and-paste it (online) into a routine that's not called. Once it's in that routine, you can manipulate the preceding logic however you want - even delete the lot and replace it with just an AFI and your OTE - and the OTE will stay "green" because the BOOL tag is still set to 1. The only way the OTE can set it back to zero, is if the OTE is scanned with a false rung-in condition - and the OTE is not being scanned any more.
I've seen the same thing with indirect addressing. I had an array of UDT's controlling a bank of 8 valves, which fed into 8 silos. I wrote the following line of code (more or less):
Code:
| Seq_Start InfeedValve[SelectedSilo].Open
|------| |--------------------------( )----------------|
...the idea being that whatever silo was selected when the sequence started, the corresponding infeed valve would open. The problem was that sometimes they would change the silo partway through the process. Let's say you start with Silo #1. So My logic effectively becomes OTE InfeedValve[1].Open. So InfeedValve[1].Open - the BOOL tag - is set to 1. But now, if they change to Silo 2, my logic becomes OTE InfeedValve[2].Open. So InfeedValve[2].Open - again, the BOOL tag - is set to 1. But what happened to BOOL tag InfeedValve[1].Open? Nothing. All of a sudden, it has no OTE addressing it in any capacity. So, it'll just sit there being a 1 until some logic comes along to change it. And now I have two valves open.
The "relay coil" analogy is great for getting your head around it to start with, but when you get into fine detail, it can trip you up