Industrial data batch processing method, industrial data processing method and system

By improving the frame format of the Ethercat protocol and adding new addressing methods and fields, the problem of inefficient data processing in industrial scenarios is solved, and batch read and write operations of slave segments are realized, and processing efficiency and flexibility are improved.

CN119806081AActive Publication Date: 2025-04-11深圳市三旺通信股份有限公司

Patent Information

Application Number
CN202411937014.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-11
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The Ethercat protocol is inefficient in data processing and lacks flexibility in industrial scenarios, especially when operating on slave physical register addresses.

Method used

It provides an industrial data batch processing method, which improves the frame format of the Ethercat protocol and adds new addressing methods and fields, and supports batch read and write operations of slave segments according to the address of physical registers. Specifically, it includes introducing START and STOP fields in the frame format, which are used to determine the start and end addresses of the target slave segment, and expanding through the command type field to indicate whether the slave is a target slave.

Benefits of technology

It improves the efficiency and flexibility of industrial data processing, can effectively solve the problem of inefficient data processing in industrial scenarios, and realizes batch operations of slave stations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806081A_ABST
    Figure CN119806081A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to an industrial data batch processing method and system, and the method comprises the steps: determining a command type value in a command type field in a unique protocol data unit according to a command type adopted by batch access; the command type value is used for indicating each target slave station to determine a read-write data type of batch access and providing a calculation mode of the target slave station; determining a first value and a second value respectively corresponding to a first address field and a second address field in the protocol data unit according to the target slave station segment to be accessed in batches and the command type value; the first value and the second value are used for each slave station to confirm whether the slave station is a target slave station according to the own address after determining the calculation mode; based on the unique protocol data unit, the batch processing messages are generated and sent to the target slave stations, and the problem that when an existing Ethercat protocol is applied to an industrial scene, the data processing efficiency is low can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to an industrial data batch processing method, an industrial data processing method and a system. Background Art

[0002] At present, there are many protocols in the field of industrial control, such as manufacturing, energy, petrochemical, power collection, etc., such as Modbus protocol, Ethercat protocol, Profinet protocol and CC-link protocol. Each protocol has its own characteristics. Among them, Ethercat protocol is favored by the industry for its simple message structure, low latency, precise synchronization and other characteristics.

[0003] The most typical networking of Ethercat protocol is as follows Figure 1 As shown in the figure, the master station constructs the topology through broadcast messages and configures a continuous station number for each slave station according to the distance from the master station, such as slave station 1, slave station 2, slave station 3, etc. The intermediate slave stations and the last slave station are judged by the port link status of the device, where the two ports (transmitting port and receiving port) of the intermediate slave station are both uplink ports (link up), and the port of the last slave station has only the receiving port as an uplink port link up.

[0004] Although the Ethercat protocol has excellent transmission performance, its data processing efficiency is low for industrial scenarios. For example, the user only needs to operate the physical register address of the slave station within a certain area segment, such as collecting data or setting parameters for a slave station with a physical register address in the range of 10 to 20. When collecting information, the current common method is to batch collect information from all slave stations through logical addressing reading, and then analyze and filter the information of the slave stations corresponding to the target slave station segment. When configuring information, a single slave station is operated through the slave station write method. In short, the Ethercat protocol is used in industrial scenarios, with low data processing efficiency and lack of flexibility. Summary of the invention

[0005] In view of this, the embodiments of the present application provide an industrial data batch processing method, an industrial data processing method and a system, which can effectively solve the problems of low data processing efficiency and lack of flexibility when the existing Ethercat protocol is used in industrial scenarios.

[0006] In a first aspect, an embodiment of the present application provides an industrial data batch processing method, which is applied to an industrial master station, and the method includes:

[0007] Determine the target slave segments that need to be accessed in batches based on business needs;

[0008] Determine, according to the command type used for the batch access, a command type value of a command type field in a unique protocol data unit contained in a preset Ethernet frame to be generated; the command type value is used to instruct each target slave station to confirm the read and write data type of the batch access, and to confirm whether it is a calculation method for the target slave station;

[0009] Determine, according to the target slave station segment and the command type value, a first value and a second value corresponding to the first address field and the second address field in the unique protocol data unit, respectively; the first value and the second value are used for each slave station to calculate whether it is the target slave station by using the calculation method;

[0010] Based on the updated unique protocol data unit, a batch processing message is generated according to a preset Ethernet frame format and sent to each target slave station based on the adjacent slave stations.

[0011] In a second aspect, an embodiment of the present application provides an industrial data processing method, which is applied to an industrial slave station, and the method includes:

[0012] Receiving a batch processing message generated by the method provided in the first aspect of the present application and sent by the industrial master station;

