Method and system for reading PLC production process parameters

By executing PDU scheduling algorithms in the MES system, reading PLC variable points in classification and group, the problems of lag and inefficiency when batch reading parameters are solved, high-speed real-time data acquisition is achieved, and real-time requirements for industrial scenarios are met.

CN119126702APending Publication Date: 2024-12-13GUANGZHOU SYC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411192153.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

When existing MES systems read multiple production process parameters in batches, there are problems such as lag, inefficient and inability to meet the real-time requirements of high-speed data acquisition and low production beats in industrial scenarios.

Method used

By executing a preset PDU scheduling algorithm, the PLC device channel category, register type and maximum PDU length are classified according to the variable point information to be read, batch read instructions are sent, the actual PDU length is dynamically calculated, and variable points are grouped to reduce access PLC times and network bandwidth consumption.

Benefits of technology

Realizes high-speed batch reading of PLC production process parameters variable values ​​in milliseconds, reducing network bandwidth consumption for communication between host computers and PLCs, and is suitable for high-speed data acquisition scenarios in Industry 4.0, and provides high-real-time batch reading of production process parameters. Data collection method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119126702A_ABST
    Figure CN119126702A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of numerical control processing, and discloses a method and system for reading PLC production process parameters, and the method comprises the steps: responding to a variable point reading request instruction, executing a preset PDU scheduling algorithm, and classifying to-be-read variable points according to the to-be-read variable point information and preset PLC equipment channel categories to obtain a first classification result; classifying the to-be-read variable points belonging to the same PLC equipment channel category according to a preset register type partition category by utilizing the first classification result to obtain a second classification result; based on the second classification result, classifying the to-be-read variable points belonging to the same PLC equipment channel category and the same register type partition category according to a preset PDU maximum length grouping category to obtain a third classification result; and in combination with the third classification result, sending a batch reading instruction. The method has the effect of realizing millisecond-level high-speed batch real-time reading of the PLC production process parameter variable values.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of numerical control processing technology, and in particular to a method and system for reading PLC production process parameters. Background Art

[0002] MES system, also known as manufacturing execution system, is a management information system for the workshop layer located between the upper-level planning management system and the underlying industrial control. It is a production information management system for the workshop execution layer of manufacturing enterprises. The main function of MES is to collect, store, analyze and process various data generated in the production process, namely production process parameters, with the help of data acquisition system, so as to realize comprehensive monitoring and management of the production process, provide visualization and transparency of production, support production decision-making and optimization, and enterprises can timely discover and correct process deviations and product defects, thereby improving product quality and safety. Production process parameters include various parameters required in the production and manufacturing process. These parameter indicators include temperature, pressure, rate, pH value, concentration, etc., which are directly related to product quality and output.

[0003] In the prior art, the MES system uses a data acquisition system to read the variable values ​​of the PLC (Programmable Logic Controller) register cache one by one in a single variable point manner. However, when concurrently reading the production process parameter request, there is a phenomenon of processing jam or software crash. Furthermore, because the data cache has a time delay of a data acquisition cycle, there is a serious delay in reading the data cache when there are many variable points and a long acquisition cycle; the single variable point reading PLC method is in the scenario of batch reading multiple production process parameters in the MES system. The more variable points are read, the greater the time consumption is proportional, so there is low efficiency and serious delay, which cannot meet the real-time requirements of high-speed data acquisition and low production rhythm of the host computer in the industrial scenario.

[0004] With respect to the above-mentioned related technologies, the inventors found that the existing production process parameter reading method has problems such as processing jams, low efficiency and failure to meet real-time requirements when batch reading multiple production process parameters. Summary of the invention

[0005] In order to improve the processing efficiency when batch reading multiple production process parameters and meet the real-time requirements of high-speed data acquisition and low production cycle of the host computer in industrial scenarios, the present application provides a method and system for reading PLC production process parameters.

[0006] In a first aspect, the present application provides a method for reading PLC production process parameters.

[0007] This application is achieved through the following technical solutions:

[0008] A method for reading PLC production process parameters, comprising the following steps:

[0009] In response to the variable point read request instruction, a preset PDU scheduling algorithm is executed, including:

[0010] According to the variable point information to be read, the variable points to be read are classified according to the preset PLC device channel categories to obtain a first classification result;

