You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old September 15th, 2021, 06:28 AM   #1
lavito1960
Supporting Member
United States

lavito1960 is offline
 
Join Date: Sep 2021
Location: tennessee
Posts: 13
FIFO indexing

Good morning
I would appreciate any assistance with this problem. I am trying to write FIFo program for what I am calling a magazine rack. I created FIFO control using FLL and FFU to index one part into one of 24 slots while understanding that if a slot is full it goes an empty slot while tracking what is in the slots and when it is unloaded. there is also the issue of there is a right and left part that needs to be identified which it is left and right which will determine if the part foes forward for right and reverse for left. I would be grateful for any assistance or guidance into what would be the best avenue of approach, thanks
  Reply With Quote
Old September 15th, 2021, 07:37 AM   #2
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,581
The description in the OP does not sound like something that can be simply modeled with an FFL/FFU-driven FIFO array. Specifically moving parts forward/right or reverse/left is not something the FFU instruction is designed to do.

Please describe the process in more detail e.g.
  • why a part is placed in a slot,
  • why a particular slot is chosen to receive a part,
  • what an empty slot means,
  • what a part means,
  • why a part would move forward/right reverse/left,
  • how a part moves affects nearby slots and parts
Answers to those queries may suggest a model apropo the process.


TL;DR


A FIFO is usually employed when all of the slots move
  • together,
  • at the same time,
  • in a single direction,
  • in a single operation,
when new contents are added at one end of the FIFO, often but not necessarily as another item is removed from the opposite end of the FIFO.


While FFL could insert an item into the middle of the FIFO by tweaking the .POS and .LENGTH values, the FFU will only ever shift the items in one direction.


That is, when an FFU is executed,
  • the contents of slot 0 are removed (First Out),
  • the contents of slot 1 move to slot 0,
  • the contents of slot 2 move to slot 1,
  • etc.
  • If slot N+1 was "empty" before the FFU, then slot N will be "empty" after the FFU
    • a slot is never actually empty, but perhaps an otherwise nonsensical INT value, such as -9999, in a slot could represent that slot being "empty" to the process.
When an FFL is executed
  • one new item (First In) becomes the contents of slot number [.POS],
    • where .POS is the number of items in the FIFO before that new item is added
    • i.e. slot .POS is the only available "empty" slot that FFL knows about.
From the description in the OP, it sounds like
  1. items are being plced into "empty" slots in the middle of the array, changing the state of that one empty slot without affecting other slots, e.g. they are not being inserted in a way that shifts all items on one side or the other of that slot.
  2. and items may be shifted either to the left or to the right
Both of those make me think the FFL/FFU-controlled FIFO array may not be exactly what OP is looking for.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.

Last edited by drbitboy; September 15th, 2021 at 07:54 AM.
  Reply With Quote
Old September 15th, 2021, 08:04 AM   #3
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,536
your description is a little vague, I have done a number of similar things for example a simple shift (although very long) where a bar code was read, it moved into the shift register (tied to the long feed conveyor) where there were 17 divert stations onto other conveyors, the bar code was stored into the first register of the shift, the conveyor had a proximity on a star wheel that shifted the barcode down the shift register when that barcode reached a divert point it compared that position with the required code if same diverted it.
Others were more complex for example On one the equivelent of your magazine had a location register, when a part was loaded onto the travelling car a register was populated with it's information, this consisted of 2 registers one contained the part information & the other a time stamp. each location of the magazine also had 2 registers, if both registers were clear or 0 then the slot was empty, the part was loaded onto the car, it traversed along the location comparing each slot info for zero i.e. empty, the car would load the part into the slot & populate the registers for that location with the relevant information, actually it was a bit more complicated than that as each location had a drying time i.e. the length it was in there, then when the time was up the car if not busy loading would go & fetch a completed part & transfer it to a off load station.
So although I do not know your process, there are a couple of ways of doing it.
1. a single 16 bit register that contains two bytes of information this could be two numbers or even use individual bits in that word for example a part type and say a second identifier.
The part is loaded into the feed system and a register tied to that feed system is populated with the information, when it reaches a slot that has it's registers at 0 (meaning empty) then it places the part in the slot and moves the information from the feed system copied into the slot register(s), same when unloading a part, it goes to the slot, picks the part & the information is transferred to the pick unit register & the slot registers are cleared to say it is empty.
It will depend on if you need some kind of hierarchy, i.e. first part in first part out etc., but again it would depend on what information you put in the registers.
Simple example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17...... //These are the slots

