0

I'm working on a conveyor-sorter solution and need to store data about items in some organised manner. My first guess was FIFO. Do you know if there is any "good practice" way to program efficient FIFO list in Structured Text (PLC)? Or have you worked with similar project and solved that differently?

Thanks in advance

  • 1
    [Here](https://infosys.beckhoff.com/english.php?content=../content/1033/tcplclib_tc2_utilities/35413643.html&id=) is an example for TwinCAT. It uses a TwinCAT specific function block: `FB_MemRingBuffer`. However, if you don't use TwinCAT this example might not be so useful. – Roald Jan 14 '22 at 13:02
  • How large of an array? For what hardware? For an array of say 20 strings, I would skip the FIFO and just use a FOR/NEXT loop - the execute penalty is small compared to a FIFO FB. If you have large data, then a type of ring buffer makes sense. The worst thing you can do for a PLC program is force 1000x string/data copies every PLC scan on a low CPU platform. – Scott Jan 30 '22 at 00:26

1 Answers1

0

I prefer to use Circular FIFO in PLC rather than simple Linear FIFO. The advantage of using Circular FIFO is that it is fast since it doesn't require shifting data.

Disadvantage: It requires a little more effort to develop.

https://en.wikipedia.org/wiki/Circular_buffer