A method and system for redundant multi-process acquisition of historical station data

Through the combination of multi-process acquisition and three-network dual redundant communication modules, the problems of limited data acquisition capacity and unreliable redundant communication modules in historical station technology are solved, and efficient and reliable data acquisition and system stability are achieved.

CN118509134BActive Publication Date: 2024-12-06NANJING GUODIAN NANZI WEIMEIDE AUTOMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410975043.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-12-06
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

When the existing historical station technology faces large data volume, high speed and long-term data acquisition, the single-process method leads to limited data acquisition capacity, and cannot utilize multi-core performance, and it is difficult for redundant communication modules to achieve seamless main and standby switching. Insufficient reliability.

Method used

Using multi-process acquisition method, communication with management processes through redundant communication modules, dynamically manage the acquisition process, avoid dual master situations, realize data acquisition and communication exception handling, reconstruct communication links, and use three-network dual redundant communication modules for redundant Management.

Benefits of technology

Effectively utilize multi-core performance to improve data acquisition throughput, enhance system stability and reliability, prevent the occurrence of false switching and dual-main operation states, and improve data acquisition efficiency and system fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118509134B_ABST
    Figure CN118509134B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for redundant multi-process acquisition of historical station data, which relates to the technical field of data processing, including a configuration program responsible for configuring historical station communication data, adding and deleting acquisition points; communicating with the opposite management process through a redundant communication module, judging the other party's state, and determining its own state according to the default configuration to avoid dual-master situations; the main management process starts the acquisition process, performs heartbeat monitoring with the acquisition process through a process communication module, and dynamically manages the acquisition process; the acquisition process implements data acquisition communication, and simultaneously performs communication exception processing and reconstructs the communication link. The present invention effectively prevents the occurrence of erroneous switching and dual-master operation of historical stations, and enhances system stability and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method and system for redundant multi-process acquisition of historical station data. Background Art

[0002] In industrial control systems, historians play a vital role in real-time data collection and storage to meet the high data requirements of industrial production processes. However, existing historian technologies have shown a series of shortcomings when faced with large data volumes, high frequencies, and long durations.

[0003] Traditional historical station data collection programs usually use a single process, which results in limited data collection capacity and cannot fully utilize the multi-core performance of modern hardware. As industrial control systems continue to increase their requirements for data real-time and accuracy, single-process data collection methods can no longer meet actual needs. In addition, due to the single nature of the collection program, once an abnormality or failure occurs, the entire historical station system may be paralyzed, which will have a serious impact on the production process.

[0004] On the other hand, in terms of redundancy of historical stations, currently, a single redundant communication module is mostly used for redundant communication, which improves the reliability of the system to a certain extent, but there are still many problems. For example, a single redundant communication module cannot effectively deal with various abnormal situations. Once a communication failure occurs, the redundant reliability of the system will be greatly reduced. In addition, the existing redundant communication scheme is difficult to achieve seamless switching between the primary and standby modes, which is a crucial function for industrial control systems, but it is quite challenging to achieve. Summary of the invention

[0005] In view of the problems existing in the configuration and communication of historical stations in the above-mentioned industrial control system, the present invention is proposed.

[0006] Therefore, the problem to be solved by the present invention is how to provide a new historical station configuration and data communication solution.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0008] In the first aspect, an embodiment of the present invention provides a method for redundant multi-process collection of historical station data, which includes: a configuration program is responsible for the historical station communication data configuration, adding and deleting collection points; communicating with the opposite management process through a redundant communication module, judging the other party's status, and determining its own status according to the default configuration to avoid dual-master situations; the main management process starts the collection process, monitors the heartbeat of the collection process through the process communication module, and dynamically manages the collection process; the collection process implements data collection communication, and simultaneously performs communication exception processing and reconstructs the communication link.

[0009] As a preferred solution of the method for redundant multi-process collection of historical station data of the present invention, the historical station is divided into three programs, including a configuration program, a data communication collection program and a data storage program; the data communication collection program includes a management process and a collection process.

