A chemical enterprise safety production risk early warning method

By collecting dynamic variables of chemical production and the levels of major hazard sources, establishing a level safety boundary table and a process coupling prediction model, and constructing a time-series feature extraction network, the problem of disordered early risk capture and warning levels in chemical production is solved, realizing early risk capture and risk level differences, and supporting real-time early warning and graded disposal.

CN123159902APending Publication Date: 2026-11-24SHANDONG BAOGANG INTERNATIONAL PORT CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611346127.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-01
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing risk warning methods for chemical production cannot capture early risks before variables approach their boundaries, ignore the differences in tolerance for abnormal fluctuations among different major hazard levels, lack guidance from process coupling mechanisms, make it difficult to distinguish between normal operational fluctuations and downstream chain shifts caused by abnormal upstream reactions, and have disordered warning levels that fail to reflect risk differences.

Method used

By collecting dynamic variables and the levels of major hazard sources, a level safety boundary table is established. Dynamic variables entering the boundary buffer zone generate instantaneous boundary risks. Combined with the process coupling relationship, a prediction model is trained, a time-series feature extraction network is constructed, and dynamic features enhanced by safety mechanisms are generated. Real-time early warning is then provided using the time-series early warning model based on the level conditions of major hazard sources.

Benefits of technology

It enables the capture of early risks before variables go out of bounds, distinguishes between spikes and continuous deterioration, reduces misjudgments, adaptively adjusts the attention given to abnormal patterns, reasonably reflects the risk differences between warning levels, and supports real-time output of warning level probabilities and tiered handling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123159902A_ABST
    Figure CN123159902A_ABST
Patent Text Reader

Abstract

The application discloses a kind of chemical enterprise safety production risk early warning method, belong to chemical safety production risk early warning technical field, including the dynamic variable and static attribute of major hazard source grade reflecting reaction, storage and transportation, leakage and equipment state are collected, sample is labeled grade according to time base window after subsequent event;According to grade, the instantaneous boundary risk recursive is generated by calling safety boundary to obtain the sustained boundary risk, based on process coupling, the chain risk is calculated by reaction anomaly gate and coupling prediction residual, and the safety mechanism is enhanced dynamic characteristics by combination;Build grade condition time sequence early warning model to extract multi-scale mode, modulate each branch according to grade to obtain dynamic risk characteristics, and the comprehensive risk representation is fused to train ordered grade prototype with interval constraint;The sample to be judged is input into model, and the maximum grade is executed disposal by outputting each grade probability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of early warning of safety production risks in the chemical industry, and in particular to a method for early warning of safety production risks in chemical enterprises. Background Technology

[0002] Chemical production processes involve reactions, storage, transportation, and leaks, characterized by complex processes, harsh reaction conditions, highly hazardous materials, and the potential for chain-like propagation of accidents. Therefore, safety risk early warning is a crucial step in preventing accidents and ensuring the safety of personnel and equipment. With the development of sensor technology and the Industrial Internet, it is now possible to collect multi-source monitoring data in real time, including temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, critical valve opening, and motor current, providing a foundation for data-driven risk early warning.

[0003] The existing technology has the following shortcomings:

[0004] 1. Existing methods mostly rely on fixed thresholds or uniform safety boundaries, and only respond after variables cross the boundary. This ignores the differences in tolerance for abnormal fluctuations among different major hazard levels, and also fails to capture early risks and the continuous accumulation process when variables approach the boundary.

[0005] 2. Existing methods independently identify anomalies for each monitored variable, lacking cascading propagation modeling guided by process coupling mechanisms, making it difficult to distinguish between normal operational fluctuations and downstream cascading shifts caused by abnormal upstream reactions.

[0006] 3. Existing methods use the same model parameters and receptive field for all major hazard levels, and cannot adaptively adjust the degree of attention to abnormal patterns at different time scales according to the major hazard level.

[0007] 4. Existing methods treat warning levels as unordered categories and do not constrain the ascending order relationship between warning levels, making it difficult to reasonably reflect the risk differences between each warning level in the feature space. Summary of the Invention

[0008] In order to overcome the technical problems described in the background, the present invention provides a method for early warning of safety production risks in chemical enterprises, which can capture early risks before they cross the boundary and distinguish between peaks and continuous deterioration, and can amplify downstream deviations only when there are abnormalities upstream to distinguish between normal fluctuations and chain propagation.

[0009] The technical solution of this invention is: a method for early warning of safety production risks in chemical enterprises, comprising the following steps:

[0010] S1. Collect dynamic variables reflecting the states of chemical reactions, storage and transportation, leakage, and equipment, and simultaneously obtain the level and static attributes of major hazard sources. Form a time window according to a unified time benchmark, mark the warning level according to the evolution of safety events after the time window, obtain chemical multi-source monitoring samples, and establish a graded safety boundary table including safety boundaries and buffer zones according to the warning level.

[0011] S2. Call the level safety boundary according to the current sample level. When the dynamic variable enters the boundary buffer area, the instantaneous boundary risk is generated. The continuous boundary risk is obtained by weighting the previous continuous boundary risk according to the risk retention coefficient and adding it to the current instantaneous risk.

[0012] Based on process coupling, upstream and downstream variables are determined and a normal coupling prediction model for upstream to predict downstream is trained. The larger instantaneous boundary risk values ​​of temperature and pressure are taken as the response anomaly gate value after propagation lag limit. The standardized coupling prediction residual of downstream deviation from normal coupling prediction is taken as the response. The chain risk is obtained by multiplying and weighting the residuals. The normalized dynamic variables of the safety level interval, instantaneous and continuous boundary risks, coupling prediction residuals and chain risks are combined in time sequence to obtain the dynamic characteristics of safety mechanism enhancement.

[0013] S3. Construct a time-series early warning model for major hazard source levels. This model uses a time-series feature extraction network to extract multi-scale patterns to obtain dynamic risk features, generates channel modulation parameters according to levels, and combines the level with instantaneous boundary risks and chain risks to statistically generate branch fusion weights for safety risk status.

[0014] A comprehensive risk representation is obtained by fusing dynamic risk characteristics, level embedding, and static attributes. An ordered level prototype is trained by interval constraints. The interval constraints are proportional to the level difference to constrain the similarity interval between the real and each error level. The time-series early warning model of the major hazard source level is trained with labeled samples.

[0015] S4. Input the samples to be judged, which are collected in real time and enhanced with the same method, into the time-series early warning model of the major hazard source level condition, output the probability of each early warning level, take the level with the highest probability as the real-time early warning level, and perform risk disposal.

[0016] Furthermore, in step S1, the dynamic variables include temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, critical valve opening degree, and motor current.

[0017] During data collection, all dynamic variables are time-aligned according to a uniform sampling period.

[0018] When the original sampling frequency of the motor current is higher than that of other dynamic variables, the effective value of the current is first calculated in each uniform sampling period, and then the effective value of the current is used as the motor current sampling value at that sampling moment.

[0019] Furthermore, in step S1, the static attributes include the number of years since production began, the designed production capacity, and the number of employees on duty.

[0020] The production period, designed capacity, and number of employees are arranged in a fixed order to form a static attribute vector.

[0021] After standardizing the static attribute vector according to the mean and standard deviation saved during the training phase, it is spliced ​​and fused with the dynamic risk features and level embedding to obtain a comprehensive risk representation.

[0022] Furthermore, in step S2, the continuous boundary risk is achieved by setting a boundary buffer area inside each level of safety boundary, so that when the sampled value of the dynamic variable enters the boundary buffer area, an instantaneous boundary risk that continuously increases between 0 and 1 is generated.

[0023] When the sampled value of the dynamic variable exceeds the safety level boundary, the instantaneous boundary risk continues to increase from 1 according to the ratio of the magnitude of the exceedance to the normal fluctuation benchmark.

[0024] Then, the continuous boundary risk at the previous sampling time is weighted according to the risk retention coefficient and added to the instantaneous boundary risk at the current sampling time to recursively obtain the continuous boundary risk value at the current sampling time.

[0025] Furthermore, in step S2, the chain risk is determined by identifying upstream related variables for downstream dynamic variables based on the process coupling relationship, and a normal coupling prediction model is trained using historical data from normal operating conditions.

[0026] The absolute value of the deviation between the measured value of the downstream dynamic variable and the predicted value given by the normal coupling prediction model is standardized according to the deviation fluctuation scale under normal operating conditions to obtain the standardized coupling prediction residual.

[0027] The reaction anomaly gate after propagation lag is then multiplied with the standardized coupled prediction residual, and the sum is obtained by weighting according to the cascading risk weights corresponding to each downstream dynamic variable.

[0028] Furthermore, in step S2, the reaction anomaly is obtained by taking the larger value of the instantaneous boundary risks corresponding to temperature and pressure and limiting it to between 0 and 1 to obtain the reaction anomaly gate value;

[0029] When both temperature and pressure are far from the safety boundary, the reaction anomaly threshold is 0. When temperature or pressure enters the boundary buffer zone, the reaction anomaly threshold increases continuously between 0 and 1. When temperature or pressure reaches or exceeds the safety boundary, the reaction anomaly threshold is 1.

[0030] The cascading risk only increases as the downstream dynamic variables deviate from the normal coupling prediction results when the abnormal response gate value increases.

[0031] Furthermore, in step S2, the security mechanism enhances dynamic features by arranging the dynamic variables, instantaneous boundary risks, and persistent boundary risks after normalization of the security level interval along the feature channel direction;

[0032] The coupled prediction residuals and cascading risks of downstream dynamic variables are arranged together according to a unified time position and spliced ​​together to obtain a feature matrix that simultaneously includes the operating status, safety boundary status, risk persistence status and accident chain propagation status.

[0033] Each row of the feature matrix corresponds to a sampling time point, which is used to provide time-by-time risk evolution input to the time-series early warning model of the major hazard source level condition.

[0034] Furthermore, in step S3, the temporal feature extraction network adopts a structure with multiple one-dimensional convolutional branches having different dilation rates;

[0035] The channel modulation parameters are composed of channel scaling vectors and channel offset vectors generated from the embedding vectors corresponding to the major hazard source level. The output of each one-dimensional convolutional branch is scaled and offset channel by channel according to the feature channel.

[0036] The safety risk status is composed of the average and maximum values ​​of instantaneous boundary risks within the time window, as well as the average and maximum values ​​of cascading risks. The branch fusion weight is generated by concatenating the major hazard source level embedding vector with the safety risk status and then passing it through a branch weight network.