[0013] Obtain a command type value from a command type field in the unique protocol data unit;

[0014] Determine the calculation method of the target slave station and the read and write data type of the batch access according to the command type value;

[0015] Respectively obtain a first value and a second value from a first address field and a second address field in the protocol data unit;

[0016] Using the calculation method, calculating whether the station itself is a target slave station according to the first value and the second value;

[0017] If it is determined to be the target slave station, it reads and writes data to itself according to the read and write data type.

[0018] In a third aspect, an embodiment of the present application provides an industrial network system, the system comprising: an industrial master station and multiple industrial slave stations; the industrial master station is used to implement an industrial data batch processing method provided in the first aspect of the present application; the industrial slave stations are used to implement an industrial data processing method provided according to the second aspect of the present application.

[0019] The embodiments of the present application have the following beneficial effects:

[0020] The command type value of the present application determines the calculation method of the read and write data type of the batch access to confirm whether the own slave device is the target slave; the first value and the second value in the protocol data unit are used for each slave to calculate whether its own slave device is the target slave in the target slave segment to be accessed in batches after determining the calculation method; and read and write access is performed on the target slave. The present application can effectively solve the problems of low data processing efficiency and lack of flexibility when the existing Ethercat protocol is used in industrial scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 The present invention shows a block diagram of an industrial network system structure obtained by networking based on the Ethercat protocol;

[0023] Figure 2 A schematic diagram of an existing Ethercat frame format provided in an embodiment of the present application is shown;

[0024] Figure 3 A schematic diagram showing an improved Ethercat frame format according to an embodiment of the present application is shown;

[0025] Figure 4 A flow chart showing a method for batch processing of industrial data according to an embodiment of the present application is shown;

[0026] Figure 5 A flow chart of the industrial data processing method according to an embodiment of the present application is shown;

[0027] Figure 6 A schematic diagram of a first frame format for batch processing messages in the industrial data processing method of an embodiment of the present application is shown;

[0028] Figure 7 A schematic diagram of a second frame format for batch processing messages in the industrial data processing method according to an embodiment of the present application is shown;

[0029] Figure 8 A third frame format schematic diagram of batch processing messages in the industrial data processing method of an embodiment of the present application is shown;

[0030] Fig. 9 A schematic diagram of the structure of an industrial data batch processing device according to an embodiment of the present application is shown;

[0031] Fig.10 A structural schematic diagram of an industrial data processing device according to an embodiment of the present application is shown.

[0032] Description of main component symbols:

[0033] 910-target slave station segment determination module; 920-command type field filling module; 930-address field filling module; 940-sending module; 1010-receiving module; 1020-command type value acquisition module; 1030-read-write type acquisition module; 1040-address value acquisition module; 1050-target slave station determination module; 1060-read-write module. DETAILED DESCRIPTION

[0034] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0035] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0036] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0037] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0038] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0039] The existing Ethercat frame structure is as follows Figure 2 As shown, it specifically includes: an Ethernet frame header, a load part, and the embodiment of the present application improves the frame structure of the Ethercat protocol. The frame structure defined by the Ethercat protocol includes an Ethernet frame header, a load part payload, and an Ethernet frame tail. The Ethernet frame header includes a target MAC address, a source MAC address, and a protocol type EtherType. The load part payload includes a protocol data unit header and multiple protocol data units PDU. The protocol data unit PDU includes a command type field CMD, IDX, an address position field (Address Position, abbreviated ADP, address position), an address offset field (Address Offset, abbreviated ADO, address offset), a length field LEN, a reserved field Reserved, C, NEXT, IRQ, a data field DATA, and a work counter WKC.

[0040] The Ethercat protocol is used in industrial scenarios with low data processing efficiency and lack of flexibility, as shown below:

[0041] 1) Ethercat's addressing method does not support addressing based on the physical address of a certain section of slave stations;

[0042] 2) When Ethercat reads information in batches, it generally adopts the logical addressing reading method, collecting all the slave station information to the master station. In particular, after receiving the logical read command, the uninterested slave stations will also put the information into the message, consuming too much time of irrelevant slave stations;

[0043] 3) After the Ethercat master station completes the information collection, it needs to screen all slave stations and extract the information of the slave station ID of interest for processing. This process consumes a lot of resources of the master station;

[0044] 4) When setting Ethercat in batches, either the node addressing writing method or the logical addressing writing method is used. In the former, the message length will be encapsulated according to each slave station, the message length is relatively long, and the processing efficiency is low; the latter will operate on all slave stations, and the efficiency is also very low.

[0045] In order to solve the above problems, the present application provides an industrial data batch processing method, an industrial data processing method and a system.