[0011] Using the first classification result, the variable points to be read that belong to the same PLC device channel category are classified according to the preset register type partition category to obtain a second classification result;

[0012] Based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category to obtain a third classification result;

[0013] In combination with the third classification result, a batch read instruction is sent, where the batch read instruction is used to read the variable points to be read that belong to the same PLC device channel category, the same register type partition category, and the same PDU maximum length grouping category at one time.

[0014] In a preferred example, the present application can be further configured as follows: according to the second classification result, the variable points to be read that belong to the same register type partition category are classified according to the preset PDU maximum length grouping category, and the step of obtaining the third classification result includes:

[0015] Based on the PDU maximum length of the PDU maximum length grouping category, dynamically calculate the PDU actual lengths of the variable points to be read that belong to the same PLC device channel category and the same register type partition category in the second classification result;

[0016] Determine in sequence whether the actual length of the PDU of the variable point to be read is greater than the maximum length of the PDU;

[0017] When the actual length of the PDU is less than or equal to the maximum length of the PDU, the corresponding variable point to be read is allocated to the group where the current maximum length grouping category of the PDU is located to construct a PDU group.

[0018] In a preferred example, the present application may be further configured as follows: after the step of successively determining whether the actual length of the PDU of the variable point to be read is greater than the maximum length of the PDU, the method further includes:

[0019] When the actual length of the PDU is greater than the PDU maximum length, a new PDU maximum length grouping category is created until the actual length of the PDU is less than or equal to the PDU maximum length of the new PDU maximum length grouping category;

[0020] The corresponding variable points to be read are allocated to the group where the new PDU maximum length group category is located, and a new PDU group is constructed.

[0021] In a preferred example, the present application may be further configured as follows: based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category, and before the step of obtaining the third classification result, the step further includes:

[0022] The variable points to be read in the second classification result that belong to the same PLC device channel category and the same register type partition category are sorted in ascending order according to the address from low to high, and the second classification result is updated.

[0023] In a preferred example, the present application may be further configured as follows: before the step of executing a preset PDU scheduling algorithm in response to a variable point reading request instruction, the step further includes:

[0024] Based on the variable point to be read, the read method is called to check whether the address of the variable point to be read is legal in the preset point table;

[0025] If the address is legal, calling a read operation and calling the PDU scheduling algorithm;

[0026] Call the corresponding driver, perform the read operation, and generate the protocol message;

[0027] Check whether a result message is returned;

[0028] If the result message is returned, check whether the read result is returned;

[0029] If the read result is returned, the request response variable point read request instruction is requested;

[0030] When it is allowed to respond to the variable point reading request instruction, a preset PDU scheduling algorithm is executed in response to the variable point reading request instruction.

[0031] In a preferred example, the present application may be further configured as follows: before the step of executing the preset PDU scheduling algorithm, it also includes:

[0032] Based on a preset session cache list, determining whether the received variable point reading request instruction already has a session cache ID in the session cache list, wherein the session cache list includes a unique mapping relationship between the variable point reading request instruction, the session cache ID and the third classification result and the pre-cached third classification result;

[0033] If the received variable point reading request instruction already has a session cache ID in the session cache list, the third classification result is matched in the session cache list according to the session cache ID.

[0034] In a second aspect, the present application provides a system for reading PLC production process parameters.

[0035] This application is achieved through the following technical solutions:

[0036] A system for reading PLC production process parameters, comprising:

[0037] MES system, used to initiate variable point reading request instructions after the workpiece enters the workstation;

[0038] A data acquisition system, communicatively connected to the MES system, for responding to the variable point reading request instruction, executing a preset PDU scheduling algorithm, and sending a batch reading instruction;

[0039] The PLC is communicatively connected to the data acquisition system, and is used to respond to the batch reading instruction, read the variable points to be read belonging to the same PLC device channel category, the same register type partition category and the same PDU maximum length grouping category at one time, and collect production process parameters.

[0040] In a third aspect, the present application provides a computer device.

[0041] This application is achieved through the following technical solutions:

[0042] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the steps of the above-mentioned method for reading PLC production process parameters when executing the computer program.

[0043] In a fourth aspect, the present application provides a computer-readable storage medium.

[0044] This application is achieved through the following technical solutions:

