Good programming practice

MikeGranby said:
Transfer all I/O via a mapping layer to internal coils. You can then have a set of rungs to actually map the stuff to real I/O. This makes debugging a lot easire, and allows better isolation from the real world system you're controlling.
Kevbo said:
Please don't take this as a challenge. I'd really like to understand where you are coming from.
It allows you to simulate inputs and to be able to force outputs. Not all PLCs give you the ability to override the status of an input or output. This is also a common practice when dealing with an HMI. Programmers will often have the HMI control a block of data then use the PLC program to map that data to a different location for use in the PLC program. This allows the programmer to easily disable the data coming from the HMI.

OEMs sometimes use this approach as well. They might create one program for a machine that has different options. Then they can use Input/Output mapping to adapt the machine to the one program.
 
Last edited:
I had said...

"My philosophy is... make ALL of your code every bit as complicated, BUT... Only As Complicated... as it really needs to be to produce the most efficient results!

After all, isn't that the real name-of-the-game? Efficiency?

Otherwise... what the hell are we being paid for??? Perhaps for nothing more than providing a fine hat-rack???

Of course, complicating the code just for the sake of complicating the code is ridiculous... and counter-productive."


I'm not speaking of efficiency in the processor... processor speed or processor memory... rather, I'm speaking of the efficiency expected by the employer that is paying you to provide that efficiency!

By all means, gobble-up any processor memory that you might need! Memory is cheap!

Regarding processor time... gobble-up all of the processor time you want, anyway you want... as long as you don't affect the over-all efficiency of the process!

Ahhh... but then... we might only be arguing the difference between oranges that are "navel" and oranges that are "non-navel"... in either case, not much difference from a user's point of view.

Now, regarding the primary statement...

"...make ALL of your code every bit as complicated, BUT... Only As Complicated... as it really needs to be to produce the most efficient results!"

Can you point out exactly what part of that you are having trouble understanding?

In the original post I clearly insinuated that this is supposed to be from the employers point of view; efficiency is everything. And I also explicitely stated that complication for the sake of complication is ridiculous.

What more do you need in this respect?

How about a little bit of classical "Critical Thinking" as you are reading?
At the very least, consider the concept in the message.


Now... regarding Naming Conventions... I had said...

"Maintaining a "naming convention" across any number of systems, just for the sake of maintaining a "naming convention"... might be ludicrous.

If you happen to have the same type of controller in all of your systems, with the same type of software in all of those systems, then you can get away with it... IF your convention is reasonable... that is... RATIONAL!

However, not all controllers, and not all controller softwares, are created the same.

The reason I raise this point is because, all too often, I've seen "names" that were NON-PROCESS-SPECIFIC! They simply followed the... convention, as it were. Did the names really indicate the true meaning? More often than not... no. Because they were NOT Process-Oriented... they were Convention-Oriented."


The point is... many controllers simply can not handle the same naming convention as some others might be able to handle.

If you are unfortunate enough to only have to deal with one controller-type in all of your applications... then yes... as I said, you can get away with that across all of your systems.

Another point... any canned module, from any vendor, is NOT designed specifically for YOUR particular process... how can it be so? It's simply generic.

(Ron should appreciate this...) Imagine... someone comes in from the cold... unfamiliar with the process... he sees a Name... apparently listed by some convention. For him, the convention is meaningless... it makes little sense, if any, in terms of the particular process. He quotes the "Conventional Name" to the operators... the operators look like deers staring into oncoming headlights...

Why is this a problem? Because the "Conventional Name" came from a Standard, of some kind, that has absolutely NO IDEA what you guys are making at that particular plant!

I guess maybe I'm simply addressing the conflict between "cryptic conventional namining" versus explicit "process naming".

Only fools argue over "buzz-word" positions... unless the "buzz-word" is used to explicitely make a particular, uninformed, irrational, point.

By the way... instead of worrying about "ain't"... how about paying attention to the "content", the "concept", of the message?

Ron...
"How do you keep 'em down on the farm... after they've seen Gay Paree?"

Keeping a program simple at the expensive of productivity is simply not acceptable... at least, not for those of us that have "seen Gay Paree!"

OMG... Ron! If your employers were reading this, how do you think that they would feel if they found out that you were sacrificing process efficiency for the sake of keeping the program simple enough for the... program maintainers???

If I was the employer, I would wonder... who is controlling this process? And why isn't he keeping the process running at maximum efficiency? After all, that is what PLCs AND PLC PROGRAMMERS are supposed to provide!

