Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

RSLogix 5000 FIFO 1

Status
Not open for further replies.

thawthorne

Petroleum
Jun 10, 2010
2
I have to get four pumps which are dedicated to one tank each to start first on first off. Even though the demand may fluctuate. I am having some major writers block figuring this out..... Every other system I have done uses first on last off.
If anyone can give me an example or even write in text an example, I would greatly appreciate it.
 
Replies continue below

Recommended for you

In the spirit of OOP (particularly the "code reuseability" part), I'm going to recycle some puesdo-code I wrote earlier tonight for your problem.


For our example let's create five tags (DINTS would be fine). call them Reg1, Reg2, Reg3, Reg4, and Reg5.

Do this for each of your four pumps:

If pump 1 is energized and Reg5 = 0, then load a "1" (using a oneshot) into Reg 5. '(However, you will have to wait to energize pump 1 until Reg5 is = 0 otherwise you will lose track of which pump came on first).

If pump 2 is energized and Reg5 = 0, then load a "2" (using a oneshot) into Reg 5. '(However, you will have to wait to energize pump 2 until Reg5 is = 0 otherwise you will lose track of which pump came on first).

If pump 3 is energized and Reg5 = 0, then load a "3" (using a oneshot) into Reg 5. '(However, you will have to wait to energize pump 3 until Reg5 is = 0 otherwise you will lose track of which pump came on first).

If pump 4 is energized and Reg5 = 0, then load a "4" (using a oneshot) into Reg 5. '(However, you will have to wait to energize pump 4 until Reg5 is = 0 otherwise you will lose track of which pump came on first).

'BTW, the "wait" period for any motor (if necessary) will always be no more than one scan.

'The only reason why Reg5 would not be set to 0 would be if two pumps tried to come on during the same scan.


'This next bit of code will have to be done for each register from Reg5 to Reg 1.

If Reg5 <> 0 and Reg4 = 0, then copy Reg5 into Reg4, and 0 out Reg5.

If Reg4 <> 0 and Reg3 = 0 then copy Reg4 into Reg3, and zero out Reg4.

If Reg3 <> 0 and Reg2 = 0 .... And so on until you get to Reg1.

'Notice that by doing your "bubble up" from the highest register to the lowest, your program will move your newest entry up the entire stack in one scan.


'Now, when it comes time to shut off a motor, look at the value in Reg1 (which should be either a 1, 2, 3, or 4), and shut that motor off. You can then turn that motor back on and it will take it's position at the bottom of the stack.

'Note that you really don't need five registers, four would do the trick, but I would provide for five because it should prevent any gremlins from popping up.

I would of coded this for you in RSLogix, but I don't have RSLogix on this PC. Sorry.

 
Thank you John. I will give this a shot. I am a little confused right now but I'm sure once I transcribe this into the ladder logic it will make more sense. I appreciate it.

T.J.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor