# Programming PLCs



## Black Dog (Oct 16, 2011)

Welcome aboard.:thumbsup:


----------



## JRaef (Mar 23, 2009)

tclupp said:


> Hello, I'm still very new to PLC but they do intrigue me and something I may look to pursue as I continue my electrical career.
> 
> Learning them in school they made sense and however the projects we do aren't very complicated it lead me to a question. How do they apply to the real world.
> 
> ...


As a general rule, the term "Electrical Contractor" can be applied to plenty of tradesmen, perfectly qualified for many types of work, who would have no business programming a PLC to safely operate a machine. On the other hand many do and in fact many who frequent this forum are very competent. It's kind of a specialty skill that is very valuable if you are doing industrial work, almost completely useless if you are not, and commercial work falls somewhere between.

As again, a generality, the process is that if someone wants to implement a PLC to control a machine, you start with a sequence of operations from someone who knows what the machine must do. Then you break that down into a series of tasks and begin writing little sub routines that accomplish those tasks individually. You then start to tie those sub routines together, along with their interactions, into a larger program.

But no, there are no software programs that do that for you. We use software to WRITE the programs, i.e. create the operating machine code from commands we understand, and we can use automated software to TEST a program we write, but not DESIGN a program from scratch. That's what we humans are for.

When the machines start to design themselves without us, you end up with SkyNet...


----------



## Jlarson (Jun 28, 2009)

Planning pad and white board.

Lots of notes, block diagrams and flow charts.


----------



## 51360 (Jun 9, 2014)

tclupp said:


> Hello, I'm still very new to PLC but they do intrigue me and something I may look to pursue as I continue my electrical career.
> 
> Learning them in school they made sense and however the projects we do aren't very complicated it lead me to a question. How do they apply to the real world.
> 
> ...


Everyone who has worked, or still works with PLCs, including programming, will have taken a different path to working in that field. Some are Electrical Engineers, some are college graduates, and many are electricians with maintenance experience using PLCs for troubleshooting, whom have later taken added training to advance their careers.

It's been my experience that Engineering firms, or consulting firms, do the design and PLC programming. Contractors are hired to install the equipment, pull and terminate the cables, and later help with the commissioning.

If it's something you want to do, you have many options. Choose one that suits you.

Good luck! :thumbsup:

Borgi


----------



## ScooterMcGavin (Jan 24, 2011)

I'm an in-house programmer/designer so I pretty much work with the same type of equipment and systems all the time.

How a project gets designed will depend slightly on who's driving the project. Often times we are given a very vague idea of what is wanted by operations or engineering such as: 

Operations: "We want the control system upgraded" 
Us: "What do you mean?" 
Operations: "We want it to work better and give us more information"
as so on and so on.

So the first thing that usually happens is we meet with operators and the engineers to try and figure out exactly what they are looking for from the system and how they might envision the system working. Once we get the wish list we can start getting a rough idea of what its going to take to do the project. 

The next step is usually coming up with an IO list for the project. We will make an Excel spreadsheet of all points and devices that will need to be installed based on the information from people. This also gives you an idea of how big the PLC system will need to be and how much wiring is going to be involved. The IO list usually grows as we go because we will think of other things that we need or want in the system to make to it function better, safer, or more efficient.


At this point the drawings and the control narrative and logic development can start. Machine programming generally falls into 2 basic categories:

Sequential/state system
Process control

Sequential state systems usually move in specified sequence over and over again.

Open fill valve
wait for tank to fill
when tank is full add chemcial
after 10 seconds turn on agitator
Once agitator has ran for 5 minutes drain tank
repeat

Process control is usually trying to hold a steady state (constant flow, constant level, constant temp etc.) Or the PLC monitors for certain conditions and will shut equipment down or start backup equipment when those conditions occur.

So depending on the system we will usually develop the logic for the system differently. State machines are generally written out in a list type format. This is an actual sample of one of our machines control narratives:


5.7	Squeeze Cycle #1

5.7.1 Diaphragm Fill Valve Opens

5.7.2 Inlet Header Drain Vent Opens when Diaphragm Pressure Transmitter indicates >15psig (OR WHEN THE DIAPHGRAGM FLOW METER READS 0 GPM)
5.7.3 Start 15 second inlet header drain/vent valve timer on open valve indication
5.7.4	Inlet header drain/vent Closes on time-out

5.7.5 Start Squeeze Timer on inlet header drain/vent closed

5.7.6 On Squeeze time-out, Diaphragm Fill Valve Closes

5.7.7 Air PRESSURE CONTROL Valve Opens

5.7.8 5 second Air Blow delay timer starts on open air blow valve

5.7.9 Diaphragm Retract Valve Opens on time-out

For process control type systems we will usually use logic diagrams to determine how the system will run:










At this point you can actually start to right some PLC logic. As JRaef said you want to break it into small tasks. Writing one giant monolithic program is very hard to debug. There are numerous strategies for writing predictable well thought out code. Its imperative that you have some strategy for code writing. Just throwing logic on the screen to see what sticks is a recipe for disaster.

The hardest part of any program is the beginning and the end. Machine startup checking all the interlocks getting motors running etc. What do you do if something doesn't do what its supposed to? It can get messy in a hurry. Then if something happens in the middle of the cycle how do you shutdown or freeze the machine until the problem is resolved, and how to you pick up where you left off?

On top of all this we also have to develop the HMI screens for the operators which is a whole other project in itself.


----------



## triden (Jun 13, 2012)

The majority of my work is done in greenfield type projects where a new system is being designed from the ground up. It usually starts with the Civil (or Prime Consultant) coming to us to bid on the electrical and controls system of the new project.

For instance, the prime will come to us and say, "we are putting in a new sewage treatment plant that we want controlled; give us a price."

From there we obtain control narratives, P&ID diagrams, and anything else that will help us determine what needs to be done. We will do an I/O list as this will help us determine how many points we have to program into our PLC and HMI's, Usually the job will have a spec that we will follow. For instance a municipality may require all Schneider products (Modicon), so we have to spec those. If the job does not have a spec, we will use products that we like working with most.

Sometimes the Civil will have no idea how to create P&ID's for the process which are important for us to do our bidding. In this case, we will offer to draft them up for them at a price and base our bid on our investigation as part of the P&ID creation process.

If our bid is accepted, we will start our pre-design which includes the drafting of elementarys, IO schedules, control panel diagrams, etc. Then we will start programming a lot of the PLC logic and HMI displays in-house to get them as completed as we can before final commissioning. When construction is complete and commissioning comes along, we will download our programs to the PLC's, test for logic errors and proper functioning. If it all works, we sign off and do it all over again on the next job.

If you are looking to get into this industry, I would suggest looking around for controls integrators that specialize in this. Most of the work will be industrial which I enjoy the most. If you can afford it, buy a small PLC from automationdirect and try programming it. Add it to your resume just to show that you have the interest and your are capable.


----------



## JRaef (Mar 23, 2009)

triden said:


> The majority of my work is done in greenfield type projects ...


My definition of "greenfield":


The place where all the greenhorns are buried...


----------



## 51360 (Jun 9, 2014)

JRaef said:


> My definition of "greenfield":
> 
> 
> The place where all the greenhorns are buried...


....and " brownfield " is where all the brown nosers live! 

:laughing: 

Just kidding, couldn't resist! 

Borgi


----------



## JRaef (Mar 23, 2009)

Borgi said:


> ....and " brownfield " is where all the brown nosers live!
> 
> :laughing:
> 
> ...


I like it! :thumbsup:


----------