[0010] As a preferred solution of the method for redundant multi-process collection of historical station data described in the present invention, wherein: the redundant communication module is used to communicate with the opposite management process, judge the other party's state, and determine its own state according to the default configuration to avoid the dual-master situation, including: the management process adopts a redundant mode, divided into a master management process and a slave management process; the redundant communication module A and the redundant communication module B of the master management process are responsible for redundant communication with the redundant communication module A and the redundant communication module B of the slave management process respectively; the redundant management module queries the communication results and states of all redundant communication modules; the master management process starts the collection process for data collection communication, and the slave management process does not start the collection process as a redundant backup; after the management process is started, the redundant communication module A is called through the redundant management module, and the redundant communication module B performs redundant communication, if the heartbeat and mode information of the opposite management process cannot be obtained, then the mode of itself is set to the master management process; if the heartbeat and mode information of the opposite management process are obtained, and the state of the opposite management process is the master management process, then the mode of itself is set to the slave management process.

[0011] As a preferred solution of the method for redundant multi-process collection of historical station data described in the present invention, the main management process starts the collection process including the following steps: the data management module obtains the configured collection data point information; the number of collection processes to be started is calculated according to the number of collection data points, and an ID is assigned to each collection process. The collection process obtains the information data index of the corresponding collection point as (b-1)×n~(b×n), wherein b is the ID and n is the maximum number of collection points for each collection process.

[0012] As a preferred solution of the method for redundant multi-process collection of historical station data described in the present invention, wherein: the main management process starts the collection process, and heartbeat monitoring with the collection process through the process communication module includes the following steps: dynamically adjusting the collection point configuration; monitoring the other party's status and heartbeat through redundant communication; when an abnormality is detected, switching from the management process to the main mode and starting the collection process; when the network is abnormal, communicating through the third network port to complete the master-slave switching.

[0013] As a preferred solution of the method for redundant multi-process collection of historical station data of the present invention, the dynamic management of the collection process includes: when the management process and the collection process are running normally, if there is a need to add or delete the collection data points, the configuration program notifies the main management process and the slave management process that there is a data update change, and the management process re-acquires the configuration information point table. The maximum number of collection points for each collection process is n. If the original number of configuration points is m, and m / n has no remainder, then the original number of collection processes started c1=m / n; if m / n has a remainder, then:

[0014] ,

[0015] If the number of collection points after the update is k, the number of collection processes that need to be started is c2. If k / n has no remainder, then c2=k / n; if there is a remainder, then:

[0016] ,

[0017] Calculate the difference t=c2-c1; if t = 0, there is no change in the number of processes at this time, and the main management process only needs to notify each collection process that there is data update. Each collection process obtains its own collection data information according to the process ID and compares it with the original configured data; if t > 0, the management process needs to start t new collection processes with IDs c1+1,...,c1+t, and notify each collection process that there is configuration data update; if t < 0, the management process needs to cancel t collection processes. At this time, the management process notifies the collection processes with IDs c1-t + 1,...,c1 to exit, and notifies the remaining collection processes that there is configuration data update.

[0018] As a preferred solution of the method for redundant multi-process collection of historical station data described in the present invention, the communication exception processing includes the following contents: the management process runs redundantly, the main management process and the collection process are located on the same host, and each host has at least 3 network ports, A network port, B network port and C network port; the collection process uses A network port and B network port for data collection communication; the redundant communication module A of the main management process establishes two independent communication links AA and AC based on A network port and C network port, and the link with a good state is preferably used to periodically send its own state and heartbeat information; the redundant communication module B of the main management process establishes two independent communication links BB and BC based on B network port and C network port, and the link with a good state is preferably used to periodically poll the heartbeat and state information of the redundant communication module B of the slave management process; if the main management process detects that the A network port and the B network port fail at the same time, the main management process notifies the slave management process through the link AC of the redundant communication module A and the link BC of the redundant communication module B. The process takes over and becomes the main management process, starts the collection process to collect data, and at the same time becomes a slave management process, notifying each collection process to exit; if an abnormality occurs in the redundant communication module A, but the redundant communication of the redundant communication module B still exists, no switching is performed; if an abnormality occurs in the redundant communication module B, but the redundant communication of the redundant communication module A still exists, no switching is performed; if dual main management processes are running, the redundant management modules of the two management processes receive information about the main management process on the opposite side through the redundant communication modules A and B, and find that they are also the main management process, then they request their own default running state from the data management module. If the default is a slave management process, they switch to the slave management process and notify the process management module. The process management module receives the switching notification and sends an exit process message to the process communication module. The process communication module notifies the collection process to exit communication collection, and the collection process exits at the same time; if the default is the main management process, no switching operation is performed.

