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

By improving the Ethercat protocol frame format, adopting a new addressing method and batch processing messages, the problem of low data processing efficiency of the Ethercat protocol in industrial scenarios is solved, and efficient batch operation of the slave segment is achieved.

CN119806081BActive Publication Date: 2025-10-24深圳市三旺通信股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The Ethercat protocol suffers from low data processing efficiency and lacks flexibility in industrial scenarios. This is especially true when operating on the physical register address of a slave segment. The existing methods are inefficient and lack flexibility.

Method used

By improving the Ethercat protocol frame format, adopting a new addressing method, using the extended command type field and the newly added address field to determine the target slave segment, generating batch processing messages, and realizing batch read and write operations on the slave segment.

Benefits of technology

It improves the data processing efficiency of the Ethercat protocol in industrial scenarios, supports batch operations on the physical register addresses of slave segments, and reduces unnecessary slave information processing and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806081B_ABST
    Figure CN119806081B_ABST
Patent Text Reader

Abstract

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

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to an industrial data batch processing method, an industrial data processing method and system. BACKGROUND

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

[0003] The most typical networking of the Ethercat protocol is shown in Figure 1 The master station constructs the topology by broadcasting 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 station and the last slave station are judged by the port link state of the device, wherein the two ports (transmit port and receive port) of the intermediate slave station are both link up, and only the receive port of the last slave station is 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 in a certain region, such as data collection or parameter setting of the slave station with a physical register address in the range of slave station number 10~20. When collecting information, the current common way is to collect the information of all slave stations in batches through logical addressing reading, and then analyze and filter the information of the target slave station segment. When configuring information, the slave station writes in a single slave station operation. In summary, the Ethercat protocol is used in industrial scenarios, and the data processing efficiency is low and lacks flexibility. SUMMARY

[0005] Therefore, the embodiments of the present application provide an industrial data batch processing method, an industrial data processing method and 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, the embodiments of the present application provide an industrial data batch processing method applied to an industrial master station, and the method comprises:

[0007] According to the business requirements, determine the target slave station segment that needs to be batch accessed;

[0008] determining a command type value of a command type field in a unique protocol data unit to be contained in a preset Ethernet frame to be generated according to a command type adopted by the batch access; the command type value is used to instruct each target slave station to confirm a read-write data type of the batch access and to confirm a calculation manner of itself whether being a target slave station;

[0009] determining a first value in a first address field and a second value in a 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 itself whether being a target slave station by using the calculation manner;

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

[0011] In a second aspect, an embodiment of the present application provides an industrial data processing method applied to an industrial slave station, and the method comprises the following steps.

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

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

[0014] determining a calculation manner of a target slave station and a read-write data type of a batch access according to the command type value;

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

[0016] calculating itself whether being a target slave station according to the first value and the second value by using the calculation manner;

[0017] if it is determined that the slave station is the target slave station, performing read-write data on itself according to the read-write data type.

[0018] In a third aspect, an embodiment of the present application provides an industrial network system, which 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 provided in the first aspect of the present application; and the industrial slave station is used to implement the industrial data processing method provided in the second aspect of the present application.

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

[0020] The application determines the calculation mode of whether the batch access read-write data type confirms that the slave station device is the target slave station according to the first value and the second value in the protocol data unit; after each slave station determines the calculation mode, the calculation mode of whether the slave station device is the target slave station in the target slave station segment to be batch accessed is calculated; and the target slave station is read and written. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the application, the drawings needed to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0022] Figure 1 An industrial network system structure block diagram obtained based on an Ethercat protocol networking provided by the application is shown;

[0023] Figure 2 An existing Ethercat frame format provided by the embodiment of the application is shown in a schematic diagram;

[0024] Figure 3 An improved Ethercat frame format of the embodiment of the application is shown in a schematic diagram;

[0025] Figure 4 A flowchart of an industrial data batch processing method of the embodiment of the application is shown;

[0026] Figure 5 A flowchart of an industrial data processing method of the embodiment of the application is shown;

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

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

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

[0030] Figure 9 A structure schematic diagram of an industrial data batch processing device of the embodiment of the application is shown;

[0031] Figure 10 Fig. 1 shows a schematic diagram of an industrial data processing device according to an embodiment of the present application.

[0032] Main element symbol explanation:

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

[0034] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to 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 the embodiments of the present application.

[0035] The components of the embodiments of the present application generally described and illustrated in the accompanying drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents 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 creative work are within the scope of protection of the present application.