[0037] The branch fusion weights are used to weight and fuse the modulated features of each one-dimensional convolutional branch to obtain dynamic risk features, so that different major hazard levels can form differentiated response strengths to the change patterns on the same time scale.

[0038] Furthermore, in step S3, the interval constraint is calculated by setting learnable level prototype vectors for each warning level, performing L2 normalization on the comprehensive risk representation and each level prototype vector, and then calculating the similarity between the two.

[0039] Multiply the absolute value of the difference between the actual warning level and the false warning level by the unit interval to get the minimum similarity interval that the corresponding false warning level needs to satisfy.

[0040] During model training, it is required that the difference between the similarity of the true warning level and the similarity of each false warning level is not less than the minimum similarity interval of the corresponding false warning level, so that the warning levels that are farther apart maintain a larger separation interval in the representation space.

[0041] Furthermore, in step S4, the risk handling involves executing a tiered response based on the real-time early warning level determined by the assessment.

[0042] When the real-time warning level is normal, routine status is recorded; when the real-time warning level is slightly abnormal, a prompt message is issued; when the real-time warning level is obviously abnormal, an audible and visual alarm is issued and the corresponding equipment is required to be checked.

[0043] When the real-time warning level is severe risk, the highest level emergency alarm is triggered, and emergency response procedures such as emergency shutdown, interlock protection, or personnel evacuation are initiated.

[0044] The beneficial effects of this invention due to the adoption of the above-mentioned technology are as follows:

[0045] 1. This invention calls the corresponding level safety boundary according to the major hazard source level of the current sample, and sets a buffer area inside the boundary so that when the dynamic variable approaches the boundary, the instantaneous boundary risk increases continuously. Then, the continuous boundary risk of the previous moment is weighted according to the risk retention coefficient and added to the current instantaneous boundary risk for recursion. This invention can capture the early risk approaching the boundary before the variable crosses the boundary, distinguish between a single short-term spike and continuous deterioration, and thus reflect the different tolerances of different hazard levels to abnormal fluctuations.

[0046] 2. This invention trains a normal coupling prediction model based on process coupling relationship to predict downstream variables from upstream variables. It uses the reaction anomaly gating obtained by propagation lag limiting of instantaneous boundary risks of temperature and pressure as a condition, and the standardized coupling prediction residual of downstream deviation from normal coupling prediction as the response to calculate cascading risks. It can amplify downstream offset only when the upstream reaction is abnormal, thereby distinguishing between normal operation fluctuations and downstream cascading propagation caused by upstream anomalies, which helps to reduce misjudgments caused by normal regulation and independent sensor fluctuations.

[0047] 3. In this invention, multiple one-dimensional convolutional branches with different dilation rates are set in the temporal feature extraction network, and the modulation parameters of the generation channel are embedded by the major hazard source level to scale and offset the output of each branch channel by channel. At the same time, the safety risk status generated by combining the level with the instantaneous boundary risk and chain risk statistics is used to generate the branch fusion weight, which enables different hazard levels to form differentiated responses to the change patterns of the same time scale, and thus adaptively adjusts the attention to abnormal patterns of different time spans.

[0048] 4. This invention sets up learnable ordered level prototypes for each warning level, and uses interval constraints proportional to the level difference to train the similarity between the comprehensive risk representation and each level prototype, so that the warning levels that are far apart maintain a larger separation interval in the representation space, thereby preserving the risk increasing order relationship between warning levels, which is conducive to reasonably reflecting the risk differences between each level in the feature space.

[0049] 5. This invention combines normalized dynamic variables of the safety interval, instantaneous boundary risk, persistent boundary risk, coupled prediction residuals, and cascading risks into dynamic features that enhance the safety mechanism at a unified time position. It also uses preprocessing parameters fixed during the training phase for online inference, which can provide the time-series early warning model with a complete risk evolution input that simultaneously includes the operating state, safety boundary state, risk persistence state, and accident chain propagation state. This enables the output of probabilities of each early warning level for real-time samples and the execution of graded risk handling according to the highest probability level. Attached Figure Description

[0050] Figure 1 This is a flowchart of the method steps of the present invention;

[0051] Figure 2 This is a flowchart of the chemical multi-source monitoring sample collection and early warning level labeling process of the present invention;

[0052] Figure 3 This is a flowchart of the continuous boundary risk extraction process of the present invention;

[0053] Figure 4 This is a flowchart of the chain risk feature extraction process of the present invention;

[0054] Figure 5 This is a diagram illustrating the construction of the dynamic feature matrix for enhancing the security mechanism of this invention.

[0055] Figure 6 This is a dynamic risk feature vector bar chart of the present invention. Detailed Implementation

[0056] like Figure 1 As shown, this invention proposes a method for early warning of safety production risks in chemical enterprises, the main contents of which are as follows:

[0057] S1. Chemical Industry Multi-Source Monitoring Sample Collection and Early Warning Level Labeling

[0058] like Figure 2 The flowchart shown illustrates the process of collecting samples and labeling early warning levels for multi-source monitoring in the chemical industry. First, industrial data is collected. This invention collects dynamic variables reflecting reaction status, storage and transportation status, leakage status, and equipment operating status during the chemical production process. Simultaneously, static attributes such as the level of major hazard sources, years of operation, designed capacity, and number of personnel on duty are acquired. Then, continuous time windows are formed according to a unified time benchmark, and early warning levels are labeled based on the evolution of safety events after the time window, thus obtaining multi-source monitoring samples for the chemical industry. The specific steps are as follows:

[0059] 1> Install corresponding sensors at reactors, storage tanks, pipelines, gas detection areas, key valves, and drive motors to continuously collect data on temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, key valve opening degree, and motor current. Specifically,

[0060] by Indicates a dynamic variable index. Among them, the first dynamic variable is temperature, the second dynamic variable is pressure, the third dynamic variable is liquid level, the fourth dynamic variable is flammable gas concentration, the fifth dynamic variable is toxic gas concentration, the sixth dynamic variable is the opening degree of key valves, and the seventh dynamic variable is motor current.

[0061] by Indicates the sampling time index under a unified time base, Indicates the first The dynamic variable in the first... The sampled values ​​at each sampling time. Temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, and critical valve opening can directly use the average value or the last effective value within the corresponding sampling period; when the original sampling frequency of motor current is higher than that of other dynamic variables, the effective value of current is first calculated within each unified sampling period, and then the effective value of current is used as the motor current sampled value at the corresponding sampling time.

[0062] In one implementation, a uniform sampling period of 1 minute can be used. The original sampling frequency of the motor current can be 1 kHz. Within each 1-minute period, the effective value, maximum value, and standard deviation of the current fluctuation are calculated, and at least the effective value of the current is used as the sampled value of the motor current. By using a uniform sampling period, dynamic variables with different sampling frequencies can maintain a one-to-one correspondence on the time axis.

[0063] In one implementation, temperature is measured in degrees Celsius (°C), pressure in kilopascals (kPa), liquid level in percentage (%), combustible gas concentration in parts per million (ppm), toxic gas concentration in parts per million (ppm), critical valve opening in percentage (%), and motor current in amperes (A).

[0064] 2. Time alignment of the seven dynamic variables according to a unified timestamp. When a dynamic variable is missing at a single sampling time, linear interpolation is performed on the adjacent valid sample values ​​before and after the dynamic variable. When the length of consecutive missing values ​​is no more than 3 sampling times, linear interpolation is performed on each missing position. When the length of consecutive missing values ​​exceeds 3 sampling times, the time window containing the consecutive missing interval is marked as an invalid time window and is not used for model training.

[0065] Furthermore, sampled values ​​that significantly exceed the physical range of the sensor are treated as invalid values. For example, the opening degree of a critical valve should be within the physical range of 0% to 100%. Sampling values ​​of critical valve opening degrees below 0% or above 100% are not directly used as valid sampling values, but are corrected based on adjacent valid sampling values. When it is impossible to reliably correct through adjacent sampling values, the corresponding time window is marked as an invalid time window.

[0066] It should be noted that sensor physical range correction is only used to eliminate communication errors, sensor disconnections, and data format errors; it is not used to cut sampled values ​​that are actually outside the safe operating range back into the safe range. Sampled values ​​that are within the sensor's physical range but exceed the process safety boundary should be retained for subsequent extraction of risk characteristics.

[0067] 3> Obtain the major hazard level of the current monitoring object. ,in, The value can be 1, 2, 3, or 4, with major hazard source level 1 corresponding to the highest level of danger and major hazard source level 4 corresponding to the lowest level of danger. Major Hazard Source Level The data, obtained from the enterprise's major hazard source registration information, remained unchanged within the time range covered by the same chemical multi-source monitoring sample.

[0068] Obtain the current monitoring object's production year, designed capacity, and number of employees, and assemble them into a static attribute vector in a fixed order. Static attribute vectors The dimensions are 3: the first element is the year of production, the second element is the designed capacity, and the third element is the number of employees.

[0069] Among them, the years of operation reflect the impact of equipment aging, material fatigue, and decreased sealing performance on risk tolerance; designed capacity reflects production scale and material handling volume; and the number of employees reflects the potential personnel exposure level after an accident. Static attribute vector It remains unchanged within a single time window.

[0070] 4> Using the current judgment time as the end point of the time window, extract data containing [the current time window] from the continuously sampled data. The sampling values ​​of the seven dynamic variables are arranged in chronological order within a time window of each sampling time, resulting in the original chemical dynamic variable sampling matrix. .

[0071] Original chemical dynamic variable sampling matrix The dimension is Each row corresponds to a sampling time, and each column corresponds to a dynamic variable. The time window length can be determined based on the response rate of the chemical process; for example, it can be 30, 60, or 120. When the uniform sampling period is 1 minute and... At that time, the original chemical dynamic variable sampling matrix Covers the 30 minutes of running data prior to the current determination time.

[0072] The sliding step size between adjacent time windows is denoted as , This indicates the number of sampling moments to move forward when generating adjacent chemical multi-source monitoring samples, and can be 1, 5, or 10. and Every 5 minutes, a multi-source monitoring sample of the chemical industry covering the operation status of the most recent 30 minutes is generated.

[0073] 5> Based on the actual safety events, alarm records, and manual verification results within the preset prediction time range following the current time window, set true early warning level labels for the current chemical multi-source monitoring samples. Real-time alert level labels The value can be 0, 1, 2 or 3. Among them, warning level 0 indicates normal operation, warning level 1 indicates a minor abnormality that needs attention, warning level 2 indicates a significant abnormality that requires intervention, and warning level 3 indicates a serious risk that requires immediate action.

