Multi-level expansion method, device, computer equipment and storage medium of IO-Link slave
By building chain encapsulation paths and automatic reconstruction mechanisms in IO-Link slave stations, the problem of low communication efficiency in the prior art is solved, and efficient multi-level data transmission and self-healing capabilities are achieved.
Patent Information
- Application Number
- CN202510955058.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-07-11
AI Technical Summary
The existing IO-Link slave expansion mechanism is difficult to build continuous encapsulation paths, resulting in process data upload in segments and low communication efficiency.
By constructing a chain encapsulated path in the first-level slave station of IO-Link, including the byte offset mapping relationship between the process data area between the slave station and the subordinate slave station, unified management and transparent forwarding of process data are realized, and the zero-copy cache mechanism is adopted to splice and upload data step by step, and the data path is automatically rebuilt when the subordinate module is detected to be disconnected.
It improves communication efficiency under multi-level topology structure, reduces the control task load of the master station, enhances protocol processing efficiency and network real-timeness, and improves the system's self-healing ability and stability.
Smart Images

Figure CN120475035B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of industrial communications, and in particular to a multi-stage expansion method, apparatus, computer equipment, and storage medium for an IO-Link slave. Background Art
[0002] Currently, IO-Link, a point-to-point industrial field communication protocol, is widely used in automation systems for data exchange and management between a master station and various sensors, actuators, and other devices. In typical applications, each IO-Link master station connects to multiple slave stations via independent ports, enabling status acquisition and issuing control commands. It is a key communication method for digital access to industrial field equipment.
[0003] Existing IO-Link slave expansion mechanisms typically only support one or two levels of expansion. Data exchange between slaves at each level typically involves separate parsing and uploading. The master must establish periodic communication with each slave, and each slave independently processes its process data and exchanges it directly with the master. While this design is simple to implement, it prevents the establishment of a continuous encapsulation path between slaves, resulting in fragmented uploads of process data that require additional merging by the master, leading to low communication efficiency.
[0004] The above-mentioned existing technical solutions have the following defects: the existing slave station expansion mechanism is difficult to build a continuous encapsulation path, resulting in segmented uploading of process data and low communication efficiency, so there is room for improvement. Summary of the Invention
[0005] In order to improve the communication efficiency between sites, the present application provides a multi-level expansion method, device, computer equipment and storage medium for IO-Link slave stations.
[0006] The above-mentioned invention objective of this application is achieved through the following technical solutions:
[0007] A multi-stage expansion method for an IO-Link slave station, the method comprising:
[0008] Constructing a chained encapsulation path for process data transmission in an IO-Link first-level slave, the path including a mapping relationship between byte offsets of process data areas of the slave and lower-level slaves;
[0009] The first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station;
[0010] The last-level slave station collects input process data and uploads it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of this level to the input process data and uploads it to the first-level slave station step by step.
[0011] When the first-level slave station completes the aggregation of input data, it uploads the complete data frame to the master station, and the transmission of the input process data and the output process data are completed within one communication cycle;
[0012] When any slave detects that the lower-level module is offline, it initiates a rescan based on the pre-stored structure mapping information, and after identifying the corresponding module, it rebuilds the data encapsulation path and resumes the forwarding process.
[0013] By adopting the above technical solution, by constructing a chain encapsulation path including the byte offset mapping relationship of the process data area of the main body and the lower-level slave station in the first-level IO-Link slave station, the position relationship of the multi-level slave stations in the same data frame can be uniformly managed, and the centralized encapsulation of process data under the multi-level topology structure can be realized, thereby reducing the communication overhead caused by the master station's independent access to multiple devices and improving the overall throughput efficiency of the link; by transparently forwarding the data segments that do not belong to the main body to the lower-level slave station through the first-level slave station, the tedious process of the master station distributing output data to the substations one by one can be avoided, thereby significantly reducing the master station's control task load and enhancing the protocol processing efficiency; By collecting input process data through the last-level slave station and uploading it to the first-level slave station step by step, a structured input data link can be formed to ensure the integrity of the uplink data, thereby reducing the complexity of the master station's merging and synchronization operations for reported data; by completing the entire process of input aggregation and output transparent transmission within one communication cycle through the first-level slave station, the data exchange cycle can be shortened, thereby improving the real-time and synchronous response capabilities of the IO-Link network; by any slave station automatically rebuilding the data path when detecting that the lower-level module is offline, the system's self-healing ability in the event of node failure or structural change can be improved, thereby enhancing the stability and maintainability of the chain network operation.
[0014] In one example, the present application may be further configured as follows: constructing a chain encapsulation path for process data transmission in the first-level IO-Link slave, wherein the path includes a mapping relationship between byte offsets of process data areas of the slave and lower-level slaves, specifically including:
[0015] After the first-level slave is powered on, it actively sends a structure detection command to the connected next-level slave, and obtains the device identification and process data length of each slave through the IO-Link service channel, thereby generating a logical topology structure;
[0016] Based on the relative connection order of each subordinate slave station in the logical topology structure, the corresponding byte segment offset address is allocated to the slave station in sequence according to the connection order through the linear address allocation strategy, and the offset mapping relationship is established between the device identifier and the offset address.
[0017] By adopting the above technical solution, the first-level slave station actively obtains the device identification and process data length of the lower-level slave station to generate a logical topology structure after power-on, which can realize automatic perception of the slave station structure and accurate extraction of data area configuration information, thereby avoiding the error-proneness of manual configuration and improving deployment efficiency; by allocating byte segment offset addresses to each slave station based on the connection order and establishing a mapping relationship between device identification and address, a clear data structure index chain can be formed, thereby improving the efficiency of data frame parsing and supporting the efficient execution of subsequent transparent transmission and splicing operations.
[0018] In one example, the present application may be further configured as follows: the first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station, specifically including:
[0019] After receiving the output process data sent by the master station based on the IO-Link periodic channel, the first-level slave station extracts the body data segment according to the offset mapping relationship and writes it into the local process data buffer;
[0020] Fast offset positioning is performed on the remaining unoccupied byte segments, a relay transparent transmission frame is generated, and the corresponding byte segments are transparently forwarded to the target lower-level slave station. The transparent transmission forwarding process adopts a zero-copy buffer mechanism.
[0021] By adopting the above technical solution, the first-level slave station extracts the main data segment and writes it into the local buffer, while the remaining segments are generated into relay transparent frames and forwarded to the lower-level slave stations. This can ensure that the output data sent by the master station is accurately distributed to the multi-level slave station target devices, thereby building an efficient data downlink path and reducing the master station task processing volume; by adopting a zero-copy cache mechanism for relay frame construction, the repeated movement of data at the intermediate level can be reduced, thereby improving forwarding efficiency and reducing latency.
[0022] In one example, the present application may be further configured as follows: before performing fast offset positioning on the remaining unoccupied byte segments, generating a relay transparent transmission frame, and transparently forwarding the corresponding byte segments to the target lower-level slave station, the method further includes:
[0023] Performing CRC residual value judgment on each field in the output process data;
[0024] If the lower-level slave station corresponding to the target field is currently in an offline state, forwarding is skipped and the error state is recorded in the offset mapping relationship for use in the self-healing detection of the next cycle.
[0025] By adopting the above technical solution, by performing CRC residual value judgment on each field in the output process data, potential data errors can be identified in advance before frame forwarding, thereby reducing the risk of erroneous data propagation in the chain structure; by skipping forwarding the lower-level slave station fields that are in an offline state and recording the error status in the mapping relationship, it can provide a status basis for the link self-healing process in the next cycle, thereby improving the stability and fault tolerance of the link.
[0026] In one example, the present application may be further configured as follows: the last-level slave station collects input process data and uploads it to the upper-level slave station; each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of the current level to the input process data, specifically including:
[0027] The last-level slave station collects the real-time status value of the main body, and encapsulates the real-time status value to generate the input process data;
[0028] After receiving the input process data, the upper-level slave station writes the input data of the main body into the corresponding paragraph in the input process data through the DMA channel according to the offset mapping relationship, and continues to forward the updated input process data until it is sent to the first-level slave station.
[0029] By adopting the above technical solution, the last-level slave station collects the main body input data and encapsulates it to generate input process data, which can ensure that each slave station can participate in the chain input upload process in a unified format, thereby simplifying the data structure definition and improving the link consistency; the upper-level slave station splices the main body input data through the DMA channel according to the mapping relationship and forwards it, which can reduce the CPU intervention in the frame merging process, thereby improving the splicing speed and enhancing the real-time response capability of the input data upload chain.
[0030] In one example, the present application may be further configured as follows: upon completing the aggregation of input data, the first-level slave station uploads a complete data frame to the master station, and the transmission of the input process data and the output process data are completed within one communication cycle, specifically including:
[0031] The master station configures the periodic scheduling parameters and sends them to the first-level slave stations through the IO-Link configuration service. Each slave station calculates the maximum available time slice of its level based on its own level and the required operation time.
[0032] Each of the slave stations performs output data parsing, input data splicing and forwarding operations based on the maximum available time slice at the same level;
[0033] In the event of congestion during a communication cycle, the local arbitration mechanism is triggered, the incomplete data exchange flag in the current cycle is recorded, and priority is given to scheduling processing in the next cycle.
[0034] By adopting the above technical solution, the master station issues periodic scheduling parameters and each slave station calculates the maximum available time slice, which can form an autonomous time scheduling mechanism within the link, thereby ensuring that the tasks of each level of slave stations within the communication cycle can be executed in an orderly manner. By each slave station completing the input splicing and output forwarding tasks within its own time slice, it can ensure the coordination of link-level operations, thereby improving the data exchange efficiency of the entire IO-Link link. By recording the unfinished status and prioritizing scheduling processing when congestion occurs in the communication cycle, it can prevent data from being permanently discarded in the transmission chain, thereby enhancing the system's fault tolerance and recovery capabilities to temporary communication anomalies.
[0035] The second object of the present invention is achieved through the following technical solutions:
[0036] A multi-stage expansion device for an IO-Link slave station, the device comprising:
[0037] An encapsulation path construction module, configured to construct a chained encapsulation path for process data transmission in an IO-Link first-level slave, the path including a mapping relationship between byte offsets of process data areas of the slave and lower-level slaves;
[0038] Output data transparent transmission module, used for the first-level slave station to receive the output process data sent by the master station, and transparently forward the data segments in the output process data that do not belong to the main body to the lower-level slave station;
[0039] The input data splicing module is used for the last-level slave station to collect input process data and upload it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of this level to the input process data and uploads it to the first-level slave station step by step.
[0040] A data aggregation upload module is used for the first-level slave station to upload a complete data frame to the master station when the input data aggregation is completed, and the transmission of the input process data and the output process data are completed within one communication cycle;
[0041] The link abnormality recovery module is used to initiate a rescan based on the pre-stored structure mapping information when any slave station detects that the lower-level module is offline, and rebuild the data encapsulation path and resume the forwarding process after identifying the corresponding module.
[0042] By adopting the above technical solution, by constructing a chain encapsulation path including the byte offset mapping relationship of the process data area of the main body and the lower-level slave station in the first-level IO-Link slave station, the position relationship of the multi-level slave stations in the same data frame can be uniformly managed, and the centralized encapsulation of process data under the multi-level topology structure can be realized, thereby reducing the communication overhead caused by the master station's independent access to multiple devices and improving the overall throughput efficiency of the link; by transparently forwarding the data segments that do not belong to the main body to the lower-level slave station through the first-level slave station, the tedious process of the master station distributing output data to the substations one by one can be avoided, thereby significantly reducing the master station's control task load and enhancing the protocol processing efficiency; By collecting input process data through the last-level slave station and uploading it to the first-level slave station step by step, a structured input data link can be formed to ensure the integrity of the uplink data, thereby reducing the complexity of the master station's merging and synchronization operations for reported data; by completing the entire process of input aggregation and output transparent transmission within one communication cycle through the first-level slave station, the data exchange cycle can be shortened, thereby improving the real-time and synchronous response capabilities of the IO-Link network; by any slave station automatically rebuilding the data path when detecting that the lower-level module is offline, the system's self-healing ability in the event of node failure or structural change can be improved, thereby enhancing the stability and maintainability of the chain network operation.
[0043] The third objective of this application is achieved through the following technical solutions:
[0044] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the multi-stage expansion method of the IO-Link slave are implemented.
[0045] The fourth objective of this application is achieved through the following technical solutions:
[0046] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the multi-stage expansion method of the IO-Link slave.
[0047] In summary, this application has the following beneficial technical effects:
[0048] 1. After power-on, the first-level slave station actively obtains the device identification and process data length of the lower-level slave station to generate a logical topology structure. This can achieve automatic perception of the slave station structure and accurate extraction of data area configuration information, thereby avoiding the error-proneness of manual configuration and improving deployment efficiency. By allocating byte segment offset addresses to each slave station based on the connection sequence and establishing a mapping relationship between device identification and address, a clear data structure index chain can be formed, thereby improving data frame parsing efficiency and supporting the efficient execution of subsequent transparent transmission and splicing operations.
[0049] 2. The first-level slave station extracts the main data segments and writes them into the local buffer. At the same time, the remaining segments are generated into relay transparent transmission frames and forwarded to the lower-level slave stations. This ensures that the output data sent by the master station is accurately distributed to the target devices of the multi-level slave stations, thereby building an efficient data downlink path and reducing the task processing workload of the master station. By adopting a zero-copy cache mechanism for relay frame construction, it can reduce the repeated movement of data in the intermediate layers, thereby improving forwarding efficiency and reducing latency.
[0050] 3. By performing CRC residual value judgment on each field in the output process data, potential data errors can be identified in advance before the frame is forwarded, thereby reducing the risk of erroneous data propagation in the chain structure; by skipping forwarding the fields of the lower-level slave station that is in an offline state and recording the error status in the mapping relationship, it can provide a status basis for the link self-healing process in the next cycle, thereby improving the stability and fault tolerance of the link. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a flow chart of a multi-stage expansion method of an IO-Link slave station in one embodiment of the present application;
[0052] Figure 2 This is a flowchart for implementing step S10 in the multi-stage expansion method of an IO-Link slave station in one embodiment of the present application;
[0053] Figure 3 This is a flowchart for implementing step S20 in the multi-stage expansion method of an IO-Link slave station in one embodiment of the present application;
[0054] Figure 4 This is another implementation flowchart of step S22 in the multi-stage expansion method of the IO-Link slave station in one embodiment of the present application;
[0055] Figure 5 This is a flowchart for implementing step S30 in the multi-stage expansion method of an IO-Link slave station in one embodiment of the present application;
[0056] Figure 6 This is a flowchart for implementing step S40 in the multi-stage expansion method of an IO-Link slave station in one embodiment of the present application;
[0057] Figure 7 This is a principle block diagram of a multi-stage expansion device for an IO-Link slave station in one embodiment of the present application;
[0058] Figure 8 It is a schematic diagram of a device in one embodiment of the present application. DETAILED DESCRIPTION
[0059] The present application is further described in detail below with reference to the accompanying drawings.
[0060] In one embodiment, if Figure 1 As shown, the present application discloses a multi-level expansion method for an IO-Link slave, which specifically includes the following steps:
[0061] S10: Constructing a chain encapsulation path for process data transmission in the first-level IO-Link slave, the path including a byte offset mapping relationship between the process data area of the slave and the lower-level slave.
[0062] Specifically, when constructing a chain encapsulation path, the structure establishment task is triggered by the preset initialization scheduling module, the link layer maximum depth information and the starting scan port are extracted from the configuration parameters, each extended port is accessed in turn and a device identification request is sent to the next-level slave station, the device identifier and process data length field contained in the response information are collected and cached in the main structure storage area, and after completing the detection of all lower-level slave stations, a logical topology relationship diagram is constructed according to the access order, and the offset position of each slave station process data segment in the unified communication data frame is calculated according to the length of the segment, thereby completing the byte segment allocation, and finally the device identification of each slave station and the corresponding offset position are written into the offset mapping table and stored in the local cache for subsequent call and use in subsequent communication cycles.
[0063] S20: The first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station.
[0064] Specifically, after receiving the complete output process data frame sent by the master station through the IO-Link periodic communication channel, the offset address range of the main byte segment recorded in the offset mapping table is called through the table lookup mechanism to extract the data required at this level from the received frame. The extracted data is immediately written into the process output buffer for use by the execution module. Subsequently, the transparent transmission data structure is generated and the relay frame is constructed according to the offset information of the remaining frame content. The transparent transmission frame is sent to the corresponding lower-level slave station in the link order. During the forwarding process, the data is not unpacked or processed, but is directly mapped and transferred according to the frame segment to ensure that the downlink data at all levels can be delivered to the target module within the shortest delay.
[0065] S30: The last-level slave station collects input process data and uploads it to the upper-level slave station. While receiving the input process data sent by the lower-level slave station, each intermediate slave station splices the input data of this level to the input process data and uploads it to the first-level slave station step by step.
[0066] Specifically, when the last-level slave station completes the input data collection of its connected device, it encapsulates its main input data into a standard input data frame according to the configuration format and sends it to the upper-level slave station. After receiving the lower-level frame data, the upper-level slave station locates the target insertion area through the identification information in the frame header, and then writes the input data block of this level into the specified byte segment in the frame structure and updates the data length and check field. After completing the data splicing, it continues to forward the updated frame to the upper level. This process is repeated step by step in the entire link until the first-level slave station finally aggregates all the slave station data segments to form a complete input data frame, providing the master station with an integrated input data collection channel.
[0067] S40: When the first-level slave station completes the input data aggregation, it uploads the complete data frame to the master station. The transmission of input process data and output process data is completed within one communication cycle.
[0068] Specifically, to ensure closed-loop processing of input and output data within a communication cycle, the master station synchronously sends the cycle scheduling parameters to the first-level slave station and resets the current cycle identifier before the start of each communication cycle. The first-level slave station then calculates the available scheduling time slice locally and completes the output data frame reception, main body data extraction, remaining data forwarding, input frame reception, splicing and uploading operations in sequence within the time slice. Each level of slave station calculates the time window downward according to its own level to ensure that all data operations are completed within the scheduling window. When the first-level slave station completes the aggregation, it immediately encapsulates the final input data frame and sends it to the master station through the IO-Link uplink channel to complete the entire cycle communication.
[0069] S50: When any slave station detects that a lower-level module is offline, it initiates a rescan according to the pre-stored structure mapping information, and rebuilds the data encapsulation path and resumes the forwarding process after identifying the corresponding module.
[0070] Specifically, during the communication process, if a slave station does not receive a response signal or data frame return from its subordinate slave station for multiple consecutive cycles, the slave station immediately calls the local offline identification module to perform a quick matching check based on the target identification record in the offset mapping table. If it is determined to be in an offline state, the structure detection command is resent to its connection port to re-identify the subordinate module. If the device identification is re-detected to be consistent with the mapping table, the path reconstruction process is executed, that is, the offset address is reallocated, the data segment mapping is updated and synchronized to the cache area, and the data transmission task and the input data return task are reopened at the same time. If a change in the device structure is detected, a topology update request is reported to the master station to trigger link mapping synchronization.
[0071] In one embodiment, if Figure 2As shown, in step S10, a chain encapsulation path for process data transmission is constructed in the first-level IO-Link slave. The path includes a byte offset mapping relationship between the process data area of the slave and the lower-level slave, specifically including:
[0072] S11: After the first-level slave station is powered on, it actively sends a structure detection command to the next-level slave station connected, and obtains the device identification and process data length of each slave station through the IO-Link service channel, and then generates a logical topology structure.
[0073] Specifically, after the first-level slave completes the initialization action, the structure identification program is called through the extended port information recorded in the configuration, and a structure detection request is initiated for each available downstream port in turn. The module identification read instruction is sent using the ISDU channel of the IO-Link protocol. After receiving the response from the lower-level slave, its device ID field and process data description field are extracted from it and bound to the current port number for storage. When multiple lower-level slaves are connected to form a cascade structure, the above operation is repeated and the structure acquisition is completed in sequence according to the access order. Finally, a complete logical topology description table is constructed inside the body. This table is used to represent the connection path, device sequence and data resource structure from the first level to the last level.
[0074] S12: Based on the relative connection order of each subordinate slave station in the logical topology structure, the corresponding byte segment offset address is allocated to the slave station in sequence according to the connection order through the linear address allocation strategy, and an offset mapping relationship is established between the device identifier and the offset address.
[0075] Specifically, after the logical topology structure is established, the byte segment management module is called to initialize the encapsulation frame structure and clear the existing offset allocation cache. The process data length field of each lower-level slave station is read in turn from the logical topology table and accumulated. The starting address of the process data segment of the first-level slave station is used as the offset starting point. The starting offset address in the communication data frame is calculated and allocated for each lower-level slave station in the access order. Subsequently, a mapping key-value pair is established between each device identifier and the allocated starting address and written into the offset mapping table. The mapping table serves as a key reference structure for chain transmission and input splicing, supporting efficient segmentation and splicing of subsequent data frames between the slave stations.
[0076] In one embodiment, if Figure 3 As shown, in step S20, the first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the main body to the lower-level slave station, specifically including:
[0077] S21: After the first-level slave receives the output process data sent by the master based on the IO-Link cycle channel, it extracts the main data segment according to the offset mapping relationship and writes it into the local process data buffer.
[0078] Specifically, after the periodic scheduling starts, when the output process data frame sent by the master station arrives at the first-level slave station, the frame analysis module is immediately started and the starting address and data length of the main body data segment recorded in the offset mapping table are retrieved, and the corresponding byte segment is intercepted from the receiving buffer as the main body control data. The data segment is then written into the main body process output register structure for real-time parsing and response by the internal control logic or execution module. At the same time, a processed flag is set to mark that the segment of data has been read and allow subsequent frame segment operations to continue. This processing process only involves the main body data and does not interfere with or modify the contents of other segments.
[0079] S22: Perform fast offset positioning on the remaining unoccupied byte segments, generate a relay transparent transmission frame and transparently forward the corresponding byte segments to the target lower-level slave station. The transparent forwarding process adopts a zero-copy buffer mechanism.
[0080] Specifically, after completing the extraction of the body data segment, the starting offset address and total length of the remaining frame segments are calculated immediately, and a transparent segment linked list is constructed based on the order recorded in the offset mapping table. All frame segments that do not belong to the body are integrated into one, and the relay frame constructor is called to generate a forwarding structure frame with a header identifier and a target identifier. After encapsulation, the frame does not need to be transferred and copied in the body storage. Instead, the original buffer pointer is directly passed to the communication interface module based on the zero-copy mechanism, and the frame is directly sent to the target slave station by the lower-level interface, thereby reducing the number of data copies and buffer overhead in the multi-level forwarding process.
[0081] In one embodiment, if Figure 4 As shown, in step S22, that is, before performing fast offset positioning on the remaining unoccupied byte segments, generating a relay transparent transmission frame and transparently forwarding the corresponding byte segments to the target lower-level slave station, the following is also included:
[0082] S221: Perform CRC residual value judgment on each field in the output process data.
[0083] Specifically, before relaying the output data frame, the verification process is first entered. The CRC module performs residual value calculation operations on each logical field in turn, and the standard CRC16 algorithm is used to process each field segment by segment. The data is compared with the check bits attached to each segment to confirm whether the data segment has bit flipping or sticking errors during the uplink transmission process. If the check values are consistent, the field is marked as valid data and allowed to enter the forwarding queue. If it is found that the field residual value does not match the expected value, it is identified as an abnormal segment and written into the error buffer area, waiting to be retrieved in the next cycle.
[0084] S222: If the lower-level slave station corresponding to the target field is currently in an offline state, skip forwarding and record the error state in the offset mapping relationship for use in the self-healing detection of the next cycle.
[0085] Specifically, after completing the field residual value judgment, the lower-level target status comparison stage is entered. First, the structure status monitoring module is called according to the device ID field recorded in the target field to read the current device connection status. If it is found that the target lower-level slave station is offline, disconnected, or the port is disconnected, the forwarding behavior of the field is immediately abandoned, and the status bit under the corresponding device ID in the offset mapping table is updated to "temporarily unreachable". At the same time, the skip status of the device in the current cycle is written to the offline record table, which will be used for re-identification and structural detection by the link recovery task in the next cycle to ensure that the abnormal state has an automatic fault tolerance and repair mechanism at the protocol layer.
[0086] In one embodiment, if Figure 5 As shown, in step S30, the last-level slave station collects input process data and uploads it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of its own level to the input process data, specifically including:
[0087] S31: The last-level slave station collects the real-time status value of the main body, encapsulates the real-time status value, and generates input process data.
[0088] Specifically, after the communication cycle scheduling starts, the last-level slave station calls the input acquisition task according to the configured input sampling cycle parameters, reads the current level status, analog voltage value or displacement encoder output and other real-time input signals from the sensor interface or actuator interface connected to the main body, and generates standard input value buffer data after completing quantization processing through the ADC module. The data is then encapsulated according to the preset process data frame structure. During the encapsulation process, the input value is written into the frame data segment and the start identifier, device identifier and data length field are attached, finally forming a complete input process data frame structure, ready for transmission to the upper-level slave station.
[0089] S32: After receiving the input process data, the upper-level slave station writes the input data of the main body into the corresponding paragraph in the input process data through the DMA channel according to the offset mapping relationship, and continues to forward the updated input process data until it is sent to the first-level slave station.
[0090] Specifically, after the upper-level slave station receives the input process data frame from the lower-level slave station, the input splicing task module is immediately started. According to the main body starting offset address and data length recorded in the offset mapping table, the current cycle main body input data is obtained from the sampling register and directly written into the corresponding byte segment in the input process data frame through the DMA channel. At the same time, the frame length field and data check field are updated to maintain the consistency of the frame structure. After the splicing is completed, it is forwarded to the higher level through the next-level sending interface. The slave station repeats the splicing process at each level, and finally the first-level slave station receives the complete input data frame containing all slave station input data segments.
[0091] In one embodiment, if Figure 6 As shown, in step S40, when the first-level slave station completes the input data aggregation, it uploads the complete data frame to the master station. The transmission of the input process data and the output process data is completed within one communication cycle, which specifically includes:
[0092] S41: The master configures the periodic scheduling parameters and sends them to the first-level slaves through the IO-Link configuration service. Each slave calculates the maximum available time slice for its level based on its level and the required operation time.
[0093] Specifically, when initializing the communication architecture, the master station sends a periodic scheduling configuration command to the first-level slave station through the IO-Link service channel. The configuration content includes the total duration of each cycle, the time slicing method, and the maximum allowable operation delay of each level. After receiving the configuration command from the first-level slave station, it calls the time slice calculation function according to its own link layer, calculates the minimum scheduling window required for data reception, parsing, splicing and uploading at this level, and then reversely infers its own maximum available operation time slice length from the total cycle time configured by the master station, and caches the result for use in the time allocation logic in the current and subsequent cycles.
[0094] S42: Each slave station performs output data parsing, input data splicing and forwarding operations based on the maximum available time slice at this level.
[0095] Specifically, when the communication cycle officially begins, each slave station starts the scheduler to execute the process data processing flow according to its own local time slice scheduling parameters. First, it uses the pre-allocated time window to perform the reception of output process data and the extraction of the main body control segment, and then completes the relay and transparent transmission operation of the remaining segments. After the downlink data processing is completed, it enters the uplink input data flow, receives the lower-level input data frame, completes the main body splicing and immediately forwards it upward. The task order is managed between each task through the interrupt priority strategy to ensure that each operation control is completed within the maximum time slice range of this level, thereby ensuring that the full-chain data transmission closed loop is completed within one cycle.
[0096] S43: When congestion occurs in a communication cycle, a local arbitration mechanism is triggered, an incomplete data exchange flag in the current cycle is recorded, and the data exchange is prioritized for processing in the next cycle.
[0097] Specifically, if a communication blocking event is detected during the operation cycle, such as a receive buffer timeout, an abnormal response from the lower-level slave station, or loss of output data frames, the exception arbitration mechanism is immediately triggered. The current operation execution status is recorded through the arbitration scheduling table, and the unfinished tasks in the cycle are labeled "deferred execution" and written into the task buffer queue. At the same time, the data exchange incomplete flag register is set. Before the start of the next cycle, the scheduler will give priority to extracting the remaining tasks of the previous cycle and insert them into the front priority of the current scheduling window for compensation processing. In this way, continuous frame loss caused by blocking failures is avoided, while maintaining a balanced distribution of data integrity and time windows.
[0098] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0099] In one embodiment, a multi-stage expansion device for an IO-Link slave is provided, and the multi-stage expansion device for an IO-Link slave corresponds one-to-one to the multi-stage expansion method for an IO-Link slave in the above embodiment. Figure 7 As shown in the figure, the multi-stage expansion device of the IO-Link slave station includes a package path construction module, an output data transparent transmission module, an input data splicing module, a data aggregation upload module, and a link abnormality recovery module. The detailed description of each functional module is as follows:
[0100] The encapsulation path construction module is used to build a chained encapsulation path for process data transmission in the first-level IO-Link slave. The path includes the byte offset mapping relationship between the process data area of the slave and the lower-level slaves;
[0101] Output data transparent transmission module, used for the first-level slave station to receive the output process data sent by the master station, and transparently forward the data segments in the output process data that do not belong to the main body to the lower-level slave station;
[0102] The input data splicing module is used for the last-level slave station to collect input process data and upload it to the upper-level slave station. While receiving the input process data sent by the lower-level slave station, each intermediate slave station splices the input data of this level to the input process data and uploads it to the first-level slave station step by step;
[0103] The data aggregation upload module is used for the first-level slave station to upload the complete data frame to the master station after completing the input data aggregation. The transmission of input process data and output process data is completed within one communication cycle;
[0104] The link abnormality recovery module is used to initiate a rescan based on the pre-stored structure mapping information when any slave station detects that the lower-level module is offline, and rebuild the data encapsulation path and resume the forwarding process after identifying the corresponding module.
[0105] Optionally, the encapsulation path construction module specifically includes:
[0106] The structure identification submodule is used to actively send structure detection commands to the connected next-level slaves after the first-level slave is powered on. It also obtains the device identification and process data length of each slave through the IO-Link service channel, and then generates a logical topology structure.
[0107] The offset mapping submodule is used to allocate corresponding byte segment offset addresses to the slave stations in the connection order based on the relative connection order of each subordinate slave station in the logical topology structure through the linear address allocation strategy, and establish an offset mapping relationship between the device identification and the offset address.
[0108] Optionally, the output data transparent transmission module specifically includes:
[0109] The body extraction submodule is used for the first-level slave station to receive the output process data sent by the master station based on the IO-Link cycle channel, extract the body data segment according to the offset mapping relationship, and write it into the local process data buffer;
[0110] The relay forwarding submodule is used to perform fast offset positioning on the remaining unoccupied byte segments, generate relay transparent transmission frames and transparently forward the corresponding byte segments to the target lower-level slave station. The transparent transmission forwarding process adopts a zero-copy cache mechanism.
[0111] Before the optional relay forwarding submodule, it also includes:
[0112] The field check submodule is used to perform CRC residual value judgment on each field in the output process data;
[0113] The abnormal skip submodule is used to skip forwarding and record the error status in the offset mapping relationship if the lower-level slave station corresponding to the target field is currently offline, for self-healing detection in the next cycle.
[0114] Optionally, the input data splicing module specifically includes:
[0115] The input encapsulation submodule is used to collect the real-time status value of the main body from the last-level slave station, encapsulate the real-time status value, and generate input process data;
[0116] The splicing forwarding submodule is used for the upper-level slave station to write the input data of the main body into the corresponding paragraph in the input process data through the DMA channel according to the offset mapping relationship after receiving the input process data, and continue to forward the updated input process data until it is sent to the first-level slave station.
[0117] Optionally, the data aggregation upload module specifically includes:
[0118] The time slice calculation submodule is used by the master station to configure the periodic scheduling parameters and send them to the first-level slave stations through the IO-Link configuration service. Each slave station calculates the maximum available time slice of its level based on its own level and the required operation time;
[0119] The task scheduling submodule is used for each slave station to perform output data analysis, input data splicing and forwarding operations based on the maximum available time slice at this level;
[0120] The blocking arbitration submodule is used to trigger the local arbitration mechanism when blocking occurs in the communication cycle, record the incomplete data exchange mark in the current cycle, and give priority to scheduling processing in the next cycle.
[0121] The specific definition of the multi-stage expansion device for IO-Link slaves can be found in the definition of the multi-stage expansion method for IO-Link slaves described above and will not be further elaborated here. Each module in the multi-stage expansion device for IO-Link slaves described above can be implemented in whole or in part through software, hardware, or a combination thereof. Each of these modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in memory in the computer device in software form, allowing the processor to call and execute the corresponding operations of each module.
[0122] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, memory, network interface and database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a multi-level expansion method of an IO-Link slave station is implemented.
[0123] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:
[0124] Constructing a chained encapsulation path for process data transmission in the first-level IO-Link slave. The path includes the byte offset mapping of the process data area of the slave and the lower-level slaves.
[0125] The first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station;
[0126] The last-level slave station collects input process data and uploads it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of this level to the input process data and uploads it to the first-level slave station step by step.
[0127] When the first-level slave station completes the input data aggregation, it uploads the complete data frame to the master station. The transmission of input process data and output process data is completed within one communication cycle.
[0128] When any slave detects that the lower-level module is offline, it initiates a rescan based on the pre-stored structure mapping information, and after identifying the corresponding module, it rebuilds the data encapsulation path and resumes the forwarding process.
[0129] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0130] Constructing a chained encapsulation path for process data transmission in the first-level IO-Link slave. The path includes the byte offset mapping of the process data area of the slave and the lower-level slaves.
[0131] The first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station;
[0132] The last-level slave station collects input process data and uploads it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of this level to the input process data and uploads it to the first-level slave station step by step.
[0133] When the first-level slave station completes the input data aggregation, it uploads the complete data frame to the master station. The transmission of input process data and output process data is completed within one communication cycle.
[0134] When any slave detects that the lower-level module is offline, it initiates a rescan based on the pre-stored structure mapping information, and after identifying the corresponding module, it rebuilds the data encapsulation path and resumes the forwarding process.
[0135] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media used in the various embodiments provided herein may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).
[0136] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0137] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A multi-stage expansion method for IO-Link slaves, characterized in that: The method comprises: Constructing a chained encapsulation path for process data transmission in an IO-Link first-level slave, the path including a mapping relationship between byte offsets of process data areas of the slave and lower-level slaves; The first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station; The last-level slave station collects input process data and uploads it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of this level to the input process data and uploads it to the first-level slave station step by step. When the first-level slave station completes the aggregation of input data, it uploads the complete data frame to the master station, and the transmission of the input process data and the output process data are completed within one communication cycle; When any slave detects that the lower-level module is offline, it initiates a rescan based on the pre-stored structure mapping information, and after identifying the corresponding module, it rebuilds the data encapsulation path and resumes the forwarding process.
2. The multi-stage expansion method of the IO-Link slave according to claim 1, characterized in that: The chain encapsulation path for process data transmission is constructed in the first-level IO-Link slave station, and the path includes a byte offset mapping relationship between the process data area of the slave station and the lower-level slave station, specifically including: After the first-level slave is powered on, it actively sends a structure detection command to the connected next-level slave, and obtains the device identification and process data length of each slave through the IO-Link service channel, thereby generating a logical topology structure; Based on the relative connection order of each subordinate slave station in the logical topology structure, the corresponding byte segment offset address is allocated to the slave station in sequence according to the connection order through the linear address allocation strategy, and the offset mapping relationship is established between the device identifier and the offset address.
3. The multi-stage expansion method of the IO-Link slave according to claim 1, characterized in that: The first-level slave station receives the output process data sent by the master station, and transparently forwards the data segments in the output process data that do not belong to the master station to the lower-level slave station, specifically including: After receiving the output process data sent by the master station based on the IO-Link periodic channel, the first-level slave station extracts the body data segment according to the offset mapping relationship and writes it into the local process data buffer; Fast offset positioning is performed on the remaining unoccupied byte segments, a relay transparent transmission frame is generated, and the corresponding byte segments are transparently transmitted to the target lower-level slave station. The transparent transmission forwarding process adopts a zero-copy buffer mechanism.
4. The multi-stage expansion method of the IO-Link slave according to claim 3, characterized in that: Before performing fast offset positioning on the remaining unoccupied byte segments, generating a relay transparent transmission frame, and transparently forwarding the corresponding byte segments to the target lower-level slave station, the method further includes: Performing CRC residual value judgment on each field in the output process data; If the lower-level slave station corresponding to the target field is currently in an offline state, forwarding is skipped and the error state is recorded in the offset mapping relationship for use in the self-healing detection of the next cycle.
5. The multi-stage expansion method of the IO-Link slave according to claim 1, characterized in that: The last-level slave station collects input process data and uploads it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of its own level to the input process data, specifically including: The last-level slave station collects the real-time status value of the main body, and encapsulates the real-time status value to generate the input process data; After receiving the input process data, the upper-level slave station writes the input data of the main body into the corresponding paragraph in the input process data through the DMA channel according to the offset mapping relationship, and continues to forward the updated input process data until it is sent to the first-level slave station.
6. The multi-stage expansion method of the IO-Link slave according to claim 1, characterized in that: When the first-level slave station completes the aggregation of input data, it uploads the complete data frame to the master station. The transmission of the input process data and the output process data is completed within one communication cycle, which specifically includes: The master station configures the periodic scheduling parameters and sends them to the first-level slave stations through the IO-Link configuration service. Each slave station calculates the maximum available time slice of its level based on its own level and the required operation time. Each of the slave stations performs output data parsing, input data splicing and forwarding operations based on the maximum available time slice at the same level; In the event of congestion during a communication cycle, the local arbitration mechanism is triggered, the incomplete data exchange flag in the current cycle is recorded, and priority is given to scheduling processing in the next cycle.
7. A multi-stage expansion device for an IO-Link slave station, characterized in that: The device comprises: An encapsulation path construction module, configured to construct a chained encapsulation path for process data transmission in an IO-Link first-level slave, the path including a mapping relationship between byte offsets of process data areas of the slave and lower-level slaves; Output data transparent transmission module, used for the first-level slave station to receive the output process data sent by the master station, and transparently forward the data segments in the output process data that do not belong to the main body to the lower-level slave station; The input data splicing module is used for the last-level slave station to collect input process data and upload it to the upper-level slave station. Each intermediate slave station, while receiving the input process data sent by the lower-level slave station, splices the input data of this level to the input process data and uploads it to the first-level slave station step by step. A data aggregation upload module is used for the first-level slave station to upload a complete data frame to the master station when the input data aggregation is completed, and the transmission of the input process data and the output process data are completed within one communication cycle; The link abnormality recovery module is used to initiate a rescan based on the pre-stored structure mapping information when any slave station detects that the lower-level module is offline, and rebuild the data encapsulation path and resume the forwarding process after identifying the corresponding module.
8. The multi-stage expansion device of the IO-Link slave according to claim 7, characterized in that: The encapsulation path construction module specifically includes: The structure identification submodule is used to actively send a structure detection command to the connected next-level slave station after the first-level slave station is powered on, and obtain the device identification and process data length of each slave station through the IO-Link service channel, thereby generating a logical topology structure; The offset mapping submodule is used to allocate corresponding byte segment offset addresses to the slave stations in the connection order based on the relative connection order of each subordinate slave station in the logical topology structure through a linear address allocation strategy, and establish the offset mapping relationship between the device identifier and the offset address.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the multi-stage expansion method of the IO-Link slave according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the multi-stage expansion method of the IO-Link slave station according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
System and method for IO-Link slave station of extensible module
CN117097754A
Internet-of-things module
US20220337450A1