Structured text - permissive redundancy

Snap25

Lifetime Supporting Member
Join Date
Dec 2014
Location
Michigan
Posts
237
I'm going over a few ST subroutines I added to a task a few months ago. I noticed somethings that I didn't catch when I wrote it..

I was adding so many redundant permissive bits for some reason. Since then, I've been making a point to write cleaner code and wanted to get everyone's opinion on how they structure routines..

For example, In the code I just mentioned, I was adding high/low level interlocks in my IF statement to run a certain mode.. I was also adding the same interlock in my "IF run_mode_active" statement to open Valve A.

Do any of your interlocks that are in your Start/Stop logic anywhere else, sequencing logic, output permissive?

Hopefully this is making sense, I've been drinking!
 
I guess what I'm saying, I'm having a hard time deciding the best way to organize the code. I'm trying to eliminate hoping around from sheet to sheet and avoid creating or using redundant tags and variables.
 
Before coding anything, look at which devices you'll be controlling.
Draw a box and put inputs and outputs you'll need. Inside the box put the variables you'll need such as latches or timers. Also, put in as inputs limits and configuration values for alarms and so on.
Doing this will take time, but you'll have re-usable code in blocks. In Siemens world, these would be FB's, in AB they'll be AOI's.

Siemens lends itself to data structuring natively with the instance DB's, but AB is not as straightforward as I understand it. But try to have a structure per device where you keep your variables instead of just adding variables.

On my valve or motor block I would put in a permissive input and a interlock input. The permissive will allow the operation to be started and any subsequent change will not affect the device. The interlock will stop the device straightaway no matter what.
You can, if you are so inclined, put in yet another input called protection where the device will only be active if you reset the fault via the screen.
These descriptions aren't mine, I was introduced to them when working with PCS7 and use them myself now.
 

Similar Topics

Hello, I am using studio 5000 pro and am trying to figure out the structured text. Here's my scenario: An operator scans a barcode, the barcode...
Replies
15
Views
303
I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
423
Good evening. I display the step number of a SFC on a display. Sometimes, on a trip, it goes quickly through many steps and I need to prove to...
Replies
1
Views
160
I am trying to set up a piece of equipment with a Horner HE-X4R. I'd like to use structured text and so far I'm just trying to get a basic On/off...
Replies
0
Views
93
Good morning. I'm doing a rehab and I need to recycle some part of the old code that won't change and that I need. This is a calculation that...
Replies
22
Views
1,402
Back
Top Bottom