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: 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.

Answer given by Allen Nelson and Terry Woods

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.

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: 

When you needed to write: 

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. 

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. 

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: 


. . . . . . . . . . . .---( )


. . . . . . . . . . . .---( )

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: 


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


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

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. 


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.