And then, I would wonder... why are my Electricians not up to speed?

The name of the game is Process Efficiency!

Do you get it yet, Ron?

That is all I've been talking about over these last several years. That's all I've been talking about when I said...

"...Only As Complicated... as it really needs to be to produce the most efficient results!"

You better hope your employer ain't listening to this.

By the way Ron, at your place of work, who is primarily responsible for the content of the program?
 
Tark...

Can you elucidate...

"Not all PLCs give you the ability to override the status of an input or output."

Which PLCs in your experience?

Honestly, I'm just curious as to your experience with this problem.
 
Terry Woods said:
I'm not speaking of efficiency in the processor... processor speed or processor memory... rather, I'm speaking of the efficiency expected by the employer that is paying you to provide that efficiency!

You are contradicting yourself….my employer pays me for efficiency…but I don’t give a damn about the other guy who is going to spend hours trying to decipher my program?…what is efficient about that?

Ahhh... but then... we might only be arguing the difference between oranges that are "navel" and oranges that are "non-navel"... in either case, not much difference from a user's point of view.

No we are still lemons to apples on this one

Now, regarding the primary statement...

"...make ALL of your code every bit as complicated, BUT... Only As Complicated... as it really needs to be to produce the most efficient results!"

Can you point out exactly what part of that you are having trouble understanding?

In the original post I clearly insinuated that this is supposed to be from the employers point of view; efficiency is everything. And I also explicitely stated that complication for the sake of complication is ridiculous.

What more do you need in this respect?

Definitions insinuate
verb insinuated, insinuating
1. To suggest or hint (something unpleasant) in an indirect way <---were you using indirect addressing?

1st Why would you insinuate anything?, I have not know you to beat around the bush about anything or hide your true feelings. Insinuation is not efficient.

So I still stand-fast, my employer wants the equipment to have 100% up time, that’s efficient, someone trying to figure out some pathetic program that’s not.

How about a little bit of classical "Critical Thinking" as you are reading?

At the very least, consider the concept in the message.

I did that’s why I said the disclaimer "Not trying to argue with Terry, but I just disagree with you on this."

And I still disagree, the most efficient that I can be and try to be…is buy leaving this place sometime in the early evening….coming back the next morning and all of the equipment is still running

That is all I've been talking about over these last several years. That's all I've been talking about when I said...
"...Only As Complicated... as it really needs to be to produce the most efficient results!"

What don’t you get Terry? My point is... it does not have to be complicated, it can be simple


Keep It Simple Sexy, I’m all for it.
 
Terry Woods said:
Tark...

Can you elucidate...

"Not all PLCs give you the ability to override the status of an input or output."

Which PLCs in your experience?

Honestly, I'm just curious as to your experience with this problem.

The older AD models do not support Override bits, those such as the DL105, D2-230, D3-330, D3-340, D4-430, D4-440.

As far as the naming convention goes, I can give you some information on a personal experience. I was involved on a few projects creating test fixtures for a semiconductor machine manufacture. Before we started on the first project we were handed a 23 page document entitled Software Standards. The document had standards for naming, documentation, required HMI screens, what software could be used, and more. Granted this document wasn’t created for PLC programs, it was for C and C++ programs, it is one of those things you learn in one industry that is worthwhile using in a different industry. The benefit of this document greatly outweighed the time needed to create it. This manufacture has outside contractors creating applications for them along with their own programmers, following this document made it easy to understand and alter existing applications.
 
Last edited:
Kevbo said:
Please don't take this as a challenge. I'd really like to understand where you are coming from.

Could you please elaborate on how/why this makes debugging easier? Seems like one more layer of obfuscation to me. I'm not getting how logically "isolating" the program from the real world makes for a more understandable/maintainable program.

One of the programs I have to maintain was done this way (AND HOW!) and I've lost count of the number of times I've wondered what the origional programmer was smok....ummm....thinking.

Not to interject on Tark's question, but I have a very good example of this and Mike's IO comm mapping approach.

I use Beckhoff remote IO over modbus serial to Unitronics Vision 280 PLCs. I map the Beckhoff IO to two locations : Inputs (MB 3000-3299) and outputs (MB 3300-3499) I reference these when programming, and modbus takes care of the rest.

Now I go in and turn off my modbus reads (inputs) and writes (outputs) for the IO modules. Why?

