hi

mehkocak

Member
Join Date
Jan 2005
Posts
58
I need to write a program in which ı have four pumps that works independently from each other.I mean, we have four run inputs for each pump but these input or ( inputs at same time ) will run the pump or ( pumps ) that finish its run last, that is the last stopped pump(pumps) will start last and if the pump (pumps) stops first than will run first also.

If you give me some idea about the procedure , It will be good for me.

thanks
 
Machines always duplicate what we do in real life.

Start with a pen and paper and imagine you are doing this by hand.

How would you do it? Perhaps you would write down:

Pump1 Start#1
Pump4 Start#2
Pump2 Start#3
Pump4 Start#4

Stop all pumps.

Next time you would look back at your paper and decide which pump to start based on what you had writen down.

Now BE the PLC and replicate this.

What pump must I start first?
Check the pump start log.
Select the pump on these condition.
Start it.

You must write down all the "What IFs" and write the complete sequence.

You will have all the coding writen down in front of your eyes.
 
Terry Woods and Allen Nelson provided some insight for this BEFORE PROGRAMMING page; http://www.patchn.com/b4programming.htm

BEFORE YOU START PROGRAMMING

This was brought about by the following question:
My problem is I have a set of tanks that have a heater unit and a pump the pump flow comes back into the tank. there are three senors in each of the tanks. there are two water flow valves to each tank in series; one is redundant in case the first sticks open.
one low level sensor to turn off the heater and pump if it turns off. the middle sensor is to do normal level control. the upper sensor is to turn off the redundant vale if it turns on.

So given the fact I have four outputs

water pump
heater unit
fill valve
redundant fill valve

and three inputs

low level
normal level
high level

Later added: [font=verdana, arial, helvetica]the pump and the heaters are hard wired to a push button on the front panel. the button turns them on or off as an input to the plc, the plc then outputs to the contactor solenoid.[/font]

[font=verdana, arial, helvetica]Answer given by Allen Nelson and Terry Woods[/font]


#1. YOU HAVE TO KNOW WHERE YOU ARE STARTING FROM.
I suggest that before you start writing code, you come up with a complete I/O list. The list will grow and change as you do the second task.
But that's OK. You've got to start somewhere.

#2. YOU HAVE TO KNOW WHERE YOU ARE GOING TO.
You need a careful, detailed sequence of operations. As you develop this sequence, you'll be realizing that you may have gaps in the I/O, (such as what CK pointed out). Fill them in, and then review your sequence again.

Be sure your sequences are detailed enough.

You were trying to write:
STEP 1. ENERGIZE PUMP OUTPUT.

When you needed to write:

PUMP SEQUENCE
STEP 1a. PRESS "START_PUMP" pushbutton sends signal to PLC.
1b. When "START_PUMP signal is recieved by PLC, energize pump output.
1c. Releasing "START_PUMP" pushbutton drops signal from PLC, but Pump remains running.
etc....


This sequence, unlik yours, shows the need for the START_PUMP PB. As you watch the process, you start asking questions like: "What makes the Pump Stop?" Ah!, I need a STOP_PUMP PB.


Some things to think about :

I have a set of tanks that have a heater unit...
Is that ONE heater to be shared by the SET (how many?) tanks. If so, what are the rules of sharing. If one tank's rules call for the heater to be OFF, and another one wants it ON, who wins.

Is High Level the only thing that turns off the heater, or do you need some sort of temperature sensor to prevent the PLC from boiling away the liquid? Or is that the job of the low level sensor?

The hardest thing for a lot of guys to overcome is the tendency to take things for granted. They don't consider the details - all of the details!

I usually suggest that a person needs to "Be the Computer". However, that might be a little presumptive in this case.

Another thing I suggest is that a person think of how they would control the system if they had to do it at a completely manual control station. However, that too might be a little presumptive... it presumes all input and output signals exist. It's too easy to overlook a detail.

The most detail oriented way that I can think of to uncover all of those details is "breadboarding". You don't have to actually do the physical breadboarding, but it sure couldn't hurt.

You can sometimes get away with "mental-breadboarding". Usually, you have to do it with a pencil and paper. Essentially, you are building a schematic of a manually operated system. But, as you do so, you make notes of what you want to do, how you can do it, and why you want to do it that way.

Then, following the rest of Allen's steps, you should end up with something that works according to what you have specified.

That DOES NOT mean that your process will work as you want it to...
it only means it will work as you specified!

Once you have your I/O list and a good sequence, you're ready to START your journey.
#3. YOU HAVE TO KNOW HOW TO GET THERE.

