ControlLogix structured text translation

Join Date
Apr 2021
Location
Nebraska
Posts
7
I am troubleshooting an issue on a controller with logic, function block and structured text. I am lost on how to read the structured text as ladder logic. I'm guessing the 1st line would read something like IF XIO tag1 THEN OTE tag2. No idea on the 2nd line with the :=NOT.

Screenshot_20210511-104431_Gallery.jpg
 
I am lost on how to read the structured text as ladder logic. I'm guessing the 1st line would read something like IF XIO tag1 THEN OTE tag2. No idea on the 2nd line with the :=NOT.

Don't expect to 'read the structured text as ladder logic' any more than you could look at some Greek and read it as English. If you know Greek you could translate it into equivalent English, and if you know ST you can translate to equivalent LAD, but the idea that you can read one as the other is rather absurd. They're different languages (albeit much more closely related than my Greek/English example); simple lines of code such as what you post may translate straightforwardly but at some point you need to actually know the language you're reading.

Your comparison of the IF NOT statement to an XIO is not completely wrong, but the key difference is that when the statement evaluates to false then nothing on that branch of the IF statement will be further considered at all -- think more like an OTL/OTU than an OTE.

The := is the assignment operator -- it assigns the value of whatever's on the right side to whatever tag is on the left. NOT is simply an inverter, changing TRUE to FALSE and vice-versa.

So IF iwUIByp.0 is TRUE, THEN set zwOut.0 to 0, and if iwUIByp.0 is FALSE (ELSE), then instead [do the following line].

Nested IF statements like this can be annoying to parse; you may find it useful to write a truth table for all values being considered in IF statements
and note what happens in each case.
 
Last edited:
Do you mean you want to convert this to ladder?


If yes, and you want to do a literal-as-possible translation, then these are all going to have to be Set/Reset (Latch/Unlatch; OTL/OTU) or equivalent, because if qxOut is 0 then the value of zwOut.0 will not be changed.


Is there a third END_IF just out of frame? Because if it's an ELSE instead then there is not enough information here.



I you want to use a single OTE to assign the value to zwOut.0 instead of several OTL/OTUs, then the rungs and branches feeding to that OTE might be near-incomprehensible, so I suggest putting the ST code in the comment.


Is this a homework problem?
 
Do you mean you want to convert this to ladder?


If yes, and you want to do a literal-as-possible translation, then these are all going to have to be Set/Reset (Latch/Unlatch; OTL/OTU) or equivalent, because if qxOut is 0 then the value of zwOut.0 will not be changed.


Is there a third END_IF just out of frame? Because if it's an ELSE instead then there is not enough information here.



I you want to use a single OTE to assign the value to zwOut.0 instead of several OTL/OTUs, then the rungs and branches feeding to that OTE might be near-incomprehensible, so I suggest putting the ST code in the comment.


Is this a homework problem?
Not a homework problem. Its an incomplete instalation we are running anyways. There is more after the bottom END IF but is a repaeat of the 1st line with .0 replaced with .1 in the tag names.


I don't understand how to read the 2nd line. What does
"If iwUIInv.0 THEN zwOut.0:= NOT ixIn00" mean? When was zwOut.0 = ixIn00 for it to be NOT = to it when iwUIInv.0? If [this] then [this thing] is equal to not [this other thing]? That's what it reads to me and why I wanted to see it as ladder logic because I can't be reading that right as it makes no sense.
 
What does If iwUIInv.0 THEN zwOut.0:= NOT ixIn00" mean? When was zwOut.0 = ixIn00 for it to be NOT = to it when iwUIInv.0? If [this] then [this thing] is equal to not [this other thing]?

As I stated above, := is an assignment operator, not a comparison, and NOT is an inverter. 'IF iwUIInv.0 THEN zwOut.0 := NOT ixIn00' means to check if iwUIInv.0 is true (1) and if so then set zwOut.0 to the opposite of the value in ixIn00.
 