[0036] Hereinafter, the terms "include", "have", and their conjugates used in the various embodiments of the present application are only intended to denote that specific features, numbers, steps, operations, elements, components, or combinations thereof are present, and should not be construed as excluding the presence or addition of one or more other features, numbers, steps, operations, elements, components, or combinations thereof. 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 and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the present application belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having a meaning that is the same as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the present application.

[0038] Some embodiments of the present application will be described in detail with reference to the drawings. The following embodiments and features of the embodiments can be combined with each other without conflict.

[0039] The existing Ethercat frame structure is shown in Figure 2 The Ethercat protocol defined frame structure includes an Ethernet frame header, a 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 payload includes a protocol data unit header and a plurality of protocol data units PDU. The protocol data unit PDU includes a command type field CMD, IDX, an address position field (Address Position, abbreviated ADP), an address offset field (Address Offset, abbreviated ADO), a length field LEN, a reserved field Reserved, C, NEXT, IRQ, a data field DATA, and a work counter WKC.

[0040] The Ethercat protocol has low data processing efficiency and lacks flexibility in industrial scenarios, which is specifically manifested as follows:

[0041] 1) The Ethercat addressing mode does not support addressing according to the physical address of a certain segment of the slave station;

[0042] 2) When the Ethercat batch reads information, a logical addressing read mode is generally used to collect all slave station information to the master station. In particular, after the slave station that does not care receives a logical read command, the information will also be put into the message, consuming too much time of the irrelevant slave station;

[0043] 3) After the Ethercat master station completes information collection, it needs to filter all slave stations, extract the information of the concerned slave station ID, and process it, which consumes a large amount of master station resources;

[0044] 4) When the Ethercat batch sets, either a node addressing write mode or a logical addressing write mode is used. The former encapsulates each slave station according to the length of the message, and the length of the message is relatively long, which is low in processing efficiency. The latter operates on all slave stations, which is also very low in efficiency.

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

[0046] The present application provides an industrial network system, which is exemplarily shown in Figure 1As shown, the industrial network system of the embodiment of the present application comprises an industrial master station and a plurality of industrial slave stations. The industrial master station is configured to implement the industrial data batch processing method of the embodiment of the present application; and the industrial slave stations are configured 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, generates a batch processing message by using the improved Ethercat protocol frame format, and sends the batch processing message to a target slave station to be batch accessed, so as to read and write data of the target slave station.

[0048] The improved Ethercat protocol frame format includes the following improvements: when performing batch operation on the slave station segment, only one protocol data unit (PDU) is included in the PDUs field. Then, the field value of the command type field CMD of the PDU is extended to represent the calculation mode of the target slave station and the read / write data type of the master station batch accessing the slave station. Finally, the first field and the second field are used to store the identification of the first target slave station and the identification of the last target slave station corresponding to the target slave station segment, respectively. The target slave station is a slave station to be read and written, and the batch processing message in the embodiment of the present application needs to be transmitted 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 identification in the identification of the first target slave station and the identification of the last target slave station is the number of slave stations between the master station and the current slave station in the communication link plus 1, and the obtained access serial number can also 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 serial number.

[0050] Exemplarily, in the first field determination mode, the ADP field is replaced by the START field for storing the start ID (the identification of the first target slave station) corresponding to the first target slave station in the target slave station segment, and the STOP field or the NUM field is added. The STOP field is used to store the end ID (the identification of the last target slave station) of the last target slave station in the target slave station segment; and the NUM field is used to store the total number of the target slave station segment to be batch accessed, as shown in Table 1. Figure 3 Exemplarily, in the second field determination mode, the ADP field can also be used to represent the start ID, and the Reserved field is used to store the proportion (access amount ratio) of the slave station to be batch accessed and the total number of slave stations, such as 1 / 2, 1 / 4, 1 / 8 and 1 / 16 of the number of all slave stations in the industrial network system. The description of each field in the improved Ethercat protocol frame format in the first field determination mode is shown in Table 1. Figure 3The structure part shown in the third row and the fourth row in the table 1; the description of each field in the improved Ethercat protocol frame format in the second field determination mode is shown in the table 2, as follows Figure 3 The structure shown in the fifth row in the table 1, and the specific extension of the CMD field is shown in the table 3.

[0051] Table 1: the meaning of each field in the batch processing message in the first field determination mode

[0052]

[0053] Table 2: the meaning of each field in the batch processing message in the second field determination mode

[0054]

[0055]

[0056] Table 3: the meaning of the extended CMD field

