Advance to the Rear - Anti-Tie-Down w/o TMR or CTR

Terry Woods

Member
Join Date
Apr 2002
Posts
3,170
This is a Tangent from jefferypb’s thread about Anti-Tie-Down, or is it an Anti-Repeat?

Regardless of what kind of mechanism jefferypb is really asking about, I just had to put some thought into the idea of developing an Anti-Tie-Down with neither a Timer nor a Counter.

I came up with one that uses the "Advance to the Rear" programming method.

Yeah, yeah... it's goofy and not real practical in terms of code-limits. But, as an intellectual exercise, it's interesting and does provide in-sight to the "Advance to the Rear" concept. The “Advance to the Rear” concept is REAL and used more often than some might think! In fact, many use it without knowing that they are! If not carefully orchestrated, this can lead to some pretty ugly spaghetti-code. If used properly, it is quite useful!

In this method (and, in this particular example), if particular conditions don't exist as required, then a module turns ON a particular flag. That flag is used in only one place... that place is the code module preceeding the code module that turned the flag ON.

That means, the fact that the particular flag has changed state won't be "known" by the module that uses it until the next scan. A "later-module" is sending a signal to an "earlier-module" ("later" and "earlier" refer to relative placement in the program).

The "earlier-module" uses the flag from the "later-module" to initiate it's own investigation of conditions. If this "earlier-module" finds a particular set of conditions, then it either performs some action that causes the program to bail-out of the "Advance to the Rear" exercise (the module found the required follow-up conditions), OR, it hasn't found the expected follow-up conditions, and therefore, turns ON its own flag, indicating to the module that preceeds it, that it - the preceeding module, should look for the expected conditions.

In any case, the previous flag from the "later" module is turned OFF.

Imagine that you can see your entire program layed out, top-to-bottom. Then, imagine that View Status is set to watch only those flags. Now, set the processor clock down real slow and activate some initiating condition.

Assuming we have an initiating action, but not the expected follow-up action...

On the first scan (with initiating conditions existing) you will see a "TRUE" indication for the "flag" in the last module.

This means that the last module has looked for, but has not seen, the expected follow-up condition. That flag is like a "baton" in a Relay Race.

The "earlier-module" does not receive (see) the "baton" until the next scan.

When the "earlier-module" does recieve (see) the "baton", then it looks for the expected follow-up conditions. It too fails to see the expected follow-up conditions and, therefore, turns ON its own flag. The "baton" is being passed.

The flag from the "later-module" turns OFF.

As you watch, the "baton" is passed from module-to-module, moving upward (backwards!) through the program. This is the type of action you get with "Advance to the Rear" programming.

Everytime the "baton is passed", one scan-time is consumed.

Now, assuming a scan-time of 10-mSec, the following code provides an Anti-Tie-Down where the buttons must be pushed within 1/2-Sec of each other.

50-modules (scans) X 10-mSec per scan = 1/2-Sec
... don't bother me with any off-by-one issue

If you wanted a 1-Sec window, then you would need 100 modules.

This "Advance to the Rear" exercise begins at the bottom! Go to the bottom of this code and work your way back to the top.

Remember... at any given module, the program must complete the scan before the "baton" is passed to the preceeding module!



MODULE-50:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PB-1 PB-2 PB-2
50 justON Armed ON
---| |---+---| |-------| |-------| |---+---+---(SET)Do CYCYLE
| | +---(RST)PB-1 just ON
| PB-2 PB-1 PB-1 | +---(RST)PB-1 ARMED
| justON Armed ON | +---(RST)PB-2 just ON
+---| |-------| |-------| |---+ +---(RST)PB-2 ARMED
+---( )50 Did it!

50
50 Did It!
---| |-------|/|---------------------------+---(RST)PB-1 just ON
+---(RST)PB-2 just ON
+---(RST)PB-1 ARMED
+---(RST)PB-2 ARMED
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
END MODULE-50:

MODULE-49:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PB-1 PB-2 PB-2
49 justON Armed ON
---| |---+---| |-------| |-------| |---+---+---(SET)Do CYCYLE
| | +---(RST)PB-1 just ON
| PB-2 PB-1 PB-1 | +---(RST)PB-1 ARMED
| justON Armed ON | +---(RST)PB-2 just ON
+---| |-------| |-------| |---+ +---(RST)PB-2 ARMED
+---( )49 Did it!

