A method for establishing correlation relationships between scenario elements of gas pipeline network emergencies
By performing word segmentation and importance weight calculation on the text data related to emergencies in the gas pipeline network, screening scenario elements and establishing association relationships, the problem of inability to quantify the degree of association in the existing technology is solved, and efficient and accurate scenario analysis is achieved.
Patent Information
- Application Number
- CN202410958672.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-07-17
AI Technical Summary
The existing gas pipeline emergency situation analysis methods cannot effectively quantify the degree of correlation between scenario elements, and rely on manual scoring, resulting in inefficiency and high subjectivity.
By obtaining text data related to gas pipeline emergencies, perform word segmentation processing and importance weight calculation, filter out words with importance weight greater than the set threshold as scenario elements, and establish a correlation between scenario elements and calculate the association degree, filter out the association relationship whose correlation degree is less than the set threshold.
It realizes that while reducing manual participation, it ensures the accuracy of scenario factor extraction, and constructs the correlation relationship of scenario factors through multi-layer correlation rules, improving analysis efficiency and accuracy.
Smart Images

Figure CN118798195B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of emergency scenario analysis, and in particular relates to a method for establishing an association relationship between emergency scenario elements in a gas network. Background Art
[0002] Pipelines are the main means of transporting and distributing energy such as natural gas. Gas pipeline networks are an important part of urban infrastructure and play a vital role in ensuring national energy security and stable supply. The safe management of gas pipeline networks is directly related to public safety. Gas pipeline network emergencies (gas leaks, deflagrations, gas pipeline damage, flash explosions, explosions, collapses, slides, fires / combustions, suffocation, poisoning, falls from heights, electric shocks, etc.) may cause significant casualties and property losses, and their scenario analysis involves a lot of professional knowledge. Scenario analysis of gas pipeline network emergencies is an important research hotspot in the current safety field, which can provide practical and targeted guidance and suggestions for emergency rescue, standard specification compilation, emergency decision-making, and even related drills and training.
[0003] In the process of scenario analysis of gas pipeline network emergencies, it is necessary to review a large number of historical events and related standards and specifications, and extract information related to the current event scenario analysis from them. The most important of these information is the scenario elements that are highly related to the analyzed scenario and the correlation between them. The scenario elements are the main factors that express and reflect the development status and trend of gas pipeline network emergencies. The correlation between scenario elements is mainly in the form of an adjacency matrix. This method can only reflect the existence of correlation relationships, and cannot quantify the degree of correlation between scenario elements in the form of domain weights. The existing analysis and classification methods of scenario element correlation relationships mainly construct correlation relationships between scenario elements through manual scoring. Although this method guarantees the effectiveness of the method to a certain extent, the resulting association rules are highly subjective, require a lot of manpower, material resources, and time, and cannot distinguish between IoT perception data and text data. Summary of the invention
[0004] In order to solve the above problems existing in the prior art, the present invention provides a method for establishing association relationships between scenario elements of gas pipeline network emergencies.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions.
[0006] A method for establishing association relationships between scenario elements of a gas pipeline network emergency event comprises the following steps:
[0007] Acquire text data related to gas pipeline network emergencies, and perform word segmentation processing on the text data;
[0008] Calculating the importance weight of each word obtained by word segmentation processing, and selecting words whose importance weight is greater than a set threshold from the words to obtain situational elements;
[0009] Establish an association relationship between any two scenario elements, calculate the association degree of the association relationship, filter out association relationships with an association degree less than a set threshold, and obtain the association relationship of the scenario elements.
[0010] Furthermore, the text data is obtained from a gas pipeline network emergency data set D, which is established based on an existing database and combined with China's gas pipeline network accident reports, laws and regulations, emergency plans, training materials, papers, monographs, standard documents, and news data.
[0011] Furthermore, the method further includes a stop word removal process after performing Chinese word segmentation, deleting words that contribute less to the meaning of the text content.
[0012] Furthermore, the method also includes: inputting the text data into a pre-trained model to obtain a word embedding vector, and processing the text data based on the word embedding vector.
[0013] Furthermore, the method further comprises fine-tuning the pre-trained model in the following manner:
[0014] Mask the key words selected from the input text, replace the key words with set marks, and replace other words with indexes in the vocabulary; establish a label array, regard the set mark position as the index of the corresponding key word in the vocabulary, and set other positions as symbol marks indicating ignoring, to obtain a training data set;
[0015] The pre-trained model is trained using the training data set to obtain a fine-tuned pre-trained model.
[0016] Furthermore, the method of calculating the importance weight of each word includes:
[0017] S1, calculate the first importance weight k1 of each word based on graph theory;
[0018] Take each word as a node in the graph and set the initial value of each node score to 1.0;
[0019] Using the cosine similarity of the word embedding vectors of the words corresponding to the two nodes as the weight of the edge connecting the two nodes, and deleting the edge whose weight is less than the set threshold;
[0020] Update the score of each node as follows, and iterate the node scores until convergence:
[0021]
[0022] Where WS (n+1) (V i ) is the node V i The score at the n+1th iteration, WS (n) (V j ) is the node V j The fraction at the nth iteration step, r is the damping coefficient, r = 0.85, L(V i ) is the node V i The set of all connected nodes, L(V j ) is the node V j The set of all connected nodes, w ij For connecting node V i and V j The weight of the edge; the node score after convergence is the first importance weight k1 of the corresponding word;
[0023] S2. Calculate the second importance weight k2 of each word based on the improved TF-IDF. The calculation formula is:
[0024]
[0025] Where N is the number of documents in the dataset D, DF(w, D) is the number of documents containing word w in the dataset D, and f w,d is the number of times word w appears in document d;
[0026] S3. The first importance weight k1 and the second importance weight k2 are weighted and summed to obtain the third importance weight k3, and the calculation formula is:
[0027]
[0028] The words whose k1, k2 or k3 are greater than the set threshold are screened out to obtain the situational elements of the gas pipeline network emergency.
[0029] Furthermore, the method further comprises filtering the contextual elements based on domain relevance:
[0030] Calculate the domain relevance of each scenario element:
[0031]
[0032] In the formula, DP(A) is the domain relevance of scenario element A, freq(A_D) is the number of times scenario element A appears in data set D, freq(A_D0) is the number of times scenario element A appears in data set D0, and data set D0 is a data set in the field of non-gas pipeline network emergencies;
[0033] Delete scenario elements whose domain relevance is less than the set threshold.
[0034] Furthermore, the method for calculating the degree of association between the association relationship between the scenario elements A and B includes:
[0035] Calculate the confidence level of the relationship between scenario elements A and B:
[0036]
[0037] In the formula, Confidence(A→B) is the confidence of the association between scenario elements A and B, Support(A∩B) is the support for the simultaneous appearance of scenario elements A and B, and Support(A) is the support for the appearance of scenario element A.
[0038] Define the time weight function:
[0039] TW(t)=e -λ(T-t) (6)
[0040] In the formula, TW(t) is the time weight, T is the current time, t is the time when the gas pipeline network emergency occurs, which is obtained by anomaly detection based on IoT monitoring data, and λ is the time attenuation coefficient;
[0041] Calculate time-weighted support:
[0042]
[0043] In the formula, TWS(A) is the time-weighted support, Count i (A) is the number of scenario elements A contained in the i-th document, and N is the number of documents in the gas network emergency data set D;
[0044] Define the severity weight function:
[0045]
[0046] In the formula, SW(s) is the severity weight, s is the severity value of the gas pipeline network emergency, which is obtained by calculating casualties and economic losses, and s max is the maximum severity value;
[0047] Calculate severity-weighted support:
[0048]
[0049] In the formula, SWS(A) is the severity weighted support;
[0050] Calculate the degree of association between scenario elements A and B:
[0051] WC(A→B)=Confidence(A→B)×TWS(A)×SWS(A) (10)
[0052] Where WC(A→B) is the degree of association between situational elements A and B.
[0053] Furthermore, methods for anomaly detection based on IoT monitoring data include:
[0054] Based on the data collected from sensors and monitoring equipment installed in the gas pipeline network, a time series dataset X = {x i}, where x i is the multi-dimensional monitoring data at the i-th time point, including at least gas pressure, gas flow and ambient temperature, where i=1,2,...,l, l is the number of data;
[0055] The single-class support vector machine method is used to solve the maximum hyperplane that divides the data set X into normal data and abnormal data, and the boundary decision function is obtained;
[0056] The IoT monitoring data x t Input boundary decision function, if the function value is less than 0, then x t is abnormal data.
[0057] Furthermore, the method also includes: establishing a gas network emergency scenario diagram based on scenario elements, and storing the scenario diagram in a digital manner.
[0058] Compared with the prior art, the present invention has the following beneficial effects.
[0059] The present invention obtains text data related to gas network emergencies, performs word segmentation on the text data, calculates the importance weight of each word, filters out words with importance weight greater than a set threshold from the words, obtains scenario elements, establishes an association relationship between any two scenario elements, calculates the association degree of the association relationship, filters out association relationships with an association degree less than a set threshold, and obtains the association relationship of scenario elements. The present invention can effectively reduce the degree of manual participation while ensuring the accuracy of scenario element extraction; and can construct the association relationship of scenario elements through multi-layer association rules. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 The present invention is a flowchart of a method for establishing association relationships between scenario elements of a gas network emergency event according to an embodiment of the present invention.
[0061] Figure 2 Schematic diagram of how the loss function changes with the number of training steps when fine-tuning the pre-trained model. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the present invention clearer and more understandable, the present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0063] Figure 1 The flowchart of a method for establishing association relationships of emergency scenario elements in a gas network according to an embodiment of the present invention includes the following steps:
[0064] Step 101, obtaining text data related to gas network emergencies, and performing word segmentation processing on the text data;
[0065] Step 102, calculating the importance weight of each word obtained by word segmentation processing, and selecting words whose importance weight is greater than a set threshold from the words to obtain situational elements;
[0066] Step 103, establishing an association relationship between any two scenario elements, calculating the association degree of the association relationship, filtering out association relationships with an association degree less than a set threshold, and obtaining the association relationship of the scenario elements.
[0067] In this embodiment, step 101 is mainly used to perform word segmentation on the text data of gas pipeline network emergencies. In this embodiment, the acquired text data of gas pipeline network emergencies is decomposed into individual words by performing word segmentation, and then the situational elements of the gas pipeline network emergencies are obtained by screening these words. The situational elements are the main factors that express and reflect the development status and trend of gas pipeline network emergencies. In this embodiment, THULAC is used to segment each sentence of the text data, and the user dictionary is loaded before the word segmentation. The user dictionary is a dictionary constructed using standard terms, risk lists, and existing security dictionaries to increase the ability to recognize domain vocabulary. The main purpose of loading the user dictionary is to avoid segmenting proper nouns.
[0068] In this embodiment, step 102 is mainly used to obtain situational elements. At present, the identification of situational elements is mainly achieved through manual analysis or pre-defined methods. It is mainly considered and classified from the four aspects of "man-machine-environment-management", and accurate identification and classification of situational elements cannot be achieved in an automated way. In this embodiment, the importance weight of each word obtained after word segmentation processing relative to the gas pipeline emergency is calculated, and then the importance weight is compared with the set threshold. The words with importance weight greater than the set threshold are situational elements, thereby realizing automatic identification of situational elements. There are many methods for calculating importance weights. This embodiment does not limit the specific calculation method. The following embodiments will give a specific technical solution.
[0069] In this embodiment, step 103 is mainly used to establish the association relationship between scenario elements. In the prior art, the analysis and classification of the association relationship of scenario elements is mainly achieved by pre-defining and manually analyzing the connection between concepts, and the obtained association relationship is highly subjective. Moreover, the association between scenario elements is mainly in the form of an adjacency matrix, which can only reflect the existence or non-existence of the association relationship, and cannot quantify the degree of association between scenario elements in the form of domain weights. To this end, this embodiment first establishes an association relationship between any two scenario elements, then calculates the degree of association of the association relationship, compares the degree of association with a set threshold, filters out the association relationship with a degree of association less than the set threshold, and obtains the association relationship of scenario elements. The quantified association relationship of scenario elements can be automatically established.
[0070] As an optional embodiment, the text data is obtained from a gas pipeline emergency data set D, which is established based on an existing database and combined with China's gas pipeline accident reports, laws and regulations, emergency plans, training materials, papers, monographs, standard documents, and news data.
[0071] This embodiment provides a method for obtaining text data of gas pipeline network emergencies. In order to facilitate the acquisition of text data, this embodiment establishes a gas pipeline network emergency data set D. This embodiment refers to the existing database, combines China's gas pipeline network accident reports, laws and regulations, emergency plans, training materials, papers, monographs, standard documents, and news data, and establishes a gas pipeline network emergency data set D specifically for Chinese. The investigation report mainly comes from the investigation reports published by the emergency management departments of various provinces and cities, and some data is also obtained by crawling the web. The legal and regulatory data comes from the national laws and regulations database. Emergency plans and training materials mainly include content data obtained from industry websites through crawlers and a gas company. Standard documents are obtained through the National Standard Information Public Service Platform combined with web crawlers. News data is mainly obtained from Sina Weibo through crawlers. Papers and monographs are mainly downloaded through open source websites.
[0072] As an alternative embodiment, after the Chinese word segmentation process, the method further includes a stop word removal process to delete words that contribute less to the meaning of the text content.
[0073] To reduce the number of segmented words and improve the data processing speed, in this embodiment, stop word removal is performed on the words obtained after the word segmentation process to delete words that contribute less to the meaning of the text content, such as function words like "de" (的), "le" (了), "zai" (在), etc.
[0074] As an alternative embodiment, the method further includes: inputting the text data into a pre-trained model to obtain word embedding vectors, and processing the text data based on the word embedding vectors.
[0075] To achieve the quantization processing of text data, in this embodiment, the obtained text data is input into a pre-trained model, namely the KBert model, to obtain the word embedding vector representation of each sentence. With the word embedding vector representation of the sentence, various quantization data processing can be performed on the text data, such as calculating the cosine similarity between two words. KBert embeds the information in the knowledge graph into the input text, enabling the model to utilize more background knowledge when processing natural language. KBert adopts a new input representation method that combines text and knowledge graph information. Specifically, KBert inserts the entity information in the knowledge graph into the sentence to form a tree-like input form, and this representation method can retain the structural information in the knowledge graph.
[0076] As an alternative embodiment, the method further includes fine-tuning the pre-trained model according to the following method:
[0077] Mask the selected keyword in the input text, replace the keyword with a set marker, and replace other words with indices in the vocabulary; establish a label array, regard the position of the set marker as the index of the corresponding keyword in the vocabulary, and set other positions as symbol markers indicating omission to obtain a training data set;
[0078] Use the training data set to train the pre-trained model to obtain the fine-tuned pre-trained model.
[0079] This embodiment provides a technical solution for fine-tuning a pre-trained model. This embodiment implements fine-tuning of a pre-trained model by constructing a whole word filling task. The whole word filling task refers to masking important words or phrases in the text, and requires the pre-trained model to predict and fill in these masked words or phrases through context information. For example, for a text "a gas pipeline leaks, resulting in an explosion risk in the surrounding area, and emergency repairs and evacuations should be carried out immediately", in the whole word filling task, the words "leak", "explosion", "emergency repair" and "evacuation" can be masked with the set mark [MASK] to form training data: "a gas pipeline [MASK] occurs, resulting in a [MASK] risk in the surrounding area, and [MASK] and [MASK] should be carried out immediately", and the unmasked words are converted into indices in the vocabulary. Create an AttentionMask to distinguish between actual data and fill-in data. Create a label array equal to the input length, treat the [MASK] position as the index of the word to be predicted, and set a symbol mark indicating that it is ignored at other positions, such as "-100". The pre-trained model is trained with masked text and labels as training data sets, and the difference between the model prediction and the real vocabulary is obtained by calculating the loss function. Then, the parameters are updated through back propagation and optimization algorithms to achieve fine-tuning of the pre-trained model. This process can enhance the pre-trained model's grasp of specific domain knowledge and understanding of the emergency handling process.
[0080] As an optional embodiment, the method for calculating the importance weight of each word includes:
[0081] S1, calculate the first importance weight k1 of each word based on graph theory;
[0082] Take each word as a node in the graph and set the initial value of each node score to 1.0;
[0083] Using the cosine similarity of the word embedding vectors of the words corresponding to the two nodes as the weight of the edge connecting the two nodes, and deleting the edge whose weight is less than the set threshold;
[0084] Update the score of each node as follows, and iterate the node scores until convergence:
[0085]
[0086] Where WS (n+1) (V i ) is the node V i The score at the n+1th iteration, WS (n) (V j ) is the node V j The fraction at the nth iteration step, r is the damping coefficient, r = 0.85, L(V i) is the node V i The set of all connected nodes, L(V j ) is the node V j The set of all connected nodes, w ij For connecting node V i and V j The weight of the edge; the node score after convergence is the first importance weight k1 of the corresponding word;
[0087] S2. Calculate the second importance weight k2 of each word based on the improved TF-IDF. The calculation formula is:
[0088]
[0089] Where N is the number of documents in the dataset D, DF(w, D) is the number of documents containing word w in the dataset D, and f w,d is the number of times word w appears in document d;
[0090] S3. The first importance weight k1 and the second importance weight k2 are weighted and summed to obtain the third importance weight k3, and the calculation formula is:
[0091]
[0092] The words whose k1, k2 or k3 are greater than the set threshold are screened out to obtain the situational elements of the gas pipeline network emergency.
[0093] This embodiment provides a technical solution for calculating the importance weight of each word. Step S1 of this embodiment calculates the first importance weight of each word based on graph theory, step S2 calculates the second importance weight of each word based on improved TF-IDF, and step S3 performs weighted summation of the first importance weight and the second importance weight based on the fusion of the attention mechanism to obtain the third importance weight. This embodiment obtains a total of 3 importance weight parameters, and the words obtained after word segmentation processing can be screened according to the size of any importance weight to obtain situational elements.
[0094] Step S1 calculates the first importance weight of each word by constructing an undirected graph consisting of nodes and edges. A node of the undirected graph corresponds to a word, and the edge connecting two nodes is represented by the cosine similarity of the word embedding vectors of the words corresponding to the two nodes. In order to simplify the undirected graph, the edges whose cosine similarity is less than the set threshold are deleted. The cosine similarity of the word embedding vectors of two words is calculated as follows:
[0095]
[0096] Where Cosine_Similarity is cosine similarity, are the word embedding vectors of two words respectively, · represents the inner product of the vector, and the absolute value represents the modulus of the vector.
[0097] The first importance weight of a word is represented by the node score of the corresponding node. The node score is calculated using an iterative method, and the initial value of the node score of each node is set to 1.0. The update formula of the node score is shown in formula (1).
[0098] Step S2 calculates the second importance weight of each word based on the improved TF-IDF formula as shown in formula (2). The second importance weight is equal to the product of TF (Term Frequency) and IDF (Inverse Document Frequency). TF is the term frequency factor, which indicates the frequency of a word appearing in a document; IDF is the inverse document frequency factor, which is a measure of the general importance of a word. TF before improvement = f w ,d / M,f w,d is the number of times word w appears in document d, and M is the number of times all words appear in document d. Improved TF = (1 + ln (f w,d )). By calculating the word frequency by taking the logarithm of the word frequency, the weight of high-frequency words can be reduced and the weight of low-frequency words can be increased (taking the logarithm has the effect of suppressing the high and raising the low), smoothing the word frequency so that high-frequency words and low-frequency words can be treated more fairly when representing the content of the document. The improvement of the IDF factor is not significant. It only changes the denominator DF(w,D) to DF(w,D)+1 to prevent the denominator from being 0, where DF(w,D) is the number of documents containing word w in the data set D. Table 1 shows the second importance weights of several contextual factors.
[0099] Table 1 The second importance weights of several scenario factors
[0100]
[0101] In step S3, based on the attention mechanism fusion, the first importance weight and the second importance weight are weighted and summed to obtain the third importance weight. The calculation formula is shown in formula (3).
[0102] As an optional embodiment, the method further includes filtering the context elements based on domain relevance:
[0103] Calculate the domain relevance of each scenario element:
[0104]
[0105] In the formula, DP(A) is the domain relevance of scenario element A, freq(A_D) is the number of times scenario element A appears in data set D, freq(A_D0) is the number of times scenario element A appears in data set D0, and data set D0 is a data set in the field of non-gas pipeline network emergencies;
[0106] Delete scenario elements whose domain relevance is less than the set threshold.
[0107] This embodiment provides a technical solution for filtering scenario elements based on domain relevance. The calculation formula for the domain relevance of scenario elements is shown in formula (4), where the numerator freq(A_D) is the number of times scenario element A appears in data set D, and the denominator freq(A_D0) is the number of times scenario element A appears in data set D0, where D0 is a non-gas pipeline emergency field data set. The greater the domain relevance of a scenario element, the more important it is to the field of gas pipeline emergencies. Therefore, scenario elements can be screened according to the size of their domain relevance, and scenario elements whose domain relevance is less than the set threshold can be deleted.
[0108] PMI (Pointwise Mutual Information) can also be used to calculate the domain correlation of two situational elements. PMI is a measure of the degree to which two situational elements occur together beyond random situations, and is usually used to quantify the statistical correlation between two words or phrases. It is based on the concept of mutual information, but is measured for specific event pairs rather than the entire data set. The calculation formula is as follows:
[0109]
[0110] In the formula, P(x,y) is the probability of two scenario elements x and y occurring at the same time, while P(x) and P(y) are the probabilities of x and y occurring respectively. P(x,y), P(x) and P(y) can be calculated as follows:
[0111]
[0112] In the formula, freq(x) and freq(y) are the number of times that context elements x and y appear in the dataset D, respectively; freq(x,y) is the number of times that context elements x and y appear in the same sentence at the same time; and N is the number of sentences. By calculating the PMI values of different pairs of context elements, we can find out which context elements often appear together, thereby revealing the potential association between context elements, which is helpful for understanding word meaning, sentiment analysis, or building language models. It is more suitable for discovering the association between context elements, rather than the correlation between a single context element and a certain field.
[0113] As an optional embodiment, a method for calculating the degree of association between the association relationship between scenario elements A and B includes:
[0114] Calculate the confidence level of the relationship between scenario elements A and B:
[0115]
[0116] In the formula, Confidence(A→B) is the confidence of the association between scenario elements A and B, Support(A∩B) is the support for the simultaneous appearance of scenario elements A and B, and Support(A) is the support for the appearance of scenario element A.
[0117] Define the time weight function:
[0118] TW(t)=e -λ(T-t) (6)
[0119] In the formula, TW(t) is the time weight, T is the current time, t is the time when the gas pipeline network emergency occurs, which is obtained by anomaly detection based on IoT monitoring data, and λ is the time attenuation coefficient;
[0120] Calculate time-weighted support:
[0121]
[0122] In the formula, TWS(A) is the time-weighted support, Count i (A) is the number of scenario elements A contained in the i-th document, and N is the number of documents in the gas network emergency data set D;
[0123] Define the severity weight function:
[0124]
[0125] In the formula, SW(s) is the severity weight, s is the severity value of the gas pipeline network emergency, which is obtained by calculating casualties and economic losses, and s max is the maximum severity value;
[0126] Calculate severity-weighted support:
[0127]
[0128] In the formula, SWS(A) is the severity weighted support;
[0129] Calculate the degree of association between scenario elements A and B:
[0130] WC(A→B)=Confidence(A→B)×TWS(A)×SWS(A)(10)
[0131] Where WC(A→B) is the degree of association between situational elements A and B.
[0132] This embodiment provides a technical solution for calculating the degree of association of the association relationship of scenario elements. This embodiment mines the association relationship between scenario elements from multiple aspects such as confidence, time-weighted support, and severity-weighted support to obtain the degree of association of the association relationship between scenario elements. First, the confidence of the association relationship between scenario elements A and B is calculated according to formula (5); then the time-weighted support is calculated based on the time weight according to formula (7). The calculation formula of the time weight TW(t) is as shown in formula (6), and its size depends on the difference (Tt) between the current time and the time t of the occurrence of the gas pipeline network emergency. The larger the difference (Tt), the smaller TW(t). The time t of the occurrence of the gas pipeline network emergency is obtained by performing anomaly detection on the IoT monitoring data, that is, if an abnormality is detected in the monitoring data (pressure, flow, etc.), it is considered that an emergency has occurred (gas leakage, explosion, gas pipeline damage, etc.). The following embodiments will provide a specific anomaly detection method. Next, the severity-weighted support is calculated according to formula (9) based on the severity weight. The severity weight is calculated based on the casualties and economic losses of the emergency, as shown in formula (8). Finally, the degree of association of the relationship between scenario elements is obtained by calculating the product of confidence, time-weighted support, and severity-weighted support, as shown in formula (10).
[0133] As an optional embodiment, the method for performing anomaly detection based on IoT monitoring data includes:
[0134] Based on the data collected from sensors and monitoring equipment installed in the gas pipeline network, a time series dataset X = {x i}, where x i is the multi-dimensional monitoring data at the i-th time point, including at least gas pressure, gas flow and ambient temperature, where i=1,2,...,l, l is the number of data;
[0135] The single-class support vector machine method is used to solve the maximum hyperplane that divides the data set X into normal data and abnormal data, and the boundary decision function is obtained;
[0136] The IoT monitoring data x t Input boundary decision function, if the function value is less than 0, then x t is abnormal data.
[0137] This embodiment provides a technical solution for anomaly detection based on IoT monitoring data. Anomaly detection of IoT monitoring data is the basis for scenario analysis of gas pipeline emergencies. IoT technology is used to collect data in real time from various sensors and monitoring devices installed in the gas pipeline network. These sensors and devices include but are not limited to pressure sensors for monitoring pressure changes in pipelines, flow sensors for monitoring gas flow, and temperature sensors for monitoring the temperature of pipelines and their surroundings. There are many anomaly detection methods, and commonly used methods include statistical methods and machine learning methods. Statistical methods: by analyzing the mean and standard deviation, detect whether the data deviates from the normal range; machine learning methods: supervised learning models trained based on historical data, predict the normal data range, and detect anomalies. This embodiment uses the one-class support vector machine method (One-Class SVM) in the machine learning method. Support vector machine method SVM is a supervised learning method used for binary or multi-classification problems. Its goal is to find a hyperplane that separates sample points of different categories as much as possible. It is mainly used for classification tasks, such as spam detection, image classification, etc. One-class support vector machine is a learning method for anomaly detection, mainly used in scenarios such as anomaly detection, fault detection, and intrusion detection. Most of the gas pipeline network monitoring data are normal data, and only a few are abnormal data, which is more suitable for single-class support vector machines. The specific detection method is given below.
[0138] For a set of multi-dimensional IoT monitoring data X = {x i}, x i is the multidimensional monitoring data at the i-th time point, including at least gas pressure, gas flow and ambient temperature, where i = 1, 2, ..., l, l is the number of data, and the optimal boundary is found by maximizing the following objective function:
[0139]
[0140] In the formula, K(x i ,x j ) is the kernel function, K(x i ,x j ) = exp(-0.1×‖x i -x j ‖ 2 ). i is the Lagrange multiplier, which reflects the importance of data at a certain point in time for identifying normal and abnormal states, satisfying v is a parameter that controls the proportion of outliers. i ,x j ) is calculated for the data point x i and x j Similarity in high-dimensional feature space. It measures the weighted sum of the overall similarity of all monitoring data points in high-dimensional space. By finding a hyperplane, normal data points are as far away from the boundary as possible, thus forming a decision boundary with the maximum margin.
[0141] According to the Lagrangian function:
[0142]
[0143] Among them, γ is a parameter used to control the width of the function (usually 0.1, 0.01 or 0.001). i ) is the data point x i The mapping in high-dimensional feature space, K(x i ,x j )=φ(x i )·φ(x j ). ρ is the bias term (or threshold), which plays the role of translating the decision boundary in the decision function. It is obtained by solving the Lagrange dual problem during the optimization process. α is the Lagrange multiplier obtained during the optimization process, which reflects the importance of each data point in constructing the optimal decision boundary. ω is the normal vector of the hyperplane, which indicates the direction of the decision boundary in the high-dimensional feature space. ξ i is a slack variable.
[0144] Find the support vector that meets the conditions and get: Construct decision function: f(x)=sign(ω * ·φ(x)-ρ * ), where ρ*, α i *, ω* are the parameters ρ, α after training i , the value of ω, and sign() is the sign function.
[0145] Test sample point x t Substitute the value of into the decision function. If the decision function value f(x t )≥0, then the test sample point x t Belongs to normal sample points; if f(x t )<0, then the test sample point x t It is an abnormal sample point.
[0146] As an optional embodiment, the method further includes: establishing a gas network emergency scenario diagram based on scenario elements, and storing the scenario diagram in a digital manner.
[0147] This embodiment provides a technical solution for establishing and storing a gas pipeline network emergency scenario graph. First, establish a gas pipeline network emergency scenario graph: use each scenario element as a node of the scenario graph, use the cosine similarity of the word embedding vectors of the words corresponding to the two nodes as the weight of the edge connecting the two nodes, and delete the edge with a weight less than a set threshold; then, digitize the scenario graph: construct an adjacency matrix of the scenario graph, each row and column of the matrix corresponds to a scenario element, and the element a in the matrix is ij Represents the edge weight (cosine similarity) between the i-th scenario element and the j-th scenario element. Construct the edge list of the scenario analysis graph, and each edge is represented by a triple (node i, node j, weight). Finally, HDF5 (Hierarchical Data Format version 5) is used to store the scenario network (adjacency matrix or edge list) and create an HDF5 file. HDF5 is a file format for storing and managing large-scale data. HDF5 files have a hierarchical structure and are suitable for storing various types of data. HDF5 files use a hierarchical structure similar to a file system, consisting of groups and data sets. A group is equivalent to a folder and can contain other groups or data sets; a data set is equivalent to a file and is used to store actual data. It supports multiple data types, including scalars, vectors, matrices, arrays, and composite data types.
[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for establishing association relationships between scenario elements of gas pipeline network emergencies, characterized in that: The following steps are involved: Acquire text data related to gas pipeline network emergencies, and perform word segmentation processing on the text data; Calculate the importance weight of each word obtained after word segmentation processing, and select words whose importance weight is greater than a set threshold from the words to obtain situational elements; Establishing a correlation relationship between any two scenario elements, calculating the correlation degree of the correlation relationship, filtering out correlation relationships with correlation degrees less than a set threshold, and obtaining the correlation relationship of the scenario elements; The method for calculating the importance weight of each word includes: S1, calculate the first importance weight k1 of each word based on graph theory; Take each word as a node in the graph and set the initial value of each node score to 1.0; Using the cosine similarity of the word embedding vectors of the words corresponding to the two nodes as the weight of the edge connecting the two nodes, and deleting the edge whose weight is less than the set threshold; Update the score of each node as follows, and iterate the node scores until convergence: Where WS (n+1) (V i ) is the node V i The score at the n+1th iteration, WS (n) (V j ) is the node V j The fraction at the nth iteration step, r is the damping coefficient, r = 0.85, L(V i ) is the node V i The set of all connected nodes, L(V j ) is the node V j The set of all connected nodes, w ij For connecting node V i and V j The weight of the edge; the node score after convergence is the first importance weight k1 of the corresponding word; S2. Calculate the second importance weight k2 of each word based on the improved TF-IDF. The calculation formula is: Where N is the number of documents in the dataset D, DF(w,D) is the number of documents containing word w in the dataset D, and f w,d is the number of times word w appears in document d; S3. The first importance weight k1 and the second importance weight k2 are weighted and summed to obtain the third importance weight k3, and the calculation formula is: The words whose k1, k2 or k3 are greater than the set threshold are screened out to obtain the situational elements of the gas pipeline network emergency.
2. The method for establishing association relationships of gas network emergency scenario elements according to claim 1, characterized in that: The text data is obtained from a gas pipeline network emergency data set D, which is established based on an existing database and in combination with China's gas pipeline network accident reports, laws and regulations, emergency plans, training materials, papers, monographs, standard documents, and news data.
3. The method for establishing association relationships of gas network emergency scenario elements according to claim 1, characterized in that: The method further includes a stop word removal process after performing Chinese word segmentation, in which words that contribute less to the meaning of the text content are deleted.
4. The method for establishing association relationships of gas network emergency scenario elements according to claim 1, characterized in that: The method also includes: inputting the text data into a pre-trained model to obtain a word embedding vector, and processing the text data based on the word embedding vector.
5. The method for establishing association relationships of gas network emergency scenario elements according to claim 4, characterized in that: The method also includes fine-tuning the pre-trained model as follows: Mask the key words selected from the input text, replace the key words with set marks, and replace other words with indexes in the vocabulary; establish a label array, regard the set mark position as the index of the corresponding key word in the vocabulary, and set other positions as symbol marks indicating ignoring, to obtain a training data set; The pre-trained model is trained using the training data set to obtain a fine-tuned pre-trained model.
6. The method for establishing association relationships of gas network emergency scenario elements according to claim 1, characterized in that: The method further includes filtering the contextual elements based on domain relevance: Calculate the domain relevance of each scenario element: In the formula, DP(A) is the domain relevance of scenario element A, freq(A_D) is the number of times scenario element A appears in data set D, freq(A_D0) is the number of times scenario element A appears in data set D0, and data set D0 is a data set in the field of non-gas pipeline network emergencies; Delete scenario elements whose domain relevance is less than the set threshold.
7. The method for establishing association relationships of emergency scenario elements in a gas network according to claim 1, characterized in that: Methods for calculating the degree of association between the association relationship between scenario elements A and B include: Calculate the confidence level of the relationship between scenario elements A and B: In the formula, Confidence(A→B) is the confidence of the association between scenario elements A and B, Support(A∩B) is the support for the simultaneous appearance of scenario elements A and B, and Support(A) is the support for the appearance of scenario element A. Define the time weight function: TW(t)=e -λ(T-t) (6) In the formula, TW(t) is the time weight, T is the current time, t is the time when the gas pipeline network emergency occurs, which is obtained by performing anomaly detection based on IoT monitoring data, and λ is the time attenuation coefficient; Calculate time-weighted support: In the formula, TWS(A) is the time-weighted support, Count i (A) is the number of scenario elements A contained in the i-th document, and N is the number of documents in the gas pipeline emergency data set D; Define the severity weight function: In the formula, SW(s) is the severity weight, s is the severity value of the gas pipeline network emergency, which is obtained by calculating casualties and economic losses, and s max is the maximum severity value; Calculate severity-weighted support: In the formula, SWS(A) is the severity weighted support; Calculate the degree of association between scenario elements A and B: WC(A→B)=Confidence(A→B)×TWS(A)×SWS(A)(10)WC(A→B) is the degree of association between the situational elements A and B.
8. The method for establishing association relationships of emergency scenario elements in a gas network according to claim 7, characterized in that: Methods for anomaly detection based on IoT monitoring data include: Based on the data collected from sensors and monitoring equipment installed in the gas pipeline network, a time series dataset X = {x i }, where x i is the multi-dimensional monitoring data at the i-th time point, including at least gas pressure, gas flow and ambient temperature, where i=1,2,...,l, l is the number of data; The single-class support vector machine method is used to solve the maximum hyperplane that divides the data set X into normal data and abnormal data, and the boundary decision function is obtained; The IoT monitoring data x t Input boundary decision function, if the function value is less than 0, then x t is abnormal data.
9. The method for establishing association relationships of emergency scenario elements in a gas network according to claim 1, characterized in that: The method further comprises: establishing a gas network emergency scenario diagram based on scenario elements, and storing the scenario diagram in a digital manner.
Citation Information
Patent Citations
Power grid emergency situation element extraction and global fusion method and system
CN112529525A
Keyword extraction method and device, electronic equipment and storage medium
CN115757680A