[0046] The present application provides an industrial network system, exemplary, such as Figure 1As shown, the industrial network system of the embodiment of the present application includes: an industrial master station and multiple industrial slave stations. The industrial master station is used to implement the industrial data batch processing method of the embodiment of the present application; the industrial slave stations are used to implement the industrial data processing method of the embodiment of the present application.

[0047] The present application first improves the existing Ethercat protocol frame format, uses the improved Ethercat protocol frame format to generate batch processing messages, and sends them to the target slave station to be accessed in batches, so as to realize reading and writing data of the target slave station.

[0048] The specific improvements of the improved Ethercat protocol frame format include: when performing batch operations on the slave segment, the PDUs domain only contains one protocol data unit (PDU). Then, the field value of the command type field CMD of the PDU is expanded to indicate the calculation method of the target slave station and the read and write data type of the master station batch access to the slave station. Finally, the first field and the second field are used to store the identifier of the first target slave station and the identifier of the last target slave station corresponding to the target slave station segment, respectively. Among them, the target slave station is a slave station that needs read and write access, and the batch processing message in the embodiment of the present application needs to be passed step by step from the first slave station adjacent to the master station to the last target slave station.

[0049] In the embodiment of the present application, the identifier of the first target slave station and the identifier of the last target slave station are both the number of slave stations between the master station and the current slave station in the communication link plus 1, and the access number obtained can be understood to be the slave station ID of the current slave station. In the present application, a counter field is also used to record the number of slave stations passed, which is called the access number.

[0050] Exemplarily, in the first field determination method, the ADP field is replaced by the START field, which is used to store the start ID corresponding to the first target slave station in the target slave station segment (the identifier of the first target slave station), and a STOP field or a NUM field is added. The STOP field is used to store the end ID of the last target slave station in the target slave station segment (the identifier of the last target slave station); the NUM field is used to store the total number of target slave station segments accessed in batches, as shown in FIG. Figure 3 As shown. Exemplarily, in the second field determination method, the ADP field can also be used to represent the start ID, and the Reserved field can be used to store the ratio of the slave stations accessed in batches to the total number of slave stations (access ratio), such as 1 / 2, 1 / 4, 1 / 8 and 1 / 16 of the number of slave stations in the industrial network system. The description of each field in the improved Ethercat protocol frame format in the first field determination method is shown in Table 1. Figure 3The structural part shown in the third and fourth rows of the second field determination method; the description of each field in the improved Ethercat protocol frame format is shown in Table 2, such as Figure 3 The structure shown in the fifth row of FIG. 14 , the specific extension of the CMD field is shown in Table 3.

[0051] Table 1 Meaning of each field in the batch processing message under the first field determination method

[0052]

[0053] Table 2 Meaning of each field in the batch processing message under the second field determination method

[0054]

[0055]

[0056] Table 3 Meaning of the extended CMD field

[0057]

[0058]

[0059] The industrial data batch processing method is described below in conjunction with some specific embodiments.

[0060] Figure 4 A flow chart of the industrial data batch processing method of an embodiment of the present application is shown. Exemplarily, the industrial data batch processing method includes the following steps:

[0061] S110, determining the target slave station segments that need to be accessed in batches according to business requirements.

[0062] S120, according to the command type used for the batch access, determine the command type value of the command type field in the unique protocol data unit contained in the preset Ethernet frame to be generated; the command type value is used to indicate the calculation method for each target slave station to determine the read and write data type of the batch access, and to confirm whether it is the target slave station. After confirming the command type value, fill the command type value into the command type field; the unique protocol data unit is located in the payload part of the preset Ethernet frame format.

[0063] S130, determining the first value and the second value respectively corresponding to the first address field and the second address field in the unique protocol data unit according to the target slave station segment and the command type value; the first value and the second value are used for each slave station to calculate whether it is the target slave station using the calculation method.

[0064] After determining a first value and a second value, the first value is filled into the first address field and the second value is filled into the second address field.

[0065] S140, generating a batch processing message based on the updated unique protocol data unit according to a preset Ethernet frame format and sending the message to each target slave station based on the adjacent slave stations.

[0066] In one implementation, the command type value includes any one of a first read data command value, a first write data command value, a second read data command value, a second write data command value, a third read data command value, and a third write data command value.