[0045] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of any one of the above-mentioned methods for reading PLC production process parameters.

[0046] In a fifth aspect, the present application provides a computer program product.

[0047] This application is achieved through the following technical solutions:

[0048] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of any one of the above methods for reading PLC production process parameters.

[0049] In summary, compared with the prior art, the technical solution provided by this application has at least the following beneficial effects:

[0050] In response to the variable point reading request instruction, the preset PDU scheduling algorithm is executed to collect the variable points to be read, and the first classification result is obtained by classifying the variable points according to the PLC device channel; the first classification result is then classified by the register type partition to obtain the second classification result; the second classification result is continued to be grouped according to the PDU maximum length, so that the actual size of each PDU of the variable point can be calculated, and the optimal PDU length can be calculated, instead of fixing the PDU size to the PDU maximum value, to achieve the minimum number of PLC accesses and the minimum network bandwidth consumption, and to achieve millisecond-level high-speed batch real-time reading of PLC production process parameter variable values, which can effectively reduce the network bandwidth consumption of the communication between the host computer and the PLC, and is suitable for the scenario of real-time interaction between the MES system and the PLC, especially for the high-speed data acquisition scenario of Industry 4.0, and provides a high-real-time batch reading of production process parameters. The data acquisition method has stronger data processing capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A schematic diagram of the main flow of a method for reading PLC production process parameters provided by an exemplary embodiment of the present application.

[0052] Figure 2 A system architecture diagram of a method for reading PLC production process parameters provided as yet another exemplary embodiment of the present application.

[0053] Figure 3 A flowchart of an execution method for reading PLC production process parameters is provided for another exemplary embodiment of the present application.

[0054] Figure 4 An interactive timing diagram of a system for reading PLC production process parameters is provided as an exemplary embodiment of the present application.

[0055] Figure 5 A workflow diagram of a high-concurrency processing engine for a method of reading PLC production process parameters provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0056] This specific embodiment is merely an explanation of the present application and is not a limitation of the present application. After reading this specification, those skilled in the art may make modifications to the present embodiment without any creative contribution as needed, but such modifications are protected by the patent law as long as they are within the scope of the claims of the present application.

[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0058] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.

[0059] When the MES system executes real-time reading of variable data of a large number of production process parameters, if reading the variable data takes a long time, the production cycle of the entire automatic production line will be extended and time-consuming, and it will not be able to meet the requirements of high-speed data acquisition and low production cycle of the host computer in industrial scenarios.

[0060] The existing technical methods have bottleneck problems such as processing freeze, software crash or collection delay when the MES system concurrently reads production process parameter requests through the data acquisition system.

[0061] To this end, the data acquisition system introduces a dynamic PDU algorithm. When the MES system requests to read multiple process parameter variables at one time, it classifies the variables according to the PLC device channel, register type partition, and PDU maximum length grouping. It requests to read the PDU at one time and reads multiple point data of the PLC register in batches, reducing the number of PLC accesses and the time spent on communication between the host and slave computers. It achieves millisecond-level high-speed acquisition of multiple points and meets the real-time requirements of high-speed data acquisition and low production cycle of the host computer in industrial scenarios.

[0062] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.

[0063] Reference Figure 1 , an embodiment of the present application provides a method for reading PLC production process parameters, and the main steps of the method are described as follows.

[0064] S1: In response to the variable point reading request instruction, execute the preset PDU scheduling algorithm, including:

[0065] S12: According to the variable point information to be read, the variable points to be read are classified according to the preset PLC device channel category to obtain a first classification result;

[0066] S13: using the first classification result, classifying the variable points to be read that belong to the same PLC device channel category according to the preset register type partition category to obtain a second classification result;

[0067] S14: Based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category to obtain a third classification result;

[0068] S15: In combination with the third classification result, a batch read instruction is sent, where the batch read instruction is used to read the variable points to be read that belong to the same PLC device channel category, the same register type partition category, and the same PDU maximum length grouping category at one time.

[0069] Specifically, refer to Figure 2 After determining that the workpiece has entered the workstation, the MES system responds to the variable point reading request instruction and requests the high-speed data acquisition system to read multiple production process parameter variable points. The high-speed data acquisition system dynamically calls the PDU calculation algorithm, executes the preset PDU scheduling algorithm, and reads the production process parameters of the workpiece in real time. The multiple variable points to be read are divided according to the PDU algorithm, and the PLC is read in batches at one time with the least number of requests, realizing the function of high-speed batch reading of production process parameters.

