Input / output service systems and overhead crane systems in industrial control
By introducing the application docking layer, data processing layer and EtherCAT docking layer of full duplex channels in the industrial control system, the key value is determined using hash table and MD5 values, and the portability and debugging efficiency of the input/output service system are optimized, and fast and accurate data transmission and functional identification are achieved.
Patent Information
- Application Number
- CN202411024073.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2044-07-29
AI Technical Summary
The existing input/output service system in industrial control lacks configuration files, resulting in poor portability, difficulty in maintaining, and the input/output port function is not obvious, increasing the cost of joint debugging.
The application docking layer, data processing layer and EtherCAT docking layer using full duplex channels, the configuration file is a JSON file, the data processing layer uses a hash table to store data, and determines the key value through the MD5 value. The EtherCAT docking layer uses message queue communication to detect state changes and optimize data transmission.
It improves the portability and debugging convenience of the system, reduces the time-consuming data transmission, simplifies input/output port function recognition, and improves data transmission efficiency.
Smart Images

Figure CN118981174B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial control, in particular to an input / output service system and an overhead crane system in industrial control. Background Art
[0002] In the field of industrial control, especially in OHT (Overhead Hoist Transport) systems, an input / output service system is required to connect various components upstream and EtherCAT modules downstream to ensure the stability and timeliness of industrial control. Therefore, a fast, efficient, and stable input / output service system is indispensable.
[0003] Typically, industrial control input / output service systems don't use configuration files, which significantly reduces portability and makes maintenance difficult. Subsequent changes to component locations require code modifications, making adjustments more difficult.
[0004] At the same time, there is no clear and eye-catching description of the functions of the input / output ports, which makes it impossible to intuitively understand the functions of the controlled input / output ports when each device is used, greatly increasing the cost of joint debugging. Summary of the Invention
[0005] The purpose of the present invention is to solve the above problems existing in the prior art and to provide an input / output service system and an overhead crane system for industrial control.
[0006] The purpose of the present invention is achieved through the following technical solutions:
[0007] The input / output service system in industrial control includes an application docking layer, a data processing layer, and an EtherCAT docking layer that are sequentially arranged to form a full-duplex channel;
[0008] The application docking layer is used to provide an interface for the visualization application program;
[0009] The data processing layer uses a hash table to store data. The key value of the hash table is determined according to the MD5 value corresponding to the interface function name of each input / output port. The interface function name is defined in a configuration file. The configuration file includes all data that needs to be modified when the visualization application is used for debugging.
[0010] The EtherCAT docking layer is used to dock the EtherCAT module.
[0011] Preferably, in the input / output service system in the industrial control, the configuration file is stored as a JSON file.
[0012] Preferably, in the input / output service system in the industrial control, when determining the key value corresponding to an interface function name, the non-repeated key value corresponding to the MD5 value is determined as the key value corresponding to the interface function name according to the MD5 value local byte extraction algorithm, and after determining the non-repeated key value corresponding to the MD5 value, the non-repeated key value and the data of the corresponding input / output port are saved in a hash table.
[0013] Preferably, in the input / output service system in the industrial control, the MD5 value local byte extraction algorithm selects four bytes whose byte sequence numbers are integer multiples of 4 from the MD5 value to form a 32-bit string as the key value to be verified during the first calculation;
[0014] During the second to nth calculations, four bytes are randomly selected from the MD5 value to form a 32-bit string as the key value to be verified;
[0015] When the key value to be verified calculated for the nth time still has duplicate values in the hash table, the decimal value corresponding to the 32-bit string determined by the nth calculation is converted to -1 to obtain a new 32-bit string as the key value to be verified.
[0016] Preferably, in the input / output service system in the industrial control, the data processing layer uses a state machine to control the data transmission process.
[0017] Preferably, in the input / output service system in the industrial control, the EtherCAT docking layer communicates with the EtherCAT module through a message queue.
[0018] Preferably, in the input / output service system in the industrial control, the EtherCAT docking layer has an interface for detecting whether the current state and the next state are the same. The interface compares the current state and the next state using the memcmp function, and when it is determined that the current state and the next state are different, determines the position of the input / output port whose state has changed.
[0019] Preferably, in the input / output service system in the industrial control, when determining that the current state is different from the next state, an exclusive OR process is used, and the position of the input / output port whose state has changed is determined based on the result of the exclusive OR process.
[0020] Preferably, in the input / output service system in the industrial control, the EtherCAT docking layer obtains the data of the input / output port whose state has changed from the data packet sent to it by the EtherCAT module by shifting according to the position of the input / output port whose state has changed, and the data packet contains the data of all input / output ports of the input / output control board where the input / output port whose state has changed is located.
[0021] An overhead crane system includes any one of the above-mentioned input / output service systems for industrial control.
[0022] The advantages of the technical solution of the present invention are mainly reflected in:
[0023] The input / output system of the present invention can effectively improve portability by setting configuration files, facilitate operations such as debugging and device adjustment, and greatly reduce the time spent on setting the status of the input / output port and the time spent on obtaining the status. At the same time, by adding an interface function name for each input / output port and using a hash table to store data based on the interface function name, data can be transmitted quickly and accurately. The outside world can simply and clearly know the function of the input / output port through the interface function name of each input / output port, and it is unique internally, making it easy to obtain data in a short time.
[0024] The present invention adopts a special key value determination method based on the MD5 algorithm, which improves the computing efficiency and avoids excessive consumption while ensuring the unbreakability of the program.
[0025] The time complexity of the method adopted by the EtherCAT docking layer of the present invention when receiving data from the EtherCAT module is O(1), which is O(n) compared to the time complexity of the traditional polling traversal. 2 )), this method greatly improves the processing speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a schematic diagram of an input / output service system of the present invention;
[0027] Figure 2 It is a code schematic diagram of the configuration file of the present invention;
[0028] Figure 3 Schematic diagram of the overhead traveling vehicle system of the present invention. DETAILED DESCRIPTION
[0029] The objects, advantages, and features of the present invention are illustrated and explained through the following non-limiting description of preferred embodiments. These embodiments are merely typical examples of the application of the technical solutions of the present invention, and any technical solutions formed by equivalent substitution or equivalent transformation fall within the scope of protection claimed by the present invention.
[0030] In the description of the scheme, it should be noted that the terms "center," "upper," "lower," "left," "right," "front," "back," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely for ease of description and simplification. They do not indicate or imply that the devices or components referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0031] Example 1
[0032] The following describes the input / output service system in industrial control disclosed by the present invention in conjunction with the accompanying drawings. It is responsible for receiving instructions from the visualization application, converting them into data recognizable by the EtherCAT module and transmitting them to the EtherCAT module. It is also responsible for receiving data sent to it by the EtherCAT module and forwarding the data to the visualization application.
[0033] As attached Figure 1 As shown, the input / output service system in the industrial control includes an application docking layer, a data processing layer and an EtherCAT docking layer arranged in sequence from top to bottom. The application docking layer interacts with the data processing layer, and the data processing layer interacts with the EtherCAT docking layer. The three form a full-duplex channel from top to bottom and from bottom to top, thereby providing stable, efficient and convenient input / output service support in the overhead crane system.
[0034] The application docking layer provides an interface for visualization applications. It implements functions such as registering input / output port callback functions, querying input / output port status, and setting synchronous / asynchronous input / output port status. The specific design depends on actual needs and is not limited here. When a device status changes, the data processing layer calls the registered input / output port callback function to notify the visualization application that registered the callback function.
[0035] The data processing layer is the core of the present invention and has at least the following functions: parsing JSON files, providing data storage for the entire system to enable high-speed querying by visualization applications, managing all input / output port data, and providing the required data space for the EtherCAT docking layer.
[0036] The data processing layer uses JSON files as configuration files, defining all the data that needs to be modified during debugging of the visualization application. This greatly improves both code portability and debugging convenience.
[0037] The configuration file is divided into three layers based on the structure of the entire industrial control system, input / output port control board, and input / output port. The specific content of the configuration file can be set as needed. Figure 2 As shown, the industrial control system has two I / O control boards, each of which uses two I / O ports, and each I / O port has the same structure. The configuration file is as follows: First, the outermost layer defines how many I / O control boards exist in the system. Then, the next outermost layer defines the I / O control board index and the number of I / O ports to use. Finally, the innermost layer defines each I / O port's interface function name, its pin number on the I / O control board (hardware attributes), and whether it is an input or output port on the I / O control board (hardware attributes).
[0038] All data in the configuration file is provided to the data processing layer. For example, if there are several input / output control boards, several spaces are allocated in the data processing layer to store the data of each input / output control board. If there are several input / output ports in the input / output control board, several spaces are allocated in the data processing layer to store the data of each input / output port. The index value of the input / output control board is the index of its corresponding data in the memory, which can be used to quickly obtain data from the memory through the index. For example, the first pointer of a space is point, and the index value of an input / output control board is 2. Then, point[2] can be used directly to obtain the data corresponding to this input / output control board.
[0039] The pin value of the input / output port is used to organize the data packet to the EtherCAT docking layer. For example, if the pin value of an input / output port is 10, then when setting the status to organize the data packet, you only need to change the 10th bit to the required value by shifting.
[0040] The input / output port type is used to avoid errors. For example, a visualization application may input an output port, which is not executed on the hardware. Therefore, it is intercepted directly at the software level to improve system resource utilization and avoid invalid operations.
[0041] The data processing layer uses a hash table to store data and uses the MD5 algorithm to determine the key value of the hash table. Each key value can be calculated based on the interface function name of each input / output port. Therefore, the data of each input / output port can be obtained by using the interface function name of the input / output port defined in the JSON file. The interface function name is user-defined and serves as a unique identifier for each input / output port. This is efficient, fast, and clear. The visualization application calls each input / output port by the interface function name.
[0042] Specifically, the key value is determined based on the MD5 value corresponding to the interface function name of each input / output port. The MD5 value is a unique 16-byte hash value generated by processing each interface function name through the MD5 algorithm. The technology for generating MD5 values through the MD5 algorithm is a known technology and will not be described here.
[0043] When determining the key value corresponding to an interface function name, it is necessary to ensure that there is no duplicate key value in the hash table. Therefore, the present invention determines the non-duplicate key value corresponding to each MD5 value based on the MD5 value local byte extraction algorithm as the key value corresponding to each interface function name, and after determining the non-duplicate key value corresponding to the MD5 value, the non-duplicate key value and the data of the corresponding input / output port are saved in the hash table.
[0044] During the first calculation, the MD5 value local byte extraction algorithm selects four bytes whose byte numbers are integer multiples of 4 (i.e., the 4th byte, the 8th byte, the 12th byte, and the 16th byte) from the MD5 value to form a 32-bit string as the key value to be verified; determines whether the key value to be verified has duplicate values in the hash table; if so, performs the next calculation; if not, determines that the key value to be verified is the non-duplicate key value corresponding to the MD5 value.
[0045] During the second to nth calculations, four bytes are randomly selected from the MD5 value to form a 32-bit string as the key value to be verified; the next calculation is performed each time the key value to be verified has a repeated value in the hash table; the n is, for example, an integer between 2 and 4.
[0046] In order to avoid the repeated calculations and consumption that may occur due to random selection, it is better to randomly select four bytes from the MD5 value to form a 32-bit string as the key value to be verified. It is better to select one of several determined string combinations as the key value to be verified. When there is a repeated value in each verification, one of the remaining unverified string combinations is selected for the next verification. Specifically, the sequence number tolerance of the four strings in each string combination is 4, that is, there are three determined string combinations. The first combination is a string composed of the 1st, 5th, 9th, and 13th bytes, the second combination is a string composed of the 2nd, 6th, 10th, and 14th bytes, and the third combination is a string composed of the 3rd, 7th, 11th, and 15th bytes. For example, during the second calculation, the first combination is randomly selected, and when there is a repeated value in the verification, then during the next verification, a random selection is made from the second and third combinations.
[0047] If the key value to be verified after the nth calculation still has duplicate values in the hash table, that is, when duplicate values are found after verification of the above three string combinations, the decimal value corresponding to the 32-bit string determined by the nth calculation (i.e., the fourth calculation) is converted to a new 32-bit string and used as the key value to be verified. Due to the probability of MD5 value generation data, each time the key value to be verified fails verification, the probability of passing verification next time increases. Therefore, at this time, the key value corresponding to the MD5 value without duplicates can be effectively obtained.
[0048] This approach can improve the program's unbreakability while increasing processing speed.
[0049] The data processing layer manages all input / output data, including all data sent to the EtherCAT interface layer and all data requiring modification to the data processing layer. This streamlines the code architecture, ensuring program stability and robustness, and streamlining subsequent troubleshooting and maintenance. The specific state machine technology is well-known and will not be detailed here.
[0050] All data that need to be modified in the data processing layer include data that need to be modified by the data processing layer when the visualization application sends instructions, and data that need to be modified by the data processing layer when the device reports data.
[0051] For example, combining Figure 2 According to the configuration file, when the visualization application issues a door-opening command, the OPEN_DOOR input / output is set to 1, which modifies the data in the data processing layer. If the door is already open, the sensor detecting whether it is open will report 1. At this time, the data is transmitted from the EtherCAT module to the EtherCAT interface layer and then to the data processing layer, which also modifies the data in the data processing layer. A state machine is used for unified management here.
[0052] The data processing layer provides the required data space for the EtherCAT docking layer. All data are maintained in the data processing layer. Other layers do not perform any form of memory processing, and the layering is clear.
[0053] The EtherCAT docking layer is used to dock the EtherCAT module, which realizes functions such as data package sending, identification of whether there is a change in the current state of data, and data packet analysis.
[0054] The EtherCAT docking layer and the EtherCAT module define data packets according to a custom data protocol and then communicate using message queues.
[0055] The custom data protocol has two data paths, one is sent from the EtherCAT docking layer to the EtherCAT module, and the other is sent from the EtherCAT module to the EtherCAT docking layer.
[0056] First, let's introduce the data sent from the EtherCAT docking layer to the EtherCAT module.
[0057] The data processing layer provides a space where the EtherCAT interface layer organizes the data corresponding to the input / output ports to be sent to the EtherCAT module into a data packet and stores it in this space. Therefore, the EtherCAT module can directly access the data in this space.
[0058] For example, if a visualization application wants to turn on the lights and open the door simultaneously, it needs to set both OPEN_DOOR and OPEN_LAMP to 1. At this point, a data packet is assembled, including the number of pins to be set, the pin number of the input / output control board on which each pin is located, and whether the state to be set is 0 or 1. In other words, {set the number of input / output ports, {board number, pin number, state}, {board number, pin number, state}}}, which is digitized as {2, {0, 0, 1}, {1, 0, 1}}. This allows the subsequent EtherCAT module to directly access the data packet from this space, accurately and quickly obtain the data based on the contents of the packet, and send it to the device, completing the configuration.
[0059] Next, we will introduce the information sent from the EtherCAT module to the EtherCAT docking layer:
[0060] The EtherCAT docking layer provides an interface for detecting whether the current state and the next state are the same. The current state and the next state are two sets of data stored by the EtherCAT module, one for the previous data and the other for the current data. The two sets of data respectively store the status of all input / output ports. Each bit in the data represents the status of an input / output port. If there are two input / output control boards, two uint32_t data are stored.
[0061] The interface for detecting whether the current state and the next state are identical compares the current state and the next state using the memcmp function. If the current state and the next state are determined to be different, the location of the input / output port whose state has changed is determined and marked. Specifically, if the current state and the next state are determined to be different, the two copies of the current state and the next state data are XORed, and the location of the input / output port whose state has changed is determined based on the XOR result. If the state of one input / output port on a particular input / output control board changes, the data of all input / output ports of that input / output control board must be transmitted.
[0062] The EtherCAT module calls the interface for detecting whether the current state and the next state are the same, and then compiles the index of the input / output control board where the input / output port with the changed state is located, the data of all the input / output ports on the input / output control board, and the location information of the input / output port according to the state change into a data packet and sends it to the EtherCAT docking layer. In this way, the EtherCAT docking layer can directly retrieve the data of the corresponding input / output port from the data packet based on the location information of the input / output port with the changed state. Compared with the traditional polling traversal (time complexity of O(n 2 )), the time complexity of this method is O(1), and the speed is improved very quickly.
[0063] For example: there are two data in the current state and the next state. The data A corresponding to the current state is 10101010, and the data B corresponding to the next state is 10010010. After comparing them through the memcmp function, it is determined that A and B are different. A and B are XORed, and the result of A XOR B is 00111000.
[0064] It can be found that in the result obtained by the XOR processing, the bit where "1" is located is the different bit number of the two data, that is, the position of the input / output port where the state changes.
[0065] After receiving a data packet, the EtherCAT interface layer directly determines the number of input / output ports whose status has changed based on the bit position of 1 in the XOR result 00111000, and then uses a bit shifting method to obtain the data of the input / output port with this bit from the data packet, thus saving a lot of traversal time.
[0066] After the EtherCAT interface layer obtains and parses the data, it passes the parsed data to the state machine of the data processing layer for state switching. The state machine then updates the corresponding input / output data in the hash table based on the data and calls the callback function pre-bound by the visualization application. If it is not bound, the callback function is not called and only the data is updated.
[0067] The input / output service system was tested and the following results were obtained:
[0068]
[0069] From the above, it can be seen that the system greatly reduces the time consumption of setting the input / output port status and the time consumption of obtaining the status, and has extremely fast data transmission efficiency.
[0070] Example 2
[0071] This embodiment discloses a crane system, as shown in the attached Figure 3 Shown, including:
[0072] Input / output service system in industrial control as described above;
[0073] A visualization application program that communicates with the application docking layer of the input / output service system, which may be an APP program installed on a mobile phone or tablet computer or industrial control software on an industrial control computer, etc., which is not limited here;
[0074] An EtherCAT module is connected and communicates with the EtherCAT docking layer of the input / output service system;
[0075] An input / output control board, connected and communicating with the EtherCAT module;
[0076] Devices are connected and communicated with the input / output control board. The devices are, for example, various sensors or actuators, such as motors, cylinders, etc., which are not limited here.
[0077] If a user wants to control a device through a visualization application, he or she first needs to use the visualization application to select a device. The visualization application then sends instructions to the input / output service system, which parses and converts the instructions into data recognizable by the EtherCAT module. The EtherCAT module then organizes the instructions into network data packets that comply with the EtherCAT protocol and transmits them to the docking input / output port of the input / output control board. Finally, the corresponding input / output port of the input / output control board outputs corresponding high and low levels, causing the device to perform the corresponding action.
[0078] There are many implementation methods of the present invention, and all technical solutions formed by equivalent transformation or equivalent transformation fall within the protection scope of the present invention.
Claims
1. Input / output service system in industrial control, characterized by: It includes an application docking layer, a data processing layer, and an EtherCAT docking layer that are sequentially arranged to form a full-duplex channel; The application docking layer is used to provide an interface for the visualization application program; The data processing layer uses a hash table to store data. The key value of the hash table is determined according to the MD5 value corresponding to the interface function name of each input / output port. The interface function name is defined in the configuration file. The configuration file includes all the data that need to be modified when the visualization application is used for debugging. The configuration file is divided into three layers based on the structure of the entire industrial control system, the input / output port control board, and the input / output port. The outermost layer defines how many input / output port control boards there are in this system. The second outermost layer defines the index value of each input / output port control board and how many input / output ports need to be used. The innermost layer defines the number of input ports for each input / output port control board. The interface function name of the input / output port, the pin number on the input / output port control board, and whether it is an input port or an output port on the input / output port control board; all data in the configuration file is provided to the data processing layer. If there are several input / output port control boards, then the number of spaces allocated in the data processing layer is used to store the data of each input / output port control board; if there are several input / output ports on the input / output port control board, then the number of spaces allocated in the data processing layer is used to store the data of each input / output port; the index value of the input / output port control board is the index of its corresponding data in the memory, and the data can be obtained from the memory through the index; The EtherCAT docking layer is used to dock the EtherCAT module.
2. The input / output service system in industrial control according to claim 1, characterized in that: The configuration file is stored as a JSON file.
3. The input / output service system for industrial control according to claim 1, characterized in that: When determining the key value corresponding to an interface function name, the non-repeated key value corresponding to the MD5 value is determined as the key value corresponding to the interface function name according to the MD5 value local byte extraction algorithm, and after determining the non-repeated key value corresponding to the MD5 value, the non-repeated key value and the data of the corresponding input / output port are saved in the hash table.
4. The input / output service system in industrial control according to claim 3, characterized in that: When the MD5 value local byte extraction algorithm is calculated for the first time, four bytes whose byte sequence numbers are integer multiples of 4 are selected from the MD5 value to form a 32-bit string as the key value to be verified; During the second to nth calculations, four bytes are randomly selected from the MD5 value to form a 32-bit string as the key value to be verified; When the key value to be verified calculated for the nth time still has duplicate values in the hash table, the decimal value corresponding to the 32-bit string determined by the nth calculation is converted to -1 to obtain a new 32-bit string as the key value to be verified.
5. The input / output service system in industrial control according to claim 1, characterized in that: The data processing layer uses a state machine to control the data transmission process.
6. The input / output service system in industrial control according to claim 1, characterized in that: The EtherCAT docking layer communicates with the EtherCAT module via a message queue.
7. The input / output service system in industrial control according to claim 1, characterized in that: The EtherCAT docking layer has an interface for detecting whether the current state and the next state are the same. The interface compares the current state and the next state using a memcmp function, and when it is determined that the current state and the next state are different, determines the position of the input / output port where the state is changed.
8. The input / output service system in industrial control according to claim 7, characterized in that: When it is determined that the current state is different from the next state, an exclusive OR process is used, and the position of the input / output port whose state is changed is determined based on the result of the exclusive OR process.
9. The input / output service system in industrial control according to claim 7, characterized in that: The EtherCAT docking layer obtains data of the input / output port whose state has changed from a data packet sent to it by the EtherCAT module by shifting according to the position of the input / output port whose state has changed, and the data packet contains data of all input / output ports of the input / output control board where the input / output port whose state has changed is located.
10. Overhead crane system, characterized by: The invention comprises an input / output service system for industrial control as described in any one of claims 1-9.
Citation Information
Patent Citations
Open type configuration method and system for IO parameters of field device
CN101634833A
Method for supporting customization of panel operation of instrument
CN105511303A