[0067] Exemplarily, as shown in Table 3, the first read data command value = 14, indicating that the slave segment addressing read command is executed based on the start and end IDs; the first write data command value = 15, indicating that the slave segment addressing write command is executed based on the start and end IDs; the calculation method is to calculate whether the slave is the target slave based on the start and end IDs. The second read data command value = 16, indicating that the slave segment addressing read command is executed based on the starting ID and the total number of accesses; the second write data command value = 17, indicating that the slave segment addressing write command is executed based on the starting ID and the total number of accesses; the calculation method is to calculate whether the slave is the target slave based on the starting ID and the total number of accesses. The third read data command value = 18, indicating that the slave segment addressing read command is executed based on the starting ID and the access quantity ratio; the third write data command value = 19, indicating that the slave segment addressing write command is executed based on the starting ID and the access quantity ratio; the calculation method is to calculate whether the slave is the target slave based on the starting ID and the access quantity ratio.

[0068] It can be understood that in step S130, determining the first value and the second value respectively corresponding to the first address field and the second address field in the unique protocol data unit according to the target slave station segment and the command type value includes:

[0069] S131, determining that the first value is an identifier of the first target slave station in the target slave station segment.

[0070] S132: If the command type value is the first data read command value or the first data write command value, determine that the second value is an identifier of the last target slave station in the target slave station segment.

[0071] S133, if the command type value is the second read data command value or the second write data command value, determine that the second value is the total number of accesses including the target slave station address in the target slave station segment; the identifier of the last target slave station is determined based on the identifier of the first target slave station and the total number of accesses.

[0072] S134, if the command type value is the third read data command value or the third write data command value, determine that the second value is an access quantity ratio; the access quantity ratio is the ratio of the number of addresses contained in the target slave station segment to the total number of slave stations; the identification of the last target slave station is determined based on the identification of the first target slave station, the access quantity ratio and the total number of addresses.

[0073] It can be understood that the first value and the second value are used for each slave station to calculate whether its own device address is within the range from the identifier of the first target slave station to the identifier of the last target slave station in the target slave station segment by using the calculation method, and then confirm whether it is the target slave station. Further, the first value and the second value are also used for each slave station to determine whether to send the received batch processing message to the next adjacent slave station.

[0074] Furthermore, the method further comprises:

[0075] The preset initial access sequence number is filled into the working counter field in the unique protocol data unit; the working counter field is used to store the access sequence number updated by each slave station according to the preset step value and the current access sequence number in the working counter field after receiving the batch processing message; for example, the initial access sequence number is 0, the preset step value is 1, and the access sequence number in the working counter field is increased by 1 for each slave station passed. In the embodiment of the present application, the working counter field is a WKC field, and there is a 16-bit working counter (WKC) at the end of each PDU. The rule for it to increase after being addressed by each slave station is as follows: after passing a slave station: WKC+1.

[0076] The identifier of the first target slave station, the identifier of the last target slave station and the updated access sequence number are used for each slave station to calculate whether it is the target slave station.

[0077] In one embodiment, the method further includes: determining a data value of a data field in the unique protocol data unit according to a read / write data type corresponding to the batch access and preset demand data, and filling the data value into the data field.

[0078] Further, if the read / write data type is batch write data, the data to be written is determined to be the data value of the data field in the unique protocol data unit and filled into the data field; the data value is used for each target slave station to obtain and write into its corresponding register according to the target register address;

[0079] If the read / write data type is batch read data, the data field contains a null value; the data field is used to store target data obtained by each target slave station from the register of the target register address.

[0080] Furthermore, the method further comprises: filling the same register address of each target slave station for the batch access into the address offset field in the unique protocol data unit; the address offset field is used for each target slave station to obtain the target register address.

[0081] Furthermore, the preset Ethernet frame format is an improved Ethercat protocol frame format; and the command type field is a command type field CMD in the unique protocol data unit.

[0082] The first address field is the address position field ADP in the unique protocol data unit; the second address field is the end address identification field added in the unique protocol data unit, or the second address field is the reserved field Reserved in the unique protocol data unit.

[0083] Furthermore, the method also includes: determining the data length value for batch access to each target slave station according to business requirements.

[0084] The data length value is filled into the data length field in the unique protocol data unit PDU; the data length value is used to clarify the size of the target data accessed in batches when each target slave station parses the data length field. The specific uses of each field are shown in Table 4.

[0085] Table 4 Meaning of the extended CMD field 2

[0086]

[0087]

[0088] Figure 5 A flow chart of an industrial data processing method according to an embodiment of the present application is shown. Exemplarily, the industrial data processing method is applied to an industrial slave station and specifically includes the following steps:

[0089] S210, receiving a batch processing message sent by the industrial master station for batch access to each target slave station. Specifically, receiving a batch processing message generated by the industrial data batch processing method according to the embodiment of the present application and sent by the industrial master station.

[0090] S220: Obtain a command type value from a command type field in the unique protocol data unit.

[0091] S230, determining a calculation method of the target slave station and a read / write data type of batch access according to the command type value.