The structured text is the better way to do it.
That said, here's a single-rung ladder implementation. Not many of us like to see so many sets/resets, but perhaps acceptable on a single rung:

Code:
---|/|---------| |-----------------------------------------(R)-----
  qxOut   |  iwUIByp.0                                    zwOut.0
          |  
          `----|/|-------------| |-------------| |---------(R)-----
             iwUIByp.0   |    iwUIInv.0  |    ixIn00      zwOut.0
                         |               |
                         |                `----|/|---------(S)-----
                         |                    ixIn00      zwOut.0
                         |
                         `-----|/|-------------| |---------(S)-----
                             iwUIInv.0    |   ixIn00      zwOut.0
                                          |
                                          `----|/|---------(R)-----
                                              ixIn00      zwOut.0

-Trevor
 
I don't understand how to read the 2nd line. What does
"If iwUIInv.0 THEN zwOut.0:= NOT ixIn00" mean? When was zwOut.0 = ixIn00 for it to be NOT = to it when iwUIInv.0? If [this] then [this thing] is equal to not [this other thing]? That's what it reads to me and why I wanted to see it as ladder logic because I can't be reading that right as it makes no sense.

The NOT used in "NOT ixIn00" is a boolean operator. Does this make sense:

If the zeroith bit of iwUIInv is 1, then set the zeroith bit of zwOut to the opposite of ixIn00. (i.e. if ixIn00 is 1, set zwOut.0 to 0; if ixIn00 is 0 then set zwOut.0 to 1)
 
Last edited:
I think this is a correct translation using an OTE, but I don't have the time to guarantee it.
Code:
     qxOut    zwOut.0                                zwOut.0
--+---] [-------] [-------------------------------+----( )-----
  |                                               |
  |  qxOut   iwUIIByp.0    [COLOR=Blue][B] iwUIInv.0  ixInv00    [/B][/COLOR]|
  +---]/[-------]/[------+---[COLOR=blue][B]--] [-------]/[----[/B][/COLOR]--+
                         |                        |
                         |  iwUIInv.0  ixInv00    |
                         +-----]/[-------] [------+
The section in bold blue implements the [If iwUIInv.0 THEN zwOut.0:= NOT ixIn00] logic.

I would not use this without the source ST in the rung comments as provenance, plus some text explaining the logic (e.g. [1] if output qxOut is 1, then do not change zwOut.0; [ii] if qxOut is 0, then ..., with descriptive names for the tags e.g. "if [QX Valve] is open (qxOut=1), then ...").
 
Last edited:
Thanks a ton everyone! I should be able to understand it now.


Basically we ere not able to run our new material handler and a particular existing conveyor belt at the same time and I wanted to drill down and get an understanding of what exactly a status running bit for that conveyor actually does in this project containing function block and structured text. After chasing down the tag for this conveyor running bit it lead to an add on instruction that had structioed text in place of ladder logic. I wanted to see within the add on instruction to know how it works and to familarize myself with this project and structured text in general.
 

Similar Topics

I am trying to learn structured text on the controllogix platform and have managed to fault the processor by creating an infinite loop. My problem...
Replies
21
Views
3,709
With this upcoming project, since I am really a "C"/"C++" programmer and *not* a PLC/Ladder programmer, I would like to use Structured Text for my...
Replies
80
Views
26,188
this is almost certainly a wild goose chase – but I've GOT to give it a try ... I have a question – and I'm pretty sure that there is no...
Replies
11
Views
6,347
I need to move values from a UDT to a new array. Currently I am using: HMI_BZ_PS[00] := XtrA_Bz1.PS; HMI_BZ_PS[01] := XtrA_Bz2.PS; HMI_BZ_PS[02]...
Replies
4
Views
1,822
For RSLogix 5000, Which software do we need to install in order to work with Functional Block Diagram and with Structured Text ? Currently I can...
Replies
6
Views
4,560
Back
Top Bottom