Communication method for programmable logic controller, and system, electronic device and medium
By adjusting the execution order of function blocks in the PLC, the data inconsistency problem between the PLC and the inference system was solved, ensuring data integrity and accuracy and improving the communication effect of the automation system.
Patent Information
- Application Number
- PCT/CN2024/105519
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2026-01-22
AI Technical Summary
In the existing technology, the data communication method between the PLC and the inference system leads to data inconsistency and incompleteness, which affects the accuracy and reliability of the automation system.
By arranging the first function block in the PLC, which executes after the function block used to determine the variable value, it is ensured that the variable value is sent only after the scan cycle is completed. By coordinating the execution order of the first and second function blocks, bidirectional communication between the automation system and the inference system is achieved.
It improves data consistency and integrity, enhances the accuracy of inference data, and reduces the configuration difficulty of functional blocks and applications.
Smart Images

Figure CN2024105519_22012026_PF_FP_ABST
Abstract
Description
Communication methods, systems, electronic devices and media for programmable logic controllers Technical Field
[0001] This invention relates to the field of automatic control technology, and in particular to communication methods, systems, electronic devices and media for programmable logic controllers (PLCs). Background Technology
[0002] A PLC is a digital computing and operating electronic system suitable for industrial applications. It uses a programmable memory to store instructions for performing logical operations, sequential control, timing, counting, and arithmetic operations, and controls various types of mechanical equipment or production processes through digital or analog inputs and outputs.
[0003] With the continuous development and in-depth application of Artificial Intelligence (AI) technology in the industrial field, AI technology has injected many new functions into traditional PLC-based automation systems. These new functions include, but are not limited to: improving the maintainability and predictability of automation systems, connecting new sensors to automation systems, and providing automation systems with functions that PLCs cannot provide, etc. A typical example of AI technology applied in industrial automation is using PLC variables as the data source for AI model-based inference systems.
[0004] Currently, variables are typically requested from the PLC by the inference system as inference data. However, this approach can lead to data inconsistencies or even incomplete data.
[0005] Summary of the Invention
[0006] The present invention provides a communication method, system, electronic device, and medium for a PLC.
[0007] Firstly, a communication method for a PLC is provided. The method includes:
[0008] Determine the first variable to be sent;
[0009] A first function block is generated, the first function block is arranged in the PLC, the input of the first function block is associated with the first variable, wherein when the first function block is executed, it is adapted to send the value of the first variable outside the PLC;
[0010] The execution order of the first function block is determined, wherein the execution order of the first function block is after the execution order of the function block used to determine the value of the first variable;
[0011] Based on the execution order of the first function blocks, the first function blocks are executed to send the value of the first variable outside the PLC.
[0012] Secondly, a communication system for a PLC is provided. The communication system includes:
[0013] PLC;
[0014] Reasoning system;
[0015] An automation program development tool is used to provide a list of variables for the PLC, display the list of variables in a graphical user interface, and select a first variable to be sent from the list of variables in response to a selection command triggered in the graphical user interface.
[0016] The first function block is arranged in the PLC, and the input of the first function block is associated with the first variable;
[0017] The first function block is used to send the value of the first variable to the inference system, wherein the execution order of the first function block is after the execution order of the function block used to determine the value of the first variable, and the function block used to determine the value of the first variable is arranged in the PLC.
[0018] Thirdly, an electronic device is provided, comprising:
[0019] processor;
[0020] Memory for storing the executable instructions of the processor;
[0021] The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the PLC communication method described above.
[0022] Fourthly, a computer-readable storage medium is provided, on which computer instructions are stored, wherein the computer instructions, when executed by a processor, implement the above-described PLC communication method.
[0023] Fifthly, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described PLC communication method.
[0024] As can be seen, in this embodiment of the invention, a first variable to be sent is determined; a first function block is generated and arranged in the PLC, the input of the first function block being associated with the first variable, wherein when the first function block is executed, it is suitable to send the value of the first variable outside the PLC; the execution order of the first function block is determined, wherein the execution order of the first function block is after the execution order of the function block used to determine the value of the first variable; based on the execution order of the first function block, the first function block is executed to send the value of the first variable outside the PLC. It is evident that by arranging the first function block in the PLC after the execution order of the function block used to determine the value of the first variable, the value of the first variable can be determined in the scan cycle before being sent, improving data consistency and integrity. Furthermore, by arranging the second function block in the PLC and coordinating the first and second applications, communication between the automation system and the inference system is realized, improving the accuracy of the inference data. In addition, determining the first and second variables based on a variable list reduces the configuration work in the respective generation processes of the function blocks and applications, lowering the implementation difficulty. Attached Figure Description
[0025] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which will make the above and other features and advantages of the present invention more apparent to those skilled in the art. In the drawings:
[0026] Figure 1 is an exemplary flowchart of a PLC communication method according to an embodiment of the present invention.
[0027] Figure 2 is an exemplary schematic diagram of the generation and arrangement of functional blocks and applications according to an embodiment of the present invention.
[0028] Figure 3 is an exemplary structural diagram of the first functional block according to an embodiment of the present invention.
[0029] Figure 4 is an exemplary structural diagram of the second functional block according to an embodiment of the present invention.
[0030] Figure 5 is an exemplary structural diagram of a first application according to an embodiment of the present invention.
[0031] Figure 6 is an exemplary structural diagram of a second application according to an embodiment of the present invention.
[0032] Figure 7 is an exemplary structural diagram of a PLC communication system according to an embodiment of the present invention.
[0033] Figure 8 is a schematic diagram of the interaction between the PLC and the inference system according to an embodiment of the present invention.
[0034] Figure 9 is an exemplary structural diagram of a communication device for a PLC according to an embodiment of the present invention.
[0035] Figure 10 is an exemplary structural diagram of an electronic device according to an embodiment of the present invention.
[0036] The reference numerals in the attached figures are as follows: Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of the present invention clearer, the following embodiments are provided to further illustrate the present invention in detail.
[0038] For the sake of brevity and intuitiveness, the following description uses several representative embodiments to illustrate the solution of the present invention. Numerous details in the embodiments are only used to aid in understanding the solution of the present invention. However, it is obvious that the technical solution of the present invention can be implemented without being limited to these details. To avoid unnecessarily obscuring the solution of the present invention, some embodiments are not described in detail, but only a framework is given. In the following text, "comprising" means "including but not limited to," and "according to..." means "at least according to..., but not limited to only according to...". Due to Chinese language habits, unless the quantity of a component is specifically indicated below, it means that the component can be one or more, or can be understood as at least one.
[0039] Currently, the typical process of applying AI technology to industrial automation involves providing independent hardware devices for AI model-based inference systems according to the computational requirements of the AI model. These independent hardware devices interact with the PLC via an industrial bus. For example, bidirectional communication can be performed between the PLC and the AI model-based inference system through industrial buses such as S7 Connection or OPC UA. The data source for the AI model's inference data (which may include model inputs and / or model outputs) is variables (such as tags) in the PLC. However, using variables (such as multiple variables) as the inference data source in the PLC can lead to data integrity and consistency issues. For example, if the inference system requests data from the PLC before the PLC's scan cycle is completed, the data received by the inference system may contain: part of the data being the data of variables that have been updated in the current scan cycle (the update process for these variables has been completed during the scan cycle when the inference system sends the request), and part of the data being the data of variables updated in the previous scan cycle (the update process for these variables has not been completed during the scan cycle when the inference system sends the request, therefore the updated variable data from the previous scan cycle needs to be sent to the inference system). It is evident that this processing method may lead to data inconsistency or even data incompleteness.
[0040] In this embodiment of the invention, by arranging a first function block in the PLC whose execution order follows that of the function block used to determine the value of the first variable, the first function block can determine the value of the first variable during a scan cycle, and then send the value of the first variable during that scan cycle, thereby improving data consistency and integrity. Furthermore, by arranging a second function block in the PLC and coordinating the first and second applications, bidirectional communication between the automation system and the inference system is achieved, improving the accuracy of the inference data. Additionally, using a variable list provided by the automation programming tool to determine the first and second variables reduces the configuration work in the respective generation processes of the function blocks and applications, lowering the implementation difficulty.
[0041] The above disclosure details the technical defects existing in the prior art, the causes of these defects, and the thought process and analysis for overcoming them. In fact, the understanding of these technical defects is not common knowledge in the field, but rather a novel discovery made by the inventors during their research. Furthermore, the tracing of the causes of these defects and the thought process and analysis for overcoming them are also the results of the inventors' gradual analysis during actual research, and are not common knowledge in the field.
[0042] Figure 1 is an exemplary flowchart of a PLC communication method according to an embodiment of the present invention. As shown in Figure 1, the method includes:
[0043] Step 101: Determine the first variable to be sent.
[0044] In one implementation, step 101 includes: obtaining a list of PLC variables from the PLC's automation program development tool; displaying the variable list in the graphical user interface (GUI) of the automation program development tool; and selecting a first variable to be sent by the PLC from the variable list in response to a selection command triggered in the GUI. For example, obtaining a list of all PLC variables (e.g., variables may include digital, analog, and pulse signals) from Total Integrated Automation (TIA). The variable list is then displayed in the GUI. Finally, based on the selection command triggered by the user in the GUI, a first variable to be sent is selected from the variable list. The number of first variables can be one or more.
[0045] Step 102: Generate a first function block. The first function block is placed in the PLC. The input of the first function block is associated with a first variable. When the first function block is executed, it is suitable to send the value of the first variable outside the PLC.
[0046] Here, various PLC function block generation tools can be used to generate the first function block. The input of the first function block is associated with a first variable. When executed, the first function block sends the value of the first variable, obtained based on its input, to outside the PLC (e.g., to the inference system). For example, PLC function block generation tools may include: STEP 7, Micro Win Smart, and TIA Portal, etc.
[0047] Step 103: Determine the execution order of the first function block, wherein the execution order of the first function block is after the execution order of the function block used to determine the value of the first variable.
[0048] In one implementation, determining the execution order of the first function block in step 103 includes: importing the first function block into the PLC's automation program development tool; displaying the first function block in the graphical user interface of the automation program development tool; and dragging the first function block after the function block used to determine the value of the first variable in the PLC's execution order sequence based on a drag instruction triggered in the graphical user interface.
[0049] The execution sequence can be represented using methods such as ladder diagrams (LD), function block diagrams (FBD), and sequential function charts (SFC). Preferably, the execution sequence of the PLC during a scan cycle can also be represented using instruction lists (IL) or structured text (ST).
[0050] For example, using a ladder diagram as an example: the first function block can be dragged and dropped after the function block used to determine the value of the first variable in the same scan cycle of the PLC's ladder diagram.
[0051] Step 104: Based on the execution order of the first function block, execute the first function block to send the value of the first variable outside the PLC.
[0052] Therefore, in a scan cycle: after the function block used to determine the value of the first variable has completed execution and determined the value of the first variable, the first function block is executed again, so that the first function block sends the value of the first variable outside the PLC. It can be seen that by having the function block determining the value of the first variable complete the determination of the first variable in the scan cycle, and then sending the value of the first variable outside the PLC by the first function block in the same scan cycle, the defect of some data being updated data in the current scan cycle and others being updated data from the previous scan cycle is avoided, thus improving data consistency and integrity.
[0053] In one implementation, when the first function block is executed, it is adapted to serialize the value of the first variable and send the serialized value of the first variable to the inference system outside the PLC. In another implementation, when the first function block is executed, it is adapted to determine whether a predetermined first trigger condition is met, wherein when the condition is met, the value of the first variable is serialized and sent to the inference system outside the PLC. For example, the first trigger condition may include: whether the sending timing has arrived and whether the current state is suitable for sending, etc.
[0054] In one implementation, the method further includes: determining a second variable to be received; generating a second function block, the second function block being arranged in the PLC, the output of the second function block being associated with the second variable, wherein when the second function block is executed, it is adapted to receive values from outside the PLC and assign the received values to the second variable; determining the execution order of the second function blocks in the PLC; and executing the second function blocks based on the execution order. For example: obtaining a list of variables of the PLC from the PLC's automation program development tool; displaying the list of variables in the graphical user interface of the automation program development tool; and selecting the second variable to be received by the PLC from the list of variables in response to a selection instruction triggered in the graphical user interface. For example, obtaining a list of all variables of the PLC from TIA. Displaying the list of variables in the graphical user interface. Then, selecting the second variable from the list of variables based on a selection instruction triggered by the user in the graphical user interface. The number of second variables can be one or more. Moreover, various PLC function block generation tools can be used to generate the second function block. The output of the second function block is associated with the second variable. When the second function block is executed, it is adapted to assign values received from outside the PLC to the second variable. For example, tools for generating PLC function blocks may include STEP 7, Micro Win Smart, and TIA Portal. Similarly, the second function block is imported into the PLC's automation program development tool; the second function block is displayed in the graphical user interface of the automation program development tool; based on the drag-and-drop command triggered in the graphical user interface, the second function block is dragged to any position in the PLC's execution sequence.
[0055] In one implementation, the second functional block receives values from outside the PLC: it receives serialized inference results from an inference system outside the PLC. Preferably, the inference results are determined based on the value of the first variable.
[0056] In one embodiment, the method includes: deploying a first application (APP) in an inference system; wherein when the first application is executed, it is adapted to perform deserialization processing on the serialized value of a first variable to obtain the value of the first variable, and publish the value of the first variable to an inference server in the inference system so that the inference server can determine an inference result based on the value of the first variable.
[0057] In one implementation, the method includes: when a first application is executed, performing deserialization on the serialized value of a first variable to obtain the value of the first variable, determining whether a predetermined second triggering condition is met, wherein when the condition is met, publishing the value of the first variable to an inference server in an inference system, so that the inference server can determine an inference result based on the value of the first variable. For example, the second triggering condition may include: whether the timing for sending has arrived or whether the current situation is suitable for sending, etc.
[0058] In one embodiment, the method includes: deploying a second application in an inference system; wherein when the second application is executed, it is adapted to obtain inference results from an inference server, serialize the inference results, and send the serialized inference results to a second functional block.
[0059] Specifically, the first and second applications can be generated using various programming languages. For example, high-level languages can be used to generate the first and second applications. Examples of high-level languages include, but are not limited to: FORTRAN, C, Java, C++, Python, JavaScript, PHP, Swift, TypeScript, Kotlin, and Rust, etc.
[0060] The above illustrative descriptions illustrate examples of automated program development tools, function block generation tools, execution sequence sequences, and application development languages. Those skilled in the art will recognize that such descriptions are illustrative and are not intended to limit the scope of protection of the embodiments of the present invention.
[0061] Figure 2 is an exemplary schematic diagram of the generation and arrangement of functional blocks and applications according to an embodiment of the present invention. In Figure 2, during the generation process 11, user 10 obtains a first variable to be sent out by the PLC and a second variable to be received by the PLC from outside the PLC, from the automation program development tool 12; generates a first functional block 14 based on the first variable and a second functional block 15 based on the second variable; and generates a first application 16 and a second application 17. Furthermore, the first functional block 14 and the second functional block 15 are arranged in the PLC 20 of the automation system. The first application 16 and the second application 17 are arranged in the control terminal 30 included in the inference system 13. For example, the control terminal 30 can be implemented as a personal computer (PC), an industrial personal computer (IPC), or an edge device, etc.
[0062] Figure 3 is an exemplary structural diagram of a first functional block according to an embodiment of the present invention. For example, the first functional block 14 generated based on the IEC65531-3 standard includes an enable input (EN) and at least one data input. In Figure 3, the first functional block 14 is illustrated with five data inputs as an example, namely IN1, IN2, IN3, IN4, and IN5. Each data input can be associated with a respective variable in the PLC. The outputs of the first functional block 14 include enable output (ENO), status (STATUS), completion (DONE), and error (ERROR). Logically, the first functional block 14 includes: a trigger detection module 141 (optional), a serialization module 142, and a sending module 143. The trigger detection module 141 is used to determine whether a predetermined first trigger condition is met. The serialization module 142 is used to serialize the value of a first variable when the trigger detection module 141 determines that the first trigger condition is met. The sending module 143 is used to send the serialized value of the first variable to a system outside the PLC (e.g., an inference system outside the PLC).
[0063] Figure 4 is an exemplary structural diagram of the second functional block according to an embodiment of the present invention. For example, the second functional block 15 generated based on the IEC65531-3 standard includes an enable input (EN) and at least one data output. In Figure 4, the second functional block 15 is illustrated with two data outputs as an example, namely OUT1 and OUT2. Each data output can be associated with its respective variable in the PLC. In addition to the data outputs, the outputs of the second functional block 15 also include an enable output (ENO) and a status (STATUS). Logically, the second functional block 15 includes: a receiving module 151, a deserialization module 152, and an assignment module 153. The receiving module 151 is used to receive values from outside the PLC; the deserialization module 152 is used to deserialize the received values; and the assignment module 153 is used to assign the deserialized values to a second variable (the second variable can be associated with the variables of OUT1 and / or OUT2).
[0064] Figure 5 is an exemplary structural diagram of a first application according to an embodiment of the present invention. In Figure 5, the first application 16 includes a deserialization module 161, a trigger detection module 162 (optional), and a publishing module 163. The deserialization module 161 is used to perform deserialization processing on the serialized value of a first variable to obtain the value of the first variable. The trigger detection module 162 is used to determine whether a predetermined second trigger condition is met. The publishing module 163 is used to publish the value of the first variable to the inference server in the inference system when the trigger detection module 162 determines that the second trigger condition is met, so that the inference server can determine the inference result based on the value of the first variable.
[0065] Figure 6 is an exemplary structural diagram of a second application according to an embodiment of the present invention. In Figure 6, the second application 17 includes an acquisition module 171, a serialization module 172, and a sending module 173. The acquisition module 171 is used to acquire inference results from an inference server. The serialization module 172 is used to serialize the inference results. The sending module 173 is used to send the serialized inference results to a second functional block.
[0066] This invention also proposes a communication system for the PLC. Figure 7 is an exemplary structural diagram of a PLC communication system according to an embodiment of the present invention. The automation system 40 includes a PLC 41 and a controlled object 42 of the PLC 41. The inference system 50 includes an industrial computer 51 and an inference engine 52 based on an AI model. The PLC 41 and the inference system 50 are connected via an industrial bus such as S7 Connection or OPC UA.
[0067] The communication system includes: a PLC 41; an inference system 50; an automation program development tool 12 for providing a variable list to the PLC 41 (e.g., variables related to measurement and / or control variables of the controlled object 42), displaying the variable list in a graphical user interface, and selecting a first variable to be sent from the variable list in response to a selection command triggered in the graphical user interface; a first function block 14, arranged in the PLC 41, with its input associated with the first variable; the first function block 14 for sending the value of the first variable to the inference system 50, wherein the execution order of the first function block 14 follows the execution order of the function block 19 for determining the value of the first variable. The function block 19 for determining the value of the first variable is arranged in the PLC 41. Specifically, the first function block 14 is used to determine whether a predetermined first trigger condition is met, wherein when met, the value of the first variable is serialized and the serialized value of the first variable is sent to the inference system 50.
[0068] The automation program development tool 12 can also select a second variable to be received from the variable list in response to a selection instruction. Furthermore, a second function block 15 is arranged in the PLC 41. The output of the second function block 15 is associated with the second variable. The second function block 15 is used to receive values from the inference system 50 and assign the received values to the second variable.
[0069] Specifically, the value received by the second functional block 15 from the inference system 50 may be a serialized inference result. The communication system may further include: a first application 16, disposed in the inference system 50; the first application 16 is used to perform deserialization processing on the serialized value of a first variable to obtain the value of the first variable, and publish the value of the first variable to the inference server 52 in the inference system 50, so that the inference server 52 can determine the inference result based on the value of the first variable. Alternatively, the first application 16 is used to perform deserialization processing on the serialized value of the first variable to obtain the value of the first variable, determine whether a predetermined second triggering condition is met, wherein when the condition is met, the value of the first variable is published to the inference server 52 in the inference system 50, so that the inference server 52 can determine the inference result based on the value of the first variable.
[0070] The communication system may further include: a second application 17, arranged in the inference system 50, for obtaining inference results from the inference server 52, serializing the inference results, and sending the serialized inference results to the second functional block 15.
[0071] Based on the above description, the following example of an automated production line will be used to illustrate the implementation of this invention. For instance, a workstation on the automated production line includes an AI-based product labeling detection model. Based on the detection results of the detection model, the automation system (PLC end) can perform further processing such as alarms. This workstation includes the following hardware:
[0072] (1) PLC: The core of the automation system on the workstation, used to process the core logic of the automation system.
[0073] (2) A sensor connected to the PLC is used to detect whether the product to be tested has reached the specified position (a typical sensor is a grating sensor).
[0074] (3) Conveyor belt and products: The conveyor belt is used to transport products to a designated location (i.e., within the field of view of an industrial camera), where the front of the product has two labels to be inspected (e.g., energy efficiency label, product certificate).
[0075] (4) Inference engine: A personal computer, IPC or edge device used to run AI models, etc.
[0076] (5) Industrial camera: Takes a picture of the front of the product when it arrives at the designated position and sends the picture to the inference engine for inference.
[0077] Once the product to be inspected reaches the execution position via the conveyor belt, the sensor sends a trigger signal (through the I / O module) to the PLC. In response to the trigger signal, the PLC sends the acquired product type and product ID to the inference engine to trigger inference. The inference engine triggers the industrial camera to take a picture of the product to be inspected, and performs inspection based on the product type and product ID. It then sends the inference result (which includes the inspection result, the number of correct labels, and the number of incorrect labels) to the PLC for subsequent processing, such as alarms.
[0078] Figure 8 is a schematic diagram of the interaction between the PLC and the inference system according to an embodiment of the present invention. The execution principle of the ladder diagram 40 of the PLC follows a left-to-right, top-to-bottom order. Specifically, the ladder diagram 40 is executed in a top-to-bottom order, and after each execution, the ladder diagram is scanned again from top to bottom. This means that when a logic element (e.g., a contactor before an arithmetic block) is triggered, the logic element below can be executed. Moreover, a logic element is executed only once in each area of the ladder diagram. The ladder diagram scan is executed according to a specific time sequence.
[0079] In the scan cycle of ladder diagram 40: first, function block 61 for obtaining product type is executed to determine the value of product type 71 as a variable. Then, function block 62 for obtaining product ID is executed to determine the value of product ID 72 as a variable.
[0080] After function blocks 61 and 62 are executed, the first function block 12 is executed during the scan cycle. One data input of the first function block 12 (named "Production Type") is associated with product type 71, and another data input (named "Production ID") is associated with product ID 72. The first function block 12, via a communication connection with the inference system 50, performs serialization processing on the value of product type 71 determined by function block 61 and the value of product ID 72 determined by function block 62. Then, it sends the serialized values of product type 71 and product ID 72 to the first application 16 in the inference system 50. The first application 16 performs deserialization processing on the serialized values of product type 71 and product ID 72 respectively, obtaining the values of product type 71 and product ID 72. Finally, it publishes the values of product type 71 and product ID 72 to the inference engine 52 in the inference system 50 via the internal bus 53. Based on the values of product type 71 and product ID 72, inference engine 52 triggers an industrial camera to photograph the product to be inspected and inspects the photograph to obtain inference results (including the value of inspection result 81, the value of the number of correct labels 82, and the value of the number of incorrect labels 83). Second application 17 in inference system 50 obtains the inference results from inference engine 52, serializes the inference results, and sends the serialized inference results to second function block 15. Second function block 15 performs deserialization processing on the serialized inference results to obtain the respective values of inspection result 81, the number of correct labels 82, and the number of incorrect labels 83. The value of inspection result 81 is assigned to the associated first data output (named: Inspection result), the value of the number of correct labels 82 is assigned to the associated second data output (named: Correct label count), and the value of the number of incorrect labels 83 is assigned to the associated third data output (named: Incorrect label count). Then, the PLC can perform various post-processing operations such as alarms based on the first, second, and third data outputs.
[0081] Figure 9 is an exemplary structural diagram of a communication device for a PLC according to an embodiment of the present invention. As shown in Figure 9, the communication device 500 for the PLC includes: a first determining module 501, configured to determine a first variable to be sent; a generating module 502, configured to generate a first function block, the first function block being arranged in the PLC, the input of the first function block being associated with the first variable, wherein when the first function block is executed, it is adapted to send the value of the first variable outside the PLC; a second determining module 503, configured to determine the execution order of the first function block, wherein the execution order of the first function block is after the execution order of the function block used to determine the value of the first variable; and an execution module 504, configured to execute the first function block based on the execution order of the first function block to send the value of the first variable outside the PLC.
[0082] In one implementation, the first determining module 501 is configured to obtain a list of variables of the PLC from the PLC's automation program development tool; display the list of variables in the graphical user interface of the automation program development tool; and select a first variable to be sent from the list of variables in response to a selection instruction triggered in the graphical user interface.
[0083] In one implementation, the second determining module 503 is used to import the first function block into the PLC's automation program development tool; display the first function block in the graphical user interface of the automation program development tool; and drag the first function block after the function block used to determine the value of the first variable in the PLC's execution sequence based on a drag instruction triggered in the graphical user interface.
[0084] In one embodiment, the execution module 504 is configured to serialize the value of a first variable and send the serialized value of the first variable to an inference system outside the PLC when the first function block is executed. In another embodiment, the execution module 504 is configured to determine whether a predetermined first trigger condition is met when the first function block is executed, wherein if the condition is met, the value of the first variable is serialized and sent to the inference system outside the PLC.
[0085] In one embodiment, a first determining module 501 is used to determine a second variable to be received; a generating module 502 is used to generate a second function block, which is arranged in the PLC, and the output of the second function block is associated with the second variable, wherein when the second function block is executed, a value is received from outside the PLC and the received value is assigned to the second variable; a second determining module 503 is used to determine the execution order of the second function block in the PLC; and an execution module 504 is used to execute the second function block based on the execution order of the second function block.
[0086] In one implementation, receiving values from outside the PLC means receiving serialized inference results from an inference system outside the PLC.
[0087] This invention also proposes an electronic device with a processor-memory architecture. Figure 10 is an exemplary structural diagram of an electronic device with a processor-memory architecture according to an embodiment of the present invention.
[0088] As shown in Figure 10, the electronic device 600 includes a processor 601, a memory 602, and a computer program stored in the memory 602 and executable on the processor 601. When the computer program is executed by the processor 601, it implements any of the above-described PLC communication methods. Specifically, the memory 602 can be implemented as various storage media such as electrically erasable programmable read-only memory (EEPROM), flash memory, and programmable programmable read-only memory (PROM). The processor 601 can be implemented as including one or more central processing units (CPUs) or one or more field-programmable gate arrays (FPGAs), wherein the FPGA integrates one or more CPU cores. Specifically, the CPU or CPU core can be implemented as a CPU, MCU, DSP, etc.
[0089] It should be noted that not all steps and modules in the above processes and structural diagrams are mandatory; some steps or modules can be omitted as needed. The execution order of the steps is not fixed and can be adjusted as required. The division of modules is merely for the convenience of description and functional division. In actual implementation, a module can be implemented by multiple modules, and the functions of multiple modules can also be implemented by the same module. These modules can be located in the same device or in different devices.
[0090] The hardware modules in each embodiment can be implemented mechanically or electronically. For example, a hardware module may include specially designed permanent circuitry or logic devices (such as dedicated processors, such as FPGAs or ASICs) to perform specific operations. A hardware module may also include programmable logic devices or circuitry (such as general-purpose processors or other programmable processors) temporarily configured by software to perform specific operations. The choice between mechanical implementation, dedicated permanent circuitry, or temporarily configured circuitry (such as software-configured circuitry) can be made based on cost and time considerations.
[0091] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A communication method of a programmable logic controller, characterized by, comprising: determining (101) a first variable to be sent out; generating (102) a first function block arranged into a programmable logic controller, an input of the first function block being associated with the first variable, wherein the first function block, when executed, is adapted to send a value of the first variable out of the programmable logic controller; determining (103) an execution order of the first function block, wherein the execution order of the first function block is after an execution order of a function block used to determine the value of the first variable; based on the execution order of the first function block, executing (104) the first function block to send the value of the first variable out of the programmable logic controller.
2. The method of claim 1, wherein, The determining (101) of the first variable to be sent out comprises: obtaining a list of variables of the programmable logic controller from an automation program development tool of the programmable logic controller; displaying the list of variables on a graphical user interface of the automation program development tool; selecting the first variable to be sent out from the list of variables in response to a selection instruction triggered on the graphical user interface.
3. The method of claim 1, wherein, The determining (103) of the execution order of the first function block comprises: importing the first function block into an automation program development tool of the programmable logic controller; displaying the first function block on a graphical user interface of the automation program development tool; based on a drag instruction triggered on the graphical user interface, dragging the first function block to be after the function block used to determine the value of the first variable in an execution order sequence of the programmable logic controller.
4. The method according to claim 1, wherein: the first function block, when executed, is adapted to serialize the value of the first variable and send the serialized value of the first variable to an inference system outside the programmable logic controller; or the first function block, when executed, is adapted to determine whether a predetermined first trigger condition is satisfied, wherein when the first trigger condition is satisfied, the value of the first variable is serialized and sent to the inference system outside the programmable logic controller.
5. The method according to any one of claims 1-4, characterized in that, comprising: determining a second variable to be received; generating a second function block arranged into a programmable logic controller, an output of the second function block being associated with the second variable, wherein the second function block, when executed, is adapted to receive a value from outside the programmable logic controller and assign the received value to the second variable; determining an execution order of the second function block in the programmable logic controller; based on the execution order of the second function block, executing the second function block.
6. The method of claim 5, wherein, The receiving of the value from outside the programmable logic controller is receiving a serialized inference result from an inference system outside the programmable logic controller.
7. The method of claim 6, wherein, comprising: arranging a first application in the inference system; wherein the first application, when executed, is adapted to perform a deserialization process on the serialized value of the first variable to obtain a value of the first variable, and to publish the value of the first variable to an inference server in the inference system for determining the inference result based on the value of the first variable by the inference server; or the first application, when executed, is adapted to perform a deserialization process on the serialized value of the first variable to obtain a value of the first variable, and to determine whether a predetermined second trigger condition is fulfilled, wherein, when fulfilled, the value of the first variable is published to an inference server in the inference system for determining the inference result based on the value of the first variable by the inference server.
8. The method of claim 7, wherein, comprising: arranging a second application in the inference system; wherein the second application, when executed, is adapted to obtain the inference result from the inference server, to serialize the inference result, and to send the serialized inference result to the second function block.
9. A communication system of a programmable logic controller, characterized in that comprising: a programmable logic controller (41); an inference system (50); an automation program development tool (12) for providing a list of variables of the programmable logic controller (41), for presenting the list of variables in a graphical user interface, and for selecting a first variable to be sent from the list of variables in response to a selection instruction triggered in the graphical user interface; a first function block (14) arranged in the programmable logic controller (41), an input of the first function block (14) being associated with the first variable; the first function block (14) for sending a value of the first variable to the inference system (50), wherein an execution order of the first function block (14) is subsequent to an execution order of a function block (19) for determining the value of the first variable, the function block (19) for determining the value of the first variable being arranged in the programmable logic controller (41).
10. The system according to claim 9, wherein the first function block (14) for serializing the value of the first variable and sending the serialized value of the first variable to the inference system (50); or the first function block (14) for determining whether a predetermined first trigger condition is fulfilled, wherein, when fulfilled, the first function block (14) serializes the value of the first variable and sends the serialized value of the first variable to the inference system (50).
11. The system according to claim 9 or 10, wherein the automation program development tool (12) for selecting a second variable to be received from the list of variables in response to the selection instruction; the system comprising: a second function block (15) arranged in the programmable logic controller (41), an input of the second function block (15) being associated with the second variable, wherein the second function block (15) is for receiving a value from the inference system (50) and assigning the received value to the second variable.
12. The system of claim 11, wherein, the second function block (15) for receiving a serialized inference result from the inference system (50); the system comprising: A first application (16) is arranged in the inference system (50); The first application (16) is configured to perform a deserialization process on the serialized value of the first variable to obtain the value of the first variable, and publish the value of the first variable to an inference server (52) in the inference system (50) to determine the inference result based on the value of the first variable by the inference server (52); or The first application (16) is configured to perform a deserialization process on the serialized value of the first variable to obtain the value of the first variable, and determine whether a predetermined second trigger condition is satisfied, wherein when the second trigger condition is satisfied, the value of the first variable is published to an inference server (52) in the inference system (50) to determine the inference result based on the value of the first variable by the inference server (52).
13. The system of claim 12, wherein, Comprising: A second application (17) is arranged in the inference system (50) and configured to obtain the inference result from the inference server (52), serialize the inference result, and send the serialized inference result to the second function block (15)。 14. An electronic device, comprising: Comprising: A processor (601); A memory (602) configured to store executable instructions of the processor (601); The processor (601) is configured to read the executable instructions from the memory (602) and execute the executable instructions to implement the communication method of the programmable logic controller according to any one of claims 1-8.
15. A computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are executed by the processor to implement the communication method of the programmable logic controller according to any one of claims 1-8.
16. A computer program product, characterised in that, The computer program is executed by the processor to implement the communication method of the programmable logic controller according to any one of claims 1-8.
Citation Information
Patent Citations
Test method of nuclear power plant instrumentation control logic function block and system
CN103869801A
Queue block for flexible automation engineering program
CN114503037A
Decentralized control system operation logic display method and device, equipment and storage medium
CN114545828A
Operation system
CN115408109A
Memory management method and device for dynamically mapping association relationship of functional blocks on line, and storage medium
CN115658314A