PLC Programming.... or what... cars & motorcycles?

Zen......

Zen programming is like using Feng Shui in designing a sawmill. LOL...You must "be" the PLC, Feel the I/O, meditate for hours to get the code just right. This is great stuff!!. :)
 
Anyone else remember that old text book "The Art of Electronics", Horowitz and Hill, 1980 ?

It was a very popular book that graced many a techies bookshelf as I recall, mainly because it was written with passion and an acknowledgment of the creative side of electronic design. looking back I think it's success as a text was in large part to the promise implied in the title.

I got my start many years ago hand taping the photo-layouts for multi-layered PCB's and yes there was an art to that for sure. Some of us could do "it", and others would take three times as long to make something that never "looked" right. Personally I think there is an under acknowledged creative aspect to many technical occupations. For me it is one of the main reasons why I continue to work for myself because just coding to someone else's FD, doesn't do it for me anymore.

Right now for example I am spending some of my own time working on a more elegant solution to a problem for one of my clients. They haven't asked for it, and they probably will never appreciate what it does for them...but I will. Mad? Yes I guess so.
 
I believe many have went on a tangent here about whether PLC programming is art or not or to what level one takes it to.

Terry specifically talks about a process and its fault handling and how one uses the "art" or "zen" or just good programming techniques to achieve a system that functions and checks itself for faults.

OK....
I said....
checks itself for faults
Maybe a bad way of stating it. (n)

I generally try to develop a system that will check itself for proper operation instead. If proper operation does not occur then you are left with a fault.

A PLC program can not be like an operator unless the programmer had the foresight to create his code in a manner that resembles an operator. He would do well to consider mimicking a very good operator.

I love this Terry, well said. So what does the operator do when something does not work correctly? Does he try it again? Does he ignore it? Does he throw up a red flag and quit? Verifing the process step by step and having the PLC program answer questions like these... you are then developing a process that is more human like and can make decisions.
Having a system that can identify its own faults is remarkable!
Not only identify them but handle them.
That is a system that will cure itself!
Indeed!

Is my code pretty? Is it easily understood? Is it commented well? Did I use the really cool instructions that saved me a couple of lines of code? :cool:

I do the best I can but my main concern is testing the process. I would hope when the program is finished and tested that the code would not be needed to be looked at unless additions need to be made.

I think Terry knew what he was doing when he started this topic.;)
I generally don't reply to these 3 or 4 page topics but I like this one. Well written Terry.
 
Last edited:
Eric Nelson said:
Then I guess we'll have to all chip in and buy Terry one of these... ;)

zen.jpg

🍻

-Eric


I got one at my shop with the software and cable ready to ship.
 
I am surprised.

No one has written a book called "The Art of PLC Programming". I searched. I have a seres book written by Donald Knuth a professor and pioneer of computer science. The books are called "The Art of Computer Programming". This series of books are well known by old geezers.

One of the three volumes is called 'Sorting and Searching' and is 700 pages long. There are over 600 pages on just sorting and searching. Prof Knuth's students probably covered one of these books in a year. Just think, 600 pages on just sorting and searching covering the advantages and disadvanges of each method for sorting and search. It is not simply about getting the job done. It is using the optimal technique or algorithm for the job.

So I agree with Terry, there is an 'Art of PLC Programming'. There is so much more than what is discussed on this forum. If is fortunate that most PLC manufacturers know this information and do their best to provide function blocks and operating systems in firmware so the 'average joe' does not need to have a degree to use a PLC.

Has anybody here written a program for a scanning/optimizing veneer lathe?
 
First of all I want to make an apology. I have offended people who I know nothing about. I have no excuse, it was bad behaviour. I also apologise to Phil, next time I will watch my manners on your forum.

Recent posts on this thread have mentioned passion and this is a very apt word when talking about peoples opinion of their own profession. I have very strong views about the way a PLC program should be constructed with relation to the section of industry in which I work. These views are based not only on personal experience throughout the whole project lifecycle (specify, design, implement, commission, and maintain). But also from listening to the views of others. I would judge myself as a professional (outbursts on forums aside), I am passionate about my work, I know my obligations and I believe in doing the 'right' thing.

My biggest obligation is my family and of course it is the most important one. I must care, nuture and provide for them. In order to provide for my family I have a second obligation. This obligation is to the company that employs me. They must profit and grow, they pay me to achieve those goals. The company employs me because they believe that my skill, knowledge and ability are what they need.

That's me, I'm British, I have lived in Japan for 4-5years, my wife is Japanese.

Looking at Terry original post one more time, and ignoring the word "art", he writes of the importance of writing software to "think" like an operator so that faults can be found and displayed. I would like to raise an alternative view.

Logic faults in ladder logic (or whatever flavor you prefer) are defects in the program that are caused by programmer error or by poor specification/design. They don't appear as if by magic, or by memory corruption, or by CPU failure. These logic faults can be prevented, to a limit. The limit, to which steps will be taken to prevent a logic fault, depends on the application (e.g. a nuclear power plant will require more effort than a baggage handling system).