[0070] Reference Figure 3 , based on the variable point reading request instruction, obtain the variable point to be read, and judge the variable point information according to the device to which it belongs. According to the variable point information to be read, the variable point to be read is classified according to the preset PLC device channel category to obtain the first classification result. Among them, the PLC device channel category includes ModbusTCP channel, FINS_TCP channel, Siemens S7 series channel and other types. Siemens S7 series includes Siemens S7-200, S7-1200, S7-300, S7-400, S7-1500 and the like.

[0071] Next, partitioning is performed according to the PLC protocol register type. Using the first classification result, the variable points to be read belonging to the same PLC device channel category are classified according to the preset register type partition category to obtain the second classification result. Among them, the register type partition category based on the ModbusTCP protocol includes coil partition, discrete quantity partition, input register partition, holding register partition, etc. Different channels can be configured with different protocol types, and different protocol types have different register types.

[0072] Further, the actual length of each PDU is dynamically calculated according to the maximum length of the PDU. Based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category to obtain a third classification result, including:

[0073] Based on the PDU maximum length of the PDU maximum length grouping category, dynamically calculate the PDU actual lengths of the variable points to be read that belong to the same PLC device channel category and the same register type partition category in the second classification result;

[0074] Determine in sequence whether the actual length of the PDU of the variable point to be read is greater than the maximum length of the PDU;

[0075] When the actual length of the PDU is less than or equal to the maximum length of the PDU, the corresponding variable point to be read is allocated to the group where the current maximum length grouping category of the PDU is located, and the PDU group is constructed;

[0076] When the actual length of the PDU is greater than the PDU maximum length, a new PDU maximum length grouping category is created until the actual length of the PDU is less than or equal to the PDU maximum length of the new PDU maximum length grouping category;

[0077] The corresponding variable points to be read are allocated to the group where the new PDU maximum length group category is located, and a new PDU group is constructed.

[0078] Specifically, after the variable point addresses of the variable points to be read that belong to the same PLC device channel category and the same register type partition category are sorted in ascending order, the variable points are traversed to determine the PDU grouping.

[0079] Among them, the actual length of the PDU of the variable point = (the address offset of the current variable point address_current-the first variable point address address_first of the current PDU group)*the byte length of the unit address+the byte length of the current variable.

[0080] Determine whether the actual length of the PDU at the variable point is greater than the maximum length of the PDU of the PDU maximum length grouping category.

[0081] When the actual length of the PDU is less than or equal to the maximum length of the PDU, the corresponding variable point is allocated to the group where the current PDU maximum length grouping category is located; when the actual length of the PDU is greater than the maximum length of the PDU, a new PDU maximum length grouping category is created and the corresponding variable point is allocated to the PDU group.

[0082] For example, there are three 16-bit integer variable points in the point table of the Modbus protocol holding register area (variable name TAG1--address 400001, variable name TAG2--address 400005, variable name TAG3--address 400200), and the maximum length of the Modbus protocol PDU is 253 bytes.

[0083] Since the holding register area is a word register, one address occupies 2 bytes. After TAG1, TAG2, and TAG3 are sorted in ascending order by address, starting from the first variable point TAG1, within the maximum length of 253 bytes of the PDU, the maximum address is 400005 and the minimum address is 400001. Therefore, TAG1 and TAG2 are divided into the same PDU group A. The actual length of PDU group A is (400005-400000)X2, which is 10 bytes.

[0084] Because the address 400200 of TAG3 exceeds the maximum length of PDU group A (greater than the address 400127), TAG3 is independently divided into PDU group B. The actual length of PDU group B is 1*2, that is, 2 bytes.

[0085] Finally, in combination with the third classification result, a batch read instruction is sent, and the batch read instruction is used to read the variable points to be read belonging to the same PLC device channel category, the same register type partition category and the same PDU maximum length grouping category at one time.