each slot is assigned a register(s) call Them slot_1_Type & Slot_1_Time

the transport system has two registers called Car_Type & Car_Time.
The obvious problem is if you do need first in first out is assume you fill all slots & give them a number i.e. i,2,3,4 etc. as it's first in first out number when slots are all full the last number is 24, when one is moved then you need to decrement each occupied slot number by 1 but not all that difficult.
I suggest you write or draw out the process & what you need as for the data & go from there.
  Reply With Quote
Old September 15th, 2021, 10:12 AM   #4
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,536
@DR, you beat me to it, so I'm glad I did not go into that detail, you saved me the hassle lol.
  Reply With Quote
Old September 16th, 2021, 06:38 AM   #5
lavito1960
Supporting Member
United States

lavito1960 is offline
 
Join Date: Sep 2021
Location: tennessee
Posts: 13
Quote:
Originally Posted by drbitboy View Post
The description in the OP does not sound like something that can be simply modeled with an FFL/FFU-driven FIFO array. Specifically moving parts forward/right or reverse/left is not something the FFU instruction is designed to do.

Please describe the process in more detail e.g.
  • why a part is placed in a slot, I have 24 slots to load for left and right handed parts
  • why a particular slot is chosen to receive a part, There really isn't any particular order just first slot that is empty
  • what an empty slot means, This project is being called a magazine rack
  • what a part means,
  • why a part would move forward/right reverse/left, there is a conveyor that I call a diverter because left handed parts would reverse and right forward, there can only be one part loaded at a time
  • how a part moves affects nearby slots and parts
Answers to those queries may suggest a model apropo the process.


TL;DR


A FIFO is usually employed when all of the slots move
  • together,
  • at the same time,
  • in a single direction,
  • in a single operation,
when new contents are added at one end of the FIFO, often but not necessarily as another item is removed from the opposite end of the FIFO.


While FFL could insert an item into the middle of the FIFO by tweaking the .POS and .LENGTH values, the FFU will only ever shift the items in one direction.


That is, when an FFU is executed,
  • the contents of slot 0 are removed (First Out),
  • the contents of slot 1 move to slot 0,
  • the contents of slot 2 move to slot 1,
  • etc.
  • If slot N+1 was "empty" before the FFU, then slot N will be "empty" after the FFU
    • a slot is never actually empty, but perhaps an otherwise nonsensical INT value, such as -9999, in a slot could represent that slot being "empty" to the process.
When an FFL is executed
  • one new item (First In) becomes the contents of slot number [.POS],
    • where .POS is the number of items in the FIFO before that new item is added
    • i.e. slot .POS is the only available "empty" slot that FFL knows about.
From the description in the OP, it sounds like
  1. items are being plced into "empty" slots in the middle of the array, changing the state of that one empty slot without affecting other slots, e.g. they are not being inserted in a way that shifts all items on one side or the other of that slot.
  2. and items may be shifted either to the left or to the right
Both of those make me think the FFL/FFU-controlled FIFO array may not be exactly what OP is looking for.
I appreciate your response and help
  Reply With Quote
Old September 16th, 2021, 06:46 AM   #6
lavito1960
Supporting Member
United States

lavito1960 is offline
 
Join Date: Sep 2021
Location: tennessee
Posts: 13
drbitboy
thanks for your reply, I hope I answered your questions to assist me with this problem, thanks for your guidance
  Reply With Quote
Old September 17th, 2021, 04:45 AM   #7
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,536
Here is some simple code that is part of a place & pick, this is only the part that would show effectively the first part that is to be picked out based on first in first out.
Assume in this case an empty mag, it starts to place parts in location 16 & then populates them in reverse order (could be the other way round), assume then a part is removed from a location (initially location 16) then a search is done for a one, the location is stored along with the part type this is then the part position in the mag to be removed, once removed, the data is cleared and the location is then classed as empty, the rest of the populated locations if not 0 are then decremented by 1, so effectively the location with a 2 in it becomes a 1 this is the next pick (FIFO), this is just a sample, the way I would program the rest would be to have another array that held the hierarchy, i.e. when a location has been picked, the hierarchy array if not 0 is decremented & the last pick location is then populated with the last pick number, sorry if not explained very well but in theory it should start to fill at location 16 and sequentially fill to location 1, the pick will follow this so it is a sort of circular rotation of the locations.
I did something like his many years ago, however, it will depend on many things is it always first in first out, are the place & pick units separate or is it just the one that places & picks the parts etc.
Anyway, the attached is just how you might approach part of it.
Attached Images
File Type: png MagScr.png (54.4 KB, 11 views)
File Type: png MagCode.png (91.8 KB, 12 views)
  Reply With Quote