[0019] In the second aspect, in order to further solve the problems existing in the configuration and communication of historical stations in industrial control systems, the embodiments of the present invention provide a system for redundant multi-process collection of historical station data, which includes: a configuration program module, which is responsible for the configuration of historical station communication data and the addition and deletion of collection points; a data communication collection program module, which is used to manage data communication collection according to configuration information, support dynamic addition and deletion of collection points, and support redundant operation; a data storage program module, which is used to store the data value and quality collected by the data communication collection program, and provide an interface for query; a management process module, which is used to obtain configuration information, start, manage collection processes and redundant communication processing and other tasks; a data management module, which is used to obtain configuration data information; redundant The redundant management module is used to query the communication results and status of the redundant communication module and perform redundant management; the process management module is used to calculate the number of collection processes to be started according to the number of collection points and assign an ID to each process; the process communication module is used to perform heartbeat monitoring with the collection process; the redundant communication module A is used for the main management process and the slave management process to perform redundant communication through the A network port and the C network port; the redundant communication module B is used for the main management process and the slave management process to perform redundant communication through the B network port and the C network port; the collection process module is used to implement real-time data collection communication, handle communication anomalies and reconstruct communication links; the data collection module is used to implement data collection; the exception handling module is used to handle communication anomalies and reconstruct communication links.

[0020] In a third aspect, an embodiment of the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the method for redundant multi-process collection of historical station data as described in the first aspect of the present invention is implemented.

[0021] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the method for redundant multi-process collection of historical station data as described in the first aspect of the present invention is implemented.

[0022] The beneficial effects of the present invention are as follows: the present invention divides data collection into multiple processes and distributes them on different cores of the server, which can effectively utilize the multi-core performance of existing machines, increase the data collection throughput, and improve the collection efficiency; the redundancy of the historical station adopts a three-network dual-redundant communication module, which effectively prevents erroneous switching and the occurrence of dual-main operation status of the historical station, and enhances the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0024] Figure 1 This is a diagram of the redundant multi-process collection process of historical station data.

[0025] Figure 2 Main management process module relationship diagram.

[0026] Figure 3 This is a diagram of the acquisition process module relationship.

[0027] Figure 4 Main management process flow chart.

[0028] Figure 5 This is a flow chart of the slave management process.

[0029] Figure 6 The following is a flow chart of the collection process. DETAILED DESCRIPTION

[0030] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.

[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0032] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0033] Example 1

[0034] Reference Figure 1 to Figure 6 , which is the first embodiment of the present invention, and provides a method for redundant multi-process collection of historical station data, comprising the following steps:

[0035] S1: The configuration program is responsible for configuring the communication data of the historical station and adding and deleting collection points.

[0036] Among them, the history station is divided into three programs, including configuration program, data communication collection program and data storage program.

[0037] Among them, the configuration program is mainly responsible for the communication data configuration of the historical station and the addition and deletion of collection points; the data communication collection program performs data communication collection management according to the configuration information, saves the collected data values ​​to the data storage program, supports dynamic addition and deletion of collection points, and supports redundant operation; the data storage program mainly stores the data values ​​and quality collected by the data communication collection program, and provides an interface for the historical station tool or third-party query tool to query data and other related information.

[0038] Furthermore, the historical station data communication collection program includes a management process and a collection process.

[0039] The management process is mainly responsible for obtaining configuration information, starting and managing the acquisition process and redundant communication processing, including data management module, redundant management module, process management module, process communication module, redundant communication module A, and redundant communication module B.

[0040] S2: Communicates with the management process on the other side through redundant communication module A and redundant communication module B to determine the other party's status, and determines its own status according to the default configuration to avoid dual-active status.

[0041] Specifically, the management process adopts a redundant mode, and is divided into a master management process and a slave management process; the master management process starts the collection process to perform data collection communication, and the slave management process does not start the collection process.