[0086] By classifying the variable points to be read by PLC device channels, further classifying them by register type, and then grouping the classification results by PDU maximum length, the actual size of each PDU of the variable point can be calculated, instead of fixing the PDU size to the PDU maximum length value, which can effectively reduce the network bandwidth consumption of communication between the host computer and PLC.

[0087] Reference Figure 3 , when executing the preset PDU scheduling algorithm, it also includes,

[0088] First determine whether the session id (session cache ID) already exists.

[0089] Specifically, based on a preset session cache list, it is determined whether the received variable point reading request instruction already has a session cache ID in the session cache list. The session cache list includes a unique mapping relationship between the variable point reading request instruction, the session cache ID and the third classification result, and the pre-cached third classification result.

[0090] If the received variable point reading request instruction already has a session cache ID in the session cache list, the third classification result is matched in the session cache list according to the session cache ID.

[0091] If the received variable point reading request instruction does not have a session cache ID in the session cache list, a preset PDU scheduling algorithm is executed.

[0092] In this embodiment, the interface field session id is a unique session cache ID used by the PDU cache. When the external system batch reads multiple production process parameter variable data, a unique session cache ID is generated each time, and the high-speed data acquisition system caches the PDU cache of the ID. When the external system batch reads the same batch of production process parameter variable data next time, the cached PDU is obtained according to the unique session cache ID without recalculating the PDU, thereby improving the efficiency of batch reading the same batch of production process parameter variable data.

[0093] Reference Figure 3 In one embodiment, based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category, and before the step of obtaining the third classification result, the step further includes:

[0094] The variable points to be read in the second classification result that belong to the same PLC device channel category and the same register type partition category are sorted in ascending order according to the address from low to high, and the second classification result is updated.

[0095] Before calculating the actual length of the PDU of the variable point, since the address segment of the register read at one time is continuous, based on this principle, the PDU calculation algorithm sorts all the variable points in the same register area in ascending order from low to high (low address first, high address last), so that the address offset of the variable point can be quickly calculated. After sorting, starting from the first variable point, the variable points are grouped according to the maximum length of the PDU. The group length is equal to or less than the maximum length of the PDU, which has higher calculation efficiency.

[0096] In one embodiment, before the step of executing a preset PDU scheduling algorithm in response to a variable point reading request instruction, the step further includes:

[0097] Based on the variable point to be read, the read method is called to check whether the address of the variable point to be read is legal in the preset point table;

[0098] If the address is legal, calling a read operation and calling the PDU scheduling algorithm;

[0099] Call the corresponding driver, perform the read operation, and generate the protocol message;

[0100] Check whether a result message is returned;

[0101] If the result message is returned, check whether the read result is returned;

[0102] If the read result is returned, the request response variable point read request instruction is requested;

[0103] When it is allowed to respond to the variable point reading request instruction, a preset PDU scheduling algorithm is executed in response to the variable point reading request instruction.

[0104] The present application also provides a system for reading PLC production process parameters, which is applied to any one of the methods for reading PLC production process parameters in the above embodiments. The system for reading PLC production process parameters includes:

[0105] MES system, used to initiate variable point reading request instructions after the workpiece enters the workstation;

[0106] A data acquisition system, communicatively connected to the MES system, for responding to the variable point reading request instruction, executing a preset PDU scheduling algorithm, and sending a batch reading instruction;

[0107] The PLC is communicatively connected to the data acquisition system, and is used to respond to the batch reading instruction, read the variable points to be read belonging to the same PLC device channel category, the same register type partition category and the same PDU maximum length grouping category at one time, and collect production process parameters.

[0108] Specifically, refer to Figure 4 ,The MES system initiates a variable read request to the high speed data acquisition system via the TCP interface service, and the variable read request matches the unique session cache ID (variable ID).

[0109] The high-speed data acquisition system responds to the variable point reading request instruction through the TCP interface service, calls the read method based on the variable point to be read through the variable driving model OVariable, queries the point table in the preset point table, and verifies whether the address of the variable name to be read is legal.

[0110] If the address is legal, the read operation is called through the variable driver model OVariable, the PDU algorithm is called dynamically, the corresponding driver is called through the device management service ODeviceManageService, the read operation is executed through the protocol driver ODriver, the protocol message is generated, and a read request is sent to the lower computer PLC.

[0111] Check whether a result message is returned.

