The best way is to use a shift register, it looks like something I did some years ago the difference was we had 10 or so divert stations, basically, the bar codes were read at a position & a simple encoder (actually a star wheel & proximity) giving pulses to shift the reads down the line, in my case just had to compare particular parts of the shift register when the data reached the divert position if correct box then it diverted, if it failed to find a divert for a particular barcode it would just go round the loop.
what you have is something similar but it appears you have no way of checking when one is removed but this is quite simple I think.
lets assume your pulses from a star wheel (personally I would not use an encoder as that sort of accuracy probably not required). on every pulse (or perhaps every x number of pulses when the RFID is read poke that into the shift register, then count the number of shift registers that have data.
Let's assume that the pulses from the star wheel correspond to 2 ft, & the circular conveyor is 100ft long then there are 50 effective shift places, when a pallet is read it is put into the shift register & shifted along, every 2 ft ( pulse from star wheel) if no data read then zero the shift register location.
You would need to find the number of pulses per pallet length (only needs to be a rough amount) to give the shift pulse. & the number of shift pulses from read position round the loop until back of the read position

Sorry about the crude drawing but this is my idea.
A RFID is read & put into the shift register location 0, if no read then a zero is put in there. as the conveyor moves pulses off the star wheel shift the reads along the shift register, denoted by the lines, if the pallet is still on when it gets back to the read position then it is read again however, if no pallet then a zero is put in there, so lets assume there are 20 pallets in the system your code will add up the number of locations with data so that gives you the number of pallets, if one has been removed then the register at the read will be reset to zero. To complex to draw this quickly but it is just a matter of getting the resolution correct, the only thing I do not know is how these pallets be removed, if only in one location then a sensor at that location could be used to clear the shift register position so every scan of the plc will check if that location has a bar code if it does but sensor does not detect a pallet then zero the shift register. so when the system counts the number of reads in the shift register it gives the number of pallets on the system. there must be a position where the pallets are loaded onto it or where it may be taken off but not shown on your drawing, so it's a guess. I would make the shift register twice as long as the pallet width the syncronisation would require a sort of encoder/star wheel on the drive Done this a number of times but slightly different it is just a matter of working out the number of shifts per pulse spaced evenly around the conveyor, the only catch is if the pallets can be removed aor placed at any position there will be an error of pallet counts for a short time.
what you have is something similar but it appears you have no way of checking when one is removed but this is quite simple I think.
lets assume your pulses from a star wheel (personally I would not use an encoder as that sort of accuracy probably not required). on every pulse (or perhaps every x number of pulses when the RFID is read poke that into the shift register, then count the number of shift registers that have data.
Let's assume that the pulses from the star wheel correspond to 2 ft, & the circular conveyor is 100ft long then there are 50 effective shift places, when a pallet is read it is put into the shift register & shifted along, every 2 ft ( pulse from star wheel) if no data read then zero the shift register location.
You would need to find the number of pulses per pallet length (only needs to be a rough amount) to give the shift pulse. & the number of shift pulses from read position round the loop until back of the read position

Sorry about the crude drawing but this is my idea.
A RFID is read & put into the shift register location 0, if no read then a zero is put in there. as the conveyor moves pulses off the star wheel shift the reads along the shift register, denoted by the lines, if the pallet is still on when it gets back to the read position then it is read again however, if no pallet then a zero is put in there, so lets assume there are 20 pallets in the system your code will add up the number of locations with data so that gives you the number of pallets, if one has been removed then the register at the read will be reset to zero. To complex to draw this quickly but it is just a matter of getting the resolution correct, the only thing I do not know is how these pallets be removed, if only in one location then a sensor at that location could be used to clear the shift register position so every scan of the plc will check if that location has a bar code if it does but sensor does not detect a pallet then zero the shift register. so when the system counts the number of reads in the shift register it gives the number of pallets on the system. there must be a position where the pallets are loaded onto it or where it may be taken off but not shown on your drawing, so it's a guess. I would make the shift register twice as long as the pallet width the syncronisation would require a sort of encoder/star wheel on the drive Done this a number of times but slightly different it is just a matter of working out the number of shifts per pulse spaced evenly around the conveyor, the only catch is if the pallets can be removed aor placed at any position there will be an error of pallet counts for a short time.