[0042] The redundant communication module A and the redundant communication module B are responsible for the redundant communication between the main management process and the slave management process. The redundant management module queries the communication results and states of the two redundant communication modules to perform redundant management.

[0043] After the management process is started, the redundant communication module A is called through the redundant management module, and the redundant communication module B performs redundant communication. If the heartbeat and mode information of the management process on the other side cannot be obtained, its own mode is set to the master management process; if the heartbeat and mode information of the management process on the other side is obtained, and the status of the management process on the other side is the master management process, its own mode is set to the slave management process.

[0044] It should be noted that the main management process will start the collection process and be responsible for the actual data collection and communication work; the slave management process will not start the collection process, it only serves as a redundant backup and is ready to take over when the main management process fails.

[0045] S3: The main management process starts the collection process, monitors the heartbeat of the collection process through the process communication module, and dynamically manages the collection process.

[0046] S3.1: The main management process starts the collection process.

[0047] The main management process data management module obtains the configured collection data point information, including data index, data name, maximum sampling period, minimum sampling period, minimum difference of data update, and other configuration information, including host name, IP address, default operation status of the machine, etc.

[0048] Calculate the number of collection processes to be started based on the number of collected data points, assign an ID to each collection process, and obtain the corresponding collection point information.

[0049] The process management module calculates the number of collection processes that need to be started based on the number of collection points, and sets an ID for each collection process according to the process start order. The ID range is 1-255. The collection process obtains the corresponding collection point information based on the set ID. For example, if the ID is 1, it obtains data with a data index of 1~1*n (n is the maximum number of collected data for each collection process) for collection. If the ID is 2, it obtains data with a data index of (1*n + 1)~(2*n) for collection, and so on.

[0050] S3.2: Heartbeat monitoring is performed with the collection process through the process communication module.

[0051] After the process management module starts the collection process, it calls the process communication module to perform heartbeat communication with the collection process.

[0052] Monitor the heartbeat and address of all collection processes regularly. If the heartbeat of a collection process does not change, the process is considered abnormal, terminated, and a new collection process (with the same ID) is started. If two collection processes with the same ID are running at the same time, terminate one of them to ensure the uniqueness of each collection process.

[0053] Specifically, the management process runs redundantly and is divided into a main management process and a slave management process, which run on two different hosts respectively. Only the main management process starts the collection process, and the main management process and the collection process are located on the same host.

[0054] Each host has at least three network ports, port A, port B and port C. The acquisition process uses port A and port B for data acquisition communication; the master management process and the slave management process communicate redundantly through two different redundant communication modules. Redundant communication module A uses port A and port C for redundant communication, and redundant communication module B uses port B and port C for redundant communication.

[0055] The redundant communication module A of the main management process establishes two independent communication links AA and AC based on the A network port and the C network port. The link with better status is selected to send its own status and heartbeat information regularly. The heartbeat count value increases by 1 each time it is sent. At the same time, it receives and saves the heartbeat and status information sent from the management process.

[0056] Periodically determine whether there is a change between the latest heartbeat value of the management process and the previous heartbeat value. If there is no change, the error counter of redundant communication module A is increased by 1. If the error counter increases for three consecutive times, it is determined that the communication of redundant communication module A is abnormal, an alarm is issued, and the communication abnormal flag of redundant communication module A is set to true.

[0057] The redundant communication module B of the main management process establishes two independent communication links BB and BC based on the B network port and the C network port. The link with the best status is selected to periodically poll the heartbeat and status information of the redundant communication module B of the slave management process. If there is a response message, the status and heartbeat value of the other party are saved. It is regularly judged whether there is any change between the latest heartbeat value and the previous heartbeat value of the slave management process. If there is no change, the error counter is increased by 1. If the error counter increases for three consecutive times, it is judged that the communication of the redundant communication module B is abnormal, an alarm is issued, and the communication abnormal flag of the redundant communication module B is set to true.

[0058] The redundant management module of the main management process periodically obtains the communication abnormality flags of the redundant communication module A and the redundant communication module B and the status of the slave management process.

[0059] First determine the status of the slave management process. If it is a slave, no processing is done. If it is a master, the data management module obtains its own default status. If it is a slave by default, it switches itself to a slave management process. The default is master operation, and no changes are made.

