FIFO (First-In First-Out) is a concept widely
used in logistics and it means that the first item that enters the stock, must
be the first item to leave the stock.
In this post we will show two instructions on Rockwell PLCs with these functions, which are FFL (FIFO LOAD) and FFU (FIFO UNLOAD). The first is responsible for inserting the item in stock and the second is responsible for removing it.
Both instructions have a common control variable,
since the controlled stock is the same, with status bits. The main status bits
are EN (FFL enabled instruction, in the FFU it is called EU), DN (bit is
activated when the stock position has reached the stock limit) and EM (Empty
for empty stock). In addition to the status bits, it is important to know the
size of the stock and the current position, which are represented by LEN and
POS.
- FIFO [i] is a DINT array of size 10. In the first scan of the PLC its size is read with the SIZE instruction and written in the size of the FIFO_Control.LEN control variable. This will be used in other operations and the advantage of doing this process is that the size is configured, instead of being entered manually.
- When there is a positive pulse of the Load bit, the FFL instruction will be executed and the value of the InputElement variable will be inserted in the available position of the stock where it is located.
- When the position reaches the stock limit, in other words when POS = LEN, the Done bit is activated. It is not possible to insert new elements in the stock while the Done bit is activated.
- When the stock is empty, POS = 0, the EM bit is activated.
- When there is a positive pulse from the Unload bit, the FFU instruction will be executed and the value in the first position will be written in the OutputElement variable.
- The logic above was inserted to reset the values in the FIFO stock array and to reset the current position.
No comments:
Post a Comment