A DCS controller log system implementation method and device
Through the introduction of the message queue asynchronous storage and power -off and backup power supply mechanism in the DCS control log log system, excessive logaric information affects the problem of real -time reality and loss of power outage, and realizes more efficient log processing and more reliable reliable log processing and more reliable logging. The log is stored.
Patent Information
- Application Number
- CN202011222061.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-05
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2040-11-05
AI Technical Summary
When the existing DCS controller logging system is too much log information, it may affect the system's real-time performance, resulting in increased CPU load and delayed hard real-time tasks.
Asynchronous storage is achieved by integrating log information in the log storage function and sending the integrated log information to the log task through the message queue. At the same time, the log task is executed when the system is idle, and the backup power supply and energy storage capacitor are used to save log information in the event of a power outage.
It effectively solves the latency of a large number of logs caused by the real -time realization of the system, improves the efficiency of the problem solving, and ensures the integrity of the log information under the power disconnection, and improves the availability and reliability of the system.
Smart Images

Figure CN112506686B_ABST
Abstract
Description
Technical Field
[0001] This article relates to log processing technology, and in particular to a method and device for implementing a DCS controller log system. Background Art
[0002] DCS (distributed control system) control systems are currently widely used in various industrial production fields, such as chemical industry, electric power, etc. The controller is the core equipment in the DCS system, and usually runs automatically for a long time in a field environment without human intervention. The controller log system is used to record daily operation information and fault information during the operation of the controller. When a fault occurs, the content recorded in the log file is the first field data for analyzing the problem. The log information at the time of the fault can be used to locate the running branch and process of the program, which is an indispensable and important method to determine the cause of the field fault.
[0003] The current DCS controller log system can complete the basic function of log storage, but there are the following problems: when the amount of log information is too much, it may affect the real-time performance of the controller system. Because the process of the log system writing logs is essentially the process of the CPU (central processing unit) erasing the non-volatile storage medium when the power is off, such as Figure 1 This will inevitably increase the load consumption of the entire system. In the case of limited CPU computing resources, it will cause delays for hard real-time tasks in the system. Summary of the invention
[0004] The embodiments of the present application provide a method and device for implementing a DCS controller log system, which can effectively solve the problem of delay impact on system real-time performance caused by a large number of existing logs and improve problem solving efficiency.
[0005] The present application embodiment provides a DCS controller log system implementation method, the method may include:
[0006] When the log task calls the interface of the preset log storage function, the log information is integrated inside the log storage function, and the integrated log information is sent to the log task through the message queue;
[0007] When the log task starts to be executed, the log task receives the log message from the message queue, parses the log message, and caches the log message according to the message type of the log message.
[0008] In an exemplary embodiment of the present application, caching the log message according to the message type of the log message may include:
[0009] When it is determined that the message type of the log message is log writing, determining whether the current cache is full;
[0010] If the cache is full, the content in the cache is synchronized to a preset storage medium, and the log information to be written is saved in the cache; if the cache is not full, the log information to be written is directly saved in the cache.
[0011] In an exemplary embodiment of the present application, the method may further include: after a system task with a higher priority than the log task is completed and the control system of the distributed control system DCS controller is in an idle state, executing the log task.
[0012] In an exemplary embodiment of the present application, the DCS controller may include a power failure backup power supply;
[0013] The method may further include: when detecting that the main power supply of the DCS controller is powered off, switching the power supply of the DCS controller to the power-off standby power supply and sending a power-off interrupt signal; waking up the log task through the interrupt signal, and saving the log information into the power-off non-volatile storage medium through the log task.
[0014] In an exemplary embodiment of the present application, waking up the log task by the interrupt signal may include:
[0015] The interrupt signal is received and fed back through a preset interrupt processing function, and a first message indicating a power failure event is sent to the log task, so as to wake up the log task through the first message.
[0016] In an exemplary embodiment of the present application, the step of saving the log information into a power-off non-volatile storage medium through a log task may include:
[0017] After the log task is awakened, a verification code is generated for the log information through a preset verification algorithm, and the log information and the verification code are saved together in the power-off non-volatile storage medium.
[0018] In an exemplary embodiment of the present application, the power-off backup power supply may include an energy storage capacitor; the energy storage capacitor is charged when the main power supply is not powered off, and is discharged when the main power supply is powered off, so as to provide power for the DCS controller.
[0019] In an exemplary embodiment of the present application, the integration may include: collecting and / or formatting the auxiliary information; the auxiliary information may include any one or more of the following: task name, task priority, and recording time.
[0020] In an exemplary embodiment of the present application, the method may further include: the reading and storing of the log information is directly completed by a central processing unit CPU, or is completed by using direct memory storage DMA.
[0021] An embodiment of the present application also provides a DCS controller log system implementation device, which may include a processor and a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and is characterized in that when the instructions are executed by the processor, any one of the above-mentioned DCS controller log system implementation methods is implemented.
[0022] Compared with the related art, the embodiment of the present application may include: when the log task of the log application calls the interface of the preset log storage function, the log information is integrated inside the log storage function, and the integrated log information is sent to the log task through the message queue; when the log task starts to execute, the log task receives the log message from the message queue, parses the log message, and caches the log message according to the message type of the log message. Through this embodiment, the delay effect of a large number of existing logs on the real-time performance of the system is effectively solved, and the efficiency of problem solving is improved.
[0023] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by implementing the present application. Other advantages of the present application can be realized and obtained by the schemes described in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0025] Figure 1 A schematic diagram of the log information storage process in a log system in the related art;
[0026] Figure 2 A flow chart of a DCS controller log system implementation method according to an embodiment of the present application;
[0027] Figure 3 A schematic diagram of the log writing process of the log system in the embodiment of the present application;
[0028] Figure 4 A schematic diagram of the log recording process in a real-time task in the related technology;
[0029] Figure 5 A schematic diagram of the power-off process log execution process of an embodiment of the present application;
[0030] Figure 6 This is a block diagram of the DCS controller log system implementation device of the embodiment of the present application. DETAILED DESCRIPTION
[0031] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.
[0032] The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique invention scheme defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other invention schemes to form another unique invention scheme defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in the present application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the attached claims and their equivalents, the embodiments are not subject to other restrictions. In addition, various modifications and changes may be made within the scope of protection of the attached claims.
[0033] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and / or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.
[0034] The present application embodiment provides a DCS controller log system implementation method, such as Figure 2 As shown, the method may include steps S101-S102:
[0035] S101, when a log task calls an interface of a preset log storage function, log information is integrated inside the log storage function, and the integrated log information is sent to the log task via a message queue;
[0036] S102: When the log task starts to be executed, the log task receives the log message from the message queue, parses the log message, and caches the log message according to the message type of the log message.
[0037] In the exemplary embodiment of the present application, the problem of too many logs affecting the real-time performance of log tasks is solved by the following solutions: Figure 3 As shown, when a task calls the log storage function interface, the log storage function first integrates the log information internally, and then sends the log information to the log task through the message queue.
[0038] In an exemplary embodiment of the present application, the integration may include: collecting and / or formatting the auxiliary information; the auxiliary information may include any one or more of the following: task name, task priority, and recording time.
[0039] In an exemplary embodiment of the present application, the ancillary information collection may include information such as the task name, task priority, and recording time of the log recording.
[0040] In an exemplary embodiment of the present application, the method may further include: after a system task with a higher priority than the log task is completed and the control system of the distributed control system DCS controller is in an idle state, executing the log task.
[0041] In the exemplary embodiment of the present application, the log task is a background task with a lower priority. When a system task with a higher priority is executed, the log task will not be scheduled for execution, thereby not affecting the real-time performance of the high-priority task. When the task with a higher priority is completed and the system is idle, the log task is executed.
[0042] In an exemplary embodiment of the present application, caching the log message according to the message type of the log message may include:
[0043] When it is determined that the message type of the log message is log writing, determining whether the current cache is full;
[0044] If the cache is full, the content in the cache is synchronized to a preset storage medium, and the log information to be written is saved in the cache; if the cache is not full, the log information to be written is directly saved in the cache.
[0045] In an exemplary embodiment of the present application, after a log task starts to execute, the log task can first receive a log message from a message queue, and after receiving a new log message, parse the log message to determine the message type of the log message; if it is a write log type, first determine whether the current cache is full, if the cache is full, synchronize the cache to the storage medium, and then save the log information to be written to the cache, if the cache is not full, directly save the log information to be written to the cache. In this way, the impact of the direct log recording storage process on real-time performance of log tasks with high real-time requirements is solved.
[0046] The current DCS controller log system still has the problem that logs are easily lost after power failure. The current main log storage process, such as Figure 4 As shown in the figure, the log system usually writes log information to non-volatile storage media such as Flash (flash memory). Both Nand-Flash (internal flash memory) and Nor-Flash (non-volatile flash memory) are low-speed peripherals. If a power failure occurs during the process of writing log information, the log content will be lost.
[0047] In an exemplary embodiment of the present application, because the logs are stored in the cache, an abnormal power outage of the system will still cause the system logs to be lost. The embodiment of the present application proposes the following solution.
[0048] In an exemplary embodiment of the present application, the DCS controller may include a power failure backup power supply;
[0049] The method may further include: when detecting that the main power supply of the DCS controller is powered off, switching the power supply of the DCS controller to the power-off standby power supply and sending a power-off interrupt signal; waking up the log task through the interrupt signal, and saving the log information into the power-off non-volatile storage medium through the log task.
[0050] In an exemplary embodiment of the present application, in addition to conventional devices, the DCS controller hardware may also have a backup power supply circuit device (the backup power supply circuit device may be a capacitor-based device), which can provide backup power for the log storage process at the time of power failure. In the embodiment of the present application, the backup power supply circuit device may be referred to as a power failure protection power supply (i.e., a power failure backup power supply); the capacitor inside the power failure protection power supply is referred to as a power failure protection capacitor; and the control implementation inside the power failure protection power supply (such as the control implementation of a field programmable gate array FPGA) may be referred to as a power failure protection logic.
[0051] In an exemplary embodiment of the present application, the power-off backup power supply may include an energy storage capacitor; the energy storage capacitor is charged when the main power supply is not powered off, and is discharged when the main power supply is powered off, so as to provide power for the DCS controller.
[0052] In an exemplary embodiment of the present application, when the main power supply of the DCS controller is turned on, the DCS controller can maintain normal operation through the main power supply, and at the same time, the power-off protection capacitor (such as the energy storage capacitor) can obtain a charging effect. When the main power supply of the DCS controller is powered off, first, the power-off protection logic (FPGA instantiation implementation) can monitor the main power supply voltage in real time. When the main power supply voltage is lower than the set threshold, the power supply of the DCS controller is switched to the power-off standby power supply, and then a power-off interrupt signal is sent to the CPU.
[0053] In an exemplary embodiment of the present application, the power-off protection capacitor can produce a discharge effect, and the DCS controller can continue to work for 0.5s to 1s through the power-off protection capacitor.
[0054] In an exemplary embodiment of the present application, waking up the log task by the interrupt signal may include:
[0055] The interrupt signal is received and fed back through a preset interrupt processing function, and a first message indicating a power failure event is sent to the log task, so as to wake up the log task through the first message.
[0056] In an exemplary embodiment of the present application, during the power-off protection capacitor's power-on time period, the CPU receives an interrupt signal from the power-off protection logic and first enters the interrupt vector table to execute an external interrupt processing function entry instruction. Figure 5 As shown, in the interrupt processing function, the interrupt signal is received and responded to, and then a first message is sent to the log task in the user space, and the interrupt processing function is completed. The first message is predefined in the software initialization and represents the information of the power failure event.
[0057] In an exemplary embodiment of the present application, the step of saving the log information into a power-off non-volatile storage medium through a log task may include:
[0058] After the log task is awakened, a verification code is generated for the log information through a preset verification algorithm, and the log information and the verification code are saved together in the power-off non-volatile storage medium.
[0059] In an exemplary embodiment of the present application, after the log task is awakened by the message, a verification code is first generated for the log information through a verification algorithm (such as a cyclic redundancy check CRC algorithm), and then the log information and the verification code are saved together to a power-off non-volatile storage medium (such as Flash). After the main process of saving the log information is completed, the system goes into sleep until it is shut down.
[0060] In an exemplary embodiment of the present application, through the above solution, during a power outage, log information can be completely saved in a power-off non-volatile storage medium without causing loss.
[0061] In an exemplary embodiment of the present application, the method may further include: the reading and storing of the log information is directly completed by a central processing unit CPU, or is completed by using direct memory storage DMA.
[0062] In an exemplary embodiment of the present application, the reading and storage process of the DCS controller log information is mainly completed by direct reading and writing by the CPU, and DMA (Direct Memory Access) can also be used to complete the log reading and writing functions, reducing the CPU computing pressure and making the overall system performance higher.
[0063] In the exemplary embodiments of the present application, the embodiments of the present application at least include the following advantages:
[0064] 1. Small impact on real-time tasks. Compared with the traditional direct synchronous storage method of logs, the embodiment of the present application adopts an asynchronous storage method of background log tasks, which can effectively eliminate the performance impact of the log recording process on real-time tasks.
[0065] 2. Higher reliability. Compared with the situation where the traditional log records are incomplete and lost during power failure, the embodiment of the present application introduces a power failure protection power supply device (i.e., a power failure backup power supply), which can detect the system power failure event in time, maintain the CPU operation through the power failure protection capacitor, and complete the storage of log information, which completely solves the problem of incomplete loss of log records during power failure.
[0066] In the exemplary embodiments of the present application, the embodiments of the present application can effectively solve the problem of delay impact caused by the existing large number of logs on the real-time performance of the system, as well as the problem of easy loss of logs in the event of power outages, thereby improving the availability and reliability of the log system, providing complete and effective log materials for the on-site problem locating process, improving problem solving efficiency, and thus reducing maintenance costs.
[0067] The present application embodiment also provides a DCS controller log system implementation device 1, such as Figure 6As shown, it may include a processor 11 and a computer-readable storage medium 12, wherein the computer-readable storage medium 12 stores instructions, and when the instructions are executed by the processor 11, any one of the above-mentioned DCS controller log system implementation methods is implemented.
[0068] In the exemplary embodiments of the present application, any embodiments in the aforementioned method embodiments are applicable to the device embodiments and will not be described one by one here.
[0069] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A method for implementing a DCS controller log system, characterized in that: The method comprises: When a log task calls the interface of a preset log storage function, the log information is integrated inside the log storage function, and the integrated log information is sent to the log task through a message queue; the integration includes: collecting and / or formatting the ancillary information; the ancillary information may include any one or more of the following: task name, task priority, and recording time; After a system task with a higher priority than the log task is executed, the log task is executed when the control system of the distributed control system DCS controller is in an idle state; when the log task starts to be executed, the log task receives the integrated log information from the message queue, parses the integrated log information, and caches the integrated log information according to the message type of the integrated log information.
2. The DCS controller log system implementation method according to claim 1, characterized in that: The caching the integrated log information according to the message type of the integrated log information includes: When it is determined that the message type of the integrated log information is log writing, determining whether the current cache is full; If the cache is full, the content in the cache is synchronized to a preset storage medium, and the log information to be written is saved in the cache; if the cache is not full, the log information to be written is directly saved in the cache.
3. The DCS controller log system implementation method according to any one of claims 1-2, characterized in that: The DCS controller includes a power failure backup power supply; The method further includes: when detecting that the main power supply of the DCS controller is powered off, switching the power supply of the DCS controller to the power-off standby power supply and sending a power-off interrupt signal; waking up the log task through the interrupt signal, and saving the log information into the power-off non-volatile storage medium through the log task.
4. The DCS controller log system implementation method according to claim 3, characterized in that: The waking up the log task by the interrupt signal comprises: The interrupt signal is received and fed back through a preset interrupt processing function, and a first message indicating a power failure event is sent to the log task, so as to wake up the log task through the first message.
5. The DCS controller log system implementation method according to claim 3, characterized in that: The step of saving the log information into a power-off non-volatile storage medium through a log task includes: After the log task is awakened, a verification code is generated for the log information through a preset verification algorithm, and the log information and the verification code are saved together in the power-off non-volatile storage medium.
6. The DCS controller log system implementation method according to claim 3, characterized in that: The power-off backup power supply includes an energy storage capacitor; the energy storage capacitor is used to charge when the main power supply is not powered off, and to discharge when the main power supply is powered off, so as to provide power for the DCS controller.
7. The DCS controller log system implementation method according to any one of claims 1-2, characterized in that: The method further includes: the reading and storage of the log information is directly completed by a central processing unit (CPU), or is completed by using direct memory storage (DMA).
8. A device for implementing a DCS controller log system, comprising a processor and a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, characterized in that: When the instruction is executed by the processor, the DCS controller log system implementation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Combined type reset system processing method and device
CN101165630A
Safety-enhanced log file system
CN108920303A
Metadata request processing method, device and equipment and readable storage medium
CN110046132A
Method, device and equipment for recording IO request log in storage system
CN111858077A