A visual inspection result binding and unloading control method and system based on station beat mapping

By using a workstation-product mapping array, detection context binding, and PLC interlocking mechanism, the problems of mismatched detection results and incorrect material cutting in continuous industrial vision inspection production lines are solved, enabling reliable binding of detection results and accurate execution of material cutting, and ensuring rapid system recovery in abnormal situations.

CN123029862APending Publication Date: 2026-11-03HEBEI BOKAI ENERGY SAVING TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611284107.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

In continuous industrial vision inspection production lines, existing technologies suffer from problems such as inaccurate position estimation, chaotic result processing, PLC interaction risks, and poor power outage recovery capabilities, leading to mismatches between inspection results and physical products, incorrect material handling, and inconsistencies with the system.

Method used

By establishing a workstation-product mapping array, generating workstation product snapshots, binding detection contexts and merging results, introducing an event generation identification mechanism, designing a PLC interlock mechanism, and persisting queue states, reliable binding of detection results and accurate execution of material feeding actions are ensured.

Benefits of technology

It effectively solves the problem of mismatched detection results caused by network latency and camera reconnection, ensuring that the most serious detection results are processed first, avoiding material feeding errors and production accidents, and the system can quickly resume normal operation in abnormal situations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123029862A_ABST
    Figure CN123029862A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of industrial automation control, and particularly relates to a visual detection result binding and unloading control method based on station beat mapping, which is applied to a continuous industrial production line comprising multiple visual detection stations, a programmable logic controller and a terminal unloading station, and comprises the following steps: S1: in response to a feeding signal, generating a unique product number for a product to be detected, establishing a station-product mapping array, and placing the product to be detected at the first position of the mapping array. The application generates a globally consistent station product snapshot in each beat event by establishing a unified station-product mapping array, so that the generation source of the detection context is unique and traceable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of industrial automation control technology, and in particular relates to a method and system for binding visual inspection results and controlling material unloading based on workstation cycle time mapping. Background Technology

[0002] In continuous industrial vision inspection production lines, products are usually numbered when they are loaded, move station by station with the conveyor according to the rhythm, and are photographed and inspected at multiple stations. Finally, they are unloaded at the end based on the inspection results (such as OK products, NG products, or manual re-judgment).

[0003] However, existing technologies have the following drawbacks in practical applications: Inaccurate location estimation: Some solutions rely on fixed delays or a single counter to estimate product location, failing to create a unified workstation-product snapshot. When multiple cameras return results asynchronously, network latency or reconnection can easily lead to mismatches between the results and the physical product.

[0004] The result processing is chaotic: asynchronously returned detection results may be late, duplicate, or out of order. If the system processes the results directly based on the message arrival time, completed products may be added back to the unloading queue, or lighter detection results (such as OK) may overwrite heavier detection results (such as NG), resulting in unloading errors.

[0005] PLC interaction risk: If an effective interlocking mechanism (such as D958 handshake) is not set between material feeding trigger and main line release, material feeding data of multiple products may overlap when the PLC is busy, resulting in inconsistencies between the executed actions and the detection results.

[0006] Poor power outage recovery capability: Traditional workstation mapping and queues are usually stored only in memory. Once the service restarts or the power is lost, the system cannot restore the product position and waiting status, which can easily cause missed loading or misaligned numbering.

[0007] Therefore, there is an urgent need for a control method that can integrate cycle position mapping, detection context verification, result severity merging, and PLC release handshake as a whole to ensure reliable binding of detection results and accurate execution of material feeding actions. Summary of the Invention

[0008] The purpose of this invention is to address the aforementioned technical problems by providing a method and system for binding visual inspection results and controlling material feeding based on workstation cycle time mapping.

[0009] In view of this, the present invention provides a method for binding visual inspection results and controlling material unloading based on workstation cycle time mapping, applicable to a continuous industrial production line including multiple visual inspection workstations, programmable logic controllers (PLCs), and an end-of-line unloading workstation. The method includes the following steps: S1: In response to the feeding signal, generate a unique product number for the product to be inspected, and establish a workstation-product mapping array, placing the product to be inspected at the beginning of the mapping array; S2: In response to a beat event, determine the generational identifier of the beat event; if it is a new beat, then perform an overall translation on the workstation-product mapping array, generate a workstation product snapshot of the current beat, and generate a detection context containing product number, workstation number and desired camera set for each visual inspection workstation based on the workstation product snapshot; S3: Receive the asynchronously returned visual inspection results and bind the visual inspection results according to the product number and workstation number in the inspection context; S4: Verify and merge the bound visual inspection results. If there are multiple visual inspection results for the same product, retain the judgment result with the highest severity and prohibit product position reversal. S5: Generate items to be unloaded based on the results of the verification and merging, and transfer the status of the items to be unloaded between the waiting queue and the ready queue according to the current cycle time; S6: When the item to be unloaded enters the ready queue, the status of the PLC unloading trigger register is checked. If the status is idle, the unloading result, product number and trigger signal are written to the PLC in the synchronization critical section, and the next ready item is processed after the status of the PLC unloading trigger register is restored to idle.