[0060] Similarly, the redundant management module of the slave management process periodically obtains the communication abnormality flags of the redundant communication module A and the redundant communication module B and the status of the main management process.

[0061] S3.3: Dynamically managing the collection process includes: dynamically adjusting the collection point configuration.

[0062] Preferably, when the management process and the collection process are running normally, if there is a need to add or delete collection data points, the configuration program notifies the main management process and the slave management process of data update changes, and the management process re-acquires the configuration information point table. The maximum number of collection points for each collection process is n. If the original number of configuration points is m, the original number of collection processes started is c1. If m / n has no remainder, then c1=m / n; if m / n has a remainder, then:

[0063] ,

[0064] If the number of collection points after the update is k, the number of collection processes that need to be started is c2. If k / n has no remainder, then c2=k / n; if there is a remainder, then:

[0065] ,

[0066] Calculate the difference t=c2-c1, and the results are divided into 3 cases:

[0067] If t = 0, there is no change in the number of processes at this time. The main management process only needs to notify each collection process that there is data update. Each collection process obtains its own collection data information according to the process ID and compares it with the original configuration data. Data points that do not exist in the original configuration information table are new data points and need to be newly collected; data points that exist in the original configuration information table but do not exist in the updated data information table need to be deleted and the collection is canceled.

[0068] If t > 0, the management process needs to start t new collection processes (with IDs of c1+1,...,c1+t), and then notify each collection process that the configuration data has been updated.

[0069] If t < 0, the management process needs to cancel t collection processes. At this time, the management process notifies the collection process (ID is c1-t + 1,..., c1) to exit, and then notifies the remaining collection processes that there is a configuration data update. Each collection process obtains its own collection data information according to the process address and compares it with the original configuration data information. Data points that do not exist in the original configuration information table are new data points and need to be newly collected; data points that exist in the original configuration information table but do not exist in the updated data information table need to be deleted and the collection is canceled.

[0070] S4: The collection process implements data collection communication, and at the same time handles communication exceptions and reconstructs the communication link.

[0071] Preferably, the collection process collects real-time data, transmits the collected data values ​​to the data storage program, and performs communication exception processing at the same time.

[0072] Among them, the collection process includes a data management module, a process communication module, a data collection module and an exception handling module.

[0073] After the collection process is running, start the data management module and process communication module.

[0074] The data management module obtains configuration data information according to the process ID and calls the data acquisition module to collect data.

[0075] The process communication module of the collection process and the process communication module of the management process perform heartbeat communication through the inter-process communication mechanism. When the heartbeat count of the management process received by the collection process does not change for three consecutive times, the data collection is exited and the collection process exits at the same time.

[0076] The exception handling module mainly handles communication exceptions. If communication of certain data points fails, the communication link of the data needs to be reconstructed. If it still fails, the time interval for reconstructing the communication link needs to be increased. For each consecutive failure, the interval increases by t seconds. After it increases to a certain time interval, it will no longer increase. The communication link is reconstructed at this interval until success.

[0077] Furthermore, when an abnormality is detected, the management process is switched to the main mode and the collection process is started.

[0078] If it is found that the communication anomaly flags of redundant communication module A and redundant communication module B are both true, the state of the process switches to become the master management process, and the collection process is started at the same time; if one of the communication anomaly flags of redundant communication module A and redundant communication module B is normal, the state of the master management process is judged. If it is the master management process, no change is made. If it is the slave management process, the state of the process switches to become the master management process, and the collection process is started at the same time.

[0079] S5.4: When the network is abnormal, the master-slave switch is completed through the third network port communication.

[0080] The collection process uses network port A and network port B for data collection communication. When the main management process detects that network port A and network port B fail at the same time, the main management process notifies the slave management process through link AC of redundant communication module A and link BC of redundant communication module B to take over and become the main management process, start the collection process, and collect data. At the same time, it becomes a slave management process and notifies each collection process to exit.

[0081] When redundant communication module A fails, redundant communication of redundant communication module B still exists and no switching is performed.

[0082] Similarly, when an abnormality occurs in the redundant communication module B, the redundant communication of the redundant communication module A still exists and no switching is performed.