[0074] The forecast time range is denoted as , This refers to the length of the future time window after the current time window ends, used to determine the actual warning level label. It can be 30 minutes, 60 minutes, or 120 minutes. For example, when... If no abnormal records are recorded within 60 minutes after the current time window ends, and the main dynamic variables remain within the normal operating range, the true warning level label can be set to 0; if local fluctuations occur but interlock protection is not triggered, the true warning level label can be set to 1; if there are continuous over-limits, equipment abnormalities, or leakage precursors requiring manual intervention, the true warning level label can be set to 2; if an emergency shutdown, major leakage alarm, or severe over-temperature or over-pressure is triggered, the true warning level label can be set to 3.

[0075] It should be noted that when multiple warning levels occur simultaneously within the same prediction time range, the highest warning level is used as the true warning level label. This labeling method enables the model to learn the correspondence between the current operating state and the subsequent risk evolution, rather than simply repeating the identification of alarm results that have already occurred.

[0076] 6> Sample the original chemical dynamic variable matrix Major hazard source level Static attribute vectors and true warning level labels A tagged chemical multi-source monitoring sample is formed. Multiple tagged chemical multi-source monitoring samples are then aggregated to obtain a training sample set. ,Right now .

[0077] in, Indicates the training sample index; Indicates the total number of training samples; Indicates the first The original chemical dynamic variable sampling matrix of each training sample; Indicates the first The major hazard level of each training sample; Indicates the first The static attribute vector of each training sample; Indicates the first The true warning level label for each training sample.

[0078] It should be noted that the training sample set The dataset should cover different production loads, different raw material batches, equipment start-up and shutdown, normal process adjustments, and seasonal environmental changes. Training, validation, and test sets should be prioritized for division by time period or production unit to avoid adjacent time windows of the same incident process appearing simultaneously in the training and test sets, thereby reducing inflated assessment results caused by data leakage.

[0079] 7. Based on the enterprise's process cards, equipment design parameters, safe operating procedures, alarm interlock settings, and HAZOP (Hazard and Operability Analysis) results, a graded safety boundary table is pre-established. The graded safety boundary table stores the upper limits of safety levels according to the major hazard source level and dynamic variable index. Safety lower bound Normal fluctuation benchmark quantity and boundary buffer ratio ,in,

[0080] Upper limit of security level This refers to the level of major hazard sources. Next The maximum safe operating value that each dynamic variable is allowed to reach; the lower bound of the safety level. This refers to the level of major hazard sources. Next The minimum safe operating value that each dynamic variable is allowed to reach; the normal fluctuation baseline. This refers to the level of major hazard sources. Next The typical fluctuation scale of a dynamic variable in historical data under normal operating conditions can be determined by the standard deviation under normal operating conditions or the minimum effective fluctuation amount verified by engineering; boundary buffer ratio. The width of the boundary buffer zone used to determine when to begin increasing the risk response before an actual exceedance occurs can be between 0.05 and 0.20.

[0081] In one implementation, the upper bound of the security level. and the lower bound of security level These parameters can be extracted directly from the company's process cards, equipment design parameters, safety operating procedures, and alarm interlock settings, or determined after engineering verification; for example, the safe operating range for reactor temperature may be specified as 100℃ to 150℃. It is 150℃. 100℃. Normal fluctuation baseline. The standard deviation is taken from the historical data of the corresponding major hazard source level and dynamic variables under normal operating conditions. If the calculated standard deviation is too small (e.g., close to 0), a minimum effective fluctuation is set based on sensor accuracy or engineering experience. For example, temperature can be set to 0.5℃ or 1℃, and pressure to 1 kPa, to avoid an excessively small divisor. Boundary buffer ratio. The value is determined by the process safety engineer based on risk preference and process dynamics, and is usually between 0.05 and 0.20. For variables with fast reaction rates and serious consequences (such as reaction temperature), a larger value (such as 0.15) can be used; for variables with slow changes or relatively minor consequences, a smaller value (such as 0.05) can be used.

[0082] It should be noted that the upper limit of the security level... It should be greater than the lower bound of the safety rating. Normal fluctuation benchmark quantity It should be a positive number. For dynamic variables that only focus on the upper limit of risk, the lower limit of safety level can be set as the lower limit of the sensor's physical range; for dynamic variables that only focus on the lower limit of risk, the upper limit of safety level can be set as the upper limit of the sensor's physical range.

[0083] S2. Enhancement of Safety Mechanism-Driven Features and Risk Precursor Mining in Multi-Source Chemical Data

[0084] The risk implications of chemical dynamic variables are simultaneously affected by the level of major hazard sources, the safety boundary of variables, the duration of anomalies, and the coupling relationship of chemical units. Simply performing uniform normalization on the original chemical dynamic variable sampling matrix makes it difficult to distinguish between normal process fluctuations, continuous shifts close to the safety boundary, and chain anomalies propagating from reaction anomalies to downstream equipment.

[0085] This invention calls upon the corresponding level of safety boundary based on the level of major hazard sources, extracts the instantaneous boundary risks approaching and exceeding the safety boundary, and obtains the persistent boundary risks through recursive accumulation; simultaneously, it calculates the coupled prediction residuals and cascading risks based on the temporal coupling relationship of variables under normal operating conditions, and finally obtains the dynamic feature matrix for enhanced safety mechanisms. The specific steps are as follows:

[0086] S201. Continuous Boundary Risk Extraction Based on Adaptive Safety Boundaries for Major Hazard Source Levels

[0087] A uniform safety threshold cannot reflect the differences in tolerance to abnormal fluctuations among different levels of major hazard sources, and it only generates a response after the dynamic variable has crossed the limit, which may easily miss early risks that are close to the safety boundary but have not yet crossed the limit.

[0088] like Figure 3 The flowchart shown illustrates the continuous boundary risk extraction process. This invention establishes a boundary buffer region inside each level of safety boundary, causing a continuously increasing instantaneous boundary risk to arise when dynamic variables approach the level of safety boundary. Furthermore, it retains the abnormal amplitude, duration, and timing of abnormal occurrences through recursive accumulation. The specific steps are as follows:

[0089] 1> Read the major hazard source level of the current chemical multi-source monitoring samples. and the original chemical dynamic variable sampling matrix And according to the level of major hazard sources Read the upper bounds of the security levels corresponding to the 7 dynamic variables from the security level boundary table. Safety lower bound Normal fluctuation benchmark quantity and boundary buffer ratio .

[0090] According to the upper limit of the security level and the lower bound of security level Calculate the first A dynamic variable in the major hazard source level The width of the safety interval below ,Right now ;in, It refers to the first A dynamic variable in the major hazard source level The width of the safety interval is used to uniformly describe the effective operating range of the dynamic variable from the lower limit of the safety level to the upper limit of the safety level.

[0091] 2> Based on the lower bound of graded security and safe interval width , will the The dynamic variable in the first... Sampled values ​​at each sampling time Convert to leveled security interval normalized value ,Right now ;in, It refers to the first The dynamic variable in the first... The normalized value of the security interval at each sampling time. hour, ;when hour, ;when When it is located in the middle of the lower and upper bounds of the security level, .

[0092] In practical implementation, the normalized value of the security level range is used. Limit to a preset numerical range, for example, limit to This is to prevent sudden spikes in sensor readings from causing excessively large input amplitudes to subsequent models. This limitation does not change the determination of whether a sampled value is out of bounds, because instantaneous boundary risks still use undressed dynamic variable sampled values. calculate.

[0093] Furthermore, the normalized values ​​of all security level intervals are arranged in chronological order and dynamic variable order to obtain the normalized dynamic variable matrix of security level intervals. Level security interval normalized dynamic variable matrix The dimension is It is used to characterize the relative position of each dynamic variable within the safety range of the corresponding major hazard source level.

[0094] 3> Based on boundary buffer ratio and safe interval width Calculate the first The boundary buffer width corresponding to each dynamic variable ,Right now ;in, It refers to the first A dynamic variable in the major hazard source level The lower boundary buffer width is used to determine the location where risk responses begin to occur inside the upper and lower safety levels.

[0095] No. The upper boundary buffer region of each dynamic variable is The lower boundary buffer area is When the sampled value of a dynamic variable enters any boundary buffer region, even if it has not exceeded the level safety boundary, it will generate an instantaneous boundary risk that changes continuously between 0 and 1.

[0096] 4> Sample values ​​of dynamic variables With the upper limit of security level and the starting point of the upper boundary buffer zone Compare and calculate the upper boundary risk response. , is represented as:

[0097] ;

[0098] in, It refers to the first The dynamic variable in the first... The upper boundary risk response at each sampling time. When the sampled value of the dynamic variable is below the upper boundary buffer area, the upper boundary risk response is 0; when the sampled value of the dynamic variable is within the upper boundary buffer area, the upper boundary risk response increases continuously from 0 to 1; when the sampled value of the dynamic variable exceeds the upper limit of the safety level, the upper boundary risk response continues to increase from 1 according to the over-limit magnitude.

[0099] It should be noted that this segmented processing creates a continuous connection between the area approaching and exceeding the upper limit of the safety level, avoiding slight fluctuations in the sampled values ​​on both sides of the threshold that could lead to abrupt changes in risk characteristics when using a hard threshold.

[0100] 5> Sample values ​​of dynamic variables With lower bound of security level and the end of the lower boundary buffer zone Compare and calculate the lower boundary risk response. , is represented as:

[0101] ;

[0102] in, Indicates the first The dynamic variable in the first... The lower boundary risk response at each sampling time. When the sampled value of the dynamic variable is above the lower boundary buffer area, the lower boundary risk response is 0; when the sampled value of the dynamic variable is within the lower boundary buffer area, the lower boundary risk response increases continuously from 0 to 1; when the sampled value of the dynamic variable is below the lower limit of the safety level, the lower boundary risk response continues to increase from 1 according to the lower limit magnitude.

[0103] 6> Compare the upper boundary risk response and lower boundary risk response The larger of the two values ​​is taken as the instantaneous boundary risk value. ,Right now ;in, Indicates the first The dynamic variable in the first... The instantaneous boundary risk value at each sampling moment is used to characterize the degree to which the dynamic variable is currently approaching or exceeding the corresponding level of safety boundary; This represents the maximum value function, which selects the largest value from multiple input values ​​as the output.

[0104] In practical implementation, when the sampled values ​​of dynamic variables are in the normal range far from the upper and lower bounds of the safety level, the instantaneous boundary risk value... The instantaneous boundary risk value is 0 when the sampled value of the dynamic variable enters any boundary buffer region. The instantaneous boundary risk value is between 0 and 1; when the sampled value of the dynamic variable exceeds any level of safety boundary. Greater than 1.

