Lead Lag Interlock Sequencing

kc_p21

Member
Join Date
Jun 2008
Location
Mich
Posts
3
I'm developing lead/lag pump interlock sequencing for 5 pumps. If pressure falls below pre-determined limit then Lag pumps will start to stop in 120 second increments. If any lag pump is stopped then it should trip next running pump.

For example:
Lag4 - Running
Lag3 - Stopped
Lag2 - Running - In this scenerio Lag4 should go out at 120 secs
Lag3 no action
Lag2 should go out at 240 secs.

Operator do change sequencing on pumps. In my program Lag2 stops at 360 secs instead at 240.

Any suggestions on how to do this?

Thanks,
 
OkiePC said:
What kind of PLC?
A PLC is just a tool.
Do we really need to answer the same question for each PLC?

Code:
Pumps[5]={0,1,2,3,4};
int OnIndex=0;
int offIndex=0;;
int OnCount=0;
word PumpIO=0;  // I/O mapped, each bit turns on a pump
PumpOnPumpOff()
{
	If ( pressure in the on range )
	{
		OnTimerEnabled();
		If ( OnTimerTimedOut() and ( OnCount < sizeof(Pumps)) )
		{
			PumpIO |= (1 <<Pumps[OnIndex++]);
			if ( OnIndex >= sizeof(Pumps) )
				OfIndex = 0;
			OnCount +=1;
			OnTimerReset();			 
		}		
	}
	else
	{
		 OnTimerReset();
	}
	If ( pressure in the off range )
	{
		OffTimerEnabled();
		If ( OffTimerTimedOut() and ( OnCount > 0 ))
		{
			PumpIO &= ~(1 <<Pumps[OffIndex++]);
			if ( OffIndex >= sizeof(Pumps) )
				OffIndex = 0;
			OnCount -= 1;
			OffTimerRest();			 
		}		
	}
	else
	{
		 OffTimerReset();
	}

}
Note, on can save the shift lefts if the Pumps array is initialized with the pump bit instead of the pump index
Pumps[5]={0x0001,0x0002,0x0004,0x0008,0x0010};
 
I was OK with your response right up intil the last line, Peter. Your code is valid but the last comment makes your answer PLC-specific. Not all processors support arrays, indirection or sequencers. So while your code can be effectively transposed to work on any plc (with enough massaging) your last line may not be.
Since the plc is an SLC5 it can be done almost directly from your example.

Keith
 
Sooo!!?? You are letting the tools constrain your thinking.

kamenges said:
I was OK with your response right up intil the last line, Peter. Your code is valid but the last comment makes your answer PLC-specific. Not all processors support arrays, indirection or sequencers. So while your code can be effectively transposed to work on any plc (with enough massaging) your last line may not be.
Since the plc is an SLC5 it can be done almost directly from your example.

Keith
You can allocate any 5 locations in memory and call it array.
When I programming a microcontroller there are no arrays. Just a lot of linear address space and some index registers.

Here is a Fifo example. I would probably use this if I had to program an old Modicon 984. Yuk.

Code:
word PumpIO=0;  // I/O mapped, each bit turns on a pump
 
InitPumpOnPumpOff()
{
	// Add these in any order you wish
	AddToOffFifo(00001B);   // Pump 0
	AddToOffFifo(00010B);   // Pump 1
	AddToOffFifo(00100B);   // Pump 2
	AddToOffFifo(01000B);   // Pump 3
	AddToOffFifo(10000B);   // Pump 4
}
PumpOnPumpOff()
{
 If ( pressure in the on range )
 {
  OnTimerEnabled();
  If ( OnTimerTimedOut() and OffFifoNotEmpty )
  {
	   PumpIndex = RemoveFromOffFifo(); 
	   PumpIO = PumpIO or PumpBit;
	   AddedToOnFifo(PumpBit);
	   OnTimerReset();	
  }  
 }
 else
 {
   OnTimerReset();
 }
 If ( pressure in the off range )
 {
  OffTimerEnabled();
  If ( OffTimerTimedOut() and OnFifoNotEmptry )
  {
   PumpBit = RemoveFromOffFifo(); 
   PumpIO &= ~PumpBit;
   AddedToOffFifo(PumpBit);
   OffTimerRest();	
  }  
 }
 else
 {
   OffTimerReset();
 }
}
Now kc_p21 has a choice.
Two solutions in short order.
 
That depends. In the bottom line of your first post you refer to 'shift left'. If this is simply a conceptual phrase then I stand corrected. If you were actually referring to a true shift instruction then you are still being platform specific as not all platforms support shifts.
Granted, I was playing with you a bit. But chiding Okie about asking about the platform then supplying what certainly appears to be a platform dependent solution seemed an bit chuckley to me.

Just being cantankorous on a Saturday morning.

Keith
 
Not all PLC's are created equal. Try and do a BSL in a Logo Block (LOCO BLOCK). If we are going to take his general concept and give him back a general solution, then we don't need to know. But if kc_p21 is looking for a real answer (shown in logic5000) then the PLC type is important.

I have done this before with BSL and BSR. When you start the pumps back up, are they sequenced on? You could have your pre-determinded trip start a timer and shift bits.
 
kamenges said:
Granted, I was playing with you a bit.
Just being cantankorous on a Saturday morning.
I know.... Me too!!!

Not all PLC's are created equal.
Is that why that have different prices?

Kev77 said:
Try and do a BSL in a Logo Block (LOCO BLOCK).
I will let you do that general example for all the crippled PLCs.

If you have followed this forum long enough you would no I have no sympathy for those that pick the wrong tool and waste $1000 worth of time to save $100. As I pointed out in my first thread the shift left isn't necessary. One could just enter the pump bits in the Pumps array so what are you complaining about?.
 
Price has little to do with it. I just replaced a Logo Block with a Small micrologix and the price was not that different, but the functions are.

As far as how to program, you can put 10 programmers in a room and get 10 different way to get the same result. What defines a good program? In the end all 10 different programs will work, but it all depends on who will maintain the program when the programmer is gone. I work on a TI program that is 4000 rungs long, written by 3 different programmers. The only tinng to do is scrap the program and start over. When I write programs, I try and make it visually friendly for the prople that use it to troubleshoot it. We have several electricians in our plant that understand ligic but could not tell you what an array is. I don't like to be called at 3:00am because somebody can't understand what I am talking about. I have worked on sooo many different programs and by the time you get done you understand how the programmers mind works. I am by no means up to the level that most of you are, I was just putting my 2 cents in.
 
Last edited:
Use the PID Instruction

Use Pressure as the PV Input to the PID Instruction-
Scale the PID CV Output to (0-100%)

Make your pumps turn on/off based on the CV output-
 

Similar Topics

Good day everyone. if you have a logic for 3 pumps (lead/lag/off), would you please email it to me? I really appreciate it!
Replies
7
Views
157
Hello everyone. I am trying to figure out what the best way to control three pumps would be. I have searched the forums and cannot seem to find...
Replies
8
Views
1,971
Hello all, I have a triplex pump skid, which they want up to 2 pumps to operate and the other to be on standby. I am kind of racking my brain on...
Replies
7
Views
2,168
I am a novice at ladder logic programming but I needed a lead/lag function for two pumps that I am controlling. I bought a cheap FX1N(C) board...
Replies
14
Views
3,125
To begin, before the Trolls pop out, I know you get your tools/test your tools/find the right tools. Thats great, but at this point Im on a...
Replies
15
Views
5,156
Back
Top Bottom