Old September 17th, 2021, 06:37 AM   #8
lavito1960
Supporting Member
United States

lavito1960 is offline
 
Join Date: Sep 2021
Location: tennessee
Posts: 13
Thanks Parky I will take a look at them
  Reply With Quote
Old September 17th, 2021, 07:37 AM   #9
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,536
This is just an interpretation of what I have done before, however, there are considerations.
1. is it truly first in first out.
2. would it make sense to populate the magazine say for example start at location 24 (in your case) then populate them in reverse order.
3. is it required to alternate between left & right every time.
4. is it required that all slots in the magazine be populated or for example would it be like a shift sequence where you populate 24 to 1 in that exact order or for example if slots 24 to 10 are populated when say 24 has been removed, would the next insert be in 9 or would you put the next part in 24 ?.
Personally, if all slots have to be used I would rotate them in other words start populating 24 down to 1 then when slot 24 becomes vacant, if 1 & 2 were still free, populate them before slot 24, this gives the effect of a rotate of locations.
Seems a little hard to get your head around but having another array that holds the removal positions makes sense to rotate the use of all slots.
It was some years ago since I did this very thing & I have lost a few brain cells since then, the important thing is keeping the tracking, mine was a little easier as the parts had to be kept in the "Magazine" for a minimum time so this was the trigger for removing a part. One thing they insisted on was that all locations were used i.e. if there were 100 locations the rate of flow in & out was only 80 so in effect there were always 20 slots empty, however, they wanted all slots to be used so rather than allow a slot that had just been emptied for the next one it would select one of the other slots. this was done in a similar manner to the position in queue, i.e. another array that when a part from a location was removed the data in each of the array elements was decremented & the next location number added to the slot that had been emptied.
  Reply With Quote
Old September 17th, 2021, 09:19 AM   #10
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,581
Quote:
Originally Posted by lavito1960 View Post
drbitboy
thanks for your reply, I hope I answered your questions to assist me with this problem, thanks for your guidance
You're welcome, but I did not yet see any response to my questions:
Quote:
Originally Posted by drbitboy View Post
Please describe the process in more detail e.g.
  • why a part is placed in a slot,
  • why a particular slot is chosen to receive a part,
  • what an empty slot means,
  • what a part means,
  • why a part would move forward/right reverse/left,
  • how a part moves affects nearby slots and parts
