You are not registered yet. Please click here to register!

plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!

Go Back - Interactive Q & A > - Interactive Q & A > LIVE PLC Questions And Answers

Thread Tools Display Modes
Old January 3rd, 2006, 10:54 PM   #1
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
bernie_carlton's Avatar
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,389
Array versus Stack Logic Solver

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.
Controlling outputs is the PLC's way of getting its inputs to change.
  Reply With Quote
Old January 4th, 2006, 04:59 AM   #2
Peter Nachtwey
United States

Peter Nachtwey is offline
Peter Nachtwey's Avatar
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,098
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.
  Reply With Quote
Old January 4th, 2006, 07:22 AM   #3
United Kingdom

Paulus is offline
Paulus's Avatar
Join Date: May 2004
Location: Portsmouth
Posts: 416
[QUOTE=Peter Nachtwey]...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?

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

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


"Nobody notices what I do, until I do it wrong"
  Reply With Quote
Jump to Live PLC Question and Answer Forum

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Logic Stack randy LIVE PLC Questions And Answers 0 December 13th, 2005 12:40 PM
B984-100 High Speed Logic Solver CONTROLTESTGUY LIVE PLC Questions And Answers 0 November 22nd, 2005 09:43 AM
Latching One shots? sportster LIVE PLC Questions And Answers 25 October 10th, 2005 10:36 AM
Allen-Bradley “Latches” vs. Direct Logic “Sets” ... round 1 ... Ron Beaufort LIVE PLC Questions And Answers 38 May 18th, 2005 09:52 AM
Building an S7 Array Move Questions DesertDog LIVE PLC Questions And Answers 19 June 17th, 2004 11:51 AM

All times are GMT -4. The time now is 09:26 AM.