[0057]

[0058]

[0059] The industrial data batch processing method will be described below in combination with some specific embodiments.

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

[0061] S110, determining a target slave segment to be batch accessed according to a business requirement.

[0062] S120, determining a command type value of a command type field in a unique protocol data unit contained in a preset Ethernet frame to be generated according to a command type adopted by the batch access; the command type value is used to indicate a calculation manner of each target slave to determine a read-write data type of the batch access and to confirm whether the target slave is itself. After the command type value is confirmed, the command type value is filled into the command type field; the unique protocol data unit is located in a load part in the preset Ethernet frame format.

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

[0064] After determining the first value and the 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 according to the preset Ethernet frame format based on the updated unique protocol data unit and sending to each target slave station based on adjacency.

[0066] In an embodiment, 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 a slave station segment addressing read command is executed based on start-end ID; the first write data command value = 15, indicating that a slave station segment addressing write command is executed based on start-end ID; and the calculation manner is to calculate whether a slave station is a target slave station according to start-end ID. The second read data command value = 16, indicating that a slave station segment addressing read command is executed based on start ID and total access number; the second write data command value = 17, indicating that a slave station segment addressing write command is executed based on start ID and total access number; and the calculation manner is to calculate whether a slave station is a target slave station according to start ID and total access number. The third read data command value = 18, indicating that a slave station segment addressing read command is executed based on start ID and access number ratio; the third write data command value = 19, indicating that a slave station segment addressing write command is executed based on start ID and access number ratio; and the calculation manner is to calculate whether a slave station is a target slave station according to start ID and access number ratio.

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

[0069] S131, determining the first value as an identification of a first target slave station in the target slave station segment.

[0070] S132, if the command type value is the first read data command value or the first write data command value, determining the second value as an identification of a 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, determining the second value as a total access number of target slave station addresses in the target slave station segment; and the identification of the last target slave station is determined according to the identification of the first target slave station and the total access number.

[0072] S134, if the command type value is the third read data command value or the third write data command value, determining that the second value is an access amount ratio value; the access amount ratio value is a ratio of an address amount contained in the target slave segment to a total number of slaves; and the identification of the last target slave is determined according to the identification of the first target slave, the access amount ratio value and the total number of slaves.

[0073] It can be understood that the first value and the second value are used for each slave to determine whether a device address calculated by the calculation manner is within a range from the identification of the first target slave to the identification of the last target slave in the target slave segment, so as to confirm whether the slave is the target slave. Further, the first value and the second value are also used for each slave to determine whether to send the received batch processing message to an adjacent next slave.

[0074] Further, the method further comprises:

[0075] filling a preset initial access sequence number to a work counter field in the unique protocol data unit; the work counter field is used to store an access sequence number updated by each slave according to a preset step value and a current access sequence number in the work counter field after receiving the batch processing message; for example, the initial access sequence number is 0, and the preset step value is 1, so that the access sequence number in the work counter field is increased by 1 after each slave. In the embodiment of the application, the work counter field is a WKC field, and each PDU has a 16-bit work counter (WKC) at the end, which is increased by each slave after being addressed according to the following rule: WKC+1 after passing through one slave.

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

[0077] In an implementation manner, the method further comprises: determining a data value of a data field in the unique protocol data unit according to a corresponding read-write data type of the batch access and a preset required data, and filling the data value to the data field.

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

[0079] If the read-write data type is batch read data, the data field is empty; and the data field is used to store target data obtained by each target slave from a register at a target register address.

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

[0081] Further, 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 an address position field ADP in the unique protocol data unit; and the second address field is an added end address identification field in the unique protocol data unit, or the second address field is a reserved field Reserved in the unique protocol data unit.

[0083] Further, the method further comprises: determining a data length value of the batch access of each target slave according to a business requirement.

[0084] The data length value is filled into a data length field in the unique protocol data unit PDU; and the data length value is used to determine the size of the target data of the batch access when each target slave parses the data length field. Each field is specifically shown in Table 4.

[0085] Table 4: meaning of extended CMD field

[0086]

[0087]

[0088] Figure 5 A flowchart 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 for batch accessing each target slave station sent by an industrial master station. Specifically, a batch processing message generated based on the industrial data batch processing method according to an embodiment of the present application is received.

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

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

[0092] S240, obtaining 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, calculating whether the first station is the target slave station according to the first value and the second value.

[0094] S260, if the first station is determined as the target slave station, reading and writing data according to the read-write data type.