[0083] The use of C network port can effectively avoid the situation where two management processes run in pairs due to the loss of redundant communication when the A network port of the main management process fails and the B network port of the slave management process fails, thereby avoiding abnormal phenomena such as slow operation due to excessive data communication volume.

[0084] If there are two main management processes running, the redundant management modules of the two management processes receive information about the main management process on the other side through the redundant communication modules A and B, and find that they are also the main management process, then they request the data management module for their own default operation status (configuration). If the default is the slave management process, then they switch to the slave management process and notify the process management module. The process management module receives the switch notification and sends a process exit message to the process communication module. The process communication module notifies the collection process to exit communication collection, and the collection process also exits accordingly. If the default is the main management process, no switch operation is performed.

[0085] Example 2

[0086] The present embodiment provides a system for redundant multi-process collection of historical station data, including: a configuration program module, which is responsible for the configuration of historical station communication data, adding and deleting collection points; a data communication collection program module, which is used to manage data communication collection according to configuration information, support dynamic addition and deletion of collection points, and support redundant operation; a data storage program module, which is used to store the data value and quality collected by the data communication collection program, and provide an interface for query; a management process module, which is used to obtain configuration information, start, manage collection processes and redundant communication processing and other tasks; a data management module, which is used to obtain configuration data information; a redundancy management module, which is used to query the communication status of redundant communication modules. The system comprises a control module, a control module and a control module. The control module calculates the number of collection processes to be started according to the number of collection points and assigns an ID to each process. The control module is used to monitor the heartbeat of the collection process. The control module A is used for redundant communication between the master management process and the slave management process through the A network port and the C network port. The control module B is used for redundant communication between the master management process and the slave management process through the B network port and the C network port. The control module is used to implement real-time data collection communication, handle communication anomalies and reconstruct communication links. The control module is used to implement data collection. The control module is used to handle communication anomalies and reconstruct communication links.

[0087] This embodiment also provides a computer device, which is suitable for the method of redundant multi-process collection of historical station data, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the method of redundant multi-process collection of historical station data proposed in the above embodiment.

[0088] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0089] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for realizing redundant multi-process collection of historical station data proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0090] In summary, the present invention divides data collection into multiple processes and distributes them on different cores of the server, which can effectively utilize the multi-core performance of existing machines, increase the data collection throughput, and improve the efficiency of collection. The redundancy of the historical station adopts a three-network dual-redundant communication module, which effectively prevents the occurrence of mis-switching and the dual-main operation state of the historical station, and enhances the stability and reliability of the system.

[0091] Example 3

[0092] Reference Figure 1 to Figure 6 This is the second embodiment of the present invention. In order to further verify the beneficial effects of the present invention, experimental data of the method for redundant multi-process collection of historical station data is provided.

[0093] In order to verify the effectiveness of the invented method, the following experiments were conducted:

[0094] First, prepare two hosts Host1 and Host2, with Linux operating system. Each host is configured with three network cards, named eth0, eth1 and eth2 respectively; install and deploy the history station program package on Host1, including the configuration program, management process program, collection process program and data storage program.

[0095] The same historical station program package as Host1 is installed and deployed on Host2, and a program DataSim that simulates data communication is written to generate random data and send it to Host1 and Host2 through a simulated communication protocol.

[0096] Configure the historical station communication data collection points, a total of 1000 collection points, the data format is float, the sampling period is 1 second, and the host name and IP address are configured as follows:

[0097] Host1 - Host name: HSHost1, IP address: 10.1.1.1, default status is main management process

[0098] Host2 - Host name: HSHost2, IP address: 10.1.1.2, default status is from the management process

[0099] Configure the network parameters as follows:

[0100] Host1 - eth0 network card IP: 10.2.1.1, eth1 network card IP: 10.3.1.1, eth2 network card IP: 10.4.1.1

[0101] Host2 - eth0 network card IP: 10.2.1.2, eth1 network card IP: 10.3.1.2, eth2 network card IP: 10.4.1.2

[0102] Start the history station program on Host1 and Host2, start the DataSim program, start generating and sending simulation data, and observe the data recorded in the data storage program; plug and unplug the eth0, eth1, and eth2 network cards respectively to observe the active-standby switching, and record the operating data in each case, including the number of data collection processes, CPU and memory usage, etc.

