View Single Post
Old August 5th, 2022, 03:19 PM   #2
Lifetime Supporting Member
United States

drbitboy is offline
drbitboy's Avatar
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,585
Originally Posted by AK5fa View Post
2. How can I "attach" RS232 data messages (coming in at fixed intervals) to a specific product on the conveyor?
Please keep in mind that there could be any number (from 1 to 5) of products on the conveyor passing by cameras each of 4 camera at rapid succession. 1 or more of them could be marked "defective" by 1 or more cameras.
This is the key question.


Any computer program is a model of something in the real world. Bits (e.g. encoder pulses, or proximity sensors), numbers (e.g. 1D position of a defect), etc. represent some state or quantity in that model.

PLC programs are about time i.e. how the program model changes over time, as measured at discrete moments called scan cycles.

Cylinder defects

With those statements in mind, let me restate the key question in a slightly different way:
  • When the center of a 170mm cylinder is at the ejector rod, how can the program know whether there is a defect within 85mm (=170mm/2) of the ejector rod?
Stated that way, the task is reduced to two sub-tasks
  • Detect (or know or predict) when a 170mm cylinder is centered at the ejector rod
    • This can be derived from "Track the position of the lead edge of each 170mm cylinder"
  • Track the position of all detected defects
So, if the program detected the rising edge of the entrance proximity sensor of the leading edge of a cylinder some N encoder pulses ago, then the program should be able to predict where that leading edge is now, in units of encoder pulses from the entrance prox.

Likewise, if some time ago the cameras detected a defect that was located at a distance of M encoder pulses from the entrance prox, and there have been K pulses since then, then the program should be able to predict where that defect is now, again in units of encoder pulses from the entrance prox.

Note that we no longer associate the defect with a cylinder, but rather we associate independent 1D positions of both cylinders and defects relative to the entrance prox/ejector rod line.

Model assumptions
  1. The cylinders do not move relative to the conveyor belt
  2. Any defect does not move relative to the cylinder on which it is detected
    1. By implication, if Assumption 1 above is also true, the any defect also does not move relative to the conveyor belt
  3. The interval between successive encoder pulses represents a fixed increment of motion of the conveyor belt, along with any cylinders and/or defects
  4. The PLC does not miss any encoder pulses
    1. or at least knows the count of encoder pulses since the last scan
  5. The 1D position of the ejector rod, relative to the entry proximity sensor, is known, in units of encoder pulses from the entrance prox.
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good
  Reply With Quote