[0095] Further, the method further comprises: if the device address of the first station is less 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] Further, the method further comprises 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 comprises 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 calculation whether the first station is the target slave station according to the first value and the second value comprises:

[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, the first station is determined as the target slave station.

[0100] In the case that the command type value is the first read data command value or the first write data command value, the identifier of the first target slave station in the target slave station segment of the batch access is determined as the first value, and the identifier of the last target slave station in the target slave station segment is determined as the second value.

[0101] In the case that the command type value is the second read data command value or the second write data command value, the identifier of the first target slave station in the target slave station segment is determined as the first value, and the total access number of the target slave station address in the target slave station segment is determined as the second value; the identifier of the last target slave station is determined according to the identifier of the first target slave station and the total access number.

[0102] In a case where the command type value is the third read data command value or the third write data command value, the identification of the first target slave station in the target slave station segment is determined as a first value, and an access quantity ratio value is the second value, which is a ratio of a number of target slave stations contained in the target slave station segment to the total number of slave stations; and the identification of the last target slave station is determined according to the access quantity ratio value, the total number of slave stations and the identification of the first target slave station.

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

[0104] S261, if the reading and writing data type is batch writing data, reading a filled data value from a data field in the unique protocol data unit; and writing the data value into a target register corresponding to a target register address of itself;

[0105] S262, if the reading and writing data type is batch reading data, obtaining target data from a corresponding register according to a target register address; and writing the target data into the data field.

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

[0107] The application further comprises: applying for storage space for storing target data to the master station. In an implementation manner, the master station fills the Ethercat header field when issuing the batch processing message, but does not apply for storage space for collecting information until the last accessed target slave station, that is, the last target slave station sends application information for storage space to the master station. In an implementation manner, the master station applies for storage space for collecting information by itself when issuing the batch processing message.

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

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

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

[0111] S313, for each slave station, it is judged 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 pressed into the DATA field of the batch processing message; for example, the first 4 bytes of data in the DATA field is the target data pressed by the slave station No. 3, the second 4 bytes of data in the DATA field is the target data pressed by the slave station No. 4, the third 4 bytes of data in the DATA field is the target data pressed by the slave station No. 5, and so on.

[0113] S315, if the updated access sequence number is less than the identification of the last target slave station, the batch processing message with the target data pressed is forwarded to the next slave station.

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

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

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

[0117] S322, for each slave, after receiving the batch processing message, whether it is the target slave 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, it is judged 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 performs the read operation.

[0120] S325, if the updated access sequence number is less than the identification of the last target slave, the batch processing message after being pushed into the target data is re-forwarded to the next slave.

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

[0122] In another example, slave segment addressing write command is executed based on the starting ID and the total access number. For example, an industrial network system with a total of 100 slaves, after reading the slave ID = 20, the information of the target slave with a total number of 1 / 2 is collected, that is, the information of the slave ID from 20 to 60 is collected, and each slave reads 4 bytes of data. 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), LEN = 4, Reserved = 1 (the second value, indicating that from the starting ID, the batch processing is performed on 1 / 2 of the total number of slaves), the frame format corresponding to the batch processing message is as shown in Figure 8

[0123] S331, it is determined to read the information of the target slave with a total number of 1 / 2 from the slave ID = 20, that is, the information of the slave ID from 20 to 60 is collected, and the master station generates a batch processing message, wherein the batch processing message is set as CMD = 18, ADP = 20, LEN = 4, and Reserved = 1.

[0124] ​S332, for each slave station, judge whether the updated access sequence number is greater than or equal to the ADP field value, if greater than or equal to the ADP field value, counting (WKC field value plus 1) is needed to obtain the target slave station cumulative number, until the last slave station completely passes, this operation is used to count how many slave stations after the target slave station corresponding to the ADP field value need to process the read operation, and the target slave station cumulative number is recorded locally by the slave station; the target slave station fills the collected information into the batch processing message and then forwards it to the next slave station. According to WKC, it can be calculated that WKC is the number of slave stations passed when performing batch read operation (WKC plus 1 for one read-write success), so the slave station count can be obtained according to WKC.

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

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

[0127] The application has the following advantages:

[0128] 1) The improved Ethercat protocol uses the extension of the reserved CMD field to increase a new addressing mode;

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

[0130] 3) The improved Ethercat protocol supports batch operation on the slave station segment according to the address of the physical register, for example, the START and STOP fields newly added in the frame format thereof are used to realize batch addressing;

