2/22/2024 12:30 PM | |
Joined: 9/23/2005 Last visit: 11/12/2024 Posts: 4785 Rating: (730)
|
Now it's clear. First - the encoder, you should calculate displacement from previous read out of the encoder till the current one, let's call it Displacement Second - the box, it should have three properties, let's call them IsPresent - means the box exists, Height - height of the box and Position - the box actual position Third - the collection, in PLCs you (usually) can't create and destroy objects, so there must exist a predefined pool of objects, where an entity representing a box can be retrieved from, an array can be used for this The algorithm for tracking boxes: 1) a box is registered at height sensor - get a free box from the collection (IsPesent = FALSE), make it exists (IsPresent = TRUE), set its Height to what was measured and Position = 0 2) every cycle of the program for each box in collection which exists, add Displacement to its current Position 3) every cycle of the program for each box in collection which exists if Position > length of the belt set IsPresent = FALSE Done. Rejection - each rejection device needs to know its own position along a belt (position of a height sensor is 0 ): 1) every cycle each rejection device checks the collection, if there exists a box for which Position = its position (don't forget some hysteresis) and Height = its preferable height then reject and set IsPresent = FALSE; Done. Roughly that's it. If you'd like to learn more about such beautiful ideas, go there. |
Last edited by: jacek d at: 02/22/2024 12:31:51Regards, |
|
Follow us on