[0010] Furthermore, in step S2, the workstation-product mapping array is shifted as a whole, specifically including: To obtain generational markers for beat events; If the generational identifier indicates a new beat, then the product ID of the (s-1)th workstation in the workstation-product mapping array is assigned to the sth workstation, where s is an integer greater than 1; If the generational identifier indicates a replay event, the current workstation product snapshot is used directly, and the workstation-product mapping array is not advanced again.

[0011] Furthermore, in step S3, before binding the visual detection result according to the detection context, a filtering step is also included: Extract the generational identifier, product number, and workstation information from the visual inspection results; If the generation identifier is earlier than the current system generation, or the product corresponding to the product number is no longer in the workstation-product mapping array, or the product corresponding to the product number has been marked as completed, then the visual detection result is discarded.

[0012] Furthermore, in step S4, the judgment result with the highest severity is retained, specifically including: Preset severity levels for the judgment results, where OK < manual review. <NG; When a new visual inspection result for the same product is received, the severity level of the new result is compared with the previously recorded judgment result. The determination result of the item to be unloaded is updated only if the severity level of the new result is higher than that of the previously recorded determination result.

[0013] Furthermore, in step S5, the status transition of the item to be unloaded between the waiting queue and the ready queue is performed according to the current cycle time, including: Calculate the theoretical position (currentStation+1) of the item to be unloaded and the actual position (snapshotStation+1) based on the snapshot of the product at the workstation. The larger of the two values ​​is taken as the current position of the item to be cut after the update. If the current position has not reached the preset unloading station, the item to be unloaded will be kept in the waiting queue; if the current position has reached or exceeded the preset unloading station, the item to be unloaded will be moved into the ready queue.

[0014] Furthermore, in step S6, writing the material feeding result, product number, and trigger signal to the PLC within the synchronization critical region specifically includes: Obtain the target item to be unloaded from the head of the ready queue; When the main line release is detected and the value of the PLC material feeding trigger register is 0, the critical section is locked. Data is written to the PLC's result register and number register in a preset order, and a valid signal is written to the trigger register. Record the trigger confirmation context and periodically monitor the value of the trigger register until it changes from 1 to 0. After confirming that the PLC has consumed this data, unlock the critical section and process the next target item to be fed.

[0015] 7. The method according to claim 1, characterized in that the method further includes a persistent recovery step: The status of the workstation-product mapping array, the queue to be promoted, and the ready queue are periodically serialized and stored in the database; Upon system restart, the workstation-product mapping array and queue status are restored from the database; Traverse the restored queue items and check whether the corresponding product is still in the mainline mapping or has been completed. If not, clear the residual items.

[0016] A vision inspection result binding and unloading control system based on workstation cycle time mapping, used to execute the above method, includes: A beat mapping module, configured to maintain a station-product mapping array, and generate a station-product snapshot in response to a beat event; A context management module, configured to generate a detection context based on the station-product snapshot, and perform binding and filtering on asynchronously returned visual detection results; A result decision module, configured to perform severity merging on multiple visual detection results of the same product, and generate a to-be-unloaded item; A queue scheduling module, configured to manage a to-be-advanced queue and a ready queue, and advance the position of the to-be-unloaded item based on beats; A PLC interaction module, configured to perform status detection, data writing and release handshaking for a PLC unloading trigger register.

[0017] The beneficial effects of the present invention are as follows: By establishing a unified station-product mapping array and generating a globally consistent station-product snapshot in each beat event, the present application enables the generation source of the detection context to be unique and traceable. Compared with the prior art that relies on fixed delays or independent counters to estimate product positions, the present application generates a detection context including a product number, a station number and an expected camera set for each visual detection station based on the snapshot, and the asynchronously returned detection results are bound by matching the context, which fundamentally eliminates the problem of mismatch between detection results and physical products caused by network delay, camera reconnection or message out-of-order, and significantly reduces the false positive rate.