Answers to those queries may suggest a model apropo the process.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 17th, 2021, 09:20 AM   #11
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,581
We still don't have an adequate description of OP's process, but it sounds to me like one way to approach this would be to have two FIFOs, one for empty slots and one for occupied slots, that contain slot identifiers because what is varying and needs to be ordered are the relative times when a slot is filled or emptied, not part identifiers as would be done with a conveyor where what is varying is the position of the part.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 17th, 2021, 10:39 AM   #12
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,536
I still don't think FIFO is the answer, pigeon holes i.e. arrays, as the "Slots" are fixed, so you cannot move the array positions that's why the idea of using perhaps 3 arrays for the slots, the slots are populated & the number in the next pick array is populated, the second array contains the part information i.e. left or right, the 3rd array perhaps will decide which is the next empty slot to be filled, it would naturally start with slots 1-24 in reverse order (does not have to be) these are filled starting at slot 24 with the next number i.e. slot 24 will be a 1, slot 23 = 2 & so on, when the part in slot 24 is removed it is set to 0 & all other occupied slots are decremented so in the next instance slot 23 becomes a 1, slot 24 becomes a 0, if there are empty slots (not the one that has just been removed) as they are filled, when no more slots are available to the left, then it starts to fill the ones already removed i.e. 24, 23 etc. This idea is so rather than filling slot 24 every time it gets emptied the all slots are used in a sort of equal way, this is where the 3rd array comes in by populating this i.e. decrementing it on a removal but populating (sort of 24-1 that rotates right in the same manner as the population array).
The one problem is we do not know if the population & extraction is as a FIFO, if for example the extraction was left then right type of part or chosen some other way then it could not be circular mode, however, it just means at some point the next & N+1 would not be in order in other words assume a totally populated magazine then it would look like this
Magazine slot:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ...
Next number:
23 22 1 3 4 7 5 6 .......
It's just a matter of laying out what the design criteria is. although a little complicated to get the data into the arrays, computers are pretty good at that without mistakes (it's the the code that fails), as a get out of jail clause it would be best to have an HMI so you could see if things get a bit messed up i.e. a status of the magazine & some way to modify it or reset it to a default start point (it will happen, a part drops off the loader etc.).
Again the design all depends on exactly how it is supposed to operate, most times on here we do not get the full picture (sometimes it's not even anything to work with), so we end up speculating, however, there are plenty of people on here that have ideas so at least there will usually be plenty of different styles or ways of achieving the posters goal.
  Reply With Quote
Old September 17th, 2021, 12:03 PM   #13
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,581
Quote:
Originally Posted by parky View Post
I still don't think FIFO is the answer,...
Perhaps you misunderstood what I meant, I am suggsting putting the magazine slot identifiers into a FIFO, not the product identifiers. Because the order in which slots are emptied is the order in which they should be reused.

Say for example there are five slots, identified (numbered) as 0 to 4, in an "available slot" FIFO array that keeps track of empty slots i.e. slots that can receive a product. Slot IDs are added on the right, removed from the left.
Code:
out<=[0 1 2 3 4]<=in   :available slot FIFO
The left-to-right order of the slot IDs in that FIFO is the order of decreasing time since each (empty) slot ID last had a product. This FIFO - First-In-First-Out - keeps track of which slot First became empty.

The ordering above is an initial order, which is arbitrary because all slots are empty no empty slot has yet had a product.

There is a second array that keeps track of any product IDs in filled slots. The index into the array is the slot ID i.e. 0 to 4. This is not a FIFO i.e. its contents will not shift:
Code:
[- - - - -]            :slot contents array
[0 1 2 3 4]            :slot ID (slot contents array index)
A hyphen in that array indicates the slot is empty.

When a new product appears, it is assigned a slot ID by unloading the next slot ID from the FIFO i.e. the slot ID that was put in the FIFO the longest time ago. Say three products come in, the arrays would look like this:
Code:
out<=[3 4]<=in         :available slot FIFO   slot IDs 0/1/2 were unloaded

[A B C - -]            :slot contents array   slots 0/1/2 were filled
[0 1 2 3 4]            :slot ID (slot contents array index)
I am using hyphens and letters for product IDs so they will look different than the slot IDs.

Now say the process, perhaps an operator using an HMI, selects the product with ID B to remove it from its slot for further processing. The location algorithm, functionally identical to the one posted early by @parky, finds product ID B in slot ID 1, "removes" B from slot ID 1 by putting a hyphen in that index in the [slot contents] array, and loads that located slot ID 1 to the end of the [available slot FIFO]:
Code:
out<=[3 4 1]<=in       :available slot FIFO   slot ID 1 was loaded into FIFO

[A - C - -]            :slot contents array   slot 1 was emptied of product B
[0 1 2 3 4]            :slot ID (slot contents array index)
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 17th, 2021, 12:53 PM   #14
lavito1960
Supporting Member
United States

lavito1960 is offline
 
Join Date: Sep 2021
Location: tennessee
Posts: 13
I cant thank you enough. I understand what you're saying now and it makes sense. I will start on it this weekend, thanks again
  Reply With Quote
Old September 18th, 2021, 03:02 AM   #15
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,536
@DR: I probably did lol, yes both methods would work, either as you say populate the magazine slot number into a FIFO or just do as I did search for the next location.
One thing that still confuses me a little, as I have read the OP's posts it does appear that this is not what I call a magazine, my interpretation of a magazine is a component is inserted and when the next one is inserted they shift (hence the FIFO), I would call it a storage rack with locations, a magazine like the one on a firearm it shifts the component along so the first out is always on the output.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
FIFO indexing lavito1960 LIVE PLC Questions And Answers 4 September 16th, 2021 06:49 AM
FIFO Load and MOV conflict locotumbler LIVE PLC Questions And Answers 14 July 16th, 2020 12:31 PM
Logix5000 FIFO manipulation alexbeatle LIVE PLC Questions And Answers 20 July 16th, 2019 07:55 PM
FIFO dilemma jakeemon LIVE PLC Questions And Answers 21 August 6th, 2013 10:22 AM
FIFO Check The_Wanderer LIVE PLC Questions And Answers 1 October 15th, 2003 07:44 AM


All times are GMT -4. The time now is 04:34 PM.


.