[0092] S240: Obtain a first value and a second value from a first address field and a second address field in the protocol data unit, respectively.

[0093] S250, using the calculation method, calculate whether the station itself is a target slave station according to the first value and the second value.

[0094] S260: If it is determined to be the target slave station, read and write data to itself according to the read and write data type.

[0095] Furthermore, the method further comprises: if the device address of the device itself is smaller than the identifier of the last target slave station, sending the batch processing message after the read / write processing to the next adjacent slave station, otherwise returning the batch processing message after the read / write processing to the master station step by step.

[0096] Furthermore, the method also includes updating the working counter field according to a preset step value and a current access sequence number in the working counter field; the working counter field is located in the unique protocol data unit.

[0097] Further, the command type value includes: any one of a first read data command value, a first write data command value, a second read data command value, a second write data command value, a third read data command value and a third write data command value.

[0098] It can be understood that in step S250, the using of the calculation method to calculate whether the station is a target slave station according to the first value and the second value includes:

[0099] If the access sequence number in the updated working counter field is within the range from the identifier of the first target slave station to the identifier of the last target slave station, it is confirmed that it is the target slave station;

[0100] In a case where the command type value is the first data read command value or the first data write command value, determining that the identifier of the first target slave station in the target slave station segment for batch access is the first value, and the identifier of the last target slave station in the target slave station segment is the second value;

[0101] In a case where the command type value is the second data read command value or the second data write command value, determining that the identifier of the first target slave station in the target slave station segment is the first value, and the total access quantity containing the target slave station addresses in the target slave station segment is the second value; the identifier of the last target slave station is determined based on the identifier of the first target slave station and the total access quantity;

[0102] When the command type value is the third read data command value or the third write data command value, the identifier of the first target slave station in the target slave station segment is determined to be the first value, the access quantity ratio is the second value, and the access quantity ratio is the ratio of the number of target slave stations included in the target slave station segment to the total number of slave stations; the identifier of the last target slave station is determined based on the access quantity ratio, the total number of addresses and the identifier of the first target slave station.

[0103] Further, in step S260, the reading and writing of data to itself according to the read and write data type includes:

[0104] S261, if the read / write data type is batch write data, read the filled data value from the data field in the unique protocol data unit; write the data value into the target register corresponding to the target register address of the unit;

[0105] S262, if the read / write data type is batch read data, obtain target data from the corresponding register according to the target register address; and write the target data into the data field.

[0106] Furthermore, the method further comprises: obtaining a filled target register address in an address offset field in the unique protocol data unit.

[0107] The application also includes: applying to the master for storage space for storing target data. In one implementation, the master fills in the Ethercat header field when sending a batch processing message, but does not apply for storage space for the collected information until the last target slave station visited applies for space. That is, the last target slave station sends a request for storage space information to the master. In one implementation, the master applies for storage space for the collected information when sending a batch processing message.

[0108] This application is applicable to the master station reading the information of each slave station in the slave station segment, or writing the target data of the DATA field in the batch processing message to each slave station in the slave station segment. For example, based on the information collection threshold configuration parameter issued by the master station, in this example, each slave station is numbered in a positive direction according to the distance relationship with the master station link, and the information in each slave station from slave station number 3 to slave station number 10 is read, and 4 bytes of data are read from each slave station. For example, the frame format in the batch processing message is as follows Figure 6 As shown, a slave station segment addressing read command is executed based on the start and end IDs, wherein in the batch processing message generated based on the improved Ethercat protocol frame format, CMD=14, START=3 (the first value, indicating the number of the starting target slave station), LEN=4, STOP=10 (the second value, indicating the number of the ending target slave station).

[0109] S311, determine to read the information in each slave station from slave station number 3 to slave station number 10, and the master station generates a batch processing message, wherein CMD=14, START=3, LEN=4, and STOP=10 are set in the batch processing message.

[0110] S312, for each slave station, after receiving the batch processing message, no matter whether it is the target slave station or not, it needs to increase the current access sequence number in the WKC field by 1, and then store it back to the WKC field to complete the update of the WKC field.

[0111] S313, for each slave station, determine whether the updated access sequence number is within the range of START field value 3 and STOP field value 10.

[0112] S314, if the updated access sequence number is within the above range, the slave station performs a read operation, that is, the target data in the physical address corresponding to the ADO field value is pushed into the DATA field in the batch processing message; for example, the first 4 bytes of data in the DATA field are the target data pushed into the slave station number 3, the second 4 bytes of data in the DATA field are the target data pushed into the slave station number 4, the third 4 bytes of data in the DATA field are the target data pushed into the slave station number 5, and so on.