[0105] 7> Based on the current instantaneous boundary risk value The continuous boundary risk value at the previous sampling time The continuous boundary risk value at the current sampling time is calculated recursively. ,Right now ;

[0106] in, Indicates the first The dynamic variable in the first... The continuous boundary risk value at the sampling time point is used to characterize the period from the start of the current time window to the sampling time point. The degree of cumulative boundary risk at each sampling time; Indicates the first The risk retention coefficient corresponding to each dynamic variable ranges from 0 to 1, and can be between 0.80 and 0.98; when season .

[0107] It should be noted that the risk retention coefficient The larger the value, the more the instantaneous boundary risk generated at earlier sampling times is retained at subsequent sampling times, making it suitable for dynamic variables with continuous cumulative effects, such as temperature, pressure, and gas concentration; risk retention coefficient The smaller the value, the more sensitive the persistent boundary risk is to recent changes, making it suitable for dynamic variables with rapid state transitions, such as critical valve opening and motor current.

[0108] It should also be noted that the recursive calculation is not simply a count of the number of times the risk exceeds the limit, but rather an accumulation of the risk magnitude at each sampling time in chronological order. When a dynamic variable only briefly approaches the level safety boundary at a single sampling time, the persistent boundary risk value will gradually decrease in subsequent normal sampling times; when a dynamic variable continuously approaches or exceeds the level safety boundary, the persistent boundary risk value will continuously increase.

[0109] In one embodiment, for example, the major hazard source level A value of 1 represents the lower bound of the safety level corresponding to the temperature. 100℃, the upper limit of the safety rating. 150℃, boundary buffer ratio The value is 0.10, which is the normal fluctuation baseline. The temperature is 2℃. Based on the width of the safe zone. ℃, to obtain the boundary buffer width Therefore, the upper boundary buffer zone for temperature is 145℃ to 150℃. When the temperature sampled at a certain sampling time is 147℃, the temperature has not yet exceeded the upper limit of the safety level, but it has entered the upper boundary buffer zone. The upper boundary risk response is: When the temperature sample value at another sampling time is 154℃, the temperature has exceeded the upper limit of the safety level, and the upper boundary risk response is: Let the risk retention factor be corresponding to the temperature. If the instantaneous boundary risk values ​​at three consecutive sampling times are 0.4, 0.8, and 1.5 respectively, then the persistent boundary risk values ​​are as follows: , , Therefore, when the temperature gradually approaches and exceeds the upper limit of the safety level at multiple consecutive sampling times, the continuous boundary risk value can simultaneously reflect the increase in the degree of anomaly and the extension of the duration of the anomaly.