[0112] When the lower PLC returns the result message, it detects whether the protocol driver Odriver, the device management service OdeviceManageService, the variable driver model Ovariable and the TCP interface of the high-speed data acquisition system return the read result in sequence. The return status code is shown in Table 1 below.

[0113] Table 1

[0114]

[0115]

[0116] If the read results are returned in sequence, the TCP interface of the high-speed data acquisition system sends a request to the TCP interface of the MES system to respond to the variable point read request instruction.

[0117] When the MES system allows responding to the variable point reading request instruction, the high-speed data acquisition system responds to the variable point reading request instruction, executes the preset PDU scheduling algorithm, controls the PLC to batch read the production process parameter variable values, and realizes the purpose of the MES system calling the high-speed data acquisition system to read the PLC production process parameters in real time.

[0118] In one embodiment, the MES system can call the real-time PLC variable reading interface to directly read the variable values ​​of devices such as PLCs or electric meters without waiting for the data acquisition cycle, thereby optimizing the speed of reading device variables.

[0119] The specific definition of a system for reading PLC production process parameters can be found in the above definition of a method for reading PLC production process parameters, which will not be repeated here.

[0120] Each module in the system for reading PLC production process parameters can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0121] In one embodiment, the high-speed data acquisition system introduces a high-concurrency processing engine to fully utilize the concurrent performance of the carrier industrial computer CPU to achieve the purpose of high-speed parallel processing of multiple concurrent requests and real-time response results.

[0122] Specifically, refer to Figure 5 After the high-concurrency processing engine API service receives a read request from a third-party platform (such as a high-speed data acquisition system), it will immediately store the request in the engine's task cache queue and automatically trigger the task dispatcher to dispatch the tasks in the task cache queue to the idle task processors in real time. After the task processor completes the task, it returns the processing result to the API service, and finally the API service returns the processing result response message to the third-party platform.

[0123] In summary, a method and system for reading PLC production process parameters, by executing a preset PDU scheduling algorithm, collects variable points to be read, and obtains a first classification result by classifying the variable points according to the PLC device channel; then classifies the first classification result by register type partition to obtain a second classification result; continues to group the second classification result by the maximum length of the PDU, and can calculate the actual size of each PDU of the variable point, and calculate the optimal PDU length, instead of fixing the PDU size to the maximum value of the PDU, to achieve the minimum number of PLC accesses and the minimum network bandwidth consumption, and to achieve millisecond-level high-speed batch real-time reading of PLC production process parameter variable values, which can effectively reduce the network bandwidth consumption of the communication between the host computer and the PLC, and is suitable for the scenario of real-time interaction between the MES system and the PLC, especially for the high-speed data acquisition scenario of Industry 4.0, and provides a high-real-time batch reading of production process parameters. The data acquisition method has stronger data processing capabilities.

[0124] A method for reading PLC production process parameters calculates the optimal PDU length by calling the PDU algorithm, achieves the purpose of real-time reading of PLC production process parameter variable values ​​in batches (1 to 5000 points) at millisecond level with the least number of PLC accesses and the minimum network bandwidth consumption.

[0125] A method for reading PLC production process parameters generates a unique session cache ID when an MES system frequently reads multiple variables in batches. A high-speed data acquisition system caches the PDU cache of the ID. When the MES system reads the same batch of variable data in batches next time, the cached PDU is obtained according to the unique session cache ID without recalculating the PDU, thereby improving the batch reading efficiency.

[0126] A method for reading PLC production process parameters adopts a high-concurrency processing engine with multi-core parallel processing, fully utilizes the concurrent computing capability of the industrial control host CPU, and realizes multi-channel concurrent processing.

[0127] A method for reading PLC production process parameters calculates the optimal PDU length by improving parallel processing capabilities, highly reusable template codes and highly concurrent data processing architecture, and achieves the purpose of high-speed batch reading of production process parameters in milliseconds with the least number of PLC accesses and minimum network bandwidth consumption.

[0128] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0129] In one embodiment, a computer device is provided, which may be a server. The computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, any of the above methods for reading PLC production process parameters is implemented.

[0130] In one embodiment, a computer-readable storage medium is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, any one of the above-mentioned methods for reading PLC production process parameters is implemented.

[0131] In one embodiment, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, any one of the above methods for reading PLC production process parameters is implemented.