[0103] During the experiment, we found that:

[0104] When two of the network cards among eth0, eth1 and eth2 of HSHost2 are disconnected, the redundant communication module detects the heartbeat information of HSHost1 and determines that HSHost1 is working normally. Therefore, HSHost2 maintains the status of a slave management process and does not start the collection process; while HSHost1 maintains the status of a master management process and continues to run 20 collection processes to collect data. However, due to network abnormalities, the CPU and memory usage increase.

[0105] When the disconnected network card of HSHost2 is reconnected, the redundant communication between the two hosts is fully restored. HSHost2 determines that HSHost1 is running normally, maintains the slave management process status, and does not start the collection process; the resource usage of HSHost1 returns to normal levels.

[0106] When all three network cards of HSHost1 or HSHost2 are disconnected, HSHost2 can no longer detect the heartbeat of HSHost1, so it determines that HSHost1 has failed, switches itself to the main management process state, starts 20 collection processes, and takes over the data collection work.

[0107] This active / standby switchover is seamless and automatic, with no data loss. At this point, the resource usage of HSHost2 increases, while the resource usage of HSHost1 does not change significantly.

[0108] When the disconnected network card of HSHost1 or HSHost2 is reconnected, the redundant communication between the two hosts is restored, and HSHost1 detects the heartbeat information of HSHost2. According to the configuration, it defaults to the slave management process state, and finds that the master management process is already running, so it switches itself to the slave management process, exits the collection process, and reduces resource usage; while HSHost2 maintains the master management process state and continues to run the collection process.

[0109] It can be seen that the inventive method achieves high reliability of data collection through mechanisms such as multi-process redundant collection, master-slave switching and dual-network redundant communication, effectively avoids data loss, improves the fault tolerance of the system, and supports dynamic adjustment of collection points, which can flexibly adapt to changes in on-site needs and improve practicality.

[0110] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for redundant multi-process collection of historical station data, characterized in that: include: The configuration program is responsible for configuring the communication data of the historical station and adding and deleting collection points; Communicate with the management process on the other side through the redundant communication module to determine the other party's status, and determine its own status according to the default configuration to avoid dual-master situations; The main management process starts the collection process, performs heartbeat monitoring with the collection process through the process communication module, and dynamically manages the collection process; The acquisition process implements data acquisition communication, and simultaneously performs communication exception processing and reconstructs the communication link; The communication with the opposite management process through the redundant communication module, judging the other party's state, and determining its own state according to the default configuration to avoid the dual master situation includes: The management process adopts a redundant mode, divided into a master management process and a slave management process; The redundant communication module A and the redundant communication module B of the master management process are responsible for redundant communication with the redundant communication module A and the redundant communication module B of the slave management process respectively; The redundancy management module queries the communication results and status of all redundant communication modules; The main management process starts the collection process to perform data collection communication, and the slave management process does not start the collection process as a redundant backup; After the management process is started, the redundant communication module A is called through the redundant management module, and the redundant communication module B performs redundant communication. If the heartbeat and mode information of the opposite management process cannot be obtained, the self-mode is set to the master management process; if the heartbeat and mode information of the opposite management process is obtained, and the status of the opposite management process is the master management process, the self-mode is set to the slave management process; The main management process starts the collection process, and performs heartbeat monitoring with the collection process through the process communication module, including the following steps: Dynamically adjust the collection point configuration; Monitor each other's status and heartbeat through redundant communication; When an anomaly is detected, the management process is switched to the main mode and the collection process is started; When the network is abnormal, the master-slave switch is completed through communication through the third network port.

2. The method for redundant multi-process collection of historical station data as claimed in claim 1, characterized in that: The history station is divided into three programs, including a configuration program, a data communication collection program and a data storage program; The data communication collection program includes a management process and a collection process.

3. The method for redundant multi-process collection of historical station data as claimed in claim 2, characterized in that: The main management process starts the collection process and includes the following steps: The data management module obtains the configured collection data point information; The number of collection processes to be started is calculated based on the number of collected data points, and an ID is assigned to each collection process. The information data index of the corresponding collection point obtained by the collection process is (b-1)×n~(b×n), where b is the ID and n is the maximum number of collection points for each collection process.