[0110] 8> For all 7 dynamic variables and all At each sampling time, instantaneous boundary risk calculation (corresponding to steps 4>, 5>, and 6> in S201) and persistent boundary risk recursion (corresponding to step 7> in S201) are performed to obtain the instantaneous boundary risk sequence and the persistent boundary risk sequence, respectively. For example, for a certain time... ,temperature( The sampled values ​​enter the upper boundary buffer and are calculated. , Then the instantaneous boundary risk value of the temperature at that moment Then, set the temperature risk retention factor. The previous continuous boundary risk value The current continuous boundary risk value .

[0111] Before feature concatenation, quantile normalization is performed on the instantaneous and persistent boundary risk values ​​using the high quantiles of the corresponding risk channels in the training set. For example, the 99th percentile of the corresponding channel in the training set can be used as the upper limit of normalization, mapping 0 to 0, mapping values ​​that reach or exceed the 99th percentile to 1, and mapping intermediate values ​​to the range of 0 to 1 proportionally.

[0112] Furthermore, the normalized instantaneous boundary risk values ​​are arranged in chronological order and dynamic variable order to obtain the instantaneous boundary risk matrix. , dimension Arrange the normalized persistent boundary risk values ​​in the same order to obtain the persistent boundary risk matrix. , dimension .

[0113] It should be noted that the instantaneous boundary risk matrix The key indicator is the degree to which the boundary approaches or exceeds the limit at the current sampling time; this is the continuous boundary risk matrix. It focuses on reflecting the accumulation and decay process of boundary risks over time, and the two can be used together to distinguish between a single peak and continuous deterioration.

[0114] S202. Extraction of cascading risk features based on the temporal coupling relationship under normal operating conditions.

[0115] Chemical accidents typically evolve continuously along the path of abnormal reaction, change in material state, deviation of control actions, abnormal equipment load, and gas diffusion. It is difficult to determine whether the abnormality is due to normal operation adjustment, local measurement noise, or chain propagation caused by abnormal temperature or pressure by judging alone whether the liquid level, gas concentration, critical valve opening, or motor current is abnormal.

[0116] like Figure 4 The flowchart shown illustrates the cascading risk feature extraction process. This invention determines the directed coupling relationships between variables based on the process flow diagram, piping and instrumentation diagram, and HAZOP analysis results. It then trains a normal coupling prediction model using historical data from normal operating conditions. When upstream reaction variables exhibit boundary risks, and downstream dynamic variables deviate from the normal coupling prediction results, the cascading risk is enhanced. The specific steps are as follows:

[0117] 1> Select time periods from the enterprise's historical operational data where no safety incidents occurred, no alarm interlocks were triggered, and the main dynamic variables remained stable to construct a historical dataset of normal operating conditions. Historical dataset under normal operating conditions It should include continuous sampling values ​​of at least temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, critical valve opening degree, and motor current.

[0118] Furthermore, the same level safety interval normalization as in step S201 is performed on the historical data under normal operating conditions to obtain a normal operating condition level safety interval normalized dynamic variable sequence. Using the level safety interval normalized dynamic variable sequence to train the normal coupling prediction model can reduce the impact of different dynamic variable dimensions and differences in the level safety intervals of major hazard sources on the model parameters.

[0119] 2> Based on the process flow diagram, piping and instrumentation diagram, and HAZOP analysis results, determine the upstream related variable sets for liquid level, combustible gas concentration, toxic gas concentration, critical valve opening degree, and motor current, respectively.

[0120] Specifically, with Indicates the index of downstream dynamic variables. ;by Indicates the first A set of upstream related variable indices corresponding to each downstream dynamic variable. For example, the set of upstream related variables for liquid level may include temperature, pressure, historical liquid level values, and critical valve opening; the set of upstream related variables for combustible gas concentration may include temperature, pressure, and critical valve opening; and the set of upstream related variables for motor current may include pressure, liquid level, critical valve opening, and historical motor current values.

[0121] It should be noted that the upstream related variable set is not obtained by arbitrarily searching all variable combinations by the model. Instead, the allowed variables are first determined based on the material flow direction, energy transfer relationship and control logic, and then the model parameters are trained within the allowed range. This reduces the chance correlations that the normal coupling prediction model learns that lack process basis.

[0122] 3> Set the historical lag order of the normal coupled prediction model Historical lag order The number of consecutive historical sampling times used when predicting downstream dynamic variables at the current sampling time can be 3, 5, or 10.

[0123] Furthermore, for the first Each downstream dynamic variable uses its upstream associated variable set. Before each dynamic variable The normalized value of the security interval at each sampling time is used to predict the normalized value of the security interval at the current sampling time. The implementation of the normalized coupled prediction model is expressed as follows:

[0124] ;

[0125] in, Indicates the first The downstream dynamic variable in the first Normal coupling prediction value at each sampling time; Indicates the first Prediction bias corresponding to each downstream dynamic variable; Indicates a historical lag index; Indicates the first The upstream correlation variable in the _th ... The historical lag position for the first The model coefficients that influence the downstream dynamic variables.

[0126] In practical implementation, historical data under normal operating conditions is used to determine the model coefficients through a least squares method with quadratic parameter constraints (i.e., ridge regression, which is implemented by adding an L2 norm penalty term for the model coefficients to the loss function of the standard least squares method). and Parameter constraints are used to limit excessively large model coefficients and prevent unstable prediction parameters from arising when there is correlation between upstream variables. Once the normal coupled prediction model is trained, its parameters are fixed and it is not jointly updated with subsequent early warning models.

[0127] 4> To ensure that the previous time window within the current time window is within the specified time frame Normal coupling prediction values ​​can be obtained even at each sampling time point, based on the original chemical dynamic variable sampling matrix. At that time, additional time windows prior to the start of the retention period are retained. The historical sampling time points are reserved only for normal coupling prediction and are not used as valid time positions in the dynamic feature matrix for security mechanism enhancement.

[0128] Furthermore, the first Before each valid sampling time The normalized values ​​of each safety level range are input into the normal coupling prediction model to obtain the normal coupling prediction values ​​corresponding to liquid level, combustible gas concentration, toxic gas concentration, key valve opening degree, and motor current.

[0129] 5> Based on the first Normalized value of the safety interval of each downstream dynamic variable and normal coupling prediction values Calculate the coupled prediction residual ,Right now , It refers to the first The downstream dynamic variable in the first The direction and magnitude of deviation of each sampling time relative to the normal temporal coupling relationship.

[0130] Calculate the first using historical data under normal operating conditions Residual fluctuation benchmark corresponding to each downstream dynamic variable Residual fluctuation benchmark This refers to the standard deviation of the coupled prediction residuals under normal operating conditions, used to convert the prediction biases of different downstream dynamic variables into a comparable scale. In practical implementation, this involves using all time points from the historical dataset under normal operating conditions. Corresponding Coupled Prediction Residual As a set of numerical values, the standard deviation of the set is calculated, thus obtaining... .

[0131] Furthermore, based on the coupling prediction residuals Absolute value and residual fluctuation benchmark Calculate the standardized coupled prediction residual ,Right now , It refers to the first The downstream dynamic variable in the first The degree to which the coupling relationship deviates from normal at each sampling time point. Standardized coupling prediction residuals. The larger the value, the more difficult it is to explain the current downstream dynamic variables using historical variable relationships under normal operating conditions.

[0132] 6> Read the instantaneous boundary risk values ​​corresponding to temperature and pressure. and By limiting the larger of the two values ​​to the range of 0 to 1, the abnormal response gating value is obtained. , is represented as:

[0133] ;

[0134] in, Indicates the first The reaction anomaly gate value at each sampling time is used to characterize whether the temperature or pressure has approached or exceeded the corresponding level of safety boundary.

[0135] In practical implementation, when both temperature and pressure are far from the safety level boundary, the reaction anomaly threshold value is activated. The threshold value is 0; when temperature or pressure enters the boundary buffer zone, the response anomaly threshold value is activated. It increases continuously between 0 and 1; when the temperature or pressure reaches or exceeds the safety boundary, it triggers an abnormal response threshold. The value is 1.

[0136] It should be noted that using a continuous response anomaly gate value instead of a hard judgment value of 0 or 1 can make the cascading risk increase smoothly as the temperature or pressure gradually approaches the level of safety boundary, reducing the sudden changes in cascading risk caused by slight fluctuations near the threshold.

[0137] 7. Based on the material transfer time and control response time between chemical units, set a propagation lag for each downstream dynamic variable. Propagation lag This refers to the propagation of the abnormal effects of a temperature or pressure anomaly to the next level. The number of sampling times required for each downstream dynamic variable can be determined based on the cross-correlation peak of historical events, process dwell time, or engineering experience.

[0138] For example, when the uniform sampling period is 1 minute, the propagation hysteresis corresponding to the liquid level can be 2, the propagation hysteresis corresponding to the combustible gas concentration can be 3, the propagation hysteresis corresponding to the toxic gas concentration can be 3, the propagation hysteresis corresponding to the critical valve opening can be 1, and the propagation hysteresis corresponding to the motor current can be 2.

[0139] Furthermore, setting the first Chaining risk weights corresponding to each downstream dynamic variable Each chain risk weight is not less than 0, and satisfies the following conditions: Chain risk weights This is used to reflect the importance of different downstream dynamic variables in accident propagation judgment. For example, combustible gas concentration and toxic gas concentration are given the highest weight, such as 0.3 each; liquid level and motor current are given medium weight, such as 0.15 each; and critical valve opening is given a low weight, such as 0.1.

[0140] 8> Gating value for abnormal response after propagation lag Coupled with current standardized prediction residuals Multiply, then according to the chain risk weights Perform a weighted summation to obtain the first... Chain risk value at each sampling time , is represented as:

[0141] ;

[0142] in, Indicates the first The combined intensity of the anomaly propagation at each sampling moment reflects the liquid level, combustible gas concentration, toxic gas concentration, critical valve opening, and motor current; when At that time, set the corresponding abnormal response threshold value. .

[0143] In practical implementation, when both temperature and pressure are within normal ranges, even if a downstream dynamic variable has a slight prediction residual, its impact on the cascading risk value will be minimal. The contribution will also be suppressed by the abnormal response gating value; when the temperature or pressure has approached or exceeded the level safety boundary, and the downstream dynamic variables deviate significantly from the normal coupling prediction results after the corresponding propagation lag, the cascading risk value will be affected. Increase.

[0144] In one embodiment, for example, the first The instantaneous boundary risk value for temperature at each sampling moment is 1.2, and the instantaneous boundary risk value for pressure is 0.6. Therefore, the reaction anomaly gate value is... Assume the propagation hysteresis corresponding to the combustible gas concentration. In the The reaction anomaly gate value at the sampling time is 0.8, and the first sampling time is... Standardized coupled prediction residuals of combustible gas concentration at each sampling time Chain reaction risk weights corresponding to combustible gas concentrations The contribution of combustible gas concentration to the current cascading risk value is: Assuming the sum of the contributions of the remaining four downstream dynamic variables to the current cascading risk value is 0.35, then the current cascading risk value is... This indicates that after an abnormal temperature or pressure occurs, the downstream variables have experienced a synchronization shift that cannot be explained by the normal coupling relationship.

[0145] It should be noted that if the same downstream standardized coupling prediction residual occurs during a period when both temperature and pressure are normal, and the response anomaly threshold value is close to 0, then the corresponding cascading risk value is small, thereby reducing misjudgments caused by normal valve regulation, maintenance operations, or fluctuations in independent sensors.

[0146] 10> All cascading risk values ​​within the time window Calculate the average and maximum values, and then perform a weighted fusion to obtain the window cascading risk index. , is represented as:

[0147] ;

[0148] in, This refers to the window cascading risk index corresponding to the current time window; This represents the peak contribution coefficient, which ranges from 0 to 1, and can be 0.5.

[0149] It should be noted that the maximum value of the chain risk within the time window is used to retain strong risk signals that spread rapidly in a short time, while the average value is used to retain persistent chain anomalies. By combining the two, we can avoid weakening short-term severe anomalies when using only the average value, and we can also avoid over-responding to a single noise spike when using only the maximum value.

[0150] 11> Perform training set quantile normalization on the standardized coupled prediction residuals corresponding to the five downstream dynamic variables, and arrange them in a fixed order of liquid level, combustible gas concentration, toxic gas concentration, key valve opening degree, and motor current to obtain the coupled prediction residual matrix. , dimension .

[0151] At the same time, the cascading risk value within the time window Perform quantile normalization on the training set and arrange them in chronological order to obtain the chain risk feature column. , dimension .

[0152] It should be noted that the window chain risk index The overall cascading risk quantity for the current time window is stored separately for comprehensive decision-making on early warning levels in step S4; cascading risk characteristic column Used to provide time series models with the evolution of cascading risks within a time window.

[0153] It should also be noted that training set quantile normalization refers to calculating the 99th (or other specified) percentile of a feature on the training set, then dividing the feature value of all samples by this percentile, and truncating values ​​greater than 1 to 1, thereby mapping the feature value to the [0,1] interval.

[0154] S203, Construction of Dynamic Feature Matrix Enhanced by Security Mechanism

[0155] The normalized dynamic variable matrix of the safety level interval reflects the relative position of each dynamic variable within the corresponding major hazard source safety level interval; the instantaneous boundary risk matrix reflects the degree of boundary approach and exceedance at each sampling time; the persistent boundary risk matrix reflects the continuous accumulation process of risk; the coupled prediction residual matrix reflects the degree to which downstream dynamic variables deviate from the normal temporal coupling relationship; and the cascading risk feature column reflects the temporal intensity of the propagation of abnormal reactions to downstream variables. For example... Figure 5 The diagram showing the construction of the dynamic feature matrix for enhanced safety mechanisms illustrates how this invention combines the aforementioned features according to a unified time position to form a model input that simultaneously includes the operational state, safety boundary state, risk persistence state, and accident chain propagation state. The specific steps are as follows:

[0156] 1> Check the normalized dynamic variable matrix of the security interval of the inspection level Instantaneous boundary risk matrix Continuous Boundary Risk Matrix Coupled prediction residual matrix and chain risk characteristics The time length ensures that all five feature types are included. Each row contains one valid sampling time, and each row corresponds to the same actual sampling time.

[0157] When the normal coupled prediction model uses the time window starting point At each historical sampling moment, the aforementioned Each historical sampling time point only participates in the coupled prediction calculation (i.e., step 3> in S202) and is not written into the coupled prediction residual matrix. and chain risk characteristics This ensures that the effective time length of all input matrices is consistent.

[0158] 2> Normalize the dynamic variable matrix of the security level interval. Instantaneous boundary risk matrix Continuous Boundary Risk Matrix Coupled prediction residual matrix and chain risk characteristics By splicing along the feature channel direction, a dynamic feature matrix for enhanced security mechanism is obtained. ,Right now ;in, This refers to the dynamic feature matrix of security mechanism enhancement corresponding to the current time window, with dimensions of [missing information]. The 27 feature channels include 7 level safety interval normalized dynamic variable channels, 7 instantaneous boundary risk channels, 7 persistent boundary risk channels, 5 coupled prediction residual channels, and 1 chain risk channel. The square brackets indicate matrix splicing along the feature channel direction.

[0159] In one embodiment, for example, when the time window length At that time, the normalized dynamic variable matrix of the security interval is... Instantaneous boundary risk matrix and persistent boundary risk matrix All dimensions are Coupled prediction residual matrix The dimension is Chain risk characteristics The dimension is The final dimension is Security mechanism enhancement dynamic feature matrix .

[0160] It should be noted that this invention does not simply copy the overall risk characteristics of the time window to each time position, but retains the time-by-time changes of instantaneous boundary risk, persistent boundary risk, coupled prediction residual and chain risk respectively. The subsequent time series model can identify the evolution sequence of "temperature boundary risk first, then pressure anomaly, and then gas concentration coupled residual", rather than just obtaining an overall statistic that does not include the relationship between time positions.

[0161] S3. Construction and Training of Time-Series Early Warning Model for Major Hazard Source Level Conditions

[0162] The same temperature rise, pressure fluctuation, or gas concentration change has different safety implications under different major hazard source levels. If the same time-series feature extraction parameters are used for all samples, the model may easily overlook the fact that high-risk monitoring objects are more sensitive to boundary proximity and accident chain propagation.

[0163] This invention constructs a time-series early warning model based on the conditional levels of major hazard sources. The model includes a multi-scale temporal encoder for major hazard source levels, a static attribute fusion module, and an ordered level prototype classification module. The multi-scale temporal encoder extracts change patterns at different time scales using shared convolutional parameters and generates channel modulation parameters based on the major hazard source levels. The ordered level prototype classification module, through interval constraints proportional to the differences in warning levels, ensures an ordered distribution of warning levels 0 to 3 in the representation space. The specific steps are as follows:

[0164] S301, Construction of a multi-scale temporal encoder for major hazard source level conditions

[0165] Chemical risks can manifest as rapid abrupt changes between adjacent sampling times, or as slow deterioration accumulating over multiple sampling times. A fixed-time receptive field cannot simultaneously adapt to both of these risk patterns.

[0166] This invention sets up multiple one-dimensional convolutional branches with different dilation rates, and dynamically determines the fusion weight of each convolutional branch based on the level of major hazard sources and the current safety mechanism risk status. The specific steps are as follows:

[0167] 1> Enhance the dynamic feature matrix of the security mechanism The input to the multi-scale temporal encoder for major hazard source level conditions is denoted as the 0th layer input feature matrix. ,Right now , dimension It is used to provide safety mechanism enhancement features corresponding to each sampling time in the multi-scale time encoder of major hazard source level conditions.

[0168] 2> Settings Multi-scale temporal coding layer for major hazard source level conditions. This indicates the number of coding layers, which can be 3. Each multi-scale temporal coding layer for major hazard source level conditions contains 3 parallel one-dimensional convolutional branches, with the following dilation rates: , and .

[0169] Among them, the one-dimensional convolution branch with an expansion rate of 1 is used to extract rapid changes between adjacent sampling times; the one-dimensional convolution branch with an expansion rate of 2 is used to extract risk development trends over a medium time range; and the one-dimensional convolution branch with an expansion rate of 4 is used to extract continuous over-limit and accident chain propagation processes over a longer time range.

[0170] In one implementation, the kernel length of each one-dimensional convolutional branch is 3, the number of output channels of each one-dimensional convolutional branch is 64, and zero padding is used to maintain the duration of the convolutional output. After convolution, batch normalization and linear rectified activation are performed sequentially.

[0171] 3> For the first Layer The first one-dimensional convolution branch will... Layer output feature matrix As input, the execution expansion rate One-dimensional convolution yields the basic branch feature matrix. , is represented as:

[0172] ;

[0173] in, Indicates the multi-scale temporal coding layer index of major hazard source level conditions. ; This represents the index of a one-dimensional convolution branch. ; Indicates the first Layer Convolution kernel parameters for each one-dimensional convolution branch; This indicates the corresponding convolution bias; Indicates the expansion rate One-dimensional convolution; Indicates batch normalization; Represents the linear rectification activation function; It refers to the first In the multi-scale temporal coding layer of the major hazard source level conditions, the first... Each one-dimensional convolutional branch pairs with the input. The basic branch feature matrix obtained after performing dilated convolution, batch normalization, and linear rectified activation has a dimension of [missing information]. , This represents the number of output channels for each one-dimensional convolution branch, which can be 64.

[0174] 4> Set up a trainable embedding matrix for major hazard source levels , dimension Among them, the four rows correspond to the major hazard source levels 1, 2, 3 and 4, respectively. This indicates the embedded dimension of the major hazard source level, which can be 16.

[0175] Furthermore, based on the current major hazard source levels of multi-source monitoring samples in the chemical industry... Embedded matrix from major hazard source level Read the first Okay, we obtain the embedding vector of the major hazard source level. , dimension It is used to generate feature modulation parameters and convolutional branch fusion weights corresponding to the current major hazard source level.

[0176] 5> Embed the major hazard source level into the vector Input the channel modulation parameters corresponding to each coding layer into the generation network to obtain the first... Layer The channel scaling vector corresponding to each one-dimensional convolutional branch and channel offset vector .

[0177] Wherein, channel scaling vector The dimension is This is used to adjust the response intensity of each feature channel in the basic branch feature matrix; channel offset vector. The dimension is This is used to adjust the response benchmark of each characteristic channel.

[0178] In one implementation, the channel modulation parameter generation network consists of an input dimension of... The hidden dimension is 32, and the output dimension is... It consists of a single hidden layer fully connected network, and the output vector is the first... Each element, after being processed by the hyperbolic tangent function, is used as the channel scaling vector. ,back Each element is used as the channel offset vector. .

[0179] 6> Scale the channel vector and channel offset vector Broadcast along the time dimension and on the basic branch feature matrix. By performing channel-by-channel modulation, the conditional branch feature matrix of the major hazard source level is obtained. , is represented as:

[0180] ;

[0181] in, Indicates the first Layer The one-dimensional convolutional branch at the th... The feature vector of major hazard source level conditions at each sampling time (i.e., the branch feature matrix of major hazard source level conditions) (the t-th row); The dimension is A vector in which all elements are 1; This indicates element-wise multiplication.

[0182] It should be noted that adding a vector with all elements equal to 1 before the channel scaling vector can make the channel modulation during the model initialization phase approach an identity transformation, preventing the model from losing basic convolutional features in the early stages of training due to the scaling factor being close to 0. The conditional feature modulation of major hazard source levels is applied to the convolutional output channel, rather than directly adding the same offset to each element of the convolution kernel, thus maintaining the local difference structure of the convolution kernel and training stability.

[0183] 7> Instantaneous boundary risk matrix from the current time window and chain risk characteristics Extract safety risk status statistics from the instantaneous boundary risk matrix. Calculate the average and maximum values ​​for all elements in the chain risk characteristic column. The average and maximum values ​​of all elements are calculated and arranged in a fixed order (the first element is the average value of instantaneous boundary risk, the second element is the maximum value of instantaneous boundary risk, the third element is the average value of cascading risk, and the fourth element is the maximum value of cascading risk) to form a safety risk state vector. .

[0184] Among them, the security risk state vector The dimension is 4, the first element is the average instantaneous boundary risk, the second element is the maximum instantaneous boundary risk, the third element is the average cascading risk, and the fourth element is the maximum cascading risk.

[0185] Furthermore, the security risk state vector This is used to characterize the overall and peak levels of boundary risks and cascading risks within the current time window. A larger average value indicates that the risk persists within the time window, while a larger maximum value indicates that an excessively strong risk peak has occurred within the time window.

[0186] 8> Embed the major hazard source level into the vector With security risk state vector Concatenate along the feature dimension and input the first feature dimension. The branch weight generation network corresponding to the layer is used to obtain the first layer. Layer branch fusion weight vector , is represented as:

[0187] ;

[0188] in, Indicates the first Layer branch fusion weight vector; , and These correspond to one-dimensional convolution branches with dilation rates of 1, 2, and 4, respectively. Indicates the first The trainable weight matrix of the layer branch weight generation network; Indicates the first Layer branch weights generate trainable bias vectors for the network; This indicates vector concatenation; This represents the Softmax function, which ensures that the fusion weights of the three branches are all not less than 0 and their sum is 1.

[0189] It should be noted that by using both the major hazard source level embedding vector and the safety risk state vector simultaneously, the model can not only adjust the time scale preference according to the major hazard source level, but also adaptively adjust the participation of different convolutional branches according to whether the current risk is a short-term outbreak or a continuous propagation.

[0190] 9> According to the branch fusion weight vector The feature matrices of the three major hazard source level condition branches are weighted and fused, and then combined with the first... The residuals of the layer output feature matrices after dimension alignment are summed to obtain the result of the first layer. Layer output feature matrix , is represented as:

[0191] ;

[0192] in, Indicates the first Layer residual dimension alignment mapping. When the input feature map... Number of channels Number of output channels of the main path When they are the same, It is an identity mapping, that is When the input feature map Number of channels Number of output channels of the main path At the same time, It is a one-dimensional convolutional layer (Conv1D) with a kernel size of 1, without changing the time dimension. By only changing the channel dimension, the number of input channels of this convolutional layer is The number of output channels is The convolution kernel has a length of 1, and its function is to... The number of channels from Linear projection to .

[0193] In one embodiment, as an example, suppose the input of the first coding layer is... The number of channels is 27, and the number of output channels of the coding layer is... ;at this time If it is not equal to 64, then It is a one-dimensional convolution with 27 input channels, 64 output channels, and a kernel length of 1. For the second and subsequent coding layers, The number of input channels is 64, and the number of output channels is... If they are the same, then and All are identity mappings.

[0194] It should be noted that residual addition can preserve the basic operating state in the previous coding layer, reducing the possibility that security boundary features and cascading risk features are over-smoothed during multi-layer coding.

[0195] 10> Complete in sequence Multi-scale temporal coding of the major hazard source level conditions at each level yields the temporal coding feature matrix. , dimension It is used to characterize the risk evolution features after modulation by major hazard source level conditions and fusion of multiple time scales.

[0196] Furthermore, the temporal coding feature matrix Global average pooling and global max pooling are performed along the time dimension, and the results of the two pooling operations are concatenated along the feature dimension to obtain the dynamic risk feature vector. , dimension .

[0197] It should be noted that global average pooling is used to retain risk characteristics that persist within the time window, while global max pooling is used to retain strong risk characteristics that appear in a short period of time within the time window. The two can be used together to adapt to both slowly accumulating anomalies and rapidly emerging anomalies.

[0198] In one embodiment, for example, when the major hazard source level When the value is 4, and both the average instantaneous boundary risk and the average cascading risk are low, the branch weight generation network can output... (Assumptions are made for explanatory purposes only), the model primarily uses a one-dimensional convolutional branch with an expansion rate of 1 to extract local operational fluctuations; when the major hazard source level... When the value is 1, and both the persistent boundary risk and the cascading risk increase significantly, the branch weight generation network can output... (As assumed for explanatory purposes only), the model increases the participation of one-dimensional convolutional branches with an expansion rate of 4 to analyze whether the risk continues to develop and spread downstream over a longer time period.

[0199] It should be noted that the branch fusion weights are learned from the training data. The aforementioned weights are only used to describe one possible model response result and are not fixed rules. This allows the model to form grade-differentiated responses while sharing the basic feature extraction capabilities, without having to build completely independent networks for each of the four major hazard source levels.

[0200] In one embodiment, such as Figure 6 The bar chart showing the dynamic risk feature vector illustrates the 128-dimensional dynamic risk feature vector obtained after concatenation of global average pooling and global max pooling by the encoder. The horizontal axis represents the feature dimension index, and the vertical axis represents the feature value, both dimensionless. The response intensity of each dimension reflects the comprehensive encoding result of persistent risk features and sudden strong risk features within the time window. The temporal encoder has compressed the security mechanism enhancement features with long temporal processes into a fixed-length representation vector, providing directly usable input for the next step of fusion with static attributes and hierarchical classification.

[0201] S302, Static Attribute Fusion and Ordered Hierarchy Prototype Classification

[0202] Warning levels 0, 1, 2 and 3 have a clear increasing risk relationship. Ordinary classification networks usually treat the four warning levels as independent unordered categories and cannot constrain the difference between warning level 0 and warning level 1 to be smaller than the difference between warning level 0 and warning level 3.

[0203] This invention fuses dynamic risk feature vectors, major hazard source level embedding vectors, and static attribute vectors into a comprehensive risk representation vector. Furthermore, by employing ordered level prototype interval loss, it maintains a larger separation interval between warning levels that are further apart in the representation space. The specific steps are as follows:

[0204] 1> Using statistics corresponding to the production year, designed capacity, and number of employees in the training set, analyze the static attribute vector. Perform Z-score standardization to obtain the standardized static attribute vector. The dimension is 3. During the training phase, only the mean and standard deviation of each static attribute are calculated using the training set; during the validation, testing, and online inference phases, the mean and standard deviation saved during the training phase are used and are not recalculated based on individual samples to be decided.

[0205] 2> Dynamic risk feature vector Major hazard source level embedding vector and standardized static attribute vectors By concatenating along the feature dimension, a fused input vector is obtained. This fused input vector is then input into the fully connected network for comprehensive representation to obtain the comprehensive risk representation vector. , is represented as:

[0206] ;

[0207] in, It refers to the comprehensive risk characterization vector of current multi-source monitoring samples in the chemical industry; This represents the trainable weight matrix that comprehensively characterizes the fully connected network; This represents the trainable bias vector that comprehensively characterizes the fully connected network.

[0208] In one implementation, the comprehensive risk representation vector The dimension is denoted as The output dimension can be 128. A fully connected network can be characterized by two fully connected layers. The output dimension of the first layer is 256, and the output dimension of the second layer is 128. Layer normalization, linear rectified activation, and random deactivation can be set between each layer.

[0209] 3> Comprehensive risk representation vector Performing L2 normalization yields the unit comprehensive risk representation vector. ,Right now , This refers to the comprehensive risk representation vector after direction normalization; This represents the L2 norm of a vector. L2 normalization ensures that subsequent level matching is primarily based on the direction of risk characteristics, rather than simply on the absolute magnitude of the comprehensive risk representation vector.

[0210] 4> Set learnable level prototype vectors for warning levels 0, 1, 2, and 3 respectively. , , and The dimension of the prototype vector for each learnable level is 1. , is used to characterize the center direction of the corresponding warning level in the comprehensive risk characterization space. Among them, This represents the learnable level prototype vector corresponding to warning level 0; This represents the learnable level prototype vector corresponding to warning level 1. This represents the learnable level prototype vector corresponding to warning level 2. This represents the learnable level prototype vector corresponding to warning level 3.

[0211] Furthermore, L2 normalization is performed on each learnable level prototype vector to obtain the unit level prototype vector. ,in, Indicates the warning level index. .

[0212] In one implementation, as an optional approach, the model can first be trained for several epochs using randomly initialized parameters to obtain the initial comprehensive risk representation vector corresponding to the training samples. Then, the initial comprehensive risk representation vectors are grouped according to the actual warning level labels, and the average vector within the same warning level group is used as the initial value of the corresponding learnable level prototype vector. During formal training, the learnable level prototype vector is updated together with other trainable parameters in the model.

[0213] 5> Calculate the unit comprehensive risk representation vector respectively The cosine similarity between the model and the four unit level prototype vectors yields the level similarity. ,Right now , This refers to the current multi-source monitoring samples and early warning levels in the chemical industry. The similarity of levels, with values ​​ranging from 1 to 2. The greater the similarity in risk levels, the closer the comprehensive risk characterization of the current multi-source monitoring samples in the chemical industry is to the corresponding early warning level prototype. Among these, for The transpose of .

[0214] Furthermore, the four levels of similarity are multiplied by a similarity temperature coefficient. Then, input the Softmax function to obtain the preliminary warning probability vector. , is represented as:

[0215] ;

[0216] in, This indicates that the current chemical multi-source monitoring samples belong to the early warning level. The initial predicted probability; This represents the similarity temperature coefficient, used to adjust the degree of differentiation after different levels of similarity are converted into probabilities. It can be set from 5 to 20.

[0217] Furthermore, the initial early warning probability vector The warning level corresponding to the highest probability in the middle is determined as the preliminary warning level. .

[0218] 6> For the first in a training batch Let there be training samples, and let their true warning level label be... Calculate the similarity between the training sample and the actual early warning level prototype. And the similarity of the levels to other error warning level prototypes. .

[0219] Furthermore, the absolute value of the difference between the true warning level and the false warning level is... Multiply by unit level interval This yields the minimum similarity interval required to determine the corresponding error warning level. (Unit level interval) The basic separation degree used to control the adjacent warning levels can be taken as 0.05 to 0.30.

[0220] Furthermore, the ordered level prototype interval loss is calculated based on the similarity of the actual warning level, the similarity of the false warning level, and the minimum similarity interval. , is represented as:

[0221] ;

[0222] in, This represents the ordered level prototype margin loss, corresponding to the ordered level prototype margin loss of a training batch. Indicates the number of samples in the training batch; This indicates the error warning level index.

[0223] It should be noted that when the false alarm level and the true alarm level are adjacent, a small minimum similarity interval is required between them; when the false alarm level and the true alarm level are far apart, a larger minimum similarity interval is required. For example, when the true alarm level is 0, the minimum similarity interval required between it and alarm level 3 is three times that between it and alarm level 1.

[0224] 7> Set category weights based on the number of samples for each warning level in the training set. Warning levels with smaller sample sizes correspond to larger category weights. The category-weighted cross-entropy loss is calculated based on the initial warning probability and the actual warning level labels. , is represented as:

[0225] ;

[0226] in, This represents the class-weighted cross-entropy loss for a training batch; Indicates the first The category weights corresponding to the true warning levels of each training sample; Indicates the first The preliminary predicted probability of each training sample at the actual warning level.

[0227] It should be noted that the category-weighted cross-entropy loss is used to ensure that the model can correctly distinguish the four warning levels, while the ordered level prototype interval loss is used to constrain the distance relationship between different warning levels in the representation space. The two have different functions.

[0228] 8> The class-weighted cross-entropy loss and the ordered rank prototype margin loss are weighted and combined to obtain the model training loss. ,Right now .in, The value represents the loss weight of the prototype interval of the ordered level, which is used to adjust the balance between the accuracy of the early warning classification and the orderliness of the level. It can be taken from 0.1 to 1.0.

[0229] In practical implementation, when When the model is too small, it primarily focuses on classification accuracy, and the orderly separation between the prototypes of the warning levels may not be obvious; when... When the value is too large, the model may overemphasize the level interval, reducing its ability to distinguish between fine-grained warning levels. The optimal value can be selected based on a combination of the macro-average F1 score on the validation set and the cost of severe missed detections. .

[0230] In one embodiment, for example, the true warning level of a training sample is 1. The model calculates the similarity to warning levels 0, 1, 2, and 3 as 0.45, 0.72, 0.60, and 0.20, respectively. Let the unit level interval be... For error warning level 2, due to The requirement is that the similarity of the true warning level is at least 0.10 higher than the similarity of the false warning level. Currently, the similarity advantage is... The interval requirement is met, and the corresponding loss term is 0. For error warning level 0, the current similarity advantage is... If the interval is greater than the minimum interval of 0.10, the corresponding loss term is 0. For error warning level 3, the required minimum interval is... The current similarity advantage is The corresponding loss term is also 0. If the similarity of the warning level 3 increases to 0.60, the similarity advantage of the real warning level 1 relative to the warning level 3 is only 0.12, which is less than the minimum interval of 0.20. The corresponding loss term is 0.08. The model training will push the training sample closer to the warning level 1 prototype and further away from the warning level 3 prototype.

[0231] S303, Training of Time-Series Early Warning Model for Major Hazard Source Level Conditions

[0232] This step uses the training sample set. End-to-end training was performed on the time-series early warning model for major hazard source levels to enable the model to learn the correspondence between dynamic features of safety mechanisms, major hazard source levels, static attributes, and actual early warning levels. The specific steps are as follows:

[0233] 1> For the training sample set For each training sample, calculate the instantaneous boundary risk matrix according to step S201. and persistent boundary risk matrix Calculate the coupled prediction residual matrix according to step S202. Chain risk characteristics and window chain risk index Then, following step S203, construct the dynamic feature matrix to enhance the security mechanism. .

[0234] The hierarchical safety boundary table, normal coupling prediction model, quantile normalization parameters, and static attribute normalization parameters used in the training phase are all saved as fixed preprocessing parameters and continue to be used in the validation, testing, and online inference phases.

[0235] 2> Input the training samples into the time-series early warning model for major hazard source levels according to the preset training batches. Number of samples per training batch. You can use 32 or 64. For training samples with different time window lengths, they should be uniformly truncated or padded to a fixed time window length before being input into the model. Avoid mixing different time dimensions in the same model.

[0236] 3> The model sequentially passes through a multi-scale temporal encoder based on the major hazard source level conditions, a static attribute fusion module, and an ordered level prototype classification module to obtain the preliminary warning probability vector for each training sample, and then calculates the model training loss. .

[0237] The Adam optimizer is used to update the one-dimensional convolutional branch parameters, channel modulation parameters to generate network parameters, branch weights to generate network parameters, major hazard source level embedding matrix, comprehensive characterization of fully connected network parameters, and learnable level prototype vector.

[0238] In one implementation, the initial learning rate of the Adam optimizer can be 0.001, the number of training epochs can be 100 to 200, and the weight decay coefficient can be... If the validation set loss does not decrease for 5 consecutive training epochs, multiply the current learning rate by 0.5; if the validation set macro average F1 score does not improve for 15 consecutive training epochs, stop training.

[0239] 4> After each training cycle, use the validation set to calculate the precision, recall, and F1 score for alert levels 0, 1, 2, and 3 respectively, and calculate the macro-average F1 score for the four alert levels.

[0240] Furthermore, a cost matrix for missed warnings is set up based on actual safety requirements. The greater the difference in warning levels, the higher the cost of missed warnings corresponding to underestimating risks. For example, the cost of incorrectly predicting a true warning level 3 as a warning level 0 is set to the highest, while the cost of incorrectly predicting a true warning level 1 as a warning level 0 is set to a relatively low.

[0241] Taking into account both the macro-average F1 score and the cost of missed reports, model parameters are selected. Priority is given to saving model parameters that meet safety requirements for the missed report rate of serious risks and have a high macro-average F1 score, which are used as parameters for the time-series early warning model of major hazard source level conditions after training.

[0242] It should be noted that the normal coupling prediction model and the time-series early warning model for major hazard source levels are trained in stages. The normal coupling prediction model is trained using only historical data under normal operating conditions to establish a baseline for normal variable coupling; the time-series early warning model for major hazard source levels is trained using training samples labeled with early warning levels to complete risk identification. Staged training can prevent the normal coupling prediction model from erroneously learning abnormal propagation relationships as normal relationships in order to adapt to accident samples.

[0243] It should also be noted that the specific structure of the time-series early warning model for major hazard source level conditions is shown in the table below:

[0244]

[0245] S4. Safety Production Risk Warning for Chemical Enterprises

[0246] After completing the model construction and training, the trained time-series early warning model for major hazard source levels can be deployed to the actual production environment to provide real-time online risk warnings for the safety production status of chemical enterprises. This early warning process strictly follows the same data preprocessing, feature extraction, and model inference procedures as the training phase to ensure the reliability and consistency of the early warning results.

[0247] First, multi-source monitoring data is acquired and preprocessed in real time. In the production control system or real-time database, real-time sampling values ​​of seven dynamic variables—temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, key valve opening degree, and motor current—are continuously acquired according to the unified sampling cycle set in step S1. For motor current with a high initial sampling frequency, its effective current value within each unified sampling cycle is calculated in real time. Simultaneously, the online acquired dynamic variable data undergoes the same time alignment, missing value linear interpolation, and sensor physical range validity checks as in step S1, forming a continuous and effective real-time data stream. The system needs to synchronously read the static attribute information of the currently monitored object, namely, the major hazard source level, the number of years of operation, the designed production capacity, and the number of employees on duty.

[0248] Secondly, online multi-source monitoring samples for chemical industries are constructed. Based on a preset time window length and sliding step size, the latest original sampling matrix of chemical dynamic variables is extracted from the continuous real-time data stream. When the length of the newly acquired data stream meets a time window requirement, the system generates a chemical multi-source monitoring sample to be judged. The static attribute portion of this sample is consistent with the current values ​​read online.

[0249] Then, safety mechanism-driven feature enhancement is performed on the current sample to be judged. All preprocessing modules and models with fixed parameters from step S2 are invoked to transform the original chemical dynamic variable sampling matrix into a safety mechanism-enhanced dynamic feature matrix. Specifically, based on the major hazard source level of the current sample, the level safety boundary table pre-stored during the training phase is invoked to calculate the level safety interval normalized dynamic variable matrix. Based on the same level safety boundary, the instantaneous boundary risk matrix and the persistent boundary risk matrix are calculated sequentially. Simultaneously, the trained normal coupling prediction model is used to predict downstream dynamic variables, the coupling prediction residual matrix is ​​calculated, and the cascading risk feature column and window cascading risk index are calculated by combining the reaction anomaly gating mechanism and propagation lag. All parameters relied upon in these calculation processes, such as level safety boundaries, normal coupling prediction model coefficients, risk retention coefficients, and quantile normalization parameters, directly use the fixed parameters saved during the training phase and are not updated online.

[0250] Next, the constructed safety mechanism-enhanced dynamic feature matrix is ​​input into the trained major hazard source level conditional temporal early warning model. The forward propagation process of the model is as follows: the major hazard source level conditional multi-scale temporal encoder dynamically modulates the features of each convolutional layer and fuses the multi-scale temporal features based on the major hazard source level embedding vector of the current sample and the real-time calculated safety risk state vector, outputting a dynamic risk feature vector. Subsequently, the static attribute fusion module fuses the dynamic risk feature vector, the major hazard source level embedding vector, and the static attribute vector after Z-score normalization to generate a comprehensive risk representation vector, and performs L2 normalization on it. The ordered level prototype classification module calculates the cosine similarity between this normalized vector and the unit level prototype vectors corresponding to the four early warning levels. After temperature coefficient adjustment and Softmax function calculation, the final risk early warning probability vector is output.

[0251] Finally, the warning level is determined and responded to. The warning probability vector output by the model gives the predicted probability that the chemical production status in the current time window belongs to warning level 0, warning level 1, warning level 2, and warning level 3. The system selects the warning level corresponding to the highest probability as the final real-time warning level. According to the determined warning level, the system executes the corresponding risk handling procedures: when the warning level is 0, it indicates that the production process is in normal operation, and the system only records the routine status; when the warning level is 1, it indicates that a minor abnormality has occurred, and the system issues a prompt message to the on-duty operator, suggesting that they strengthen monitoring and pay attention to the trend changes of relevant dynamic variables; when the warning level is 2, it indicates that a significant abnormality requiring intervention has occurred, and the system issues an audible and visual alarm, requiring the operator to immediately check the operating status of the corresponding equipment or section and take predefined control measures; when the warning level is 3, it indicates that a serious risk requiring immediate handling has occurred, and the system triggers the highest level emergency alarm, and can automatically or suggest the initiation of emergency shutdown, interlock protection, or personnel evacuation procedures according to the company's safety regulations.

Claims

1. A method for early warning of safety production risks in chemical enterprises, characterized in that: Includes the following steps: S1. Collect dynamic variables reflecting the states of chemical reactions, storage and transportation, leakage, and equipment, and simultaneously obtain the level and static attributes of major hazard sources. Form a time window according to a unified time benchmark, mark the warning level according to the evolution of safety events after the time window, obtain chemical multi-source monitoring samples, and establish a graded safety boundary table including safety boundaries and buffer zones according to the warning level. S2. Call the level safety boundary according to the current sample level. When the dynamic variable enters the boundary buffer area, the instantaneous boundary risk is generated. The continuous boundary risk is obtained by weighting the previous continuous boundary risk according to the risk retention coefficient and adding it to the current instantaneous risk. Based on process coupling, upstream and downstream variables are determined and a normal coupling prediction model for upstream to predict downstream is trained. The larger instantaneous boundary risk values ​​of temperature and pressure are taken as the response anomaly gate value after propagation lag limit. The standardized coupling prediction residual of downstream deviation from normal coupling prediction is taken as the response. The chain risk is obtained by multiplying and weighting the residuals. The normalized dynamic variables of the safety level interval, instantaneous and continuous boundary risks, coupling prediction residuals and chain risks are combined in time sequence to obtain the dynamic characteristics of safety mechanism enhancement. S3. Construct a time-series early warning model for major hazard source levels. This model uses a time-series feature extraction network to extract multi-scale patterns to obtain dynamic risk features, generates channel modulation parameters according to levels, and combines the level with instantaneous boundary risks and chain risks to statistically generate branch fusion weights for safety risk status. A comprehensive risk representation is obtained by fusing dynamic risk characteristics, level embedding, and static attributes. An ordered level prototype is trained by interval constraints. The interval constraints are proportional to the level difference to constrain the similarity interval between the real and each error level. The time-series early warning model of the major hazard source level is trained with labeled samples. S4. Input the samples to be judged, which are collected in real time and enhanced with the same method, into the time-series early warning model of the major hazard source level condition, output the probability of each early warning level, take the level with the highest probability as the real-time early warning level, and perform risk disposal.

2. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S1, the dynamic variables include temperature, pressure, liquid level, combustible gas concentration, toxic gas concentration, key valve opening degree, and motor current. During data collection, all dynamic variables are time-aligned according to a uniform sampling period. When the original sampling frequency of the motor current is higher than that of other dynamic variables, the effective value of the current is first calculated in each uniform sampling period, and then the effective value of the current is used as the motor current sampling value at that sampling moment.

3. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S1, the static attributes include the number of years since production began, the designed production capacity, and the number of employees on duty. The production period, designed capacity, and number of employees are arranged in a fixed order to form a static attribute vector. After standardizing the static attribute vector according to the mean and standard deviation saved during the training phase, it is spliced ​​and fused with the dynamic risk features and level embedding to obtain a comprehensive risk representation.

4. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S2, the continuous boundary risk is generated by setting a boundary buffer area inside each level of safety boundary, so that when the sampled value of the dynamic variable enters the boundary buffer area, an instantaneous boundary risk that continuously increases between 0 and 1 is generated. When the sampled value of the dynamic variable exceeds the safety level boundary, the instantaneous boundary risk continues to increase from 1 according to the ratio of the magnitude of the exceedance to the normal fluctuation benchmark. Then, the continuous boundary risk at the previous sampling time is weighted according to the risk retention coefficient and added to the instantaneous boundary risk at the current sampling time to recursively obtain the continuous boundary risk value at the current sampling time.

5. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S2, the chain risk is determined by identifying upstream related variables for downstream dynamic variables based on the process coupling relationship, and a normal coupling prediction model is trained using historical data from normal operating conditions. The absolute value of the deviation between the measured value of the downstream dynamic variable and the predicted value given by the normal coupling prediction model is standardized according to the deviation fluctuation scale under normal operating conditions to obtain the standardized coupling prediction residual. The reaction anomaly gate after propagation lag is then multiplied with the standardized coupled prediction residual, and the sum is obtained by weighting according to the cascading risk weights corresponding to each downstream dynamic variable.

6. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S2, the reaction anomaly is obtained by taking the larger value of the instantaneous boundary risks corresponding to temperature and pressure and limiting it to between 0 and 1; When both temperature and pressure are far from the safety boundary, the reaction anomaly threshold is 0. When temperature or pressure enters the boundary buffer zone, the reaction anomaly threshold increases continuously between 0 and 1. When temperature or pressure reaches or exceeds the safety boundary, the reaction anomaly threshold is 1. The cascading risk only increases as the downstream dynamic variables deviate from the normal coupling prediction results when the abnormal response gate value increases.

7. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S2, the enhanced dynamic features of the safety mechanism are achieved by arranging the dynamic variables, instantaneous boundary risks, and persistent boundary risks after the normalization of the safety level interval along the feature channel direction. The coupled prediction residuals and cascading risks of downstream dynamic variables are arranged together according to a unified time position and spliced ​​together to obtain a feature matrix that simultaneously includes the operating status, safety boundary status, risk persistence status and accident chain propagation status. Each row of the feature matrix corresponds to a sampling time point, which is used to provide time-by-time risk evolution input to the time-series early warning model of the major hazard source level condition.

8. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S3, the temporal feature extraction network adopts a structure with multiple one-dimensional convolutional branches having different dilation rates. The channel modulation parameters are composed of channel scaling vectors and channel offset vectors generated from the embedding vectors corresponding to the major hazard source level. The output of each one-dimensional convolutional branch is scaled and offset channel by channel according to the feature channel. The safety risk status is composed of the average and maximum values ​​of instantaneous boundary risks within the time window, as well as the average and maximum values ​​of cascading risks. The branch fusion weight is generated by concatenating the major hazard source level embedding vector with the safety risk status and then passing it through a branch weight network. The branch fusion weights are used to weight and fuse the modulated features of each one-dimensional convolutional branch to obtain dynamic risk features, so that different major hazard levels can form differentiated response strengths to the change patterns on the same time scale.

9. The method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S3, the interval constraint is calculated by setting learnable level prototype vectors for each warning level, performing L2 normalization on the comprehensive risk representation and each level prototype vector, and then calculating the similarity between the two. Multiply the absolute value of the difference between the actual warning level and the false warning level by the unit interval to get the minimum similarity interval that the corresponding false warning level needs to satisfy. During model training, it is required that the difference between the similarity of the true warning level and the similarity of each false warning level is not less than the minimum similarity interval of the corresponding false warning level, so that the warning levels that are farther apart maintain a larger separation interval in the representation space.

10. A method for early warning of safety production risks in chemical enterprises according to claim 1, characterized in that: In step S4, the risk handling involves executing a tiered response based on the real-time early warning level determined by the assessment. When the real-time warning level is normal, routine status is recorded; when the real-time warning level is slightly abnormal, a prompt message is issued; when the real-time warning level is obviously abnormal, an audible and visual alarm is issued and the corresponding equipment is required to be checked. When the real-time warning level is severe risk, the highest level emergency alarm is triggered, and emergency response procedures such as emergency shutdown, interlock protection, or personnel evacuation are initiated.