[0132] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. When the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0133] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.

Claims

1. A method for reading PLC production process parameters, It is characterized in that The following steps are included: In response to the variable point read request instruction, a preset PDU scheduling algorithm is executed, including: According to the variable point information to be read, the variable points to be read are classified according to the preset PLC device channel categories to obtain a first classification result; Using the first classification result, the variable points to be read that belong to the same PLC device channel category are classified according to the preset register type partition category to obtain a second classification result; Based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category to obtain a third classification result; In combination with the third classification result, a batch read instruction is sent, where the batch read instruction is used to read the variable points to be read that belong to the same PLC device channel category, the same register type partition category, and the same PDU maximum length grouping category at one time.

2. The method for reading PLC production process parameters according to claim 1, It is characterized in that According to the second classification result, the step of classifying the variable points to be read that belong to the same register type partition category according to the preset PDU maximum length grouping category to obtain the third classification result includes: Based on the PDU maximum length of the PDU maximum length grouping category, dynamically calculate the PDU actual lengths of the variable points to be read that belong to the same PLC device channel category and the same register type partition category in the second classification result; Determine in sequence whether the actual length of the PDU of the variable point to be read is greater than the maximum length of the PDU; When the actual length of the PDU is less than or equal to the maximum length of the PDU, the corresponding variable point to be read is allocated to the group where the current maximum length grouping category of the PDU is located to construct a PDU group.

3. The method for reading PLC production process parameters according to claim 2, It is characterized in that After the step of successively determining whether the actual length of the PDU of the variable point to be read is greater than the maximum length of the PDU, the method further includes: When the actual length of the PDU is greater than the PDU maximum length, a new PDU maximum length grouping category is created until the actual length of the PDU is less than or equal to the PDU maximum length of the new PDU maximum length grouping category; The corresponding variable points to be read are allocated to the group where the new PDU maximum length group category is located, and a new PDU group is constructed.

4. The method for reading PLC production process parameters according to claim 1, It is characterized in that Based on the second classification result, the variable points to be read that belong to the same PLC device channel category and the same register type partition category are classified according to the preset PDU maximum length grouping category to obtain the third classification result, and the step also includes: The variable points to be read in the second classification result that belong to the same PLC device channel category and the same register type partition category are sorted in ascending order according to the address from low to high, and the second classification result is updated.

5. The method for reading PLC production process parameters according to any one of claims 1 to 4, It is characterized in that Before the step of executing a preset PDU scheduling algorithm in response to the variable point reading request instruction, the method further includes: Based on the variable point to be read, the read method is called to check whether the address of the variable point to be read is legal in the preset point table; If the address is legal, calling a read operation and calling the PDU scheduling algorithm; Call the corresponding driver, perform the read operation, and generate the protocol message; Check whether a result message is returned; If the result message is returned, check whether the read result is returned; If the read result is returned, the request response variable point read request instruction is requested; When it is allowed to respond to the variable point reading request instruction, a preset PDU scheduling algorithm is executed in response to the variable point reading request instruction.

6. The method for reading PLC production process parameters according to any one of claims 1 to 4, It is characterized in that Before the step of executing the preset PDU scheduling algorithm, the method further includes: Based on a preset session cache list, determining whether the received variable point reading request instruction already has a session cache ID in the session cache list, wherein the session cache list includes a unique mapping relationship between the variable point reading request instruction, the session cache ID and the third classification result and the pre-cached third classification result; If the received variable point reading request instruction already has a session cache ID in the session cache list, the third classification result is matched in the session cache list according to the session cache ID.

7. A system for reading PLC production process parameters, It is characterized in that include, MES system, used to initiate variable point reading request instructions after the workpiece enters the workstation; A data acquisition system, communicatively connected to the MES system, for responding to the variable point reading request instruction, executing a preset PDU scheduling algorithm, and sending a batch reading instruction; The PLC is communicatively connected to the data acquisition system, and is used to respond to the batch reading instruction, read the variable points to be read belonging to the same PLC device channel category, the same register type partition category and the same PDU maximum length grouping category at one time, and collect production process parameters.

8. A computer device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, It is characterized in that The invention comprises a computer program, which implements the steps of the method according to any one of claims 1 to 6 when being executed by a processor.