There are no shortcuts. You start by understanding how logic is scanned (especially how what you do on one scan will affect the next), and knowing your instruction set. For beginners, -| |-, -|/|-, -( )-, Timers and Counters are enough (certainly enough for your application.


Then you start with the outputs. Just draw them out in space like this:


PUMP . . . . . . . . . . . .---( ) FILL_VALVE . . . . . . . . . . . .---( )

`
Then look at your sequence.
When does the pump come on? - When the START_PB is pressed

When does the FILL_VALVE open? - Only while the pump is running and then only the LOW level is reached.

So you add those out in space:


START_PB PUMP----| |-----+ . . . . . . . . .---( ) PUMP LOW FILL_VALVE-----| |----+-----|?|---- . . . . . .---( )

`
The -|?|- is there because I don't know if you plan to use the NO or NC contact from the Low Level switch. Does a signal (voltage on the input wire) mean that the tank is low, or that the tank is OK. When you know the answer, change the -|?|- to -| |- or -|/|-, whichever is appropriate.


The line in the sequence: "When the PB is released, the pump keeps running" means that we need to "latch" or "seal" (epending on your age and where you went to school) the pump, like so:





START_PB PUMP

----| |-----+ . . . . . . . . .---( )

|

PUMP |

-----| |----+


Similarly, the FILL_VALVE stays open even after the tank has been filled past the low level.

The PMP stops when the STOP_PB is pressed. The FILL_VALVE stops at Mid level.

Adding those in yeilds the complete rung:




START_PB STOP_PB PUMP

----| |-----+------|/|-----------------------------( )

|

PUMP |

-----| |----+





PUMP LOW MID FILL_VALVE

----| |-----+------|?|-----+-----|?|---------------( )

| |

| FILL_VALVE |

+-------| |----+


I'm intentially leaving the heater and redundant valve for you to program.



#4. YOU HAVE TO EXPECT DETOURS.

With the completed code, you start asking yourself "What-If" question?

"I know what's supposed to happen when the valve sticks OPEN. What if the valve sticks CLOSED?"
How will I know? Is staying at LOW for more than XX time good enough, or should I have a limit switch on the valve so the PLC can compare what's happening to what it thinks SHOULD be happening?

"What if the valve sticks OPEN (or CLOSED). Shouldn't the PLC tell somebody?"
If so, how. Lights? Noise? How will those be turned off once the problem is fixed?

"What if BOTH the valve stick OPEN?!?"
Should I shut down the Pump? Sound the Alarm? And how will I know? HI_LEVEL staying ON for too long?





This "map" is just a start. If you are serious about learning PLCs, get PHIL'S BOOK.

Step-by-step. Plain English. It will not just teach you about PLCs, but might even show you how to think in the methodical manner required, not just for PLCs, but programming in general.
 
Just In Case

You left out some details. As stated the 4 pumps could have 256 possible start sequences OR can it they be just started in order depending on which stopped last? Example: pumps numbered 1, 2, 3, and 4. Original start sequence was 1234, pump 3 stopped last so sequence on next start would be 4123. This method brings the start combination down to 4 sequences i.e. 1234, 2341, 3421, and 4123.

What brand PLC will you be using, more specific help may be offered if that is known.
 
Think about it...

Pretend that YOU are managing the sequence, using a pencil and paper.

Now, according to what you are saying... if the pumps can only be started in the order that they were turned off (with one possible exception - discussed later), then... this arrangement could be set up with a single Start Button (with a good debouncer). There would still have to be a Stop Button for each pump.

When you press the Start Button, the first pump on the "list" is started. That pump is then removed from the list. When you press the Start Button again, the next pump, now sitting at the top of the list, is started. And then it too is removed from the list.

As long as any particular pump is running it should not be on the "Start this Pump Next" list.

Now, when you press the Stop Button for any particular pump, that pump is added to the bottom of the list.

Now, if a particular pump happens to be running, and then you press the Stop Button for that pump, that pump is placed at the bottom of the "Start this Pump Next" list.

Now, before I go on to describe how the "list" is managed, let's cover that exception that I mentioned.

After creating this code, and running it for the first time, there should be no "Stop-Based" entries on the "list". However, you can easily set it up so that the list consists of Pump-1, Pump-2, Pump-3 and Pump-4 - in that order. Pump-1 will start first, followed by Pump-2, etc.

After the code has has been created and run for the first time, you might get to the point where you need to shut-down the PLC for... whatever. If your "list" is maintained in "Retentive Memory" (retained during power-down) then the "list" will be maintained when you restart. If you do not use Retentive Memory then you'll have to use the "First-Scan" bit to force a reloading of the Pump-1, Pump-2, etc. scheme.

Now... how to maintain the "list".

The easiest way is to use a four-slot shift-register. You need to know the memory location for each of the four slots, or at least the base-address of that four-slot array. Depending on the number of pumps running, you might have as many as four pumps in the list (no pumps running), or as few as... none (all pumps running).

By the way, if you shut-down the PLC while any pumps are running (which you shouldn't do) then you need to add the running pumps to the list in the opposite order in which they were started. That means, you also need to maintain a "Start this Pump Last" list. This list is populated as the pumps are started.

There is another, more difficult way to maintain your list... using only control relays.

Before I go any further, how do you feel about this scheme so far?
 
What a sweet explanation. I wish all commisioning had this type of structure.
It sure would make life a lot easier for us field pukes.. lol..:)
 
Thanks Russ.

mehkocak said...

"please be clear about your explenition,if you it will be better four me."

mehkocak...
Are you asking me to re-explain what I have already said? Or, are you asking me to continue?

If you have any questions about what I've already said, then please, ask about it now!
 
Back
Top Bottom