[0018] The present application introduces an event generation identifier mechanism, which updates the generation number each time material clearing or system reconnection is performed. The asynchronously returned detection results need to pass triple filtering of generation verification, product existence verification and completion state verification before binding. Any residual result carrying an old generation identifier, or any ghost result whose product number is not in the current mapping array and not in the historical tracking table, will be automatically discarded. This mechanism ensures that even under complex working conditions such as abnormal production line interruption and equipment reconnection, the system will not generate wrong unloading decisions due to processing expired or invalid data.

[0019] The present application presets a severity level system of OK < manual recheck < NG. When multiple detection results of the same product are returned at different stations or at different times, the system performs an update only when the severity of the new round of results is higher than the existing record. This means that a lighter judgment result (such as OK) will never overwrite a heavier judgment result (such as NG), ensuring that the final unloading decision is always based on the most severe defect level, and avoiding the risk of defective products flowing out due to result rollback.

[0020] This application maintains a dual-queue structure of a pending queue and a ready queue, and performs position correction on the items to be unloaded in the queues during each cycle. Specifically, the system simultaneously calculates the theoretical advancement position of the item to be unloaded (original position plus one) and the actual physical position based on the latest workstation product snapshot, taking the larger of the two values ​​as the updated current position. This mechanism effectively solves the position lag problem caused by software processing delays—when a product has physically arrived at the unloading station, but the software record has not yet been updated, the system can promptly move it into the ready queue based on the snapshot, avoiding production line waiting. At the same time, the rule of only increasing and never decreasing the position completely eliminates the anomaly of product position regression due to late results.

[0021] This application incorporates a complete interlocking mechanism in the material feeding stage. Before writing feeding data, the system first checks if the PLC's feeding trigger register is idle. Only after confirming idleness does it enter the synchronization critical section and write the result register, number register, and trigger register sequentially according to a preset order. After writing, the system continuously monitors the status of the trigger register until it changes from active to idle, confirming that the PLC has completed data consumption and unlocking the critical section. This mechanism ensures that the result code, product number, and trigger signal belong to the same product transaction and cannot be interrupted by other threads or clock cycles, fundamentally preventing serious production accidents such as data overwriting, actuator malfunctions, or product number misalignment caused by PLC overload.

[0022] This application periodically persists the critical states of the workstation-product mapping array, the pending queue, and the ready queue. When the system crashes unexpectedly or restarts due to a power outage, it can restore the complete production line state from the database and automatically traverse the remaining items in the queues, verifying whether the corresponding product still exists in the current mapping or has been unloaded. For remaining items that have left the main line or have been processed, the system automatically clears them, avoiding missed or duplicate unloading due to inconsistent states after a restart. This ensures the production line can quickly and safely resume normal operation after an anomaly, significantly reducing manual intervention costs. Attached Figure Description

[0023] Figure 1 It is a flowchart of workstation cycle time mapping, inspection result binding and material feeding control; Figure 2 This is a diagram of the asynchronous result error prevention binding and recovery mechanism. Detailed Implementation

[0024] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0025] In the description of this application, it should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. For ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following drawings denote similar items; therefore, once an item is defined in one drawing, it need not be further discussed in subsequent drawings.

[0026] It should be noted that the terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and are not limited in number; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0027] It should be noted that in the description of this application, the directional terms such as "front, back, up, down, left, right", "horizontal, vertical, horizontal" and "top, bottom" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description. Unless otherwise stated, these directional terms do not indicate or imply that the device or element referred to must have a specific orientation or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the scope of protection of this application. The directional terms "inner" and "outer" refer to the inner and outer contours relative to the outline of each component itself.

[0028] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0029] Example 1: Normal beat mapping and result binding based on snapshots: This embodiment combines Figure 1 This describes how the system performs location mapping and result binding under normal production cycle time.

[0030] Material loading and mapping initialization: When product P101 is physically loaded, the system generates a unique product number (such as SN20231001) and an internal product ID, and writes the ID into the first position of the workstation-product mapping array (Station 1).

[0031] Beat Progression and Snapshot Generation: When a beat event is triggered by the camera sensor, the system checks the event generation. If it is a new beat, the system shifts the entire array forward (Station s = Station s-1) and generates a snapshot of the workstation product at the current moment.

[0032] Context Construction: Based on this snapshot, the system queries the process configuration corresponding to the current product model to determine the list of cameras that need to be activated or detected at the current workstation, i.e., the desired camera set. Then, a detection context is generated, which includes: {Product Number, Workstation Number, Desired Camera Set, Batch Serial Number}. Before sending the detection trigger command, the system registers this context to prevent context loss due to cameras returning too quickly.

