A fast data recording method and system for real-time control system
By adopting redundancy mechanism and data synchronization technology in the real-time control system, data recording before and after the event is triggered solves the problem of being unable to record data before and after the fault occurs in the existing technology, and improves the reliability and time resolution of data recording. rate, ensuring support for failure analysis.
Patent Information
- Application Number
- CN202110817188.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-20
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-07-20
AI Technical Summary
Existing real-time control systems cannot effectively record data before and after a fault occurs, and the time resolution of the historical database is usually second-level, unable to support millisecond-level data detail recording, and data cannot be recorded when the control processing unit fails. Impact failure analysis.
The real-time control system adopts a redundant mechanism, and realizes data recording before and after event triggering through data synchronization between the main control processing unit and the backup control processing unit, and performs data storage with millisecond time resolution to ensure the integrity of data recording. performance and reliability.
It realizes the provision of pre- and post-event data records after the event occurs, solves the problem of being unable to record data before and after the fault occurs, and improves the reliability and integrity of data records through a dual redundancy mechanism to avoid data loss caused by single point failures.
Smart Images

Figure CN113687775B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of real-time data acquisition and storage, in particular to a real-time control data recording system with a redundancy mechanism and a fast data recording method. Background Art
[0002] In the prior art, a real-time control system generally refers to a real-time system centered on a computer and used for production process control. The system requires real-time collection of field data, and timely processing of the collected data, and then automatically controls the corresponding actuators so that certain parameters (such as temperature, pressure, orientation, etc.) can change according to a predetermined rule to ensure product quality and increase production. In general real-time control systems, the control processing unit is not provided with a separate data recording function, and an additional historical database needs to be configured. The historical database periodically collects and stores data from the control processing unit. The historical database of the real-time control system is a persistent storage of real-time data, which supports querying data changes within a certain period of time in the past. When a fault or accident occurs in the controlled object, the historical data stored in the historical database is used to recall the accident. By retrieving a period of data before and after the event, the cause of the fault is analyzed. Due to the limitations of capacity and performance of the historical database, its time resolution is usually stored in seconds, and the details of the data changes within seconds cannot be known. In some cases, it cannot provide sufficient data support to analyze the cause of the fault.
[0003] In situations where higher data sampling resolution is required, special SOE devices are used to record the displacement of discrete quantities. The SOE (Sequence Of Event) function of the real-time control system can usually achieve a time resolution of milliseconds, but it requires the use of additional SOE acquisition devices to support it. It can only support changes in discrete quantities and cannot support rapid changes in continuous signals. In addition, its capacity is relatively small.
[0004] In some real-time control systems, the control processing unit has a built-in data recording function. However, when a controlled object fails, if the control processing unit also fails or unexpectedly crashes, it is impossible to record the data before and after the failure and perform fault analysis based on these data. Summary of the invention
[0005] The object of the present invention is to provide a fast data recording method for a real-time control system and a corresponding real-time control data fast recording system, which can realize effective recording of data before and after a fault occurs, and does not require external additional hardware, thereby ensuring the integrity and reliability of data recording.
[0006] To achieve the above object, the present invention is implemented by adopting the following technical solutions:
[0007] In a first aspect, the present invention discloses a fast data recording method for a real-time control system, comprising: obtaining preset variable information of data to be collected, event trigger variable information, and length information of data to be recorded, wherein the data length information includes a data length N1 before the event is triggered and a data length N2 after the event is triggered;
[0008] Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered; and periodically collect real-time data of the corresponding variables according to the variable information of the data to be collected;
[0009] Determine whether the real-time data of the corresponding variable meets the preset event trigger condition according to the event trigger variable information: if not, store the collected real-time data in the first data buffer area in a circular overwrite mode, otherwise store the collected real-time data in the second data buffer area;
[0010] In response to the data length of the second data buffer area being equal to N2, the data of the current first data buffer area and the second data buffer area are merged to generate and store a data record file of the event.
[0011] Optionally, the real-time control system includes a main control processing unit and a backup control processing unit redundantly arranged with the main control processing unit and communicating with each other, and the fast data recording method is executed by the main control processing unit;
[0012] The method further includes: receiving status query information of the standby control processing unit, replying current event trigger status information to the standby control processing unit, and according to the current event trigger status: in the event untriggered state, sending the real-time data record length N1P of the first data buffer area to the standby control processing unit; in the event triggered state, sending the real-time data record length N1P of the first data buffer area and the real-time data record length N2P of the second data buffer area to the standby control processing unit; according to the current event trigger status: in the event untriggered state, synchronizing the data recorded in the first data buffer area to the standby control processing unit; in the event triggered state, synchronizing the data recorded in the first data buffer area and the second data buffer area to the standby control processing unit;
[0013] And, in response to the data length of the second data buffer area being equal to N2, a recording completion notification is sent to the standby control processing unit. The standby control processing unit achieves the reliability and integrity of the final data through data synchronization.
[0014] It can be seen that through data synchronization processing, the present invention can implement a data recording method under a data recording CPU redundant setting architecture. After the main CPU completes the recording, the backup CPU can also obtain data records before and after the event triggering, thereby realizing a redundant mechanism for data recording and further improving the reliability of data recording.
[0015] Optionally, the method further includes: in response to the variable real-time data satisfying a preset event trigger condition, sending event trigger notification information to the backup control processing unit. The idea of this implementation is to place the logic processing in the entire real-time control system as much as possible on the main control processing unit side, so that the backup control processing unit does not need to make an event trigger judgment again, but stores the real-time data in the second buffer area according to the received event trigger notification.
[0016] Optionally, the method further includes receiving the same external timing signal as the standby control processing unit;
[0017] When storing real-time data, the collected real-time data and its timestamp information are stored in the first data buffer area or the second buffer area;
[0018] When synchronizing data to the standby control processing unit, data synchronization is performed in the order of the timestamps of the stored data.
[0019] Therefore, synchronization between the master and standby CPUs can be achieved through external timing signals, and data time resolution at the ms level can be achieved.
[0020] Optionally, the method further includes receiving an event query request from a data query terminal, and transmitting the stored data record file information of the corresponding event to the data query terminal according to the event query request.
[0021] In a second aspect, the present invention provides a fast data recording method for a real-time control system based on a redundancy mechanism, wherein the real-time control system comprises a main control processing unit and a backup control processing unit which are redundantly arranged and communicate with each other, and the main control processing unit and the backup control processing unit are respectively provided with a first data buffer area, a second data buffer area and a third data buffer area;
[0022] The fast data recording method is executed by a standby control processing unit, and the method includes:
[0023] Sending status query information to the main control processing unit;
[0024] receiving the current event triggering status information and the real-time data record length information replied by the main control processing unit in response to the status query information;
[0025] receiving the data to be synchronized transmitted by the main control processing unit according to the current event triggering state, and storing the data in the third data buffer area;
[0026] Obtaining preset variable information of data to be collected and data length information to be recorded, wherein the data length information includes the data length N1 before the event is triggered and the data length N2 after the event is triggered;
[0027] Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered;
[0028] According to the variable information of the data to be collected, periodically collect real-time data of the corresponding variables;
[0029] According to the current event triggering status information replied by the main control processing unit: if the event has been triggered, the collected variable real-time data is stored in the second data buffer area; if the event has not been triggered, the collected variable real-time data is stored in the first data buffer area in a circular overwrite mode, and after the event is triggered, the collected variable real-time data is stored in the second data buffer area;
[0030] In response to receiving a record completion notification sent by the main control processing unit, or in response to the data record length of the second data cache area being equal to N2, based on the data in the first data cache area, the second data cache area, and the third data cache area, the data with a maximum length of N1 before the event is triggered and the data with a maximum length of N2 after the event is triggered are selected and merged to generate a data record file for the event and store it.
[0031] If the event has not been triggered when the standby control processing unit is started, for determining whether to trigger the subsequent event, as a preferred implementation, the method further includes, in the event-untriggered state, in response to receiving an event trigger notification sent by the main control processing unit, storing the collected real-time data in a second data buffer area;
[0032] And, monitor the working state of the main control processing unit, and switch to the working mode of the main control processing unit when the main control processing unit works abnormally. The idea of this implementation method is to put the work of the system logic processing part on the main control processing unit as much as possible, simplify the work of the backup control processing unit, and do not need to judge the event trigger again, but only need to store real-time data.
[0033] As another implementation method of the standby control processing unit realizing the trigger state acquisition, the method further includes obtaining preset event trigger variable information;
[0034] In the event-untriggered state, according to the event trigger variable information, it is determined whether the collected real-time data of the corresponding variable meets the preset event trigger condition: if not, the collected real-time data continues to be stored in the first data buffer area in a circular overwrite mode; if it is satisfied, the collected real-time data is stored in the second data buffer area. In this implementation mode, the standby control processing unit can also determine the event-triggered node by itself, thereby switching the data recording location.
[0035] Optionally, the receiving main control processing unit stores the to-be-synchronized data transmitted according to the current event trigger state into the third data buffer area, including: if the current event trigger state is that the event is not triggered, then N1P data of the first data buffer area transmitted by the main control processing unit are stored as pre-trigger data into the local third data buffer area; if the current time trigger state is that the event has been triggered, then N1P data of the first data buffer area and N2P data of the second data buffer area transmitted by the main control processing unit are stored as pre-trigger data and post-trigger data into the local third data buffer area, respectively;
[0036] The method of selecting data with a maximum length of N1 before the event is triggered and data with a maximum length of N2 after the event is triggered based on the data in the first data buffer area, the second data buffer area, and the third data buffer area for merging includes:
[0037] For pre-trigger data, if the real-time data length N1P' of the local first data buffer is less than N1 when the recording completion notification is received, and N1P'+N1P>N1, then the last recorded N1 pre-trigger data among the N1P data and the N1P' data are intercepted according to the timestamp as the recording result of the pre-trigger data, and if N1P'+N1P≤N1, then the N1P data and the N1P' data are merged as the pre-trigger data; if the real-time data length N1P' of the local first data buffer is greater than N1 when the recording completion notification is received, then the last recorded N1 data are intercepted from the N1P' data according to the timestamp as the pre-trigger data recording result;
[0038] For post-trigger data, the N2P' data stored in the local second data cache are merged with all post-trigger data synchronized in the local third data cache, and the data with a maximum length of N2 recorded after the event is triggered is intercepted according to the timestamp to obtain the post-trigger data recording result.
[0039] In a third aspect, the present invention further discloses a real-time control data recording system with a redundancy mechanism, comprising a timing device, a data query terminal, and a main control processing unit and a backup control processing unit which are redundantly arranged and communicate with each other; the main control processing unit and the backup control processing unit are respectively provided with a first data buffer area, a second data buffer area and a third data buffer area;
[0040] The timing device sends the same timing signal to the main control processing unit and the standby control processing unit respectively, so that the main control processing unit and the standby control processing unit have the same clock source information;
[0041] The main control processing unit is started before the standby control processing unit, executes the fast data recording method described in the first aspect, collects real-time system data, realizes data recording and generation before and after event triggering, and performs data synchronization with the standby control processing unit when the standby control processing unit is started;
[0042] The standby control processing unit executes the fast data recording method described in the second aspect, performs data synchronization with the main control processing unit at startup, collects real-time system data after startup, and generates data recording results before and after event triggering after receiving a recording completion notification from the main control processing unit;
[0043] The data query terminal sends an event query request to the main control processing unit or the backup processing unit in response to the query information input by the user, and the main control processing unit or the backup processing unit transmits the stored data record file information of the corresponding event to the data query terminal according to the event query request;
[0044] The standby control processing unit monitors the working state of the main control processing unit, and switches to the working mode of the main control processing unit when the main control processing unit works abnormally; the abnormal main control processing unit works in the working mode of the standby control processing unit after restarting.
[0045] By accessing high-precision timing signals, the data time resolution of the present invention can reach the ms level, and no additional hardware is required. The dual redundancy mechanism can ensure the integrity and reliability of the data.
[0046] Compared with the prior art, the present invention has the following beneficial effects:
[0047] The present invention can provide data of a period of time before and after an event occurs, thereby solving the problem in the prior art that data before and after a fault occurs cannot be recorded.
[0048] At the same time, the present invention also implements a data recording method of a dual-redundancy mechanism: the main and standby CPUs have a fast data recording function respectively, and use a partitioned cache to quickly record the data before and after the accident. The redundant CPUs synchronize the state and data of the data records of both parties through a redundant network to avoid the loss of recorded data due to a single CPU crash or CPU redundancy switching during the data recording process, thereby affecting the fault analysis and ensuring the integrity and reliability of the data records. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 The figure is a schematic diagram of an embodiment of the real-time control data recording system of the invention;
[0050] Figure 2 The figure is a schematic flow chart of a real-time data recording method executed by a main control processing unit in an embodiment;
[0051] Figure 3 The figure is a schematic flow chart of a real-time data recording method executed by a standby control processing unit in an embodiment. DETAILED DESCRIPTION
[0052] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0053] Example 1
[0054] This embodiment discloses a fast data recording method for a real-time control system. Figure 2 , the method includes: obtaining preset variable information of data to be collected, event trigger variable information and data length information to be recorded, wherein the data length information includes data length N1 before event triggering and data length N2 after event triggering;
[0055] Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered; and periodically collect real-time data of the corresponding variables according to the variable information of the data to be collected;
[0056] Determine whether the real-time data of the corresponding variable meets the preset event trigger condition according to the event trigger variable information: if not, store the collected real-time data in the first data buffer area in a circular overwrite mode, otherwise store the collected real-time data in the second data buffer area;
[0057] In response to the data length of the second data buffer area being equal to N2, the data of the current first data buffer area and the second data buffer area are merged to generate and store a data record file of the event.
[0058] By partitioning and caching the real-time data according to the trigger point time, this embodiment can achieve complete recording of the data before and after the fault.
[0059] Example 2
[0060] Based on Example 1, this example introduces a fast data recording method for a real-time control system based on a CPU redundancy mechanism. Figure 1As shown, the real-time control system includes a main control processing unit, i.e., a main CPU, and a standby control processing unit, i.e., a standby CPU, which is redundantly set with the main control processing unit and communicates with each other. The main and standby CPUs access the same source timing signal through the timing device to ensure that the data collected by the main and standby CPUs have timestamps based on the same clock source.
[0061] In application, in this embodiment, the CPU that starts up first is used as the main CPU, that is, the CPU that starts up first starts working according to the working mode of the main CPU, and the CPU that starts up later starts working according to the working mode of the standby CPU.
[0062] In combination with Example 1, Figure 1 , the fast data recording method executed by the main CPU in this embodiment includes:
[0063] Obtaining preset variable information of data to be collected, event trigger variable information, and data length information to be recorded, wherein the data length information includes the data length N1 before the event trigger and the data length N2 after the event trigger;
[0064] Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered; and periodically collect real-time data of the corresponding variables according to the variable information of the data to be collected;
[0065] Determine whether the real-time data of the corresponding variable meets the preset event trigger condition according to the event trigger variable information: if not, store the collected real-time data in the first data buffer area in a circular overwrite mode, otherwise store the collected real-time data in the second data buffer area, and send event trigger notification information to the standby control processing unit;
[0066] While data is being collected and recorded, if the status query information of the standby control processing unit is received, the current event trigger status information is replied to the standby control processing unit, and according to the current event trigger status: in the event untriggered state, the real-time data record length N1P of the first data buffer area is sent to the standby control processing unit; in the event triggered state, the real-time data record length N1P of the first data buffer area and the real-time data record length N2P of the second data buffer area are sent to the standby control processing unit; according to the current event trigger status: in the event untriggered state, the data recorded in the first data buffer area is synchronized to the standby control processing unit; in the event triggered state, the data recorded in the first data buffer area and the second data buffer area are synchronized to the standby control processing unit;
[0067] In response to the data length of the second data buffer area being equal to N2, the data of the current first data buffer area and the second data buffer area are merged, a data record file of the event is generated and stored, and a record completion notification is sent to the standby control processing unit.
[0068] Furthermore, in this embodiment, the main CPU and the standby CPU receive the same external timing signal;
[0069] When storing real-time data, the main CPU stores the collected real-time data and its timestamp information in the first data buffer area or the second buffer area;
[0070] When the main CPU synchronizes data to the standby control processing unit, the data synchronization is performed in the order of the timestamps of the stored data.
[0071] This embodiment can not only realize the recording of data before and after the failure, but also improve the reliability of data recording through the redundant design of the active and standby CPUs, the data synchronization mechanism and the data merging logic design. When any CPU works abnormally, it will not affect the generation of data files.
[0072] In addition to executing system logic functions, the main CPU and the standby CPU are also responsible for receiving event query requests from the data query terminal, and transmitting the stored data record file information of the corresponding event to the data query terminal according to the event query request.
[0073] During the operation of the main CPU, the standby CPU periodically queries the working status of the main CPU, and the main CPU replies corresponding working status information to the standby CPU. If the main CPU crashes or other abnormalities occur, the standby CPU cannot receive a reply, or when receiving a reply indicating an abnormal operation, the standby CPU switches to the main CPU and executes the fast data recording method executed by the main CPU in this embodiment. After the original main CPU is restarted, it records data according to the working mode of the standby CPU.
[0074] Example 3
[0075] Combining Example 2 and Figure 1 This embodiment introduces a fast data recording method executed by a standby CPU in a real-time control system, wherein the main CPU and the standby CPU are respectively provided with a first data buffer area, a second data buffer area and a third data buffer area; the fast data recording method comprises:
[0076] After the startup is completed, status query information is sent to the main control processing unit;
[0077] receiving the current event triggering status information and the real-time data record length information replied by the main control processing unit in response to the status query information;
[0078] receiving the data to be synchronized transmitted by the main control processing unit according to the current event triggering state, and storing the data in the third data buffer area;
[0079] Obtaining preset variable information of data to be collected and data length information to be recorded, wherein the data length information includes the data length N1 before the event is triggered and the data length N2 after the event is triggered;
[0080] Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered;
[0081] According to the variable information of the data to be collected, periodically collect real-time data of the corresponding variables;
[0082] According to the current event triggering status information replied by the main control processing unit: if the event has been triggered, the collected variable real-time data is stored in the second data buffer area; if the event has not been triggered, the collected variable real-time data is stored in the first data buffer area in a circular overwrite mode, and after the event is triggered, the collected variable real-time data is stored in the second data buffer area;
[0083] In response to receiving the recording completion notification sent by the main control processing unit, based on the data in the first data cache area, the second data cache area and the third data cache area, the data with a maximum length of N1 before the event is triggered and the data with a maximum length of N2 after the event is triggered are selected and merged to generate and store a data record file for the event.
[0084] Specifically, the standby CPU receives the data to be synchronized transmitted by the main control processing unit according to the current event trigger state, and stores it in the third data buffer area, including: if the current event trigger state is that the event is not triggered, then the N1P data of the first data buffer area transmitted by the main control processing unit are stored as pre-trigger data in the local third data buffer area; if the current time trigger state is that the event has been triggered, then the N1P data of the first data buffer area and the N2P data of the second data buffer area transmitted by the main control processing unit are stored as pre-trigger data and post-trigger data in the local third data buffer area respectively;
[0085] The standby CPU selects data with a maximum length of N1 before the event is triggered and data with a maximum length of N2 after the event is triggered based on the data in the first data cache area, the second data cache area, and the third data cache area to merge, including:
[0086] For pre-trigger data, if the real-time data length N1P' of the local first data buffer is less than N1 when the recording completion notification is received, and N1P'+N1P>N1, then the last recorded N1 pre-trigger data among the N1P data and the N1P' data are intercepted according to the timestamp as the recording result of the pre-trigger data, and if N1P'+N1P≤N1, then the N1P data and the N1P' data are merged as the pre-trigger data; if the real-time data length N1P' of the local first data buffer is greater than N1 when the recording completion notification is received, then the last recorded N1 data are intercepted from the N1P' data according to the timestamp as the pre-trigger data recording result;
[0087] For post-trigger data, the N2P' data stored in the local second data cache are merged with all post-trigger data synchronized in the local third data cache, and the data with a maximum length of N2 recorded after the event is triggered is intercepted according to the timestamp to obtain the post-trigger data recording result.
[0088] refer to Figure 3 During the data recording process, if the data length of the first data buffer area has reached N1 when the event is not triggered, the standby CPU can abandon the pre-trigger data synchronized in the third data buffer area.
[0089] If the main CPU replies that the event has not been triggered when the standby CPU is started, a preferred implementation method for determining whether it will be triggered later is that when the main CPU determines that the event is triggered, the main CPU sends an event trigger notification to the standby CPU, and the standby CPU stores the collected real-time data in the second data cache in response to receiving the event trigger notification sent by the main control processing unit.
[0090] The standby CPU can also independently determine whether an event is triggered. The specific implementation method is as follows: after startup, the preset event trigger variable information is obtained; when the event is not triggered, based on the event trigger variable information, it is determined whether the collected real-time data of the corresponding variable meets the preset event trigger condition: if not, the collected real-time data continues to be stored in the first data cache area in a circular overwrite mode; if it is satisfied, the collected real-time data is stored in the second data cache area.
[0091] The standby CPU can monitor the working status of the main control processing unit by periodically sending working status query information to the main CPU. When the main control processing unit works abnormally, the standby CPU switches to the working mode of the main control processing unit.
[0092] Example 4
[0093] Based on the same inventive concept as in Examples 1-3, this embodiment introduces a real-time control data recording system with a redundancy mechanism, such as Figure 1As shown, it includes a timing device, a data query terminal, and a main control processing unit and a backup control processing unit that are redundantly arranged and communicate with each other; the main control processing unit and the backup control processing unit are respectively provided with a first data buffer area, a second data buffer area and a third data buffer area;
[0094] The timing device sends the same timing signal to the main control processing unit and the standby control processing unit respectively, so that the main control processing unit and the standby control processing unit have the same clock source information;
[0095] The main control processing unit is started before the standby control processing unit, executes the fast data recording method described in Example 1 or Example 2, collects real-time system data, realizes data recording and generation before and after event triggering, and performs data synchronization with the standby control processing unit when the standby control processing unit is started;
[0096] The standby control processing unit executes the fast data recording method described in Example 3, performs data synchronization with the main control processing unit at startup, collects real-time system data after startup, and generates data recording results before and after event triggering after receiving a recording completion notification from the main control processing unit;
[0097] The data query terminal sends an event query request to the main control processing unit or the standby control processing unit in response to the query information input by the user, and the main control processing unit or the standby control processing unit transmits the stored data record file information of the corresponding event to the data query terminal according to the event query request;
[0098] The standby control processing unit monitors the working state of the main control processing unit, and switches to the working mode of the main control processing unit when the main control processing unit works abnormally; the abnormal main control processing unit works in the working mode of the standby control processing unit after restarting.
[0099] When the system of this embodiment is used, the user can pre-set the data variables to be recorded in the CPU, that is, the data variable information to be collected, and periodically collect the values of the data variables; each time the collection is performed, the values of all data variables are collected to form a data unit. After the data recording is completed once, the recorded data is saved in a file of the CPU, and a file contains multiple data units.
[0100] The main CPU is responsible for control strategy calculation and control output, and the standby CPU performs hot standby. When the main CPU fails, restarts or shuts down, the standby CPU immediately takes over as the main CPU. After the original main CPU is restored, it becomes the standby CPU for redundant hot standby.
[0101] The data recording trigger point is also pre-set by the user, that is, the event trigger variable information is set. When the event that the user is concerned about occurs, the value of the corresponding data point, that is, the event trigger variable, will change, and the main CPU can determine that the event has been triggered.
[0102] There are three data buffer areas in both the main CPU and the backup CPU: the first data buffer area is the trigger point pre-data buffer area B1, the second data buffer area is the trigger point post-data buffer area B2, and the third data buffer area is the synchronization data buffer area B3; the B1 buffer area records the collected data before the trigger point is triggered, the B2 buffer area records the data after the trigger point is triggered, and the B3 buffer area is used for the backup CPU to record the synchronized data.
[0103] During a data recording process, the data recording state of the CPU includes three stages: pre-trigger acquisition state S1, trigger point trigger state S2, and post-trigger acquisition state S3. The data collected in the S1 stage is stored in the B1 buffer, and the data collected in the S3 stage is stored in the B2 buffer.
[0104] The number of data units N1 in the pre-trigger point data buffer and the number of data units N2 in the post-trigger point data buffer are also preset by the user. After completing the data recording, the active and standby CPUs merge the data in the B1 buffer and the B2 buffer according to N1 and N2 to form a complete data record for a period of time before and after the trigger, and save it as a data record file to support data browsing on the data viewing terminal.
[0105] The main CPU and the backup CPU are synchronized through the timing device to ensure that the two CPUs have millisecond-level clock accuracy. After a pair of redundant CPUs are powered on and started, the CPU that starts first is the main CPU, and the one that starts later is the backup CPU.
[0106] After the main CPU is started, the status of the data recording trigger point is checked periodically;
[0107] When the event is not triggered, the main CPU stores the recorded data in its B1 buffer. When the number of data units in the B1 buffer reaches N1, the B1 buffer is overwritten cyclically;
[0108] After the event is triggered, the main CPU stores the recorded data in the B2 buffer. When the number of data units in the B2 buffer reaches N2, one data recording is completed, and the data in the B1 buffer and the B2 buffer are merged to save the data recording file.
[0109] After the standby CPU is started, it queries the data recording status of the main CPU through the redundant network. If the main CPU is in the S1 state, the main CPU replies to the standby CPU with its status and the real-time data recording length N1P of its B1 buffer data unit; the standby CPU records its own collected data to the B1 buffer, and at the same time, the main CPU synchronizes its B1 buffer data to the standby CPU's B3 buffer through the redundant network in the order of the timestamps of the B1 buffer data units. When the number of the standby CPU's B3 buffer data units is N1P, it no longer receives synchronization data from the main CPU;
[0110] After the event is triggered, if the number of data units in the B1 buffer of the standby CPU is N1, the recorded data in the B3 buffer is abandoned; otherwise, the recorded data in the B1 buffer and the B3 buffer are merged in the order of the data unit timestamps, and the last N1 data units are intercepted and stored in the B1 buffer again;
[0111] When the data record length of the B2 buffer of the active CPU and the standby CPU is N2, the active CPU and the standby CPU merge their B1 and B2 buffer data respectively, and save the data record files to their respective CPU files, and this data record is completed.
[0112] If the main CPU is in S3 state when the standby CPU starts, the main CPU replies to the standby CPU with its state and the real-time data record length N1P of the B1 buffer and the real-time data record length N2P of the B2 buffer; the standby CPU records the data collected by itself to the B2 buffer, and at the same time, the main CPU synchronizes the data of its B1 buffer and B2 buffer to the B3 buffer of the standby CPU through the redundant network;
[0113] When the number of data units in the main CPU B2 buffer is N2, the main CPU merges the data in the B1 and B2 buffers and saves the data record file to the main CPU, and the data recording is completed; at the same time, the main CPU notifies the standby CPU of the recording completion through the redundant data network, and the standby CPU merges the recorded data in the B3 and B2 data buffers according to the sequence of the data unit timestamps, and intercepts the last N1 and N2 data units before and after the trigger respectively, and saves the data record file to the standby CPU.
[0114] When the user needs to view data records, use the data query terminal to upload the data record file of the main CPU or standby CPU and view it on its human-machine interface.
[0115] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0116] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0119] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.
Claims
1. A fast data recording method for a real-time control system, the real-time control system comprising a main control processing unit and a backup control processing unit which are redundantly arranged and communicate with each other, the main control processing unit and the backup control processing unit are respectively provided with a first data buffer area, a second data buffer area and a third data buffer area; The fast data recording method is executed by a standby control processing unit, and is characterized in that the method include: Sending status query information to the main control processing unit; receiving the current event triggering status information and the real-time data record length information replied by the main control processing unit in response to the status query information; receiving the data to be synchronized transmitted by the main control processing unit according to the current event triggering state, and storing the data in the third data buffer area; Obtaining preset variable information of data to be collected and data length information to be recorded, wherein the data length information includes the data length N1 before the event is triggered and the data length N2 after the event is triggered; Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered; According to the variable information of the data to be collected, periodically collect real-time data of the corresponding variables; According to the current event triggering status information replied by the main control processing unit: if the event has been triggered, the collected variable real-time data is stored in the second data buffer area; If the event is not triggered, the collected variable real-time data is stored in the first data buffer in a loop overwrite mode, and after the event is triggered, the collected variable real-time data is stored in the second data buffer; In response to receiving a recording completion notification sent by the main control processing unit, or in response to the data recording length of the second data buffer area being equal to N2, based on the data in the first data buffer area, the second data buffer area, and the third data buffer area, data with a maximum length of N1 before the event is triggered and data with a maximum length of N2 after the event is triggered are selected for merging, and a data recording file of the event is generated and stored; The main control processing unit and the standby control processing unit receive the same external timing signal; when the main control processing unit stores real-time data, the collected real-time data and its timestamp information are stored in the first data buffer area or the second data buffer area; when synchronizing data to the standby control processing unit, data synchronization is performed according to the timestamp order of the stored data; The standby control processing unit receives the data to be synchronized transmitted by the main control processing unit according to the current event trigger state, and stores it in the third data buffer area, including: if the current event trigger state is that the event is not triggered, then N1P data of the first data buffer area transmitted by the main control processing unit are stored as pre-trigger data in the local third data buffer area; if the current time trigger state is that the event has been triggered, then N1P data of the first data buffer area and N2P data of the second data buffer area transmitted by the main control processing unit are stored as pre-trigger data and post-trigger data in the local third data buffer area respectively; The method of selecting data with a maximum length of N1 before the event is triggered and data with a maximum length of N2 after the event is triggered based on the data in the first data buffer area, the second data buffer area, and the third data buffer area for merging includes: For pre-trigger data, if the real-time data length N1P' of the local first data buffer is less than N1 when the recording completion notification is received, and N1P'+N1P>N1, then the last recorded N1 pre-trigger data among the N1P data and the N1P' data are intercepted according to the timestamp as the recording result of the pre-trigger data, and if N1P'+N1P≤N1, then the N1P data and the N1P' data are merged as the pre-trigger data; if the real-time data length N1P' of the local first data buffer is greater than N1 when the recording completion notification is received, then the last recorded N1 data are intercepted from the N1P' data according to the timestamp as the pre-trigger data recording result; For post-trigger data, the N2P' data stored in the local second data cache are merged with all post-trigger data synchronized in the local third data cache, and the data with a maximum length of N2 recorded after the event is triggered is intercepted according to the timestamp to obtain the post-trigger data recording result.
2. The method according to claim 1, characterized in that: The method further includes, in an event-untriggered state, in response to receiving an event trigger notification sent by the main control processing unit, storing the collected real-time data in a second data buffer area; And, monitoring the working state of the main control processing unit, when the main control processing unit works abnormally, switching to the working mode of the main control processing unit.
3. The method according to claim 1, characterized in that: The method also includes obtaining preset event trigger variable information; When the event is not triggered, determine whether the collected real-time data of the corresponding variable meets the preset event trigger condition based on the event trigger variable information: if not, continue to store the collected real-time data in the first data cache area in a circular overwrite mode; if satisfied, store the collected real-time data in the second data cache area.
4. The method according to claim 1, characterized in that: The operations performed by the main control processing unit include: Obtaining preset variable information of data to be collected, event trigger variable information, and data length information to be recorded, wherein the data length information includes the data length N1 before the event trigger and the data length N2 after the event trigger; Determine the data record length of the first data buffer area according to the data length before the event is triggered, and determine the data record length of the second data buffer area according to the data length after the event is triggered; According to the variable information of the data to be collected, the real-time data of the corresponding variable is collected periodically; according to the event trigger variable information, it is judged whether the real-time data of the corresponding variable meets the preset event trigger condition: if not, the collected real-time data is stored in the first data buffer area in a circular overwrite mode, otherwise, the collected real-time data is stored in the second data buffer area; In response to the data length of the second data buffer area being equal to N2, merging the data of the current first data buffer area and the second data buffer area, generating and storing a data record file of the event; Receive status query information of the standby control processing unit, reply current event trigger status information to the standby control processing unit, send event trigger notification information to the standby control processing unit in response to the variable real-time data satisfying the preset event trigger condition, and according to the current event trigger status: in the event untriggered state, send the real-time data record length N1P of the first data buffer area to the standby control processing unit; in the event triggered state, send the real-time data record length N1P of the first data buffer area and the real-time data record length N2P of the second data buffer area to the standby control processing unit; According to the current event triggering state: when the event is not triggered, the data recorded in the first data buffer area is synchronized to the standby control processing unit; when the event is triggered, the data recorded in the first data buffer area and the second data buffer area are synchronized to the standby control processing unit; And, in response to the data length of the second data buffer area being equal to N2, a recording completion notification is sent to the standby control processing unit.
5. A real-time control data recording system with a redundant mechanism, characterized in that: It includes a timing device, a data query terminal, and a main control processing unit and a backup control processing unit which are redundantly arranged and communicate with each other; the main control processing unit and the backup control processing unit are respectively provided with a first data buffer area, a second data buffer area and a third data buffer area; The timing device sends the same timing signal to the main control processing unit and the standby control processing unit respectively, so that the main control processing unit and the standby control processing unit have the same clock source information; The main control processing unit is started before the standby control processing unit, collects real-time system data, realizes data recording and generation before and after event triggering, and performs data synchronization with the standby control processing unit when the standby control processing unit is started; The standby control processing unit executes the fast data recording method of any one of claims 1 to 4, performs data synchronization with the main control processing unit at startup, collects real-time system data after startup, and generates data recording results before and after event triggering after receiving a recording completion notification from the main control processing unit; The data query terminal sends an event query request to the main control processing unit or the standby control processing unit in response to the query information input by the user, and the main control processing unit or the standby control processing unit transmits the stored data record file information of the corresponding event to the data query terminal according to the event query request; The standby control processing unit monitors the working state of the main control processing unit, and switches to the working mode of the main control processing unit when the main control processing unit works abnormally; the abnormal main control processing unit works in the working mode of the standby control processing unit after restarting.