[0113] S315, if the updated access sequence number is smaller than the identifier of the last target slave station, the batch processing message after the target data is pushed is forwarded to the next slave station.

[0114] S316, until the updated access sequence number is the STOP field value, it means that the slave station is the last target slave station, and after collecting the information, the batch processing message is returned to the master station.

[0115] In another example, the slave segment addressing read command is executed based on the starting ID and the total number of accesses. In this example, each slave is numbered in a positive direction according to the distance relationship with the master link, and the information in each slave numbered 3 to 10 is read, and 4 bytes of data are read from each slave. Figure 7 As shown, in the batch processing message generated based on the improved Ethercat protocol frame format, CMD=16, START=3 (the first value, indicating the starting ID of the target slave station), LEN=4, NUM=7 (the second value, indicating that the seven consecutive slave stations after the slave station corresponding to the starting ID are all target slave stations).

[0116] S321, determine to read the information in each slave station from slave station number 3 to slave station number 10, and the master station generates a batch processing message, wherein CMD=16, START=3, LEN=4, and NUM=7 are set in the batch processing message.

[0117] S322, for each slave station, after receiving the batch processing message, no matter whether it is the target slave station or not, it needs to increase the current access sequence number in the WKC field by 1, and then store it back to the WKC field to complete the update of the WKC field.

[0118] S323, for each slave station, determine whether the updated access sequence number is within the range of START field value + NUM field value.

[0119] S324, if the updated access sequence number is within the above range, the slave station performs a read operation.

[0120] S325, if the updated access sequence number is smaller than the identifier of the last target slave station, the batch processing message after the target data is pushed is forwarded to the next slave station.

[0121] S326, until the updated access sequence number is equal to the START field value + the NUM field value, it means that the slave station is the last target slave station, and after collecting the information, the batch processing message is returned to the master station.

[0122] In another example, a slave segment addressing write command is executed based on the starting ID and the total number of accesses. For example, an industrial network system with a total of 100 slaves reads the information of the target slaves after slave ID = 20, which is half of the total number of slaves, that is, collects information from slave IDs 20 to 60, and reads 4 bytes of data from each slave. For the batch processing message generated by the master station, CMD = 18, ADP = 20 (the first value, indicating the starting ID of the target slave station), LEN = 4, Reserved = 1 (the second value, indicating that starting from the starting ID, 1 / 2 of the total number of slaves are processed in batches), and the frame format corresponding to the batch processing message is as follows: Figure 8 shown.

[0123] S331, determine to read the information of the target slave stations starting from slave station ID=20 and half of the total number of slave stations, that is, collect the information of slave stations with IDs 20 to 60, and the master station generates a batch processing message, wherein CMD=18, ADP=20, LEN=4, and Reserved=1 are set in the batch processing message.

[0124] S332, for each slave station, determine whether the updated access sequence number is greater than or equal to the ADP field value. If it is greater than or equal to the ADP field value, it is necessary to count (WKC field value plus 1) to obtain the cumulative number of target slave stations until the last slave station has completely passed. This operation is used to count how many slave stations need to process the read operation after the target slave station corresponding to the ADP field value. The slave station locally records the cumulative number of the target slave station; the target slave station fills the collected information into the batch processing message and then forwards it to the next slave station. It can be calculated based on WKC, that is, when performing a batch read operation, WKC is the number of slave stations that pass through (WKC plus 1 for each successful read or write), so the slave station count can be obtained based on WKC.

[0125] S333: If the cumulative number of target slave stations of the current slave station is less than or equal to the value of the Reserved field multiplied by the total number of slave stations, the current slave station performs a read operation.

[0126] S334, until the last target slave station receives the message, the last target slave station is determined according to the ADP field value, the total number of slave stations and the Reserved field value, and the last target slave station applies for a memory size of 4Byte*40=80Byte from the master station; the last target slave station fills the collected information into the batch processing message and returns it to the master station.

[0127] This application has the following advantages:

[0128] 1) The improved Ethercat protocol extends the use of the reserved CMD field and adds a new addressing mode;

[0129] 2) The improved Ethercat protocol performs batch read and write operations on the slave segment according to the address of the physical register;

[0130] 3) The improved Ethercat protocol supports batch operations on slave segments according to the addresses of physical registers, for example, batch addressing is achieved through the newly added START and STOP fields in its frame format;

[0131] 4) The improved Ethercat protocol bounces the message after the slave device in the slave segment leaves after the operation is completed, and no longer traverses the subsequent slaves;

[0132] 5) Improved Ethercat protocol segment collection uses the method of applying for space from the last slave node.

[0133] Fig. 9 A schematic diagram of the structure of an industrial data batch processing device according to an embodiment of the present application is shown. Exemplarily, the industrial data batch processing device includes: a target slave segment determination module 910, a command type field filling module 920, an address field filling module 930 and a sending module 940.