[0033] Result Binding: The camera asynchronously returns the detection result of P101 at workstation 3. The system extracts the product number and workstation number from the result, matches them with the registered Context, and binds the result (such as "scratch") to P101.

[0034] Example 2: Error prevention and severity merging for asynchronous results: This embodiment combines Figure 2 Describe how the system handles out-of-order, duplicate, and late results.

[0035] Ghost and Residual Filtering: Suppose the system updates the generation from Gen 1 to Gen 2 due to a cleanup operation. If a late detection result carrying a Gen 1 identifier is received at this time, the system directly determines it as residual data and discards it. If a result with a product number that does not exist in the current mapping array and is not in the historical tracking table is received, it is determined as a ghost result and discarded.

[0036] Severity merging logic: Product P102 first returned the inspection result of station 2, which was judged as "manual re-judgment" (medium severity). The system generated item U to be unloaded, and the status was marked as "manual re-judgment".

[0037] Subsequently, due to network jitter, the system received a retransmission result from workstation 2, which was judged as "OK" (low severity). The system comparison found that the severity of the new result was lower than the current record, so the OK result was ignored, and the "manual review" status remained unchanged.

[0038] Next, the system received the inspection result from workstation 4 and judged it as "NG" (high severity). The system updated the judgment result of the item to be unloaded, U, to "NG".

[0039] During this process, regardless of how the results are updated, the current position (currentStation) of the item to be loaded will only increase and not decrease, to prevent the position from regressing due to late results.

[0040] Example 3: Dual-queue advancement and position correction: This embodiment describes how to ensure the accuracy of the material feeding position.

[0041] Dual queue mechanism: The system maintains a "waiting queue" and a "ready queue". Products that have not yet reached the unloading station move in the waiting queue according to the cycle time.

[0042] Position cross-correction: In each cycle, the system calculates the theoretical position of the item to be unloaded (original position + 1) and the actual position (snapshot position + 1) based on the latest station snapshot. The system takes the larger of the two values ​​as the updated current position. This strategy follows the "physical reality priority" principle: for example, if a product is still recorded at station 4 due to software processing delay, but the snapshot shows that it has physically reached station 5, the system uses station 5 as the current position, forcibly corrects the software status, and prevents unloading delays.

[0043] Ready to move: When the current material station is set to station 10, if the calculated new position is ≥10, the system will move the product from the pending queue to the ready queue, waiting to be unloaded.

[0044] Example 4: PLC material handling and critical zone protection: This embodiment describes how the system interacts with the PLC to ensure that the material feeding is executed correctly.

[0045] Access control and handshake: When the ready queue is not empty, the system first waits for the main line release signal. Then it reads the PLC register D958 (material unloading trigger status bit).

[0046] Critical section write: If D958=1, it means that the PLC is processing the previous product and the current product is waiting.

[0047] If D958=0, the system enters the synchronization critical section. The material unloading number (e.g., No.5) is parsed from the product number, and the final judgment result (e.g., NG) is obtained.

[0048] The system writes to the PLC sequentially: the result register (e.g., D954=2 represents NG), the number register (e.g., D960=5), and the trigger register (e.g., D958=1). These three steps are part of the same transaction at the code level and cannot be interrupted by other threads.

[0049] Release Confirmation: After writing, the system records the trigger context. A background thread continuously monitors D958; once D958 changes from 1 back to 0, it indicates that the PLC has read the data and executed the push rod action. The system then clears the context, allowing the next product in the ready queue to be unloaded.

[0050] Example 5: State persistence and restart recovery: This embodiment describes the system's disaster recovery capabilities.

[0051] State saving: The system serializes and saves the workstation-product mapping array, the queue to be pushed, and the ready queue to the database every fixed time interval (e.g., 500ms) or when the queue changes.

[0052] Reboot and Restore: If the software crashes and restarts unexpectedly, the system will load the above state from the database.

[0053] Residual cleanup: After recovery, the system iterates through the product IDs in the queue and checks if they still exist in the current workstation mapping array. If a product has been removed from the main line (e.g., physically removed), it is removed from the queue to prevent accidental material placement.