Because now I can create a simulation IO routine for each station using a few timers and test the entire process without having an actual machine to connect to. This lets me handle major level debug, test my process flow, simulate fault handler logic, all before my engineer has started cutting metal.

Big plus.

TM
 
To everybody who responded - thank you! This little workshop that I'm supposed to do at work has been much improved by your input. Now I have to go over it and make sure it fits in one hour... :)
 
Good Luck, Rhonda!

Git says...
"What don’t you get Terry? My point is... it does not have to be complicated, it can be simple"

Git... as your name clearly indicates... you are in "training"!

Complicated systems sometimes need to employ complicated solutions for particular problems/situations... that is NOT to say that one should employ complicated code where it is not needed... HOWEVER... when complicated code IS REALLY NECESSARY in order to maximize the performance of the process... then by all means, use whatever means are available to DO SO!

Yeah... it would really, really, be great if life was simple... but...

HELLO! HELLO! EARTH CALLING GIT! LIFE AIN'T SIMPLE! Neither is Process Control... especially in the more complex systems!

Git... you ain't been around the block! You simply don't know what is out there!

Of course, OF COURSE... KEEP CODE AS SIMPLE AS POSSIBLE!!!

BUT... when it comes down to designing code for the sake of the Night Shift Guy versus the need/want of the Corporate owners... duh... I wonder... who has to "give" in that equation?

Are you gonna say to your Boss... "No! I'm not gonna do that because Bubba, on the Night-Shift, can't handle it."? Are you really gonna do that?

I don't think so.

So... what happens next? Do you like Bubba? Do you like the rest of those that are not as good as Bubba?

Whether you like Bubba or the near-Bubbas, if you don't want Management to send Bubba, and his friends, down the road then YOU have to give Bubba, and his friends, the tools they need to do what they need to do in order to keep the process going and to keep themselves from being bounced down that damned road!

It doesn't matter one whit how you feel about Bubba and his friends... YOU HAVE AN OBLIGATION TO YOUR FELLOW MAN! YOU HAVE THE POWER TO MAKE HIM LOOK GREAT!!! BY ALL OF THE MEANS AT YOUR INTELLECTUAL DISPOSAL, FOR GOD'S SAKE, DO SO!!!

Making the Operators and Bubba look great only serves to make you a virtual god... at least as far as they are concerned!

Bear in mind that the Operators are under Quota Numbers! You have to satisfy them first!

Then, if a problem occurs that is beyond the the Operators... You have to satisfy the Maintenance Folks!

If you make them both look great then... believe it or not... they will KNOW who has made them look so damned good!

Programming for Automation is a very serious endevour... it involves the lives of normal, everyday, working people! Possibly, your Mom, your Dad, and your Neighbors!

If code is too tough, without providing tools for those that are using or troubleshooting... then it is probably the case that the programmer should be bounced!

I've said it before, and I'll say it again... my first goal is to make the user look good! Then, when things go beyond the user... to make the maintenance folks look good!

In order to do all of that... the programmer has to BUST HIS EVER-LOVING A$$ TO MAKE IT SO!!!!!!!!!!!!!!!!!!!!!

Bear this in mind... always...

Production interests come first...
Then Operators...
Then Maintenance Folks...

At the very end of that line is ease for the programmer.

Any programmer that isn't CONSTANTLY trying to find a better way to execute the process, a better way to help the Operators, a better way to help the Maintenance Folks... is "Not worth his Salt"!

If you have any sense of History at all... for someone to be "Not worth his Salt" means that the particular person is better off being, at least with respect to the larger scheme of things,... Gone, Nada, Zip,... DEAD.

What is it that YOU don't get?

If you are working with an A-B-C, 1-2-3, kinda system... GOOD FOR YOU! You are Lucky! You have the easy-life!

Some of us have to deal with things that are far more complicated than A-B-C.

So, now... WOULD SOMEONE PLEASE KICK THIS SOAP-BOX OUT FROM UNDER MY LEGS NOW, PLEASE???
 
Terry,

Why must you think that you are superior? Its obvious in your response, suggesting that in my process I don’t have complicated equipment? Have you ever seen my place of employment? Do you know even what we do?

I do have a very complicated and sophisticated equipment, I have 3 profibus networks with 7 Siemens 1 HMI, I also have 15ish other stand alone S5’s and S7’s, I have 4 DH+ hwy’s 4-11 nodes on each, 30ish stand alone SLC 504’s and micro logix, 6 panel view’s, 5 Rsview32 apps (3-1500 tags and 2-300) 2 CLX with device net and RIO’s HSC etc, 4 DL06 with ethernet, 8 Redlion HMI’s Ethernet, just to name a few.

