Auxiliary control detection method and device based on Go language and related medium
Through the auxiliary control detection method based on Go language, the problems of poor coordination and equipment compatibility between AMC and CAC are solved, efficient data transmission and unified processing are achieved, and the overall performance of industrial control systems is improved.
Patent Information
- Application Number
- CN202510366194.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-07-11
AI Technical Summary
In existing industrial control systems, the collaborative work between AMC and CAC lacks an efficient data interaction mechanism, is difficult to resolve multi-protocols, and lacks device compatibility, especially insufficient communication optimization for embedded devices, resulting in data overflow and transmission delay problems.
The auxiliary control detection method based on Go language is adopted, and by loading configuration files, initializing the communication serial port, establishing the connection between the upper computer and the data acquisition module, creating a message monitor monitoring status, obtaining system indicators and process status information, and transmitting it to the upper computer through the communication serial port, realizing unified data format and efficient transmission.
It improves the collaborative processing and equipment compatibility of the control system, reduces the complexity of protocol resolution, optimizes transmission efficiency, reduces maintenance costs, and ensures the efficient operation of the system in heterogeneous environments.
Smart Images

Figure CN120301957A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial automation control technology, and particularly to an auxiliary control detection method, device and related medium based on the Go language. Background Art
[0002] In existing industrial control systems, there are various technical defects, especially in the collaborative work between the AMC (Auxiliary Monitoring Unit) and the CAC (Control Execution Unit). In traditional industrial control systems, the AMC and the CAC often operate independently, lacking an efficient data interaction mechanism, which leads to the control decision-making being unable to make full use of the monitoring data and affects the overall performance of the system. In addition, multiple communication protocols are commonly used in industrial sites, such as Modbus, IEC 104, etc. The fragmentation of these protocols poses great challenges for the AMC and CAC units to achieve unified parsing and response of multiple protocols. Moreover, the existing system has deficiencies in device compatibility, especially the communication optimization for embedded devices (such as ESP32) is insufficient, often resulting in data overflow and transmission delay problems. Summary of the Invention
[0003] Embodiments of the present invention provide an auxiliary control detection method, device and related medium based on the Go language, aiming to solve the problems of poor coordination and device compatibility in the existing control system.
[0004] In the first aspect, embodiments of the present invention provide an auxiliary control detection method based on the Go language, including:
[0005] Loading a configuration file and initializing configuration information;
[0006] Initializing a communication serial port with the configuration information and establishing a communication connection between the host computer and the data acquisition module;
[0007] Creating a message monitor and starting the monitoring function to monitor the status and operation of the data acquisition module to obtain data monitoring information;
[0008] Starting the communication serial port and obtaining the system metric information of the data acquisition module and the acquisition process status monitoring information;
[0009] Transmitting the data monitoring information, system metric information and process status monitoring information to the host computer through the communication serial port respectively.
[0010] In the second aspect, embodiments of the present invention provide an auxiliary control detection device based on the Go language, including:
[0011] A data loading unit for loading a configuration file and initializing configuration information;
[0012] A data connection unit for initializing a communication serial port using the configuration information and establishing a communication connection between the host computer and the data acquisition module;
[0013] A data monitoring unit for creating a message monitor and starting the monitoring function, monitoring the status and operation of the data acquisition module to obtain data monitoring information;
[0014] A data acquisition unit for starting the communication serial port and obtaining the system metric information of the data acquisition module and the monitoring information of the acquisition process status;
[0015] A data transmission unit for transmitting the data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port respectively.
[0016] In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the auxiliary control detection method based on the Go language in the first aspect.
[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, it implements the auxiliary control detection method based on the Go language in the first aspect.
[0018] An embodiment of the present invention provides an auxiliary control detection method based on the Go language, including: loading a configuration file and initializing configuration information; initializing a communication serial port using the configuration information and establishing a communication connection between the host computer and the data acquisition module; creating a message monitor and starting the monitoring function, monitoring the status and operation of the data acquisition module to obtain data monitoring information; starting the communication serial port and obtaining the system metric information of the data acquisition module and the monitoring information of the acquisition process status; transmitting the data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port respectively. The present invention transmits the obtained data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port for unified processing. In this way, the collaborative processing performance of the control system and the device compatibility are improved.
[0019] An embodiment of the present invention further provides an auxiliary control detection device, a computer device, and a storage medium based on the Go language, which also have the above beneficial effects. Description of the Drawings
[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts.
[0021] Figure 1 It is a schematic flowchart of an auxiliary control detection method based on the Go language provided by an embodiment of the present invention;
[0022] Figure 2 It is another schematic flowchart of an auxiliary control detection method based on the Go language provided by an embodiment of the present invention;
[0023] Figure 3 It is a systematic block diagram of an auxiliary control detection method based on the Go language provided by an embodiment of the present invention;
[0024] Figure 4 It is a schematic block diagram of an auxiliary control detection device based on the Go language provided by an embodiment of the present invention. Detailed implementation manners
[0025] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.
[0026] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0027] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0028] It should be further understood that the term " / and / " used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the related listed items, and includes these combinations.
[0029] Next, please refer to Figure 1 ,Figure 1 The figure is a schematic flowchart of an auxiliary control detection method based on the Go language provided by an embodiment of the present invention, specifically including steps S101 to S105.
[0030] S101. Load the configuration file and initialize the configuration information;
[0031] S102. Initialize the communication serial port using the configuration information and establish a communication connection between the host computer and the data acquisition module;
[0032] S103. Create a message monitor and start the monitoring function to monitor the status and operation of the data acquisition module, and obtain data monitoring information;
[0033] S104. Start the communication serial port and obtain the system index information of the data acquisition module and the acquisition process status monitoring information;
[0034] S105. Transmit the data monitoring information, system index information, and process status monitoring information to the host computer through the communication serial port respectively.
[0035] Combined with Figure 2 As shown, in step S101, first load the configuration file, which may include configuration information such as parameter settings, communication serial port configuration, sampling period, control instructions, etc. The loading of the configuration file will provide basic parameters for the subsequent system initialization and operation. The system will initialize according to the content of the configuration file to ensure that all parameters and settings meet the predetermined requirements.
[0036] In step S102, initialize the communication serial port according to the configuration information read from the configuration file. The communication serial port is the bridge for data transmission between the host computer and the data acquisition module, ensuring the stability of communication. The system completes the configuration of serial port communication by configuring serial port parameters such as baud rate, data bits, parity bits, etc. After initialization, the system establishes a communication connection between the host computer and the data acquisition module to ensure bidirectional data transmission through the serial port.
[0037] In one embodiment, step S102 includes:
[0038] Identify the communication protocol type according to the configuration information;
[0039] Call the corresponding protocol parser according to the communication protocol type to extract data content and protocol meta-information, and obtain the parsing result;
[0040] Use the template mapping mechanism to perform protocol conversion on the parsing result, map fields of different protocols to the standard data model to achieve data format unification.
[0041] In this embodiment, according to the previously loaded configuration information, the type of communication protocol is automatically identified using a feature recognition algorithm. The configuration information contains the detailed parameters of network devices and communication protocols. The system determines the type of protocol used based on these parameters and the characteristics of communication data. The feature recognition algorithm can automatically identify the protocol type by performing a preliminary analysis of network packets, such as common industrial protocols like Modbus, IEC 104, etc. According to the communication protocol type, the corresponding protocol parser is called to extract the data content and protocol meta-information, obtaining the parsing result. That is, after identifying the protocol type, the system will call the protocol parser corresponding to that protocol type. Each protocol parser can parse the packet content and its related meta-information of a specific protocol. The protocol parser analyzes the data fields in the packet to extract the data content (such as sensor values, control instructions, etc.) and protocol meta-information (such as protocol version, data type, check information, etc.). These parsing results are important bases for subsequent processing, ensuring that data of different protocols can be effectively extracted and understood.
[0042] Here is an introduction to the IEC 104 protocol:
[0043] First is the IEC 104 message structure. The IEC 104 protocol message structure is divided into four main parts:
[0044] Start field: This field is used to identify the start of the data packet, ensuring the correct parsing of the data packet.
[0045] Length field: The length field (4 bytes) is used to represent the total length of the message, ensuring that the receiving party can correctly process the entire message.
[0046] Control field: Contains control information, usually used to identify the type of data packet or other protocol control information.
[0047] ASDU data: This is the variable-length data part that contains the specific application data and is the core content of the entire message.
[0048] Secondly is the ASDU structure (Application Service Data Unit). The ASDU is the core part of the IEC 104 protocol, and its structure includes the following fields:
[0049] TypeID (1 byte): Identifies the data type.
[0050] VSQ (1 byte): Indicates whether there are multiple information elements.
[0051] COT (2 bytes): Command type, used to describe the operation type of data exchange.
[0052] Address (2 bytes): Device address, identifying the device corresponding to this data packet.
[0053] Information Objects: Store specific data objects and reflect information such as device status.
[0054] The IEC 104 protocol parsing process specifically includes the following steps:
[0055] Capture TCP packets: First, obtain the transmitted data packets through the TCP protocol.
[0056] Find the start of APDU (identified by 0x68): APDU (Application Protocol Data Unit) is an important data unit in the IEC 104 protocol. The system will locate the starting position of the APDU data by searching for the 0x68 identifier.
[0057] Parse APDU: Parse the APDU part to obtain and process the ASDU data.
[0058] Parse ASDU: Further parse the ASDU data part to obtain the control information and data content therein.
[0059] Parse information objects: Analyze the information objects in the ASDU and extract data related to device status, control commands, etc.
[0060] Obtain data and quality: Based on the transmitted data and its quality information (Value + Quality), perform further processing of the data.
[0061] Through these steps, the system can parse the captured IEC 104 protocol data packets into available device data and control information, and finally provide them to the host computer or control system for decision-making and operation.
[0062] Furthermore, after the data extraction is completed, the system uses a template mapping mechanism to perform protocol conversion on the parsing results. This mechanism maps the fields of different protocols according to a preset standard data model, thereby unifying the data formats of various protocols. Each field of the protocol corresponds one by one with the fields in the standard data model, ensuring the compatibility and consistency of different protocol data. For complex multi-level protocols, the system adopts a recursive parsing strategy to gradually strip the nested data levels, ensuring that all nested fields can be correctly extracted and mapped to the standard model. In this way, the system can convert various heterogeneous data into a unified format, facilitating subsequent data analysis and processing. Through the above steps, the system can efficiently process data of different protocols in a heterogeneous protocol environment, reduce the complexity of protocol parsing, improve the interoperability of the system, and reduce the maintenance cost. This implementation method ensures that the system can flexibly support multiple protocols and maintain efficient operation in a constantly changing industrial environment.
[0063] In step S103, a message monitor is created to monitor the status and operation of the data acquisition module. The message monitor will receive the monitoring information from the data acquisition module in real time, including the system operation status, data acquisition progress, and possible errors or exceptions. The message monitor will parse this information and update the monitoring status in real time, providing a basis for subsequent data transmission and control decisions.
[0064] In step S104, the initialized communication serial port is started to begin real-time data transmission. Through the communication serial port, the system can obtain the system metric information provided by the data acquisition module, including but not limited to system performance metrics such as CPU usage, memory usage, disk space, etc. In addition, the system will also collect the status monitoring information of the processes to ensure that the running status of each process is monitored. This information includes the response time, running status, etc. of the processes, providing real-time data support for subsequent data analysis and control execution.
[0065] In step S105, the obtained data monitoring information, system metric information, and process status monitoring information are respectively transmitted to the host computer through the started communication serial port. The transmitted data undergoes protocol conversion and packaging to ensure the integrity of the information. After receiving the data, the host computer performs further analysis, processing, and decision-making based on this information, thereby achieving real-time monitoring and auxiliary control of the system.
[0066] In one embodiment, step S105 includes:
[0067] Use a data characteristic analyzer to analyze the transmitted information, detect the type, structural characteristics, and change patterns of each piece of information, and generate corresponding information characteristic descriptions;
[0068] Use a serialization strategy selector to select a suitable serialization method from the strategy library and apply different encoding methods to each of the information characteristic descriptions;
[0069] Based on the serialization method, split the large data sets in the transmitted information into data blocks, sort and transmit the data blocks according to multi-level queue scheduling, and dynamically adjust the transmission parameters during the transmission process.
[0070] In this embodiment, a data characteristic analyzer is used to analyze the transmitted information. The data characteristic analyzer generates corresponding characteristic descriptions by detecting the data type, structural features, and change patterns of each piece of information. Specifically, the data types include time-series data, structured data, binary data, etc.; the structural features refer to the organization method of the data, such as field types, field orders, and their hierarchical relationships; the change patterns refer to the performance of the data under time or environmental changes, such as incremental changes, volatility, or stability. Through these analyses, the system can generate a complete characteristic description for each piece of information to help select the most appropriate serialization method subsequently. After the information characteristic description is generated, a serialization strategy selector is used to select the most appropriate serialization method from a pre-set strategy library. According to the characteristic description of each piece of information, the serialization strategy selector will decide to apply different coding methods for different types of data. For example, time-series data uses an incremental coding method to reduce data redundancy and improve compression efficiency; structured data uses field compression and index optimization techniques to reduce storage space and improve data transmission speed; while binary data uses a dedicated compression algorithm to minimize the volume of the data for efficient transmission.
[0071] Binary data can be divided into the following five parts:
[0072] The first part, the packet header (1 byte), is a fixed value of 0xAA for the packet header part, which is used to identify the start of the data packet. It acts as an identifier for the data packet to ensure that the system can correctly identify and process the transmitted data.
[0073] The second part, the type (1 byte), is used to identify the data type in the data packet. Its values are:
[0074] 0x01: indicates "system metric data"
[0075] 0x02: indicates "network packet data"
[0076] 0x03: indicates "process status data"
[0077] 0x04: indicates "process information data"
[0078] This field indicates the content type included in the data packet through different numerical values, which helps the receiving party correctly parse the data.
[0079] The third part, the length (1 byte), is used to represent the number of bytes of the data part, ensuring that the data receiving end knows how many bytes of data need to be read next. Its value is the number of bytes of the data part length, which helps ensure the complete reception and parsing of the data.
[0080] Part 4, Data (n bytes). The data field is the main part of the data packet and contains the actual content to be transmitted. Depending on the data type field, the content of the data part will vary. Each type of data has a specific structure and meaning. This part may contain monitored data for transmission, control instructions, etc.
[0081] Part 5, Checksum (1 byte). The checksum field is used to ensure the integrity of data transmission. It calculates the checksum for all bytes in the data packet to ensure that no errors or losses occur during data transmission. The receiving end verifies the integrity of the data packet through the checksum. If the checksum fails, the receiving end can request retransmission of the data.
[0082] Data Type Description:
[0083] Packet Header: Fixed value 0xAA, used as a data packet identifier.
[0084] Data Type: Different transmission data types are distinguished by values from 0x01 to 0x04, specifically including system metric data, network packet data, process status data, and process information data.
[0085] Length: Indicates the number of bytes in the data part, ensuring that the receiving end knows how many bytes of data to read.
[0086] Checksum: Calculates the data part to ensure that the data has not been tampered with or lost during transmission.
[0087] Through this structured protocol format, the system can efficiently and reliably transmit various types of data, ensuring the integrity and accuracy of the data.
[0088] Furthermore, after the serialization method is determined, the system splits the large data sets during transmission according to this method, breaking them into multiple smaller data blocks for transmission. By transmitting data in chunks, the system avoids large data sets occupying the transmission channel for too long, effectively improving the transmission efficiency. In addition, the system uses a multi-level queue scheduling mechanism to sort and transmit the data blocks. This mechanism determines the transmission order of each data block according to factors such as the priority, importance, and transmission delay of the data, ensuring that high-priority data can be transmitted first. At the same time, the system dynamically adjusts transmission parameters during transmission, such as the size of the data block, transmission frequency, and compression ratio, etc., to adapt to changes in the network conditions, further optimizing the transmission efficiency and stability. Through the above steps, the system can efficiently pack, compress, and transmit information, greatly improving the data transmission efficiency, reducing bandwidth occupancy, and at the same time ensuring the integrity and accuracy of the data.
[0089] In one embodiment, the dynamically adjusting the transmission parameters during transmission includes:
[0090] Dynamically adjust the data compression ratio of the data block according to the network condition and CPU load;
[0091] Dynamically adjust the data sending interval and data transmission rate according to the device load of the data acquisition module. Specifically, when the device load of the data acquisition module increases, extend the data sending interval; when the device load of the data acquisition module decreases, increase the data transmission rate;
[0092] Add CRC check information to the data block to reduce the data transmission volume.
[0093] In this embodiment, the compression ratio of the data block is dynamically adjusted according to the real-time network condition and CPU load. When the network bandwidth is sufficient and the CPU load is low, the system can select a lower compression ratio, thereby reducing the computational overhead in the data compression and decompression processes and ensuring the data transmission speed. In the case of limited network bandwidth or high CPU load, the system will increase the data compression ratio to reduce the data transmission volume, thereby effectively saving bandwidth and improving the transmission efficiency. Through this dynamic adjustment, the system can achieve the best data transmission performance in different operating environments and reduce network congestion and processing latency.
[0094] During the transmission process, the system also dynamically adjusts the data sending interval and transmission rate according to the device load of the data acquisition module. When the device load of the data acquisition module increases, the system will appropriately extend the data sending interval to reduce the pressure on the device and ensure the stability and reliability of the system. On the contrary, when the device load is low, the system will increase the data transmission rate to make full use of the available computing resources and bandwidth and improve the data transmission efficiency. This mechanism can adapt to different load environments, reduce the excessive consumption of system resources caused by too high a transmission rate, or the impact on the real-time nature of data updates due to too low a transmission rate.
[0095] Furthermore, in each data block, the system will automatically add CRC (Cyclic Redundancy Check) checksum information to ensure that the data is not damaged during the transmission process. The checksum information can help the receiving end verify the integrity of the data after receiving it. If the data is damaged during the transmission process, the receiving end will identify it through the check mechanism and request retransmission. In this way, the system can reduce the data transmission volume because only the complete and undamaged data will be further processed or transmitted, avoiding invalid retransmission operations and additional bandwidth waste. This mechanism not only improves the reliability of the transmission but also significantly reduces the data transmission volume by reducing invalid retransmissions, increasing the data compression ratio, and reasonably adjusting the sending interval and rate. Especially in an industrial network environment with limited bandwidth, this optimization can improve the overall performance of the system, reduce network congestion, ensure that critical information can be transmitted preferentially, and guarantee that the real-time monitoring and control tasks of the system can be completed in a timely manner.
[0096] In one embodiment, the Go language-based auxiliary control detection method further includes:
[0097] Calculating the short-term change rate and the long-term change rate of the data monitoring information respectively to obtain a change feature vector;
[0098] Evaluating the importance of each data monitoring information according to a preset rule based on the change feature vector, and assigning a priority score to the data monitoring information;
[0099] Using the non-linear mapping function to convert the change feature vector and the priority score into a sampling frequency adjustment factor respectively to obtain the optimal sampling period of the data monitoring information;
[0100] After obtaining the optimal sampling period, use the built-in resource evaluator to monitor the system resource usage to adjust the optimal sampling period.
[0101] In this embodiment, each data monitoring information is analyzed, and its short-term change rate and long-term change rate are calculated respectively. For example, the short-term change rate is usually calculated with a 10-second time window to focus on the rapid fluctuations of the data; while the long-term change rate is calculated with a 10-minute time window to focus on the long-term trends and change patterns of the data. These change rates reflect the change characteristics of the data on different time scales, and can help the system identify the dynamic change situation of the data. By combining the short-term and long-term change rates, a change feature vector is formed to provide data support for subsequent sampling frequency adjustment. According to the change feature vector, the system evaluates the importance of each data monitoring information based on a preset rule. The rule takes into account the change amplitude, volatility of the data, and the degree of influence on the system monitoring target. The system assigns a priority score to each data monitoring information according to the evaluation result. The data with a higher priority is usually a key monitoring indicator or data that has a greater impact on the system stability. In this way, the system can automatically determine which data needs to be sampled more frequently and which data can appropriately reduce the sampling frequency, so as to optimize the use of resources. After obtaining the change feature vector and the priority score of each data monitoring information, the system uses the non-linear mapping function to convert this information into a sampling frequency adjustment factor. This function dynamically adjusts the sampling period of the data according to the change characteristics and the priority score. For data with frequent changes or a higher priority, the system will automatically shorten the sampling period to ensure timely update of the data; while for data with slow changes or a lower priority, the system will appropriately extend the sampling period to reduce unnecessary resource consumption. In this way, the system can automatically determine the optimal sampling period for each data monitoring information, ensuring the monitoring quality while saving system resources.
[0102] Furthermore, after determining the optimal sampling period, the system will monitor the usage of system resources in real time through a built-in resource evaluator. The resource evaluator can track the consumption of resources such as CPU, memory, and network bandwidth. When the system resources are strained, the evaluator will adjust the optimal sampling period according to the current resource load and priority situation. For example, the system may extend the sampling period for low-priority data or shorten the sampling period for high-priority data to ensure the timely collection of critical monitoring data under limited resources. This ensures that the system can flexibly adjust the sampling strategy according to the actual situation and maintain high-quality monitoring effects under limited resources. The adaptive sampling mechanism in this embodiment can dynamically adjust the sampling frequency according to real-time data changes and system resource conditions, optimize the resource usage efficiency of the system, and ensure the efficient collection of critical monitoring data. This mechanism is particularly suitable for resource-constrained edge devices such as AMC and CAC units, reducing resource occupancy while enhancing the system monitoring ability.
[0103] In one embodiment, the Go language-based auxiliary control detection method further includes:
[0104] Using a health detection module to monitor resource usage, process activities, communication quality, and functional integrity respectively to obtain system monitoring data;
[0105] Performing multi-level threshold detection on the system monitoring data to classify the system status into multiple status levels; wherein, the status levels include normal, warning, danger, and emergency;
[0106] When the status level is warning, trigger logging and notify the user;
[0107] When the status level is danger, start resource adjustment and process restart;
[0108] When the status level is emergency, execute a complete system recovery process to restore the system to a normal state;
[0109] Transmit the multiple status levels to the host computer through a serialization protocol to display the system status in the configuration management interface.
[0110] In this embodiment, the health detection module monitors four key dimensions in real time: resource usage (including the consumption of resources such as CPU, memory, disk, etc.), process activities (including the running status and response time of processes), communication quality (including latency and packet loss rate), and functional integrity (including the availability of key functions). The health detection module continuously acquires and analyzes these data to generate system monitoring data, providing basic information for subsequent status judgment and self-healing mechanisms. After obtaining the system monitoring data, the system will analyze and judge these data through multi-level threshold detection. According to the preset threshold rules, the system divides the status into four levels: normal, warning, dangerous, and critical. Each status level corresponds to different system operating conditions and anomaly severities, where "normal" indicates that the system is running stably, and the other levels indicate anomalies of different degrees. The warning level indicates that there are potential problems in the system, the dangerous level indicates that the problems are relatively serious, and the critical level indicates that the system is in a serious failure state and needs to be restored immediately.
[0111] When the status level of the system monitoring data is warning, the system will automatically trigger the logging function and record the monitored abnormal information. The system will also notify the user through an appropriate notification mechanism (such as email, SMS, pop-up prompt, etc.), indicating that there are potential problems in the system. This measure can help managers discover problems in a timely manner and take corresponding preventive measures. When the status level of the system reaches dangerous, it means that the problems are relatively serious and the system needs to perform self-healing processing. At this time, the system will start the resource adjustment mechanism to optimize the allocation of system resources to relieve resource pressure; at the same time, the system will try to restart relevant processes to ensure that key processes resume normal operation. Through these self-healing measures, the system can automatically return to the normal working state without relying entirely on manual intervention. When the system status level is critical, it means that the system has experienced a catastrophic failure and comprehensive recovery measures need to be taken immediately. At this time, the system will start a complete system recovery process, including restoring configurations, reloading key status information, and executing recovery strategies, etc., to ensure that the system returns to the normal working state. This process aims to minimize data loss and business interruption and reduce the system recovery time to the lowest.
[0112] Finally, the system will transmit multiple status levels in the monitoring data to the host computer through the serialization protocol. After receiving this information, the host computer will perform visual display through the configuration management interface, enabling managers to view the health status of the system in real time. Through the graphical interface, users can intuitively understand the current operating conditions of the system, discover potential problems in a timely manner, and perform corresponding processing.
[0113] In one embodiment, the auxiliary control detection method based on the Go language further includes:
[0114] Obtain the primary cache of the data acquisition module and the secondary cache of the host computer;
[0115] Adjust the size of the primary cache according to the device resource usage to maximize the data retention time;
[0116] Introduce a retrieval mechanism into the secondary cache and synchronize the missing data of the system through parallel synchronization technology.
[0117] In this embodiment, the primary cache of the data acquisition module and the secondary cache of the host computer are obtained. The primary cache is located at the data acquisition unit side (i.e., corresponding to the data acquisition module) and is used to temporarily store the latest collected data; while the secondary cache is located at the host computer side (i.e., corresponding to the host computer) and undertakes the task of storing and managing a larger scale of historical data. The primary cache and the secondary cache together constitute the data protection architecture of the system, ensuring that data can be effectively stored and restored in an environment with unstable network. The system dynamically adjusts the size of the primary cache according to the usage of device resources. The primary cache adopts a circular buffer design, supporting high-speed writing and circular overwriting to ensure that the latest data can always be retained. According to the storage resources and load conditions of the device, the system will adjust the size of the cache to maximize the data retention time and avoid cache overflow. For devices with relatively tight resources, the cache size will be appropriately reduced to reduce resource occupancy; while for devices with sufficient resources, the cache space will be increased to retain as much monitoring data as possible under limited storage conditions. The system introduces a retrieval mechanism into the secondary cache to optimize the data access efficiency. The secondary cache adopts a hierarchical storage architecture, storing hot data in a high-speed in-memory database to support real-time query and analysis; while cold data is migrated to persistent storage to provide long-term historical records. To ensure high access performance in a large amount of historical data, the system implements an intelligent indexing and retrieval mechanism to ensure that users can quickly retrieve and access the required data. In addition, the system also uses parallel synchronization technology to ensure that the missing data of the system can be effectively synchronized and restored after a network interruption. When the network resumes, the system will use the incremental transmission method to only transmit the missing data and use parallel synchronization technology to process multiple data streams simultaneously to maximize the recovery efficiency. Through the priority scheduling mechanism, key data will be synchronized first to ensure that core business data can be restored as soon as possible under limited bandwidth, ensuring the continuity of the system and the integrity of the data.
[0118] In one embodiment, the auxiliary control detection method based on the Go language further includes steps of fault tracing and diagnosis:
[0119] In the first step, the system deploys lightweight probes at key points to capture all important operations and state transition events in real time. These events include control commands, communication activities, and resource changes, etc., ensuring that key actions during the system operation can be comprehensively recorded. Each event is attached with a timestamp, source identifier, and context information, forming a complete event chain. In this way, the system can establish a detailed operation history record, ensuring that comprehensive event data can be provided in case of a failure, providing sufficient basis for subsequent fault diagnosis.
[0120] In the second step, the system also records the system state regularly or before and after key operations, including key information such as resource usage (such as CPU, memory, disk, etc.), configuration parameters, and operating environment. The snapshot collector generates state snapshots at each critical moment as the benchmark data for subsequent fault analysis. To save storage space, the system adopts incremental storage technology, only recording the changed parts of the state, thereby minimizing the storage overhead and ensuring efficient storage and fast access. These state snapshot data provide important time-point snapshots for the system, which can be used for backtracking and positioning after a failure occurs.
[0121] In the third step, when a system failure occurs, the causal relationship analysis engine starts from the failure point and traces back the event chain and state changes. The engine identifies the initial event that caused the failure and its triggering conditions through temporal correlation analysis and impact propagation models. Specifically, the system will analyze the causal relationships between various operations and states in the event chain, trace the system behavior before the failure occurred, and determine the association between the changes in key operations or states and the failure. The analysis results are presented visually, intuitively showing the process of the failure occurrence, helping technicians quickly understand the failure mechanism and cause.
[0122] In the fourth step, through temporal correlation analysis and causal relationship tracing, the system can generate a complete chain of the failure occurrence and visually display the analysis results on the interface. Users can intuitively view the process of the failure occurrence through the graphical interface, trace back the event chain from the failure point, and find the root cause of the failure. This visual analysis not only helps technicians quickly locate the cause of the failure but also provides data support for subsequent failure prevention and system optimization.
[0123] In the fifth step, based on the above fault tracing framework, the system can shorten the traditional fault location time from hours to minutes. Through fast and accurate fault diagnosis and location, the system can respond in a timely manner and take necessary recovery measures, reducing the system downtime. Through efficient fault tracing and diagnosis technologies, the maintenance costs of AMC and CAC devices are significantly reduced, and the operating efficiency of the system is improved.
[0124] Combined with Figure 3As shown in the figure, an auxiliary control detection system based on the Go language is also provided in an embodiment of the present invention. The system adopts a modular design and includes multiple functional modules, capable of realizing efficient data acquisition, processing, transmission, and control. The main modules of this system are as follows:
[0125] Host computer main program (i.e., host computer): responsible for managing the configuration parameters of the probe system and flexibly configuring each module through a configuration file.
[0126] Network message monitoring module (i.e., network message monitoring): Based on the gopacket library, it captures and parses network messages of the IEC 104 protocol, providing data support required for the decision-making of the control unit. This module consists of a message capture sub-module and a message parsing sub-module. The message capture sub-module is responsible for capturing messages on the target network device, and the message parsing sub-module is responsible for parsing the ASDU data in the IEC104 protocol.
[0127] System metric collection module (i.e., system metric collection): Collects key metrics of the system, such as CPU usage, memory usage, disk usage, and system load, through the gopsutil library, and encapsulates these metrics into structured data objects for evaluating the health status and execution ability of the system.
[0128] Control execution module (i.e., protocol parsing and edge computing): Includes an instruction parsing sub-module and an execution feedback sub-module. The instruction parsing sub-module is responsible for parsing the control instructions sent by the host computer, and the execution feedback sub-module is responsible for executing the control operation and generating status feedback information.
[0129] Serial communication module (i.e., communication conversion circuit): Responsible for transmitting the collected data to the host computer through serial communication. This module includes a data packing sub-module and a data sending sub-module. The data packing sub-module packs the collected system metrics, network message data, and execution status information according to a custom binary protocol format, and the data sending sub-module sends the packed data to the host computer through the serial port.
[0130] Process monitoring module (i.e., real-time monitoring): This module is used to monitor the running status of a specified process and report the process status information to ensure the reliable execution of the control function.
[0131] This system adopts a modular design. Each functional module conducts data interaction through channels, ensuring loose coupling of the system architecture, facilitating subsequent functional expansion and maintenance. Moreover, the system supports multiple data transmission methods. It can transmit data through the serial port using a custom binary protocol, and also supports converting data into JSON format for transmission to meet the communication requirements of different external devices. The system has functions of protocol parsing and health fault monitoring. It can parse the messages of the IEC 104 protocol and provide decision-making support for the control unit. Through the custom binary protocol, it efficiently transmits the collected data to ensure effective data support and control assistance in scenarios such as industrial control and Internet of Things device monitoring.
[0132] This system provides an efficient and reliable industrial control and monitoring solution by integrating multifunctional modules such as network message monitoring, system metric collection, control execution and feedback, health monitoring, and fault diagnosis. The modular design of the system makes functional expansion and maintenance more convenient; through the custom protocol and flexible data transmission methods, the system can adapt to different communication requirements, ensuring efficient data transmission and real-time monitoring. This system is applicable to multiple application scenarios such as industrial automation and Internet of Things device monitoring, and is particularly suitable for providing full closed-loop management from monitoring to control in AMC and CAC environments.
[0133] Combined Figure 4 as shown Figure 4 A Go-language-based auxiliary control detection device provided by an embodiment of the present invention, the Go-language-based auxiliary control detection device 400 includes:
[0134] A data loading unit 401, configured to load a configuration file and initialize configuration information;
[0135] A data connection unit 402, configured to initialize a communication serial port using the configuration information and establish a communication connection between the host computer and the data acquisition module;
[0136] A data monitoring unit 403, configured to create a message monitor and start the monitoring function, monitor the status and operation of the data acquisition module, and obtain data monitoring information;
[0137] A data acquisition unit 404, configured to start the communication serial port and obtain the system metric information of the data acquisition module, as well as the acquisition process status monitoring information;
[0138] A data transmission unit 405, configured to transmit the data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port respectively.
[0139] In this embodiment, the data loading unit 401 loads the configuration file and initializes the configuration information; the data connection unit 402 initializes the communication serial port by using the configuration information and establishes a communication connection between the host computer and the data acquisition module; the data monitoring unit 403 creates a message monitor and starts the monitoring function to monitor the status and operation of the data acquisition module, and obtains data monitoring information; the data acquisition unit 404 starts the communication serial port and obtains the system index information of the data acquisition module and the acquisition process status monitoring information; the data transmission unit 405 transmits the data monitoring information, the system index information, and the process status monitoring information to the host computer through the communication serial port respectively.
[0140] In one embodiment, the data connection unit 402 includes:
[0141] A type recognition unit, configured to recognize the communication protocol type according to the configuration information;
[0142] A type parsing unit, configured to call a corresponding protocol parser according to the communication protocol type to extract data content and protocol meta-information, and obtain a parsing result;
[0143] A protocol conversion unit, configured to perform protocol conversion on the parsing result by using a template mapping mechanism, map fields of different protocols to a standard data model, so as to realize data format standardization.
[0144] In one embodiment, the data transmission unit 405 includes:
[0145] An information analysis unit, configured to analyze the transmitted information by using a data characteristic analyzer, detect the type, structural characteristics, and change pattern of each piece of information, and generate a corresponding information characteristic description;
[0146] An information encoding unit, configured to select a suitable serialization method from a policy library by using a serialization policy selector and apply different encoding methods to each of the information characteristic descriptions;
[0147] An information transmission unit, configured to divide a large data set in the transmitted information into data blocks based on the serialization method, sort and transmit the data blocks according to a multi-level queue scheduling, and dynamically adjust transmission parameters during the transmission process.
[0148] In one embodiment, the information transmission unit includes:
[0149] A data adjustment unit, configured to dynamically adjust the data compression ratio of the data blocks according to the network condition and the CPU load;
[0150] A data sending unit, configured to dynamically adjust the data sending interval and data transmission rate according to the device load of the data acquisition module. Specifically, when the device load of the data acquisition module increases, the data sending interval is extended; when the device load of the data acquisition module decreases, the data transmission rate is increased.
[0151] A data adding unit, configured to add CRC check information to the data block to reduce the data transmission volume.
[0152] In one embodiment, the Go language-based auxiliary control detection device 400 further includes:
[0153] A data adding unit, configured to calculate the short-term change rate and long-term change rate of the data monitoring information respectively to obtain a change feature vector.
[0154] A data allocation unit, configured to evaluate the importance of each data monitoring information based on the change feature vector according to a preset rule and assign a priority score to the data monitoring information.
[0155] A function adjustment unit, configured to use the non-linear mapping function to convert the change feature vector and the priority score into a sampling frequency adjustment factor respectively to obtain the optimal sampling period of the data monitoring information.
[0156] A period adjustment unit, configured to monitor the system resource usage situation by using a built-in resource evaluator after obtaining the optimal sampling period to adjust the optimal sampling period.
[0157] In one embodiment, the Go language-based auxiliary control detection device 400 further includes:
[0158] A resource monitoring unit, configured to use a health detection module to monitor resource usage, process activities, communication quality, and functional integrity respectively to obtain system monitoring data.
[0159] A threshold setting unit, configured to perform multi-level threshold detection on the system monitoring data to divide the system state into multiple state levels. Among them, the state levels include normal, warning, dangerous, and emergency.
[0160] A first-level unit, configured to trigger log recording and notify the user when the state level is warning.
[0161] A second-level unit, configured to start resource adjustment and process restart when the state level is dangerous.
[0162] A third-level unit, configured to execute a complete system recovery process to restore the system to a normal state when the state level is emergency.
[0163] A level upload unit for transmitting the multiple state levels to the host computer through a serialization protocol to display the system state in a configuration management interface.
[0164] In one embodiment, the Go language-based auxiliary control detection device 400 further includes:
[0165] A cache acquisition unit for acquiring the primary cache of the data acquisition module and the secondary cache of the host computer;
[0166] A primary cache unit for adjusting the size of the primary cache according to the device resource usage to maximize the data retention time;
[0167] A secondary cache unit for introducing a retrieval mechanism into the secondary cache and synchronizing the missing data of the system through parallel synchronization technology.
[0168] Since the embodiments of the device part correspond to the embodiments of the method part, for the descriptions of the embodiments of the device part, please refer to the descriptions of the embodiments of the method part, which will not be elaborated here.
[0169] An embodiment of the present invention also provides a computer-readable storage medium with a computer program stored thereon. When the computer program is executed, the steps provided in the above embodiments can be implemented. The storage medium may include various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.
[0170] An embodiment of the present invention also provides a computer device, which may include a memory and a processor. When the processor calls the computer program stored in the memory, the steps provided in the above embodiments can be implemented. Of course, the computer device may also include various network interfaces, power supplies, and other components.
[0171] The embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple. For the relevant parts, please refer to the description in the method part. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
[0172] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device that comprises a series of elements includes not only those elements but also other elements not expressly listed, or elements that are inherent to such process, method, article, or device. Without further limitation, an element defined by the phrase "comprising an..." does not exclude the presence of additional identical elements in the process, method, article, or device that comprises the element.
Claims
1. An auxiliary control detection method based on the Go language, characterized in that, Including: Loading a configuration file and initializing configuration information; Initializing a communication serial port using the configuration information and establishing a communication connection between the host computer and the data acquisition module; Creating a message monitor and starting the monitoring function to monitor the status and operation of the data acquisition module, obtaining data monitoring information; Starting the communication serial port and obtaining the system metric information of the data acquisition module and the acquisition process status monitoring information; Transmitting the data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port respectively.
2. The auxiliary control detection method based on the Go language according to claim 1, characterized in that, Also including: Calculating the short-term change rate and long-term change rate of the data monitoring information respectively to obtain a change feature vector; Evaluating the importance of each data monitoring information according to a preset rule based on the change feature vector and assigning a priority score to the data monitoring information; Using the non-linear mapping function to convert the change feature vector and the priority score into a sampling frequency adjustment factor respectively to obtain the optimal sampling period of the data monitoring information; After obtaining the optimal sampling period, using a built-in resource evaluator to monitor the system resource usage to adjust the optimal sampling period.
3. The auxiliary control detection method based on the Go language according to claim 1, wherein, The initializing the communication serial port using the configuration information includes: Identifying the communication protocol type according to the configuration information; Invoking a corresponding protocol parser according to the communication protocol type to extract data content and protocol meta-information to obtain a parsing result; Using a template mapping mechanism to perform protocol conversion on the parsing result, mapping fields of different protocols into a standard data model to achieve data format standardization.
4. The auxiliary control detection method based on the Go language according to claim 1, characterized in that The transmitting the data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port respectively includes: Using a data characteristic analyzer to analyze the transmitted information, detecting the type, structural characteristics, and change pattern of each information, and generating a corresponding information characteristic description; Using a serialization strategy selector to select a suitable serialization method from a strategy library and applying different encoding methods to each information characteristic description; Based on the serialization method, splitting a large data set in the transmitted information into data blocks, sorting and transmitting the data blocks according to a multi-level queue scheduling, and dynamically adjusting transmission parameters during the transmission process.
5. The auxiliary control detection method based on the Go language according to claim 4, wherein The dynamically adjusting transmission parameters during the transmission process includes: Dynamically adjusting the data compression ratio of the data blocks according to the network condition and CPU load; Dynamically adjusting the data sending interval and data transmission rate according to the device load of the data acquisition module, where when the device load of the data acquisition module increases, extending the data sending interval, and when the device load of the data acquisition module decreases, increasing the data transmission rate; Adding CRC check information to the data blocks to reduce the data transmission volume.
6. The auxiliary control detection method based on the Go language according to claim 1, characterized in that, Also including: Using a health detection module to monitor resource usage, process activities, communication quality, and functional integrity respectively to obtain system monitoring data; Performing multi-level threshold detection on the system monitoring data to divide the system state into multiple state levels; where the state levels include normal, warning, dangerous, and emergency; When the status level is a warning, trigger logging and notify the user; When the status level is dangerous, initiate resource adjustment and process restart; When the status level is critical, execute a complete system recovery process to restore the system to a normal state; Transmit multiple said status levels to the host computer through a serialization protocol to display the system status in the configuration management interface.
7. The auxiliary control detection method based on the Go language according to claim 1, characterized in that Further includes: Obtain the primary cache of the data acquisition module and the secondary cache of the host computer; Adjust the size of the primary cache according to the device resource usage to maximize the data retention time; Introduce a retrieval mechanism into the secondary cache and synchronize the missing data of the system through parallel synchronization technology.
8. An auxiliary control detection device based on the Go language, characterized in that, Includes: A data loading unit for loading a configuration file and initializing configuration information; A data connection unit for initializing a communication serial port using the configuration information and establishing a communication connection between the host computer and the data acquisition module; A data monitoring unit for creating a message monitor and starting the monitoring function, monitoring the status and operation of the data acquisition module to obtain data monitoring information; A data acquisition unit for starting the communication serial port and obtaining the system metric information of the data acquisition module, as well as collecting process status monitoring information; A data transmission unit for transmitting the data monitoring information, system metric information, and process status monitoring information to the host computer through the communication serial port respectively.
9. A computer device, characterized in that, Includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the Go language-based auxiliary control detection method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements the Go language-based auxiliary control detection method according to any one of claims 1-7.