need opinion's on this progamming style

eastkodakguy

Member
Join Date
May 2002
Location
Fayetteville, Arkansas
Posts
96
The attached file from some of my plc code. I deleted all files but two just so I couldnt get in trouble from my company for sharing my code. The code is in state logic and both my previous and present job required we do our programming in this style. I have never tried this style of programming on a continous process and was wondering if it would hold up. It works fine for sequential machines and batch type processes. I also know this type seems to take up alot of memory, but I have never had any problems with scan time. Just let me know what some of you pros out there seem to think of it. I have included comments in the program to give you a little idea of how the state logic works and the structure of the program

Software is RSLogix 500 Ver 6.00.

also I dont have any fault code in I normally put it in there so I can have all of my faults for that part of the machine/process in the same file with the actual logic
 
Last edited:
EKG

Since no one has spoken up, I'll take the floor.

It's apparent that this program ain't your first rodeo. I'm curious how long you've been at it and how did you learn? If this is your program and it works, well done. BTW is it a program for a bottle palletizer?

The are as many different programming styles as there are programmers. Outside of the obvious--"Does it work?", basic rules (not including today's hot topic--Safety) for programming obviously include the ability to document intelligently what the logic is supposed to do. You appear to have comments and descriptors, which personally, I cannot overemphasize the importance of. You could get hit by a bus tomorrow and your program needs to be understandable for the next guy.
Some folks might disagree with me on this but I try to streamline the program as much as possible. You stated your company makes you program a certain way and it did seem to be "chunky". You also stated that scan rates were not an issue. You gotta follow the rules or program somewhere else, huh?
It might be more enlightening to see the whole program, but I understand why it's not possible.
That's my opinion.
 
I've seen a couple of variations on this method and don't have anything too negative to say about it. The main caveat I would have is that the program documentation should include a flow chart or Venn diagram to plainly illustrate what the code achieves. With that, it is easy for others to follow and/or modify the sequence.

I don't see any benefit from the "input routing" (input buffering) section. Is that a carry-over from using PLC5's with RIO?

My preference would be to use SFC's for this type of logic - the flow is obvious from the diagram (which is the program), plus you get real time monitoring of where in the sequence the machine is (no scrolling around dozens of rungs). But, of course, you can't do that on an SLC.

For continuous processes - you might use the method to sequence start-up and shut-down and maybe fault action, but most likely normal running would be just one state with control loops active.
 
Thanks Rube, and Gerry

Rube,
I been programming mostly small projects for a little over 2 years. It wasn't until I joined my current company that I started to do alot of larger projects. Mostly programming several sections to larger projects. This form of state logic is useful because several different people can work on the same program at the same time. The only thing that needs to be added once everyone is done is the internal hand shakes from each file to file (i.e carriage needs to know when to push the product onto the hoist.) and yes its a type of high level bottle palletizer/row pusher. Mostly plastic bottles in the 1 gallon range. State logic does take some of the creativity out of it. I first learned of state logic while working at kodak. I took a full weeks worth of class put on by kodak mostly learning to draw state diagrams, then applying it to the actual logic. It was ok but for every latch you would have an unlatch. So it pretty much doubled the number or rungs.The person that taught me this is a former Kodak employee also. I also normally put a state diagram illustrating the current state the machine is in on the HMI/touchscreen. But even after training the operator still has no clue to what it means. When I see a problem I can normally pinpoint it to a section of the process then look up the state diagram for that section. Also Rube I am making a program right now for a similar machine. More of a freelance project I can send it to you when I am done along with the state diagram. As far as the part I showed you it works. The machine was installed and is now up and running without any problems.You would be suprised see how few problems there are with the code once its put into a machine Another thing that I like is I can pretty much do all of the symbols, addresses, descriptors in excel then import into RSLogix. When I actually start writting code everything is done its just a matter of selecting the write instructions, and symbols. I think this can only be done with RSLogix Pro.
Gerry,
Thats a good idea of putting a state diagram in the programming documentation. I myself could do without the input routing and the action logic(where the states actually drive an internal bit that which inturn drives a real world output. As for SFC's I disagree with you. Me and a former co-worker argued all the time I said SFC's where better. I think SFC's are great for a constant sequence where nothing differentiates. but "What If" the operator moves/jogs something manually or removes product from the machine etc. Maybe I don't fully grasp SFC's but doesnt it go from state 1, state 2, state 3 etc in a sequential operation. I thought SFC's could not go from a say state 2 back to state 1 or if its in state 3 it could go to state 5, 6 or 7. Maybe you could clear up the subject. I have only used it in Rockwells software. As for a continuous process I was thinking along the same lines as you are maybe
STATE 1- OFF/LOST
STATE 2- START/RUNNING(PROCESS LOOPS ACTIVE ETC)
STATE 3- IDLE
STATE 4- FAULT ROUTINE
anyhoo I should run
If anyone else has opinion's please express them both good and bad
 
As for SFC's I disagree with you. Me and a former co-worker argued all the time I said SFC's where better. I think SFC's are great for a constant sequence where nothing differentiates. but "What If" the operator moves/jogs something manually or removes product from the machine etc. Maybe I don't fully grasp SFC's but doesnt it go from state 1, state 2, state 3 etc in a sequential operation. I thought SFC's could not go from a say state 2 back to state 1 or if its in state 3 it could go to state 5, 6 or 7. Maybe you could clear up the subject.
As with any paradigm, it takes time and experience to appreciate how to achieve the desired results and also if and when to use the paradigm. You can branch and loop and jump within an SFC, so there's no question that the same sequences can be achieved as in the state diagram. However, the chart may appear more complex.

I am also only familiar with AB's version(s) of SFC. They got a bad name from the implementations in the 'classic' PLC5's and the PLC5-250. When the 'real deal' came out in the 'new platform' PLC5's most people didn't know or didn't care anymore. The CLX version is very similar to the NP5, but necessarily different to accommodate the nature of CLX.

AB had a brief flirtation with state control when they introduced the SDS (smart directed sequencer) instruction on the PLC5 and PLC5-250. It provided a direct implementation of a state diagram with powerful diagnostic and initialization features. No idea why they abandoned it.
 

Similar Topics

Hi everyone. I'm working on a new simulator to help teach troubleshooting skills. The goal would be to simulate an operational machine and then...
Replies
0
Views
1,478
The 14 gauge wires don't fit in the 1/4hp 208 atv320 drives with ferrels. Panel shop said UL strictly forbids using 16 gauge. why?
Replies
32
Views
7,551
hello all.... i have a problem with electrical motor ..this may out of the box from plc but i guess all of you in here are genuis..here it goes...
Replies
25
Views
3,864
In planning stage to data collect OEE performance of entire plant in stages of work cells. Would like opinion from previous experience of what...
Replies
4
Views
3,377
We are trying to poll data coming from a PLC for remote monitoring we have the IP address of the PLC and the default port number and the path is...
Replies
25
Views
418
Back
Top Bottom