Integrated visual identification PLC method
By integrating visual recognition algorithm into PLC and adopting multi-core isolation technology, the problems of system complexity and data transmission delay in the existing technology are solved, and efficient, stable and low-cost integrated visual recognition PLC design is realized, which improves the system's Real-time and reliability.
Patent Information
- Application Number
- CN202410989692.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-22
AI Technical Summary
The existing integrated visual recognition PLC design has problems such as increased system complexity, data transmission delay, integration process difficulties and communication reliability, which affects the real-time and overall performance of the system.
By integrating the visual recognition algorithm into the PLC, uploading and initializing the visual algorithm library using defined interface protocols and WEB services, multi-core isolation technology is used to run visual recognition and PLC tasks separately to ensure efficient collaborative work and fault isolation.
It achieves the goals of simplification of the system architecture, high real-time, high stability, simple integration and low cost, reduces dependence on external devices, improves response speed and processing efficiency, and enhances the stability and reliability of the system.
Smart Images

Figure CN119006983A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of program control systems, in particular to a programmable logic controller. Background Art
[0002] The existing PLC design method with integrated visual recognition combines PLC control with computer vision technology to improve the efficiency and accuracy of industrial automation. However, this method faces technical challenges such as increased system complexity, data transmission delay, difficulty in integration process and reduced communication reliability during implementation, which may affect the real-time performance and overall performance of the system. For example, the Chinese patent with publication number CN115816469B discloses a cloud-based PLC control material sorting method and system based on machine vision, and provides the following technical solutions. The present invention discloses a cloud-based PLC control material sorting method and system based on machine vision, which relates to the field of intelligent material sorting technology. It includes: the material conveying system conveys the material to be sorted to the sorting area according to the set conveying mode; the machine vision recognition system obtains the image containing the material, generates the material information and sends it to the cloud-based PLC control system; the cloud-based PLC control system receives the material information, generates the sorting control instruction and sends it to the sorting execution system; the sorting execution system completes the material sorting task according to the sorting control instruction. The present invention adopts the cloud-based PLC software method to realize the control function, which is simple to deploy and has low redundancy cost. However, the above-mentioned cloud-based PLC-controlled material sorting method and system based on machine vision uses cloud PLC control, which has poor real-time performance, high cost, and complex debugging. Summary of the invention
[0003] The problems of overly complex systems, delayed data transmission, difficult integration and poor reliability in the prior art are solved. The present invention proposes an integrated visual recognition PLC method, which achieves the goals of simple system architecture, high system real-time performance, high system stability, simple integration and low cost.
[0004] To achieve the above object, the present invention adopts the following technical solution: An integrated visual recognition PLC method, characterized by comprising the following steps: S1: Initialize the visual algorithm library and logic program; S2: Initialize the calling vision algorithm; S3: Obtain image data, start the visual algorithm library, and call the visual algorithm library initialization function; S4: Call the calculation function of the visual algorithm library to implement logic program control, process the image data and obtain the result.
[0005] The advantage of this design is that by integrating the visual recognition algorithm into the PLC, image processing and control decisions can be performed directly within the PLC, reducing dependence on external devices and improving the system's integration and response speed.
[0006] Preferably, the step S1 comprises: S1.1: Use the defined interface protocol, select the corresponding visual algorithm library, and generate the algorithm library file; S1.2: Use the WEB service to upload the visual algorithm library to the PLC; S1.3: IEC logic program performs initialization operations.
[0007] The benefit of this design is that by using the defined interface protocol, effective communication between the PLC and the visual algorithm is ensured. At the same time, uploading the algorithm library through the WEB service simplifies the deployment process and improves the flexibility and maintainability of the system.
[0008] Preferably, in step S1.1, a defined interface protocol is used including a visual recognition algorithm function interface definition, an error code definition, and an algorithm library status definition, to define an interface between the PLC and the visual algorithm for collaborative operation.
[0009] The benefit of this design is that clear interface definitions and error handling mechanisms ensure the stability and reliability of the system, while promoting efficient collaboration between PLC and vision algorithms.
[0010] Preferably, the step S2 comprises: S2.1: Call algorithm initialization; S2.2: Determine whether the call is successful, if so, proceed to step S3, if not, proceed to step S2.3; S2.3: Reset the algorithm library and return to step S2.1.
[0011] The advantage of this design is that through strict initialization calls and error handling processes, the correct loading and operation of the visual recognition algorithm is ensured, improving the stability and fault recovery capabilities of the system.
[0012] Preferably, in step S1.3, the IEC logic program performs initialization operations including reading configuration files and establishing communications with IO, and the IEC program is responsible for implementing overall logic control.
[0013] The benefit of this design is that, through the initialization operation of the IEC program, it is ensured that the system can be correctly configured and establish necessary communications when it starts.
[0014] Preferably, the PLC is isolated from the visual algorithm during runtime, and multi-core isolation technology is adopted to run on different cores of the CPU respectively.
[0015] The advantage of this design is that, through multi-core isolation technology, while ensuring system performance, it can prevent visual recognition tasks from interfering with PLC control tasks and prevent the spread of faults, thereby improving system stability and reliability.
[0016] Preferably, the step S4 comprises: S4.1: Select the corresponding IEC program and call the algorithm library; S4.2: Call the algorithm library calculation function, take the logic parameter as input, and obtain the algorithm calculation return data; S4.2: Determine whether the call is successful, if so, proceed to step S4.3, if not, proceed to step S2.3; S4.3: Perform logical processing, process the image, obtain the corresponding result, output it and return to step S4.2.
[0017] The advantage of this design is that, through a clear calling process and error handling mechanism, it ensures the correct calling of the algorithm library and the effective processing of data, thereby improving the real-time performance and control accuracy of the system.
[0018] Preferably, the step S3 includes starting the algorithm library and calling the algorithm library initialization function to determine whether the call is successful. If so, proceed to step S4, if not, proceed to step S2.3; the calling of the algorithm library initialization function includes establishing communication with the outside to check whether the operating conditions are met.
[0019] The advantage of this design is that, through strict initialization process and condition checking, the correct startup of the algorithm library and the suitability of the operating environment are ensured, thus improving the reliability and stability of the system.
[0020] Preferably, in step S1.2, a high-level language is used to build a high-level language application to implement web services and provide system and algorithm library processing functions. The high-level language application provides an HMI human-computer interaction interface and processes the visual algorithm.
[0021] The advantage of this design is that, through high-level language applications, a more friendly and flexible human-computer interaction interface can be provided, while ensuring the effective processing of visual algorithms and the ease of use of the system.
[0022] Preferably, in steps S3 and S4, if there is an exception in the process of calling the algorithm library, the algorithm reset function is called to reinitialize the algorithm library.
[0023] The advantage of this design is that, through exception handling and algorithm reset mechanisms, it ensures that the normal operation of the algorithm library can be restored in time when an abnormal situation occurs, thereby improving the system's fault tolerance and stability.
[0024] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention integrates the visual recognition algorithm into the PLC, so that image processing and control decisions can be performed directly inside the PLC, thereby reducing the reliance on additional external devices. This integration not only simplifies the system architecture, but also significantly improves the response speed and processing efficiency of the system. Since all visual processing and control logic are executed on the same hardware platform, faster data transmission and decision making can be achieved, which is particularly important for automated control scenarios that require fast response.
[0025] 2. The present invention ensures efficient collaboration between PLC and visual algorithms through clear interface definitions, error handling mechanisms, and strict initialization processes. For example, the use of defined interface protocols and error code definitions ensures effective communication between the algorithm and PLC, reducing uncertainty in operation. In addition, through multi-core isolation technology, visual recognition tasks and PLC control tasks run on different CPU cores, effectively preventing interference and fault propagation between tasks, thereby improving the stability and reliability of the entire system.
[0026] 3. The present invention uses WEB services to upload the visual algorithm library and utilizes the human-computer interaction interface provided by the high-level language application. This design method greatly simplifies the deployment and update process of the algorithm library. This design not only makes system configuration and maintenance more flexible, but also improves the scalability of the system. Users can easily monitor the system and adjust the algorithm through a friendly HMI interface, which not only improves the convenience of operation, but also enables the system to quickly adapt to new application requirements or environmental changes. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 The present invention is a flowchart of an embodiment of the present invention.
[0028] Figure 2 A system architecture diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical scheme and advantages of the present disclosure clearer, the following will further describe the embodiments of the present disclosure in detail with reference to the accompanying drawings. The proportions of the components are not drawn according to the actual proportions, and the proportions and sizes shown in the accompanying drawings should not limit the substantial technical scheme of the present invention. These embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described.
[0030] See also Figure 1-2 As shown, an integrated visual recognition PLC method is characterized by comprising the following steps: S1: Initialize the visual algorithm library and logic program; S2: Initialize the calling vision algorithm; S3: Obtain image data, start the visual algorithm library, and call the visual algorithm library initialization function; S4: Call the calculation function of the visual algorithm library to implement logic program control, process the image data and obtain the result.
[0031] The method designed by the present invention aims to solve several key technical problems, including effectively integrating visual recognition technology into PLC systems, achieving efficient data transmission and processing to support real-time visual recognition tasks, ensuring system stability and reliability, and improving system flexibility and ease of use. The innovative method designed by the present invention combines control systems and visual recognition technologies in the field of industrial automation, and its technical background mainly involves: PLC (Programmable Logic Controller): PLC is a commonly used control device in industrial automation, used to control various production equipment and processes. Traditionally, PLC is widely used for logical control of mechanical, electrical and hydraulic systems; Visual recognition technology: With the development of computer vision technology, visual recognition has been widely used in industrial production. Image information is obtained through cameras and other devices, and product features, defects, etc. are detected and identified through algorithm analysis and processing; Integration trend: There is a general trend of integrating and applying different technologies in the current industrial automation field. The design method of integrated visual recognition and PLC takes advantage of this trend to combine traditional PLC control systems with advanced visual recognition technology to improve production efficiency and quality.
[0032] However, existing visual recognition PLC design methods face multiple technical shortcomings, such as: The system is too complex: Independently deployed visual recognition devices and PLCs require additional communication modules and interfaces, which increases the complexity and maintenance cost of the system; Data transmission delay: Data transmission between the independent visual recognition device and the PLC may be delayed, affecting the real-time performance and response speed of the system; Difficulty in integration: Independent devices require additional engineers to integrate and debug, which increases the difficulty of deployment and maintenance; Poor reliability: Communication between independent devices may introduce failure points, reducing the reliability and stability of the entire system.
[0033] To overcome these problems, by developing a special communication protocol and interactive function blocks, defining the control field and data field for communication between visual recognition and PLC, and using multi-core isolation technology to integrate the visual recognition function into the PLC, the purpose of simplifying the system architecture, improving the real-time performance of the system, enhancing the system stability and reducing costs can be achieved. The integration method designed by the present invention not only reduces the additional communication links and equipment, simplifies the system architecture, but also realizes collaborative operation and fault isolation by running visual recognition and PLC on different cores of the same CPU, thereby improving the stability and reliability of the overall system, while reducing the overall cost of deployment and maintenance.
[0034] like Figure 1 In one embodiment shown, Figure 1 This is a flow chart of an embodiment of the present invention. The simple process is as follows: ①Use the defined interface protocol, select the visual algorithm library, and generate the so file; ②Use WEB service to upload the visual algorithm so library to PLC; ③Select the corresponding IEC program, call the algorithm so library, and implement logical program control.
[0035] In one embodiment, the specific design method is: An integrated visual recognition PLC method, characterized by comprising the following steps: S1: Initialize the visual algorithm library and logic program; S1.1: Use the defined interface protocol, select the corresponding visual algorithm library, and generate the algorithm library file; S1.2: Use the WEB service to upload the visual algorithm library to the PLC; S1.3: IEC logic program performs initialization operations; S2: Call algorithm initialization and ensure the call is successful; S2.1: Call algorithm initialization; S2.2: Determine whether the call is successful, if so, proceed to step S3, if not, proceed to step S2.3; S2.3: Reset the algorithm library and return to step S2.1; S3: Obtain image data, start the visual algorithm library, and call the visual algorithm library initialization function; Determine whether the call is successful, if so, go to step S4, if not, go to step S2.3; S4: Call the calculation function of the visual algorithm library to implement logic program control, process the image data and obtain the result; S4.1: Select the corresponding IEC program and call the algorithm library; S4.2: Call the algorithm library calculation function, take the logic parameter as input, and obtain the algorithm calculation return data; S4.2: Determine whether the call is successful, if so, proceed to step S4.3, if not, proceed to step S2.3; S4.3: Perform logical processing and return to step S4.2.
[0036] Among them, when starting to run, the IEC logic program performs initialization operations, such as reading configuration files and establishing communication with IO, etc.; calling the algorithm library initialization function, such as establishing communication with external industrial cameras and checking whether the operating conditions are met, etc.; Call the algorithm library calculation function, take the logical parameters as input, and obtain the algorithm calculation return data; Integrate, convert and apply algorithm calculation data to IEC logic control; If there is any exception in the process of calling the algorithm library, you can call the algorithm reset function to reinitialize the algorithm library; In the step S1.1, the interface between the PLC and the visual algorithm is defined using the defined interface protocol including the visual recognition algorithm function interface definition and the error code definition and the algorithm library status definition for collaborative operation; In step S1.3, the IEC logic program performs initialization operations including reading configuration files and establishing communication with IO, and the IEC program is responsible for implementing overall logic control; The PLC is isolated from the visual algorithm during runtime, and multi-core isolation technology is used to run on different cores of the CPU respectively; in the step S1.2, a high-level language is used to build a high-level language application to implement web services, provide system and algorithm library processing functions, and the high-level language application provides an HMI human-computer interaction interface and processes the visual algorithm.
[0037] The present invention encapsulates the visual algorithm into the form of an SO library for direct call by the IEC logic program, thereby reducing the communication delay between different devices. This optimization can effectively reduce the system response time, enhance the overall performance, and improve the reliability and efficiency of the system in real-time applications. The defined IEC program and algorithm SO library interaction interface is as follows.
[0038] The present invention uses multi-core isolation technology to isolate the visual algorithm and PLC runtime, and respectively run them on different cores of the CPU, so that "both integrated and reliable operation can be achieved, and failures will not spread", and the stability of the system can be improved. In one embodiment, the CPU cores are distributed as follows. CPU core number Application Binding 0 Linux system application 1 Backend Services 2 Visual recognition algorithms 3 PLC Runtime
[0039] The present invention uses high-level languages to implement web services, providing functions such as system logs, version management, detailed diagnosis, and algorithm library management. After the visual algorithm is developed, the so file can be downloaded to the PLC through the web interface to implement the deployment of the algorithm library, simplifying the configuration process and reducing the cost of deployment and maintenance.
[0040] The present invention defines an interface between PLC and visual algorithm to achieve the purpose of collaborative operation, wherein the visual recognition algorithm function interface is defined as follows.
[0041] The error code ERROR_CODE is defined as follows. Status Code Status Description 0x00 No Error 0x01 Call failed 0x02 Call timeout 0x03 Memory leak 0x04 Hardware not found 0x05 Hardware initialization failed
[0042] The algorithm library status VISU_STATUS is defined as follows. Status Code Status Description 0x00 Running normally 0x01 Uninitialized 0x02 Algorithm calculation 0x03 Algorithm calculation timeout 0x04 Operation stop
[0043] The design concept of an integrated visual recognition PLC method designed by the present invention is to embed the visual processing function directly into the framework of a programmable logic controller (PLC), and to create a highly integrated, responsive, stable and reliable control system by optimizing the use of hardware resources and improving the collaborative efficiency between software components.
[0044] The advantages of the present invention are: 1. Compact system architecture due to high integration. By encapsulating the visual algorithm library into a shared object (SO) library for direct IEC logic program calls, the visual recognition function in the system is tightly integrated with the control logic. This integration greatly simplifies the system architecture because no additional middleware or bridge modules are required to connect independent visual processing units and PLCs. Such a design not only reduces potential failure points, but also reduces the physical space occupied and hardware costs of the system.
[0045] 2. Improved system real-time performance and performance. In the integrated solution, the visual algorithm library is directly uploaded to the PLC using the WEB service, which reduces the communication delay between different devices and improves the real-time performance of the system. The results of visual processing can be fed back more quickly and used for control decisions, which is especially important for industrial applications that require fast response. In addition, multi-core isolation technology ensures that the computational load of the visual algorithm will not affect other control tasks of the PLC, thereby improving overall performance.
[0046] 3. Enhanced system stability and reliability. This design method improves system stability by running the visual algorithm and PLC runtime on different CPU cores. This multi-core isolation avoids the overall system crash that may be caused by a single point of failure, because the failure can be confined to the core where the problem occurs and will not affect the operation of other cores. This design also makes it easier to recover the system when a failure occurs, because the problematic part can be reset separately without interfering with other parts that are running normally.
[0047] 4. Improved usability and maintainability. WEB services and human-machine interface (HMI) implemented by high-level languages make the deployment, logging, version management and diagnosis of algorithm libraries intuitive and simple. The abstract level provided by high-level languages lowers the technical threshold, allowing non-professionals to configure and maintain the system, thereby reducing the overall maintenance cost and complexity of the system.
[0048] 5. Optimization of error handling and system response. The system design includes detailed error code and algorithm library status definitions, which provides a clear framework for error diagnosis and response. When an abnormality occurs, the system can quickly identify the problem and restore it to normal through the algorithm reset function. This not only enhances the system's fault tolerance, but also ensures continuity and stability in the production process.
[0049] 6. Integration of advanced functions. The design method of the present invention also allows the integration of more advanced functions through WEB services, such as system logs, diagnostics, and algorithm library management, making the operation of the system more transparent and easy to monitor and optimize. This transparency is essential for complying with strict industrial standards and specifications, and it ensures traceability and quality control of the production process.
[0050] In general, the method designed by the present invention not only improves the performance and real-time performance of the system by integrating visual recognition and PLC technology, but also enhances the stability and reliability of the system, and also improves the ease of use and maintainability of the system. These improvements together provide an efficient, stable and user-friendly solution for industrial automation applications.
[0051] like Figure 2 In one embodiment shown, Figure 2 This is a system architecture diagram of an embodiment of the present invention. Figure 2As shown, it can be seen that in the present invention, the IEC program plays the core role of the overall logic control and is responsible for coordinating the operation of the entire system. In order to meet the needs of different scenarios, a visual algorithm function library (algorithm SO) is specially developed to customize specific visual recognition tasks. In addition, the application program (high-level language APP) written in a high-level language provides a WEB service, which not only provides a human-machine interaction interface (HMI) for operators to facilitate monitoring and operation, but also includes various management functions for visual algorithms, such as viewing, updating and deleting operations of the algorithm library. In this embodiment, the Linux 5.4 operating system is used as the basic platform, combined with the Linux+RT real-time kernel patch to ensure the real-time operation of the entire system. This real-time performance is the key to the normal operation of the high-level language APP, which provides the necessary system support and a stable operating environment for the APP. In terms of the hardware of this embodiment, IPC4002, as a traditional PLC hardware, provides an interface for connecting various sensor devices, ensuring that various industrial field sensor data can be accurately and timely collected, and then processed by the IEC program and the visual algorithm function library. This design achieves seamless integration of software and hardware, which not only improves the flexibility and scalability of the automation system, but also improves the efficiency and reliability of the industrial control system.
[0052] At present, the integration of integrated visual recognition technology and programmable logic controller (PLC) has shown great potential in the field of industrial automation. Traditionally, visual recognition systems and PLCs exist as independent entities, but the close integration of the two can improve production line efficiency, quality control and flexibility. With the development of Industry 4.0, the demand for accurate and efficient production process monitoring is growing. Based on this background, this method is committed to developing a PLC design with integrated visual recognition, which realizes real-time monitoring and control of functions such as object recognition and position tracking in the production process by connecting visual sensors to PLC. Through the method designed by the present invention, users can use PLC as a central control unit to realize rapid processing and response of visual sensor data, thereby realizing smarter and more efficient production management. This integration method not only simplifies the system architecture and saves costs, but also improves the real-time performance and reliability of the system, bringing new development opportunities to the field of industrial automation.
[0053] At present, traditional PLC systems are usually unable to be directly integrated with visual recognition equipment, which makes it difficult to achieve visual inspection and identification of products on industrial automation production lines. This integration difficulty usually requires additional software and hardware development, complex data transmission and processing mechanisms, and increases the cost and complexity of system design and maintenance. Therefore, this patent provides a new design method that enables PLC systems to be more easily integrated with visual recognition equipment, thereby achieving more efficient and intelligent production line operations.
[0054] The practicality of the technology of the present invention lies in: 1. Improve production efficiency: Combined with visual recognition technology, the PLC system can identify and process objects more accurately and quickly, improving the efficiency of the production line.
[0055] 2. Reduce human errors: Reduce human intervention through visual recognition, reduce operational errors, and improve production quality and consistency.
[0056] 3. Realize automatic control: Combining visual recognition with PLC can realize automatic control and monitoring of the production process and improve the intelligence level of the production line.
[0057] 4.Flexible adaptation to diverse products: The visual system can identify and classify according to the characteristics of different products, thereby achieving flexible production and adaptability of the production line.
[0058] 5. Data analysis and optimization: The data obtained through visual recognition can be used for production process analysis and optimization, helping companies improve production efficiency and save costs.
[0059] In use, the image captured by the camera in the detection system will show that the liquid and foam are clearly layered after standing. From the horizontal direction, the proportion of foam content can be determined. If the semantic segmentation algorithm in deep learning is used, different colors can be used to represent the corresponding segmented parts. For example, the liquid in the cup, the foam, and the empty part in the cup are divided into three polygons respectively. This result can be used to obtain the proportion of foam in the total capacity of the measuring cup after a certain post-processing operation. The entire measuring cup will be divided into three parts from top to bottom by the segmentation algorithm: the empty part, the foam and the liquid. After the corresponding calibration, the length of each part in the vertical direction can be obtained, and the proportion of foam can be obtained after a simple calculation. In the implementation of the project, a measuring cylinder with a longer length and a smaller diameter can better reduce the perspective effect (that is, the edge of the circular cross-section at the intersection in the segmentation task has less curvature) and better show the space occupied by the foam (that is, the length in the vertical direction is longer). In addition, the foam content can be analyzed in time sequence according to the time sequence, that is, the complete situation of the defoaming process is obtained, and the effect of the defoaming agent under the current working conditions is better understood.
[0060] In summary, the integrated visual recognition PLC method designed by the present invention combines industrial automation control systems and image processing technology, and is suitable for technical fields such as automation control, machine vision and industrial production. By integrating visual sensors and corresponding algorithms in PLC, real-time monitoring and control of the production process can be achieved. The method uses visual recognition technology to acquire and process image information, thereby realizing functions such as product quality inspection, positioning, and counting. By seamlessly integrating visual recognition with the PLC controller, the intelligence level of the production line is improved, production efficiency and product quality are enhanced, and equipment layout and maintenance management are simplified, which has high practicality and economy. The present invention integrates visual recognition functions into PLC by developing special communication protocols and interactive function blocks, such as defining control fields and data fields for communication between visual recognition and PLC, and adopting multi-core isolation to improve system performance and stability. The following purposes can be achieved: 1. Simplify the system architecture: reduce additional communication links and equipment, simplify the system architecture, and reduce the complexity of the system; 2. Improve the real-time performance of the system: complete image processing and control decisions in a shorter time, and improve the real-time performance of the system; 3. Improve system stability: Visual recognition and PLC run on different cores of the same CPU, which can not only run in coordination but also ensure fault isolation, thus improving the stability and reliability of the overall system; 4. Reduce costs: Reduce the cost of additional hardware equipment and communication modules, and reduce the overall cost of deployment and maintenance.
[0061] The present invention is not limited to the above-mentioned embodiments. No matter any changes are made in the shape or material composition, any structural design provided by the present invention is a variation of the present invention and should be considered to be within the protection scope of the present invention.
Claims
1. An integrated visual recognition PLC method, characterized in that: The following steps are involved: S1: Initialize the visual algorithm library and logic program; S2: Initialize the calling vision algorithm; S3: Obtain image data, start the visual algorithm library, and call the visual algorithm library initialization function; S4: Call the calculation function of the visual algorithm library to implement logic program control, process the image data and obtain the result.
2. The integrated visual recognition PLC method according to claim 1 is characterized in that: The step S1 comprises: S1.1: Use the defined interface protocol, select the corresponding visual algorithm library, and generate the algorithm library file; S1.2: Use the WEB service to upload the visual algorithm library to the PLC; S1.3: IEC logic program performs initialization operations.
3. The integrated visual recognition PLC method according to claim 2 is characterized in that: In the step S1.1, the defined interface protocol includes the visual recognition algorithm function interface definition, error code definition and algorithm library status definition, and defines the interface between the PLC and the visual algorithm for collaborative operation.
4. An integrated visual recognition PLC method according to claim 1, 2 or 3, characterized in that: The step S2 comprises: S2.1: Initialize the calling algorithm; S2.2: Determine whether the call is successful, if so, proceed to step S3, if not, proceed to step S2.3; S2.3: Reset the algorithm library and return to step S2.
1.
5. An integrated visual recognition PLC method according to claim 2 or 3, characterized in that: In step S1.3, the IEC logic program performs initialization operations including reading configuration files and establishing IO communications, and the IEC program is responsible for implementing overall logic control.
6. The integrated visual recognition PLC method according to claim 3 is characterized in that: The PLC is isolated from the visual algorithm during operation, and uses multi-core isolation technology to run on different cores of the CPU respectively.
7. The integrated visual recognition PLC method according to claim 4 is characterized in that: The step S4 comprises: S4.1: Select the corresponding IEC program and call the algorithm library; S4.2: Call the algorithm library calculation function, take the logic parameter as input, and obtain the algorithm calculation return data; S4.2: Determine whether the call is successful, if so, proceed to step S4.3, if not, proceed to step S2.3; S4.3: Perform logical processing, process the image, obtain the corresponding result, output it and return to step S4.
2.
8. The integrated visual recognition PLC method according to claim 4 is characterized in that: The step S3 includes starting the algorithm library and calling the algorithm library initialization function to determine whether the call is successful. If so, proceed to step S4, if not, proceed to step S2.3; calling the algorithm library initialization function includes establishing communication with the outside and checking whether the operating conditions are met.
9. The integrated visual recognition PLC method according to claim 2 is characterized in that: In the step S1.2, a high-level language is used to build a high-level language application to implement web services and provide system and algorithm library processing functions. The high-level language application provides an HMI human-computer interaction interface and processes the visual algorithm.
10. The integrated visual recognition PLC method according to claim 1, characterized in that: In the steps S3 and S4, if there is an exception in the process of calling the algorithm library, the algorithm reset function is called to reinitialize the algorithm library.
