If more information is needed about this project I will try my best but this is about as much as I know about the project currently.
What computer programming experience do you have?
- types of computers e.g. Windows, Linux, embedded, etc.
- programming languages e.g. Python, Rust, Go, Perl, Bash, C/C++, Java, JavaScript, Node, Fortran, etc.
The key to programming a PLC is managing time, and the PLC scan cycle is the clock. See
this video series to understand the PLC scan cycle and how it drives the user program. See
this website for the common logic patterns used in PLC relay logic (when to do what).
Almost all computer programs model (simulate) something in the real world. The primary design choice is the level of fidelity in the model: it may model the height products along the conveyor; it will not need to model the color of the operator's socks.
With products on a conveyor, it is common to model the conveyor as an array of bits (or groups of bits a.k.a. integers), where
- the element locations at one end of the array represent the position at the start of the conveyor,
- the location at the other end of the array represent the position at end of the conveyor,
- the array locations in between the ends represent discrete positions along the conveyor line,
and to shift the values of the elements in the array along the locations in the array to model the movement of the products along the conveyor line. In this model, a particular array location (index) will represent a station along the conveyor line e.g. an inspection station or a reject station or a label application station, etc. Each shift of the values is triggered by an event, such as a conveyor motor encoder, or a proximity sensor detecting teeth on an conveyor sprocket, or even a timer expiration, that is detected during a single scan cycle.
Once the model array is set up and shifting the values to mirror the products (bits) moving along the conveyor (array), there needs to be program logic to measure and control the process. For example, a proximity sensor triggered by a passing product could cause that product to be inspected by a camera or a barcode scanner; the result(s) of that inspection could be written into the array at the array location that models the camera position along the conveyor. A second array location (index) might model the position of a reject station downstream from the camera along the conveyor. Each value is shifted from where it was written (camera/barcode index) along the array until it reaches that reject station index, at which point the PLC logic will examine its value and trigger the appropriate action e.g. reject and divert a product that failed an earlier inspection.
A similar model also uses an array, but leaves the values in their locations, and increments an index into an array location, which index represents the start of the conveyor, to model the start of the conveyor, and uses offsets from that start index as the positions of various station, with wraparound from the end of the array to the beginning, so the array is a circular buffer.
The most common Studio 5000 instructions for this are the bit-shift (BSL, BSR) and FIFO (FFL, FFU) instructions. See
here.
One thing to note about this kind of model is that the array comprises element value at
discrete locations, while physical conveyor positions are, quantum physics aside
,
continuous. This is where thinking about the model's level of fidelity comes in: how accurately do discrete element locations in the array need to model positions along the conveyor; will there need to be twenty elements in the array, or a thousand?
It might be useful so search for the terms bsr, bsl, fifo, and conveyor on this forum, or the web, to find examples of these kinds of PLC models.
This only covers the programming side, which is the easy and boring part of the project. The interesting bits will be establishing connections and/or communications between the PLC and the various input (e.g. barcode scanner, conveyor motor encoder, proximity sensors) and output devices.