Array versus Stack Logic Solver

bernie_carlton

Lifetime Supporting Member + Moderator
Join Date
Apr 2002
Location
Yakima, Washington
Posts
6,412
This ia a response to SCOTTMURPHY's inquiry regarding Alaric's observation in the thread titled 'Push Bottom' (How's that for an intro?)

Ladder Logic in PLC's attempts to emulate in a computer the control functions illustrated in the electrical diagram called a 'ladder diagram' because of the vertical power rails at the left and right side coupled with horizontal cross connections. In general power is switched by various contacts to a final device which may or may not be energized based on the logical connections which preceeded it. An observation is, that in actual wiring, ALL the logic is being solved simultaneously except for transit time of contacts and deliberately introduced timer delays.

A computer's CPU (unless it is a huge multiply parallel device) can only solve one logic connection at a time. The question is how to translate the solution in a way which closely emulates the real world.

One method, used by Modicon and apparently Twido if Alaric's observation is correct, is to plot each logic contact (and this includes wire tying for ANDing and ORing) in a fixed set of memory represented by a rectangular array. Each location hass associated memory points representing INPUTS to the logic and OUTPUTS. The'Array Solver' as Alaric put it (and I hadn't heard this term either) starts in the upper left corner of a group of logical contacts. The solution works DOWN the left hand column until it reaches the bottom of the rectangular area (which Modicon calls a 'network') then continues at the top of the column to the right and works down again. Once it has completed the entire rectangle it continues on to the next network. At each logical square the solver gathers the inputs, solves the simple logic, and sets the outputs to the indicated state. Note, in many networks there may be many squares which have no logic at all. This 'empty' area still takes up memory. Closer to the right hand side of each network are the 'outputs' (real-world or internal conditions).

Another form of ladder solving doesn't really involve a 'ladder' structure at all. The code is just presented in a graphical 'ladder' format for easier entry and understanding. The AB format does include concepts of 'Start of Run (SOR)'. Click on an AB rung to see the actual text involved. Are basically the codes you enter manually plus some (like the Start Of Rung) which are 'entered' by the act of beginning a new rung. The Automation Direct ladder logic doesn't include commands to begin rungs. There are commands however which can only be placed at the left hand rail. The actual commands used can be seen by viewing the 'Mnemonic' form of the code (though it can't be edited directly in this form). In both AB and AD the sequence of solution is the actual sequence of the mnemonic commands which are generated. Part of the solution requires 'remembering' previous logical states as branches are formed then rejoined. The logical states are stored on a 'stack' of which Alaric speaks. The are taken off and used in later portions of the rung, primarily when branches merge again.

The differences between these two methods of solving a group of logic can cause much confusion (believe me, I know) and becomes a vital point to check when evaluating a new PLC. I think I'll let others take over from here, correcting my mistakes as needed.
 
I looked at the Twido document. The TWIDO's ( NON IEC STANDARD ) IL looks straight forward when generated from the ladder. I could not see any evidence of an 'array solver'. The IL that is generated in all examples is what I would expect given their modification to the PLC Open standard. Look at the example at the bottom of page 350. It definately is executing code in the second column and then going back to the first column. Go to page 353. You will see example of stack processing. In the end the AB and TWIDO both have to accomplish the same thing and they will be accomplished in similar ways. AB's stack instructions are BST, NXB, and BND. ( I hope I remembered that right ).

See page 337. It say ladder is stored as IL. IL is solved sequentially. No 'array solver' is necessary.

IEC has a R_TRIG and F_TRIG. It doesn't have a ANDP, ANDF, ORR, ORF, LDR and LDF as the TWIDO documentation suggests. I don't think the PLC Open commitee asked for Telemechanique's opinion either and they are European. Who are these PLC Open guys that make standards without asking the rest of the world?

BTW, I think Telemechnique's extensions are reasonable. It makes coding more straight forward.
 
Peter Nachtwey said:
...I don't think the PLC Open commitee asked for Telemechanique's opinion either and they are European. Who are these PLC Open guys that make standards without asking the rest of the world?
QUOTE]

Peter,
I think that you'll find that Schnieder Electric (brand owners of Telemechanique)are in fact voting members of PLC Open...

http://www.plcopen.org/plcopen/members_voting.htm

...but it doesn't mean to say that the 'members' will always follow the standards!
 

Similar Topics

Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
1
Views
81
I am trying to copy an array of real numbers into a UDT with a real data type element. I have attached a snip below showing my COP instruction...
Replies
4
Views
200
I have an array of 55 REAL values. Is there a way to multiply based on the array location ? I have 55 transfer belts that are equally spaced...
Replies
3
Views
149
Hello everyone, I'm working on a project that involves controlling an array of nozzles within a CNC environment, where the nozzles travel along a...
Replies
5
Views
176
Hi. I'm using a Modbus ProSoft where I basically map data to a big INT array. Example, where GX_I_63HPU is a REAL, MNETC.DATA.WriteData[200] an...
Replies
21
Views
416
Back
Top Bottom