4. The method for redundant multi-process collection of historical station data as claimed in claim 3, characterized in that: The dynamic management collection process includes: When the management process and the collection process are running normally, if there is a need to add or delete collection data points, the configuration program will notify the main management process and the slave management process that there are data updates and changes, and the management process will re-acquire the configuration information point table. The maximum number of collection points for each collection process is n. If the original number of configuration points is m, and there is no remainder between m / n, then the original number of collection processes started c1=m / n; if there is a remainder between m / n, then: , If the number of collection points after the update is k, the number of collection processes that need to be started is c2. If k / n has no remainder, then c2=k / n; if there is a remainder, then: , Calculate the difference t=c2-c1; If t = 0, there is no change in the number of processes. The main management process only needs to notify each collection process that there is data update. Each collection process obtains its own collection data information according to the process ID and compares it with the original configured data. If t > 0, the management process needs to start t new collection processes with IDs c1+1,...,c1+t, and notify each collection process of configuration data update; If t < 0, the management process needs to cancel t collection processes. At this time, the management process notifies the collection processes with IDs c1-t + 1,...,c1 to exit, and notifies the remaining collection processes that there is a configuration data update.

5. The method for redundant multi-process collection of historical station data as claimed in claim 4, characterized in that: The communication exception handling includes the following contents: The management process runs redundantly. The main management process and the collection process are located on the same host. Each host has at least three network ports: A, B, and C. The collection process uses network ports A and B for data collection communication; The redundant communication module A of the main management process establishes two independent communication links AA and AC based on the A network port and the C network port, and selects the link with good status to send its own status and heartbeat information regularly; The redundant communication module B of the main management process establishes two independent communication links BB and BC based on the B network port and the C network port, and selects the link with good status to periodically poll the redundant communication module B of the slave management process for heartbeat and status information; If the master management process detects that both network ports A and B fail at the same time, the master management process notifies the slave management process to take over and become the master management process through link AC of redundant communication module A and link BC of redundant communication module B, starts the collection process to collect data, and at the same time becomes the slave management process itself, notifying each collection process to exit; If redundant communication module A fails but redundant communication of redundant communication module B still exists, no switching will be performed; If redundant communication module B fails but redundant communication of redundant communication module A still exists, no switching will be performed; If two main management processes are running, the redundant management modules of the two management processes receive information that the other side is the main management process through the redundant communication module A and the redundant communication module B, and find that they are also the main management process, then they request their own default running status from the data management module. If the default is the slave management process, they switch to the slave management process and notify the process management module. The process management module receives the switching notification and sends an exit process message to the process communication module. The process communication module notifies the collection process to exit communication collection, and the collection process exits at the same time. If the default is the main management process, no switching operation is performed.

6. A system for redundant multi-process collection of historical station data, based on the method for redundant multi-process collection of historical station data as claimed in any one of claims 1 to 5, characterized in that: include: Configuration program module, responsible for the configuration of historical station communication data, adding and deleting collection points; Data communication acquisition program module, used to manage data communication acquisition according to configuration information, supports dynamic addition and deletion of acquisition points, and supports redundant operation; A data storage program module is used to store the data values ​​and quality collected by the data communication collection program and provide an interface for query; The management process module is used to obtain configuration information, start and manage the acquisition process and redundant communication processing tasks; Data management module, used to obtain configuration data information; A redundancy management module is used to query the communication results and status of the redundant communication modules and perform redundancy management; The process management module is used to calculate the number of collection processes to be started according to the number of collection points and assign an ID to each process; Process communication module, used for heartbeat monitoring with the collection process; Redundant communication module A is used for the master management process and the slave management process to perform redundant communication through the A network port and the C network port; Redundant communication module B, used for redundant communication between the master management process and the slave management process through the B network port and the C network port; The acquisition process module is used to implement real-time data acquisition communication, handle communication anomalies and reconstruct communication links; A data collection module, used for implementing data collection; The exception handling module is used to handle communication exceptions and reconstruct communication links.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for redundant multi-process collection of historical station data described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for redundant multi-process collection of historical station data described in any one of claims 1 to 5 are implemented.