[0131] 4) The improved Ethercat protocol bounces back the message after the slave station device of the slave station segment performs the operation and leaves, instead of traversing the following slave stations;

[0132] 5) The improved Ethercat protocol segment adopts the last slave station node application space mode when collecting.

[0133] Figure 9 A structure schematic diagram of an industrial data batch processing device is shown. The industrial data batch processing device includes a target slave station 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 segment determination module 910, configured to determine target slave segments requiring batch access according to service requirements;

[0135] a command type field filling module 920, configured to determine a command type value of a command type field in a unique protocol data unit contained in a preset Ethernet frame to be generated according to a command type adopted by the batch access; the command type value is used to instruct each target slave to confirm a read-write data type of the batch access and a calculation manner of confirming whether the target slave is itself;

[0136] an address field filling module 930, configured to determine a first value and a second value respectively corresponding to first and second address fields in the unique protocol data unit according to the target slave segment and the command type value; the first and second values are used for each slave to calculate whether the target slave is itself by using the calculation manner;

[0137] a sending module 940, configured to generate a batch processing message in a preset Ethernet frame format based on the updated unique protocol data unit and send to each target slave based on an adjacent slave.

[0138] It can be understood that the apparatus of the embodiment corresponds to the industrial data batch processing method of the above-mentioned embodiment, and the optional items in the above-mentioned embodiment are also applicable to the embodiment, and therefore will not be described here again.

[0139] Figure 10 Fig. 1 shows a structural schematic diagram of an industrial data processing apparatus according to an embodiment of the present application. Exemplarily, the industrial data processing apparatus comprises a receiving module 1010, a command type value obtaining module 1020, a read-write type obtaining module 1030, an address value obtaining module 1040, a target slave determination module 1050 and a read-write module 1060.

[0140] The receiving module 1010 is configured to receive a batch processing message for batch accessing each target slave sent by an industrial master station; specifically, the receiving module 1010 is configured to receive a batch processing message generated based on an industrial data batch processing method provided by an embodiment of the present application and sent by an industrial master station.

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

[0142] The read-write type obtaining module 1030 is configured to determine a calculation manner of a target slave and a read-write data type of batch access according to the command type value;

[0143] The address value obtaining module 1040 is configured to obtain a first value and a second value from a first address field and a second address field in the protocol data unit respectively.

[0144] The target slave station determining module 1050 is configured to determine whether the device is a target slave station according to the first value, the second value and a device address of the device by using the calculation manner.

[0145] The read-write module 1060 is configured to perform read-write data on the device according to the read-write data type when it is determined that the device is the target slave station.

[0146] It can be understood that the device of the embodiment corresponds to the industrial data batch processing method of the above-mentioned embodiment, and the optional items in the above-mentioned embodiment are also applicable to the embodiment, and thus will not be described herein again.

[0147] The application further provides a terminal device. The terminal device includes a processor and a memory. The memory stores a computer program. The processor runs the computer program. If the terminal device is a master, the processor causes the terminal device to perform the functions of the modules in the industrial data batch processing method or the industrial data batch processing device. If the terminal device is a slave, the processor causes the terminal device to perform the functions of the modules in the industrial data processing method or the industrial data processing device.

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

[0149] The memory can 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), and the like. Among them, the memory is used to store a computer program, and the processor can execute the computer program correspondingly after receiving an execution instruction.

[0150] The application further provides a computer readable storage medium for storing the computer program used in the terminal device. For example, the computer readable storage medium can include, but is not limited to, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.

[0151] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other ways. The apparatus embodiments described above are only schematic, for example, the flow charts and block diagrams in the drawings show the possible implementation architectures, functions and operations of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flow chart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that, in alternative implementation ways, the functions noted in the block can also occur in different order from that noted in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the structural diagram and / or flow chart, and the combination of blocks in the structural diagram and / or flow chart, can be implemented by a dedicated hardware-based system for executing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0152] In addition, each functional module or unit in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can 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 solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0154] The above is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. An industrial data batch processing method, characterized by, The method is applied to an industrial master station, and comprises the following steps: According to the business requirement, a target slave station segment requiring batch access is determined; According to a command type adopted by 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 is determined; the command type value is used to indicate a read-write data type of each target slave station to confirm the batch access and a calculation manner of each target slave station to confirm whether the target slave station is itself; According to the target slave station segment and the command type value, a corresponding first value in a first address field and a corresponding second value in a second address field in the unique protocol data unit are determined; the first value and the second value are used for each slave station to calculate whether the slave station is a target slave station by using the calculation manner; A batch processing message is generated according to the updated unique protocol data unit in a preset Ethernet frame format and is sent to each target slave station based on an adjacent slave station; The command type value comprises 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 the received batch processing message is sent to an adjacent next slave station; The first value and the second value are also used for each slave station to determine whether the received batch processing message is sent to an adjacent next slave station; The first value is determined as an identifier of a first target slave station in the target slave station segment; If the command type value is the first read data command value or the first write data command value, the second value is determined as an identifier of a last target slave station in the target slave station segment; If the command type value is the second read data command value or the second write data command value, the second value is determined as a total access quantity of target slave station addresses 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, the second value is determined as an access quantity ratio value; the access quantity ratio value is a ratio of a quantity of target slave stations contained in the target slave station segment to a total quantity of slave stations; the identifier of the last target slave station is determined according to the identifier of the first target slave station, the access quantity ratio value and the total quantity of slave stations.