and the latest…

3 Mitsubishi’s Q series PLC’s with 4 HMI’s… this one piece of equipment has over 1000 I/Os, it use to take 27 people to do this process now it will take 9, do you think that for one moment that we can automate this process in this fashion and keep it with SIMPLE code?

Well….Yes, someone on PLCS.net made a point some time ago and "said our programs are smart"…hell it may have been you, by well documenting our programs and interfacing our HMI’s in such a way we can help our operators and maintenance staff…If the operator calls for some action but in our program we know that the action can not be completed due to one or more variables not being true…so we write the code in such a manner that it tells them the actual error message…I know that this is not new news to you, but its leading up to my point.

My point… my employer pays me to do the best job that I can, not for ‘me’ but for the equipment, the equipment has to keep running, I don’t get reviewed on the number of programs I wrote last year, but on machine up time. So yes I could write a program in half of the time that it may take me, but unless its well thought out and simple for someone else besides me to understand then its worthless.

Do I think that all of the maintenance staff should be able to the job that I can? I wish, truly I do…so its my responsibility to assist them and make it as SIMPLE as I can.

I think we are both on the correct path, sometimes code is complicated by nature…but I also think that you can not just through out the KISS concept.



On a different note… I was a psychology major before I got into automation, humans by nature are very predictable they are just unreliable, I guess that why I like the manipulation of process equipment, also that’s one of the reasons I enjoy debating with you

The horse is dead…but I have enjoyed it.

regards,
Mark
 
Git said...

"...do you think that for one moment that we can automate this process in this fashion and keep it with SIMPLE code?"

Uhhh... Git... didn't you just make the same point that I have always made regarding K.I.S.S.???

That is, at some point... generally based on those actions/responses required by the process... employing the K.I.S.S. principal just for the sake of the least capable program-maintainer simply doesn't apply anymore... except to the extent that one should always try to keep it as simple as possible, but only as simple as the conditions and requirements allow.

That is nothing more... nothing less... than what I've always said about K.I.S.S.

The point is... the least capable program-maintainer always wants the programmer to Keep It Stupid... (for) Simple.

And of course, as the excellent programmer that you are... your code tells the operators what the problem is before the program-maintainer needs to look at the code... doesn't it?

Which is to say... when a problem occurs... the operator KNOWS the problem, and then the operator simply calls the Maintenace Electrician (whether he is code-capable, or not), or the Maintenance Mechanic (whether he is code-capable, or not), to simply change-out such-n-such.

If that is so... then we are so much on the same page!
 
Terry Woods said:
Git said...

"...do you think that for one moment that we can automate this process in this fashion and keep it with SIMPLE code?"

Uhhh... Git... didn't you just make the same point that I have always made regarding K.I.S.S.???

and on the next line GIT said ..."Well….Yes,"



Terry,

Don’t just skim through my post...its offending to me, also I have subliminal messages encrypted inside and you will not get the full just of it..:angr:

Have a good night
 
Hehe... I tried kicking the soapbox Terry.... But somehow I kept getting the ankles instead....

Good discussion folks. If I had anything meaningful to contribute to one side or the other I would...
 
Object Orineted

CroCop said:
Object Orient your program.
Hoist_N
Hoist_S
Trolley_N
Trolley_S

All operate in basically the same way, so you can use / reuse code to handle the functions, and troubleshoot quickly.

🍻 :unsure:
I asume it wil come with STL. I am new to PLC stuff and I wonder how many of OOP Step 7 really support. Do you have some experience with OOP in Step7?
 

Similar Topics

I'm looking for some starter kits but there aren't so many on the market, so I'm thinking about buying individual components for my needs. I just...
Replies
15
Views
2,463
Good Day Friends! I really want to advance in PLC Programming like our guys here in this forum, and I'm Pleading to all friends here to help by...
Replies
5
Views
2,760
hi al.. i am a bigginer to plc programming..ladder logic can anybody pls suggest the best programming practices using in industries..
Replies
21
Views
5,197
Morning folks--I have been programming in RS 5 and 500 for quite a few years. I need to get proficient in navigating in 5000 and I would like to...
Replies
3
Views
1,797
Hi, Following a large project our company recently finished, I would like to ask what is the best method for object oriented programming. We...
Replies
10
Views
12,441
Back
Top Bottom