0

I've spent many hours and and a ton of paper sketching and I haven't been able to stumble upon anything to get me past this problem.

We got two tanks filled with water and two pumps between them. We need to automatically push the water to the second tank using these pumps if h>hmax (Tank 1) and H

I can't figure out one thing. First sequence assumes that if H>Hmax the pump 1 or 2 will work (they can't work simultaneously). When the water is pumped to second tank and in first tank will fall, the sequence is repeated after the water is replenished in first tank. I can't figure out how to make automatic change in pumps using only potentiometer after each sequence. What i need to do more is to include failure of one of the pump. I'm dealing with this problem for almost a week.

diagram of system

SNAREGOD
  • 13
  • 6
  • I don't quite understand. What is the purpose of having two pumps? Is it only to have a backup in case one fails? Does the operator select a pump, or do you want to alternate each run, or do you want to run the same pump all the time unless it faults? – Ben Miller - Remember Monica Feb 14 '17 at 15:51
  • Also, are the "potentiometers" you mentioned the level sensors? – Ben Miller - Remember Monica Feb 14 '17 at 16:06
  • I think I figured out it alone, using other programming language. It's a exercise and you're right it's a backup. Two potentiometer simulates level of water in each tank. Somehow i dont know how to use ladder diagram for this. The pump is running until the water in second tank i above Hmax. After the first tank is replenished and then filled above hmax the pump which wasnt working in previous sequence now works, first pump not working in this step. Sorry for my english. – SNAREGOD Feb 15 '17 at 12:27
  • 1 Step Water rises in first tank pump 1 (or 2) works after water in second tank rises above Hmax and water in tank 1 is empty, the pomp is stopped. 2 Step After the tank 1 is replenished with water the pump which didnt take a part in previous operation now works, and the other not. – SNAREGOD Feb 15 '17 at 12:30

1 Answers1

0

Hope this is what you mean. I wrote it as an "working" pseudo code. In real life this code is not the best, cause from the moment on you have more then 2 pumps it should be complicated, but this one is very detailed. Also an emergency switch is missing (so a button someone can push if he has to stop the pumps manually). Better would be to use some function_blocks and methods...

declaration:

VAR
//INPUT
levelTank1          AT %I*  : INT;  //potentiometer 1
levelTank2          AT %I*  : INT;  //potentiometer 2

pump1Malfunction    AT %I*  : BOOL; //TRUE=pump has no malfunction || FALSE=malfunction
pump2Malfunction    AT %I*  : BOOL;

//OUTPUT
pump1Operation      AT %Q*  : BOOL; //TRUE=pump should run
pump2Operation      AT %Q*  : BOOL;

lastPumpInOperation : BYTE := 1;

nState  : UINT  := 0;
END_VAR

Somewhere you should define the min and max levvels, I did it as a constant value:

VAR CONSTANT
tank1Hmax   : INT   := 32000;
tank1Hmin   : INT   := 5000;
tank2Hmax   : INT   := 25000;
tank2Hmin   : INT   := 2000;
END_VAR

As remark: the analog inputs are usually INT values, so max. level equals 32767

And now the program:

CASE nState OF
0:  //wait till tank 1 is filled and make sure tank2 is not overcharged
    IF (levelTank1 >= tank1Hmax) AND NOT (levelTank2 >= tank2Hmax) THEN
        nState := 1;
    END_IF

1: //start one pump
    //first check worst case - both pumps are broken
    IF NOT pump1Malfunction AND NOT pump2Malfunction THEN
        nState := 100;  //emergency 
    //last time pump1 was used, and now pump 2 should start when it has no malfunction
    ELSIF lastPumpInOperation = 1 AND pump2Malfunction THEN 
        pump2Operation := TRUE;
        lastPumpInOperation := 2;
        nState := 2;
    //last time pump2 was used, and now pump 1 should start when it has no malfunction
    ELSIF lastPumpInOperation = 2 AND pump1Malfunction THEN
        pump1Operation := TRUE;
        pump2Operation := FALSE;
        lastPumpInOperation := 1;
        nState := 2;
    //now we have to define what happens when one pump is in malfunction
    ELSIF NOT pump1Malfunction THEN
        pump2Operation := TRUE;
        pump1Operation := FALSE;
        lastPumpInOperation := 2;
        nState := 2;
    ELSIF NOT pump2Malfunction THEN
        pump1Operation := TRUE;
        lastPumpInOperation := 1;
        nState := 2;
    END_IF

2: //pump operation till tank1 is "empty", tank2 is "full" or pump failure occurs
    IF (levelTank1 <= tank1Hmin) OR (levelTank2 >= tank2Hmax) THEN
        nState := 3; //stop pumps
    ELSIF (pump1Operation AND NOT pump1Malfunction) THEN //pump has gone in malfunction during operation
        nState := 1;    //go back to step2 to start another pump
    ELSIF (pump2Operation AND NOT pump2Malfunction) THEN
        nState := 1;
    END_IF

3:  //stop pumps
    pump1Operation := FALSE;
    pump2Operation := FALSE;
    nState := 0;

100:    //emergency
        //do what you can do - close the valve to tank1 or run as fast as you can
        pump1Operation := FALSE;
        pump2Operation := FALSE;

        IF (pump1Malfunction OR pump2Malfunction) THEN
            nState := 0;
        END_IF 
END_CASE
Arndt
  • 98
  • 5