2. The industrial data batch processing method of claim 1, wherein, The method further comprises the following steps: A preset initial access serial number is filled into a work counter field in the unique protocol data unit; the work counter field is used to store an updated access serial number of each slave station according to a preset step value and a current access serial number in the work counter field after the slave station receives the batch processing message; The identifier of the first target slave station, the identifier of the last target slave station and the updated access serial number are used for each slave station to calculate whether the slave station is a target slave station.

3. The industrial data batch processing method according to claim 2, characterized by, If the read-write data type is batch write data, it is determined that the data to be written is the data value of the data field in the unique protocol data unit and is filled into the data field; the data value is used for each target slave to obtain and write into the corresponding register according to the target register address; If the read-write data type is batch read data, the data field is empty; the data field is used to store the target data obtained by each target slave from the register of the target register address.

4. The industrial data batch processing method according to claim 3, characterized by, The method further comprises: The same register address of each target slave in 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 to obtain the target register address.

5. The industrial data batch processing method of claim 1, wherein, 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 position field in the unique protocol data unit; The second address field is an added end address identification field in the unique protocol data unit, or the second address field is a reserved field in the unique protocol data unit.

6. The industrial data batch processing method according to any one of claims 1 to 5, characterized in that, The method further comprises: According to the business requirements, the data length value of the batch access of each target slave is determined; The data length value is filled into the data length field in the unique protocol data unit; the data length value is used to determine the size of the target data of the batch access when each target slave parses the data length field.

7. An industrial data processing method characterized by, Applied to an industrial slave, the method comprises: Receiving the batch processing message generated based on the method in any one of claims 1 to 6 and sent by an industrial master station; Obtaining the command type value from the command type field in the unique protocol data unit; According to the command type value, determining the calculation method of the target slave and the read-write data type of the batch access; Obtaining the first value and the second value from the first address field and the second address field in the protocol data unit, respectively; Using the calculation method, calculating whether the target slave is itself according to the first value and the second value; If it is determined that the target slave is itself, performing read-write data on itself according to the read-write data type.

8. The industrial data processing method of claim 7, wherein, The command type value comprises 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 comprises: if the device address of itself is less than the identification of the last target slave, sending the batch processing message after read-write processing to the next adjacent slave, and updating the work counter field according to a preset step value and the current access sequence number in the work counter field; the work counter field is located in the unique protocol data unit; The calculation whether the target slave is itself according to the first value and the second value using the calculation method comprises: If the access sequence number in the updated work counter field is within the range from the identification of the first target slave to the identification of the last target slave, it is determined that the target slave is itself. In a case where the command type value is the first read data command value or the first write data command value, the first target slave station in a target slave station segment is determined to have the first value as its identifier, and the last target slave station in the target slave station segment is determined to have the second value as its identifier; In a case where the command type value is the second read data command value or the second write data command value, the first target slave station in the target slave station segment is determined to have the first value as its identifier, and the last target slave station in the target slave station segment is determined to have the second value as its identifier, wherein the second value is a total number of target slave stations in the target slave station segment; and the identifier of the last target slave station is determined according to the identifier of the first target slave station and the total number of target slave stations; In a case where the command type value is the third read data command value or the third write data command value, the first target slave station in the target slave station segment is determined to have the first value as its identifier, and an access quantity ratio value is determined to have the second value, wherein the access quantity ratio value is a ratio of a number of target slave stations in the target slave station segment to a total number of target slave stations; and the identifier of the last target slave station is determined according to the access quantity ratio value, the total number of target slave stations, and the identifier of the first target slave station.

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

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