water tank level program

harrybon_98

Guest
H
hello everyone.

I am a very poor programmer and admit it freely if there is a hard way to do it I find it.

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

how the heck do i accomplish this in the easiest way. am using an AB slc 500 1747-l40c processer (already in the machine).

any help will be apreciated. feel free to email me at [email protected] with any questions or comments.
 
For a start your high level sensor should be hardwired to the solenoid or contactor that operates your pump or fill valve.

That way even if you screw up your program you won't flood the
place. You can still take an input from the sensor to the PLC so you know why your pump shut off or valve closed and then post an alarm.

Next how do you start your pump or fill valve, hardwired buttons or HMI?
 
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 sontactor solenoid.
 
PLC Programming is a Journey, not a Destination.

harrybon_98 said:
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

and then
the button turns them on or off as an input to the plc, the plc

So now you are up to (5, 7, ?) inputs?

If you have trouble programming, this is one of the FOUR reasons why:




#1. YOU HAVE TO KNOW WHERE YOU ARE STARTING FROM.
I suggest that before you start writing code, you come up with a more 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?




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.
 
Last edited:
Allen seems to have nailed it down pretty good.

I'll add only one (long) comment to his Step #2.

#2. YOU HAVE TO KNOW WHERE YOU ARE GOING TO.

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!

If it doesn't work exactly as you want, then you have missed some details. And that is the point of my addition to Allen's Step #2.
 
Allen, that is one of the best examples of how to create ladder logic I have seen. Combined with Terry's comments, it tells the whole story!
 
Aww, shucks, guys. You're embarassing me.

Thanks guys.

The big thing that helped, was that Harry's problem was so easy to grasp, which is why Phil uses it as an example in his tutorial.

Ron: Sure, you can copy it. Just fix my typos, OK? I tend to forget closing parens and question marks.

There are still things I had wanted to add, but ran out of time (wife & kids, dontcha know).

Does that PUMP start and stop with the pushbuttons, or does the SYSYEM start and stop? If the latter, then he would need to have an internal bit labeled SYSYEM, programmed like PUMP is above. Then the SYSYEM bit would be used internally to help dirve outputs (like the PUMP bit does in the FILL_VALVE rung). This introduces the concept of internal bits.

Does he want to start filling the tank when the START button is pressed, or just wait until the LOW_LEVEL is reached (which is how the logic I drew works). If so, he needs to add a branch with the START button contact aroound the LOW contact on the FILL_VALVE rung.

These are the sorts of things that would be answered in a well-written detailed sequence. But I wasn't about to write it for him, and some of the questions might not make sense until after the code is at least started.

I agree with Terry about the whole "Be the PLC",, and "mental breadboarding" thing. What I do while I work out the sequence is mentally write the code. Not the details, just picturing what the rung will look like. Like in the code above, sometimes I see that I have a START, but don't have a STOP. Or that one output is being driven by two contradictory rules.

I said it before, but it bears repeating:
IN THIS JOURNEY, THERE ARE NO SHORTCUTS.
But there is a lot of running back home (Step 1 - Make an I/O list) to get the thing that you forgot to take with you.
 
actually guys this is harrybon_98

the problem was that i am pasting new equipment into old equipment and trying to get it to work. this is a parts washer simple chain line that drags parts through the water spray. one soap tank heated and one rinse tank heated. the problem has been the way the manufacturer has set it up with a single level sensor we have managed to burn several heater coils and two pumps. not a pleasent thing.

one problem is that the code i have doesn't have documentation.

so over time i have figured out the i/o and put in discriptions as noted but there are some things in there that just seem to defy logic.

the system is supposed to have a manual mode and automatic but from what i see they have three different ways of turning on and off all the various parts of the system.

several different lines control the same coil output (thought that was a no no)

so short of rewiting the whole thing (they don't have the time to do it right.) and not being sure i could do it correctly. am trying to hack in the right code to make the tank functions work correctly. and slowly work on the rest. thank you for all your help on this.
 
Harry its time to get your feet wet

This sounds like a PERFECT example for learning, not a big I/O list, has a semi working code already, so its the PERFECT chance to learn (if thats what you want to do).

You can keep a copy of the original on disk and/or hdd. Start working on a NEW Program for the machine. You can when time allows,load your program and test things, like I/O checks etc. Once you get your code working as well as if not better than old code then you can leave it there and debug it, make your changes when you find an easier way or better way to do something, add alarms if needed etc etc.

When the day comes that you feel you can leave your code in there you have passed your first test now you only have 30 years to go before you graduate. :D

This is a perfect chance.
 
lol yes a very basic machine to learn with. thankfully. i have been working on the programing a little at a time and getting it to run correctly. or maybe should say more correctly. they through all of this at me at the last minute and not got to produce have got a good majority i think fingered out but need t get alarms out but only have a light tree of red and green already it blinks red or stays green maybe morse code to tell the operator whats wrong hmm. but that may have to wait for a while. maybe can get them to look in the tanks them selves and go duhh.
 
Dear sir,
Im seeking ur guidance and help , Im very poor programmer for analog instruction im very confused in developin instruction for ladder using analog value for RSlogix500 , can you help me to create a sample ladder programm for level transmitter range from 0 mtr - 40 mtr height of the tank please help me or a sample demo to understand this logic thanks .
 
samsam,

What PLC are you using complete catalog number.
What analog card do you have?
What is the signal coming into the analog card 4-20ma, 1-5volts,0-10volts??
 
Samsam replied with PM

ANALOG INSTRUCTION HELP
Thanks for ur reply ,
1). The 1762-IF4
2). RSLOGIX500
3). 4-20mA

THANKS
WAITING FOR YOUR REPLY
SAM
 
Last edited:

Similar Topics

In our water cooling tank, I've installed and successfully wired up 4 float switches & updated the PLC (big thanks to @parky for that). As a...
Replies
46
Views
11,373
I am trying to build a project for controlling water level in a tank using PLC,3 level sensor, water pump, and electrical valve and i need help...
Replies
5
Views
3,665
Hello.. i need help doing my project..i dont know how to start using CJ1M plc..can anyone?
Replies
2
Views
2,656
need to know how to determine how much water in a tank by taking the MA output of a transmitter and converting it to feet of H2O. thanks
Replies
7
Views
5,689
We've had an intermittent issue with this for years. The application is sensing a level, or more accurately the absence of level in smallish ~5-10...
Replies
13
Views
7,323
Back
Top Bottom