49
49 Did It!
---| |-------|/|-------------------------------( )50
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
END MODULE-49:

MODULE-48:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PB-1 PB-2 PB-2
48 justON Armed ON
---| |---+---| |-------| |-------| |---+---+---(SET)Do CYCYLE
| | +---(RST)PB-1 just ON
| PB-2 PB-1 PB-1 | +---(RST)PB-1 ARMED
| justON Armed ON | +---(RST)PB-2 just ON
+---| |-------| |-------| |---+ +---(RST)PB-2 ARMED
+---( )48 Did it!

48
48 Did It!
---| |-------|/|-------------------------------( )49
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
END MODULE-48:


Insert duplicate sections of
code for modules (scans) 47 through 3


MODULE-2:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PB-1 PB-2 PB-2
2 justON Armed ON
---| |---+---| |-------| |-------| |---+---+---(SET)Do CYCYLE
| | +---(RST)PB-1 just ON
| PB-2 PB-1 PB-1 | +---(RST)PB-1 ARMED
| justON Armed ON | +---(RST)PB-2 just ON
+---| |-------| |-------| |---+ +---(RST)PB-2 ARMED
+---( )2 Did it!

2
2 Did It!
---| |-------|/|-------------------------------( )3
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
END MODULE-2:

MODULE-1:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PB-1 PB-2 PB-2
1 justON Armed ON
---| |---+---| |-------| |-------| |---+---+---(SET)Do CYCYLE
| | +---(RST)PB-1 just ON
| PB-2 PB-1 PB-1 | +---(RST)PB-1 ARMED
| justON Armed ON | +---(RST)PB-2 just ON
+---| |-------| |-------| |---+ +---(RST)PB-2 ARMED
+---( )1 Did it!

"1 Did It!" indicates follow-up conditions were found.
The cycle is initiated and this "Advance to the Rear" exercise
is discontinued.

1
1 Did It!
---| |-------|/|-------------------------------( )2

If module-1 is active and it didn't find the required
follow-up conditions, module-1 turns ON Flag-2
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
END MODULE-1:


PB-1 PB-1 PB-1
ON Armed just ON
---| |-------| |-------|/|-----------------+---(SET)PB-1 just ON
+---(RST)PB-1 Armed
+---( )Look for PB-2

PB-2 PB-2 PB-2
ON Armed just ON
---| |-------| |-------|/|-----------------+---(SET)PB-2 just ON
+---(RST)PB-2 Armed
+---( )Look for PB-1


Look for Do Machine
PB-1 Cycle Ready
---| |---+---|/|-------| |---------------------( ) 1
|
Look for| "1" is the initiating "flag"
PB-2 | "1" initiates module-1
---| |---+ This "flag" goes ON for 1-scan.




PB-1 PB-1
ON Armed
---|/|-------|/|-------------------------------(SET)PB-1 Armed

PB-2 PB-2
ON Armed
---|/|-------|/|-------------------------------(SET)PB-2 Armed




Once "Do CYCLE" goes TRUE, the "Do Cycle Module" can monitor the PB's to see that they are held as required during the cycyle.

"Do Cycle" is reset when the cycle is done, or E-Stop or whatever.

Other conditionals can be added to modules, as required, to make this code more-perfect.
 

Similar Topics

I'm a bit stuck again... See the redacted picture. At the moment, pressing F7 saves the "live" laser measurement into the boxes indicated by the...
Replies
9
Views
1,073
I have 2 TIA Wincc projects. One project is in TIA V17 Wincc Professional and other project is in TIA V15 Wincc Advance. How can I copy the Wincc...
Replies
1
Views
1,246
Is it possible to convert the project in Wincc Professional to Wincc advance?
Replies
6
Views
1,793
I have a tia v17 project in laptop. I prepared a PC to be used as HMI. In Tıa projecy there is wincc advance. How can I transfer this wincc...
Replies
1
Views
1,363
Does anyone know where I can order a T9110 SIS processor from? Seems like the availability of them online is scarce.
Replies
4
Views
1,893
Back
Top Bottom