If there is a fault in the logic of the PLC program it should be corrected. The cost of correcting a defect increases the further along the lifecycle of the project. So I would go for prevention rather than cure when it comes to logic faults in PLC programs.

Secondly, I/O failure and how to detect it. How to combat, or whether to combat this, should be decided by risk assessment. Identify the hazard, decide the severity and specify whether steps should be taken and if so, what.

Thirdly, process faults. The purpose of many machines is to reach a certain state in which production takes place. This could be by opening valves, starting motor or regulating a temperature for instance. Instrumentation is necessary to monitor the state of the machine. Too little instrumentation and there is a risk that the product quality will suffer, too much instrumentation and the machine will not be financially viable. The process state must be displayed and in some cases recorded. Terry gives a good description on the requirements for displaying the process state, so I won't contradict him on this.
 
Your apology is not so necessary , however it is honourable . We are all guilty of making comments at times that can be confrontational , I think the important thing in this case , is that if we say something that may give offense , we should be prepared for the reply .
As you can see , this is a very "passionate" subject , and so it should be . For me , whilst the money is really important , the satisfaction of seeing something "just so" is priceless , particularly if I have been involved - of course others don't share this passion , no one person is right or wrong .

I agree with you sentiment that software can be such that it is impossible to run the machine , and I tend to provide a machine with three modes of operation , an AUTO mode , which does just what it says , it is interlocked and looks after itself ; a MAN mode where the operator may operate individual components (to clear a blockage for instance) , but the machine is still interlocked ; and a MAINT mode where , should the technician wish , he can bend the thing in half if desired . I like to add features , such as detector proving ( particularly on a cyclic or repetitive process where the tendancy to "link out" a failed product detector exists)

What ever happens , retain your "passion" - only a few have it .
 
I do know as a programmer?... I guess that's what I'm doing now... I always endeavor to make every section of code I write not just working, but working the BEST WAY POSSIBLE! In other words, the most elegant and aesthetically pleasing solution should be the one used to eliminate the problem, not just the first one you find that works. Many of the questions I post here are along those lines. I am constantly looking for new and better ways to do something, and this is one of the best places around for me to pick someone else's brain.

I am currently trying to implement some of the error tracking techniques Terry talks about so passionately, just because all of our original machines don't have an efficient setup. I'm TIRED of having to go online with a machine somewhere in our plant, so I can tell the other maintenance tech which prox in the operation rung isn't being made.... I WANT the machine to tell them right there!
 
Last edited:
I agree Terry, Having started my profesional life as an electrician and 13 years later becoming an engineer for the past 11 years, my experienced has shown me without a doubt that the gentleman that said he approaches programming from a trouble shooting stand point is dead on the head! When I write PLC logic I spend more time simplifiying it and trying to make it easy to understand with all the relavent data easily viewed then I do on any other part. I once had a professor state "the best designs are those just complicated enough to perform every function needed no more." I have seen alot of programs that I felt the programmer was trying to show us how smart he was, some systems need alot of complexity but don't go further then is necesary to acheive the best results. remember someone who does not know what you were thinking will most likely have to troubleshoot it so do what you can to help him understand, good comments are essential. and always remember Downtime is quite often the highest cost of all your options. Anything you can do to help the service tech understand your program is time well spent. This is where the true programming artist shines!
 
Part of this "Art" is to be "organized".
I find so much logic that is all over the place. I usually do my logic with the rungs sequentially organized into the "steps of the process". I do have a separate subroutine for I/O mapping, alarms, and analog conversions. I am a firm believer in "keeping it simple as possible" to perform the function.

Example..
As part of converting from PLC5 to Controllogix, I am reverse engineering code done for a company by an employed engineering firm that is in house. It appears you can tell they have lots of time on their hands and want to justify their need to be kept "in house".
The engineer mapped in and out of every subroutine and he has 30 subroutines in this logic. A real pain to troubleshoot because the addressees are mapped so many times.
He even had "simulation" logic that was used to test the equipment without certain required conditions met.

I assume he thought he had done some nice "Art". I think the true definition of it being an "Art" is when the next guy comes up to troubleshoot, he can easily understand what is going on.
 
terryp84 and netnathan
Guy's Terry woods has long since retired - I understand he no longer works in the industry or posts here. the very early days when this was still PLCS.net was good fun and many of Terry's diatribes were fun.
Just check the date of the posts please
 

Similar Topics

Hello colleagues, Some time ago I started my adventure with programming. With your help and the courses, things are starting to come together...
Replies
13
Views
680
Dear All, I need a sample PLC program to count the output pulse of a mass flow meter so that a specific amount of mass (for example 100gm)can be...
Replies
2
Views
146
Hi Please I have zeilo smart relay #SR2A201BD but I don't have it's programming cable. Can I use any general usb/rs232 converter? Or need...
Replies
3
Views
150
Hi, Does anyone have thoughts or know of, can point in the right direction any published materials with a plumbing centric point of you explaining...
Replies
1
Views
164
@ All: what is your best guess on a potential range in increase in efficiency in % (i.e. saved programming hours, greater output, etc.) when...
Replies
5
Views
349
Back
Top Bottom