[0054] The embodiments of this application have been described above with reference to the accompanying drawings. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. This application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for binding visual inspection results and controlling material feeding based on workstation cycle time mapping, characterized in that, Applied to a continuous industrial production line including multiple vision inspection stations, programmable logic controllers, and end-of-line unloading stations, the method includes the following steps: S1: In response to the feeding signal, generate a unique product number for the product to be inspected, and establish a workstation-product mapping array, placing the product to be inspected at the beginning of the mapping array; S2: In response to a beat event, determine the generational identifier of the beat event; if it is a new beat, then perform an overall translation on the workstation-product mapping array, generate a workstation product snapshot of the current beat, and generate a detection context containing product number, workstation number and desired camera set for each visual inspection workstation based on the workstation product snapshot; S3: Receive the asynchronously returned visual inspection results and bind the visual inspection results according to the product number and workstation number in the inspection context; S4: Verify and merge the bound visual inspection results. If there are multiple visual inspection results for the same product, retain the judgment result with the highest severity and prohibit product position reversal. S5: Generate items to be unloaded based on the results of the verification and merging, and transfer the status of the items to be unloaded between the waiting queue and the ready queue according to the current cycle time; S6: When the item to be unloaded enters the ready queue, the status of the PLC unloading trigger register is checked. If the status is idle, the unloading result, product number and trigger signal are written to the PLC in the synchronization critical section, and the next ready item is processed after the status of the PLC unloading trigger register is restored to idle.

2. The method according to claim 1, characterized in that, In step S2, the workstation-product mapping array is shifted as a whole, specifically including: To obtain generational markers for beat events; If the generational identifier indicates a new beat, then the product ID of the (s-1)th workstation in the workstation-product mapping array is assigned to the sth workstation, where s is an integer greater than 1; If the generational identifier indicates a replay event, the current workstation product snapshot is used directly, and the workstation-product mapping array is not advanced again.

3. The method according to claim 1, characterized in that, In step S3, before binding the visual detection result according to the detection context, a filtering step is also included: Extract the generational identifier, product number, and workstation information from the visual inspection results; If the generation identifier is earlier than the current system generation, or the product corresponding to the product number is no longer in the workstation-product mapping array, or the product corresponding to the product number has been marked as completed, then the visual detection result is discarded.

4. The method according to claim 1, characterized in that, In step S4, the judgment result with the highest severity is retained, specifically including: Preset severity levels for the judgment results, where OK < manual review. <NG; When a new visual inspection result for the same product is received, the severity level of the new result is compared with the previously recorded judgment result. The determination result of the item to be unloaded is updated only if the severity level of the new result is higher than that of the previously recorded determination result.

5. The method according to claim 1, characterized in that, In step S5, the status transition of the item to be unloaded between the waiting queue and the ready queue is performed according to the current cycle time, including: Calculate the theoretical position of the item to be unloaded and the actual position based on the workstation product snapshot; The larger of the two values ​​is taken as the current position of the item to be cut after the update. If the current position has not reached the preset unloading station, the item to be unloaded will be kept in the waiting queue; if the current position has reached or exceeded the preset unloading station, the item to be unloaded will be moved into the ready queue.

6. The method according to claim 1, characterized in that, In step S6, writing the material feeding result, product number, and trigger signal to the PLC within the synchronization critical region specifically includes: Obtain the target item to be unloaded from the head of the ready queue; When the main line release is detected and the value of the PLC material feeding trigger register is 0, the critical section is locked. Data is written to the PLC's result register and number register in a preset order, and a valid signal is written to the trigger register. Record the trigger confirmation context and periodically monitor the value of the trigger register until it changes from 1 to 0. After confirming that the PLC has consumed this data, unlock the critical section and process the next target item to be fed.

7. The method according to claim 1, characterized in that, The method also includes a persistent recovery step: The status of the workstation-product mapping array, the queue to be promoted, and the ready queue are periodically serialized and stored in the database; Upon system restart, the workstation-product mapping array and queue status are restored from the database; Traverse the restored queue items and check whether the corresponding product is still in the mainline mapping or has been completed. If not, clear the residual items.

8. A vision detection result binding and unloading control system based on workstation cycle time mapping, used to execute the method described in any one of claims 1-7, characterized in that, include: The cycle time mapping module is used to maintain the workstation-product mapping array and generate workstation product snapshots in response to cycle time events; The context management module is used to generate a detection context based on the workstation product snapshot and to bind and filter the asynchronously returned visual detection results; The results decision module is used to merge the severity of multiple visual inspection results for the same product and generate items to be cut. The queue scheduling module is used to manage the queue to be advanced and the ready queue, and to advance the position of the items to be unloaded based on the cycle time. The PLC interaction module is used to perform status detection, data writing, and release handshake of the PLC feeding trigger register.