[0134] A target slave station segment determination module 910 is used to determine the target slave station segment that needs to be accessed in batches according to business requirements;

[0135] The command type field filling module 920 is used to determine the command type value of the command type field in the unique protocol data unit contained in the preset Ethernet frame to be generated according to the command type used for the batch access; the command type value is used to indicate each target slave station to confirm the read and write data type of the batch access, and to confirm whether it is a calculation method of the target slave station;

[0136] The address field filling module 930 is used to determine the first value and the second value corresponding to the first address field and the second address field in the unique protocol data unit according to the target slave station segment and the command type value; the first value and the second value are used for each slave station to calculate whether it is the target slave station using the calculation method;

[0137] The sending module 940 is used to generate a batch processing message based on the updated unique protocol data unit according to a preset Ethernet frame format and send it to each target slave station based on the adjacent slave stations.

[0138] It can be understood that the device of this embodiment corresponds to the industrial data batch processing method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.

[0139] Fig.10 A schematic diagram of the structure of an industrial data processing device according to an embodiment of the present application is shown. Exemplarily, the industrial data processing device includes: a receiving module 1010, a command type value acquisition module 1020, a read / write type acquisition module 1030, an address value acquisition module 1040, a target slave station determination module 1050, and a read / write module 1060.

[0140] The receiving module 1010 is used to receive batch processing messages sent by the industrial master station for batch access to each target slave station; specifically, it is used to receive batch processing messages sent by the industrial master station that are generated based on the industrial data batch processing method provided in the embodiment of the present application.

[0141] A command type value obtaining module 1020, configured to obtain a command type value from a command type field in the unique protocol data unit;

[0142] A read / write type acquisition module 1030, used to determine a calculation method of a target slave station and a type of read / write data for batch access according to the command type value;

[0143] An address value acquisition module 1040, configured to respectively acquire a first value and a second value from a first address field and a second address field in the protocol data unit;

[0144] A target slave station determination module 1050 is used to use the calculation method to determine whether it is a target slave station according to the first value, the second value and its own device address;

[0145] The read / write module 1060 is configured to read and write data to itself according to the read / write data type when it is determined to be the target slave station.

[0146] It can be understood that the device of this embodiment corresponds to the industrial data batch processing method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.

[0147] The present application also provides a terminal device. Exemplarily, the terminal device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program. If the terminal device is a host, the terminal device executes the functions of each module in the above-mentioned industrial data batch processing method or the above-mentioned industrial data batch processing device; if the terminal device is a slave, the terminal device executes the functions of each module in the above-mentioned industrial data processing method or the above-mentioned industrial data processing device.

[0148] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0149] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0150] The present application also provides a computer-readable storage medium for storing the computer program used in the above-mentioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0151] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0152] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0153] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.

[0154] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A method for batch processing of industrial data, characterized in that: Applied to an industrial master station, the method comprises: Determine the target slave segments that need to be accessed in batches based on business needs; Determine, according to the command type used for the batch access, a command type value of a command type field in a unique protocol data unit contained in a preset Ethernet frame to be generated; the command type value is used to instruct each target slave station to confirm the read and write data type of the batch access, and to confirm whether it is a calculation method for the target slave station; Determine, according to the target slave station segment and the command type value, a first value and a second value corresponding to the first address field and the second address field in the unique protocol data unit, respectively; the first value and the second value are used for each slave station to calculate whether it is the target slave station by using the calculation method; Based on the updated unique protocol data unit, a batch processing message is generated in accordance with a preset Ethernet frame format and sent to each target slave station based on the adjacent slave stations.

2. The industrial data batch processing method according to claim 1, characterized in that: The command type value includes: any one of a first read data command value, a first write data command value, a second read data command value, a second write data command value, a third read data command value and a third write data command value; The first value and the second value are also used for each slave station to determine whether to send the received batch processing message to the next adjacent slave station; The determining, according to the target slave station segment and the command type value, the first value and the second value respectively corresponding to the first address field and the second address field in the unique protocol data unit comprises: Determine that the first value is an identifier of a first target slave station in the target slave station segment; If the command type value is the first data read command value or the first data write command value, determining that the second value is an identifier of the last target slave station in the target slave station segment; If the command type value is the second data read command value or the second data write command value, determining that the second value is the total access quantity including the target slave station address in the target slave station segment; the identifier of the last target slave station is determined according to the identifier of the first target slave station and the total access quantity; If the command type value is the third read data command value or the third write data command value, determine that the second value is an access quantity ratio; the access quantity ratio is the ratio of the number of target slave stations included in the target slave station segment to the total number of slave stations; the identification of the last target slave station is determined based on the identification of the first target slave station, the access quantity ratio and the total number of addresses.

