FIFO indexing

lavito1960

Member
Join Date
Sep 2021
Location
tennessee
Posts
13
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
 
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.
 
Last edited:
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.
 
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
 
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.

MagScr.png MagCode.png
 
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.
 
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:
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.
 
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 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.
 
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  [COLOR=Blue][B] slot IDs 0/1/2 were unloaded[/B][/COLOR]

[A [B]B [/B]C - -]            :slot contents array   [COLOR=blue][B]slots 0/1/2 were filled[/B][/COLOR]
[0 [B]1 [/B]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[B] 1[/B]]<=in       :available slot FIFO   [COLOR=Blue][B]slot ID 1 was loaded into FIFO[/B][/COLOR]

[A [B]-[/B] C - -]            :slot contents array   [B][COLOR=Blue]slot 1 was emptied of product B[/COLOR][/B]
[0 [B]1 [/B]2 3 4]            :slot ID (slot contents array index)
 
@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.
 

Similar Topics

Good morning, I am interested in using FIFO to use for a magazine rack that uses a loader to load part in a slot and index each subsequent part to...
Replies
4
Views
1,865
I am not sure if this is possible but if there is a way, you guys would be the ones to know. I am currently working on a project where we are...
Replies
7
Views
184
Hello all, I'm using a 5069-L330ER in a project and I need to essentially capture some data that will be shown as a trend on a screen. The data...
Replies
9
Views
941
Hello! I have a network of conveyors bringing raw product to 4 machines. A sensor in the hopper of each machine calls for more product. I'm...
Replies
15
Views
5,688
Hello everyone, has anyone out there ever made a FIFO using an FFL and FFU instructions on a Micro800? I have tried setting it up just as I would...
Replies
9
Views
3,062
Back
Top Bottom