3. The industrial data batch processing method according to claim 2, characterized in that: The method further comprises: Filling a preset initial access sequence number into a working counter field in the unique protocol data unit; the working counter field is used to store the access sequence number updated by each slave station according to a preset step value and the current access sequence number in the working counter field after receiving the batch processing message; The identifier of the first target slave station, the identifier of the last target slave station and the updated access sequence number are used for each slave station to calculate whether it is the target slave station.

4. The industrial data batch processing method according to claim 3 is characterized in that: If the read / write data type is batch write data, the data to be written is determined to be the data value of the data field in the unique protocol data unit and filled into the data field; the data value is used for each target slave station to obtain and write into its corresponding register according to the target register address; If the read / write data type is batch read data, the data field contains a null value; the data field is used to store target data obtained by each target slave station from the register of the target register address.

5. The industrial data batch processing method according to claim 4, characterized in that: The method further comprises: The same register address of each target slave station for the batch access is filled into the address offset field in the unique protocol data unit; the address offset field is used for each target slave station to obtain the target register address.

6. The industrial data batch processing method according to claim 2, characterized in that: The preset Ethernet frame format is an improved Ethercat protocol frame format; the command type field is a command type field in the unique protocol data unit; The first address field is an address location field in the unique protocol data unit; The second address field is an end address identification field added in the unique protocol data unit, or the second address field is a reserved field in the unique protocol data unit.

7. The industrial data batch processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: Determine the data length value for batch access to each target slave station based on business requirements; The data length value is filled into the data length field in the unique protocol data unit PDU; the data length value is used to clarify the size of the target data for batch access when each target slave station parses the data length field.

8. An industrial data processing method, characterized in that: Applied to an industrial slave station, the method comprises: Receiving a batch processing message sent by an industrial master station and generated based on the method according to any one of claims 1 to 7; Obtain a command type value from a command type field in the unique protocol data unit; Determine the calculation method of the target slave station and the read and write data type of the batch access according to the command type value; Respectively obtain a first value and a second value from a first address field and a second address field in the protocol data unit; Using the calculation method, calculating whether the station itself is a target slave station according to the first value and the second value; If it is determined to be the target slave station, it reads and writes data to itself according to the read and write data type.

9. The industrial data processing method according to claim 8, characterized in that: The command type value includes: any one of a first read data command value, a first write data command value, a second read data command value, a second write data command value, a third read data command value and a third write data command value; The method further includes: if the own device address is less than the identifier of the last target slave station, sending the batch processing message after the read and write processing to the next adjacent slave station, and updating the working counter field according to the preset step value and the current access sequence number in the working counter field; the working counter field is located in the unique protocol data unit; The using the calculation method to calculate whether the station itself is a target slave station according to the first value and the second value includes: If the access sequence number in the updated working counter field is within the range from the identifier of the first target slave station to the identifier of the last target slave station, it is confirmed that it is the target slave station; In a case where the command type value is the first data read command value or the first data write command value, determining that the identifier of the first target slave station in the target slave station segment for batch access is the first value, and the identifier of the last target slave station in the target slave station segment is the second value; In a case where the command type value is the second data read command value or the second data write command value, determining that the identifier of the first target slave station in the target slave station segment is the first value, and the total access quantity containing the target slave station addresses in the target slave station segment is the second value; the identifier of the last target slave station is determined based on the identifier of the first target slave station and the total access quantity; When the command type value is the third read data command value or the third write data command value, the identifier of the first target slave station in the target slave station segment is determined to be the first value, the access quantity ratio is the second value, and the access quantity ratio is the ratio of the number of target slave stations included in the target slave station segment to the total number of slave stations; the identifier of the last target slave station is determined based on the access quantity ratio, the total number of addresses and the identifier of the first target slave station.

10. An industrial network system, characterized in that: The system comprises: an industrial master station and a plurality of industrial slave stations; the industrial master station is used to implement the industrial data batch processing method according to any one of claims 1-7; the industrial slave stations are used to implement the industrial data processing method according to any one of claims 8-9.

Citation Information

Patent Citations

  • Communication method for actively informing master station of data reading by slave station under Modbus protocol

    CN116599792A

  • Slave station equipment information processing method and device, terminal equipment and industrial network system

    CN118694481A

  • Industrial data processing method and device, terminal equipment and industrial network system

    CN118759919A

  • Communication system, master station device, slave station device, and computer program

    JP2022055738A

Cited By

  • Message processing method and device based on Ethercat protocol and storage medium

    CN120547051A