Intelligent monitoring and alarming method and system for buried oil-water separator
By simultaneously collecting data from oil layer, overflow, and sludge sensors, and combining anomaly detection models and decision tree classifiers, efficient fault location and predictive maintenance of buried oil-water separators were achieved. This solved the problem of inaccurate fault location in existing technologies and improved operation and maintenance efficiency and equipment reliability.
Patent Information
- Application Number
- CN202611356117.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-24
Smart Images

Figure CN123158401A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of intelligent monitoring and alarm, and in particular to an intelligent monitoring and alarm method and system for buried oil-water separators. Background Technology
[0002] Buried oil-water separators are widely used for the pretreatment of oily wastewater from gas stations, parking lots, and industrial plants. During operation, it is necessary to regularly monitor the thickness of internal sludge accumulation, the thickness of the floating oil layer, and whether overflow occurs.
[0003] In related technologies, for sludge dredging scenarios, various sensor data (such as weight, vibration, water level, concentration, pressure, etc.) are collected from the sludge removal, adjustment, and pressing processes, and then input into an anomaly data analysis model for anomaly detection, ultimately identifying and displaying the anomalies.
[0004] While this solution enables anomaly monitoring throughout the entire dredging process, its output can only pinpoint the stage or procedure where the anomaly occurred. However, the same anomaly may correspond to multiple different causes. Relying solely on the personal experience of maintenance personnel for troubleshooting and handling can easily lead to inefficient maintenance due to misjudgment and may also cause secondary accidents due to improper operation. Summary of the Invention
[0005] To improve the accuracy of fault location in buried oil-water separators, this application provides an intelligent monitoring and alarm method and system for buried oil-water separators.
[0006] Firstly, this application provides an intelligent monitoring and alarm method for buried oil-water separators, employing the following technical solution: A method for intelligent monitoring and alarm of buried oil-water separators includes the following steps: Data acquisition: Acquire target data within a preset time window prior to the current moment. The target data includes oil layer thickness signals acquired using an oil layer sensor, overflow signals acquired using an overflow sensor, and sludge accumulation signals acquired using a sludge sensor. Feature vector construction: Extract features from the target data to obtain statistical features, and construct feature vectors based on the statistical features; Classification: The feature vector is input into the pre-trained anomaly detection model to obtain anomaly scores. If the anomaly score is greater than or equal to a first preset threshold, the alarm status information of the sensor corresponding to each target data is obtained. The alarm status information and statistical features are input into the pre-trained decision tree classifier to obtain the root cause diagnosis results.
[0007] This application adopts a scheme that simultaneously acquires the oil layer thickness signal from the oil layer sensor, the overflow signal from the overflow sensor, and the sludge accumulation signal from the sludge sensor within a preset time window. This scheme can cover information on three dimensions—oil layer status, wellbore flow, and tubing blockage—at the same time scale, minimizing data correlation deviations caused by inconsistent acquisition time periods, and ensuring that the data used for subsequent analysis has temporal consistency and completeness.
[0008] This application adopts a scheme that first inputs the feature vector into a pre-trained anomaly detection model to obtain anomaly scores, and only when the anomaly scores exceed a first preset threshold are the alarm status information of each sensor obtained and input together with statistical features into a decision tree classifier for root cause diagnosis. This scheme can avoid unnecessary root cause analysis under normal operating conditions, reduce invalid calculations, and can also use the decision tree to jointly judge the alarm status and statistical features to distinguish whether the anomaly is caused by changes in oil layer thickness, overflow or sludge accumulation, resulting in more accurate localization, reducing false alarms and missed alarms, and improving operation and maintenance efficiency.
[0009] Optionally, the method further includes: Based on the voltage change slope in the statistical characteristics, predict the remaining time for the oil layer sensor and / or sludge sensor to reach the corresponding alarm threshold, respectively. When the remaining time for the oil layer sensor and / or sludge sensor to reach the corresponding alarm threshold is less than the preset early warning time threshold, a predictive maintenance prompt message is generated.
[0010] This application adopts a scheme to predict the remaining time for oil layer sensors and / or sludge sensors to reach the alarm threshold based on the slope of voltage change in statistical characteristics. It can use the changing trend of sensor signals to estimate how long the equipment is away from triggering an alarm, allowing maintenance personnel to have time to arrange maintenance plans in advance and effectively avoid passive shutdown caused by sudden alarms.
[0011] This application adopts a scheme that automatically generates predictive maintenance prompts when the predicted remaining time is less than a preset warning time threshold. This can issue a reminder when the equipment is about to malfunction, allowing maintenance personnel to schedule repairs within a suitable time window and reducing the impact of sudden failures on production.
[0012] Optionally, the prediction process for the remaining time includes: First-order linear fitting is performed on the signals collected by the oil layer sensor and / or sludge sensor to obtain the signal time relationship curve of the oil layer sensor and / or sludge sensor. The remaining time is calculated based on the signal-time relationship curve of the oil layer sensor and / or sludge sensor and the alarm threshold.
[0013] This application adopts a scheme to obtain the signal time relationship line by performing first-order linear fitting on the signals collected by oil layer sensors and / or sludge sensors. First-order linear fitting has low computational load and fast speed, does not require complex model training, and can directly extract the overall trend of change from sensor data with certain fluctuations.
[0014] Optionally, before performing the step of constructing the vector, the method further includes: performing a threshold judgment with a preset delay on the statistical features of various target data, specifically: If any target data triggers a preset alarm condition and the duration reaches a preset delay, the acquisition device corresponding to the target data is marked as a threshold warning state, and the timestamp of the target data triggering the preset alarm condition is recorded.
[0015] This application adopts a scheme that performs threshold judgment with preset delay on the statistical characteristics of various target data before constructing vectors. Only when any target data triggers an alarm condition and the duration reaches the preset delay will the corresponding acquisition device be marked as a threshold warning state and a timestamp be recorded. This is equivalent to performing a coarse screening before the data enters the subsequent model analysis, so as to avoid sending normal data as abnormal data into the model for analysis due to instantaneous sensor jitter. This reduces the invalid calculation of the subsequent anomaly detection model and also reduces the probability of false alarms.
[0016] Optionally, the anomaly detection model is an isolated forest model, and the method further includes: The isolated forest model is pre-trained offline to obtain a pre-trained isolated forest model; The pre-trained isolated forest model is converted into a decision tree lookup table to obtain the converted isolated forest model, which is then stored in the microcontroller's Flash memory.
[0017] This application adopts a scheme of offline pre-training of the isolated forest model, and then converting the pre-trained model into a decision tree lookup table and storing it in the flash memory of the microcontroller. This is equivalent to running the trained model on the computer in advance and then translating it into a format that the microcontroller can directly look up and run. In this way, the field device does not need to have strong computing power, nor does it need to run the model training online. It can directly look up the table to calculate the anomaly score, which greatly reduces the requirements for hardware computing power. This allows the entire solution to be deployed on embedded devices with limited computing power and to complete anomaly detection without relying on cloud servers.
[0018] This application adopts a scheme that converts the model into a decision tree lookup table and stores it in Flash. The execution method of the lookup table is much faster than traditional model inference, hardly occupies runtime memory, the model can be used as soon as it is powered on, there is no delay problem of cold start loading the model, and the Flash does not lose data when it loses power, the model is still there after the device restarts, and there is no need to reload it every time, which ensures the real-time and continuous detection, and also makes the whole system more stable and reliable.
[0019] Optionally, the decision tree classifier is generated based on the C4.5 algorithm, and the classification rules of the decision tree classifier are formulated based on the alarm status information and the statistical characteristics of each target data.
[0020] Optionally, before performing the vector construction step, the method further includes: The target signal is collected by three sensors installed in the buried oil-water separator tank. The target data is conditioned and converted from analog to digital to obtain the target data. The target data is stored in a ring buffer at a preset sampling frequency. At each preset time window interval, it is determined whether the circular buffer has been filled with a preset number of data points. If so, the vector construction step is executed; otherwise, no processing is performed.
[0021] This application adopts a scheme in which three sensors inside the buried oil-water separator tank collect target signals respectively, and after conditioning and analog-to-digital conversion of the target data, the data is stored in a ring buffer at a preset sampling frequency. Conditioning and analog-to-digital conversion turn the analog signals from the sensors into clean digital signals, eliminating interference during transmission. The advantage of the ring buffer is that it is of fixed size. New data is automatically overwritten by old data, so there is no need to worry about the storage space being filled up or to manually clear the data.
[0022] This application adopts a scheme that checks whether the circular buffer is full of a preset number of data points at each preset time window, and only executes the vector construction step when it is full. This is equivalent to adding a data integrity threshold to the subsequent feature extraction and anomaly detection. It avoids rushing to calculate due to insufficient collection time or too few data points, and tries to avoid the problem of inaccurate results caused by forced analysis before enough data has been collected. The data is sufficient and complete every time the vector construction step is entered, which improves the quality of statistical feature extraction and the reliability of anomaly detection. At the same time, it also makes the execution rhythm of the whole process more controllable and avoids the situation of being fast or slow.
[0023] Optionally, after obtaining the target data, the method further includes: Based on the target data, preset open circuit threshold and short circuit threshold, fault diagnosis is performed on each sensor to obtain fault diagnosis results, and the fault information of each sensor is marked according to the fault diagnosis results. Based on the target data, the alarm status information of each sensor is determined according to the preset hierarchical logic.
[0024] This application adopts a scheme to diagnose and mark fault information of each sensor based on target data combined with preset open circuit thresholds and short circuit thresholds. This is equivalent to checking whether the sensor itself has a problem before taking the data for anomaly analysis, thus reducing misjudgments caused by sensor faults.
[0025] Optionally, after obtaining the root cause diagnosis result, the method further includes: Total Alarm: An alarm signal is issued when the alarm status information of any sensor indicates that the sensor is in an alarm state or the fault information indicates that the sensor has a hardware failure; Fault alarm: When a fault message from any sensor indicates a hardware failure, the power supply to that sensor is cut off.
[0026] This application adopts a scheme that issues a general alarm signal when any sensor is in an alarm state or a hardware failure occurs. This means that whether it is an anomaly at the data level or a problem with the sensor hardware itself, as long as one link is not right, the system will immediately notify the system. This will prevent a situation where a sensor has alarmed but the system does not respond, thus improving the alarm coverage.
[0027] This application adopts a scheme to directly control and cut off the power supply of the sensor when a hardware failure occurs. This can isolate the faulty sensor, avoid it from continuously outputting erroneous data and interfering with subsequent analysis, and also avoid the safety hazards that may be caused by the faulty sensor being powered on for a long time. At the same time, after the power is cut off, the data of this sensor will no longer enter the subsequent feature extraction and anomaly detection process, effectively ensuring that the data used in the entire diagnostic link are from normal sensors, making the root cause diagnosis results more reliable.
[0028] Secondly, this application provides an intelligent monitoring and alarm system for buried oil-water separators, employing the following technical solution: A smart monitoring and alarm system for buried oil-water separators includes: The sensor module is used to collect target data. The sensor module includes an oil layer sensor, an overflow sensor, and a sludge sensor. The oil layer sensor is used to monitor the oil layer thickness, the overflow sensor is used to monitor the overflow, and the sludge sensor is used to monitor sludge accumulation. The signal acquisition and conditioning module is used to process target data, including an intrinsically safe isolation barrier, signal conditioning circuit, and analog-to-digital conversion unit; The intelligent control module, including a microcontroller, is used to perform reverse alarm logic judgment and root cause diagnosis; The output execution module is used to output alarm signals or perform protection actions, including relays, audible and visual alarm units, and remote communication units.
[0029] In summary, this application includes at least one of the following beneficial technical effects: 1. The oil layer sensor, overflow sensor, and sludge sensor are based on three different physical principles, which can distinguish between oil, water and sludge media at the physical level. Maintenance personnel can accurately determine the three fault types of oil full, sludge full and overflow without opening the cover to confirm, which can avoid the shortcomings of traditional single sensors that cannot distinguish the cause of alarm.
[0030] 2. The oil layer sensor is submerged in water during normal operation and does not trigger an alarm; it only triggers when the oil layer thickens, causing it to be exposed to oil / gas. The overflow sensor is normally suspended in the air and does not trigger an alarm; it only triggers when the water level rises abnormally and submerges the sensor. The hierarchical reverse logic adopted in this application effectively avoids false alarms under normal operating conditions.
[0031] 3. This application effectively filters out instantaneous false alarms caused by liquid level fluctuations by performing threshold judgments with a 10-second delay on three sensors. It employs sliding window standard deviation analysis to distinguish between the actual oil layer and oil / dirt buildup on the probe; integrates a trend prediction algorithm to provide early warnings of sludge buildup or oil layer thickening, transforming maintenance from reactive repair to planned maintenance; and utilizes a decision tree root cause classification function to automatically provide diagnostic conclusions upon alarm activation, reducing manual troubleshooting time. Attached Figure Description
[0032] Figure 1 This is a flowchart of Embodiment 1 of this application; Figure 2 This is a schematic diagram of the working principle of the oil layer sensor in Embodiment 1 of this application; Figure 3 This is a schematic diagram of the working principle of the overflow sensor in Embodiment 1 of this application; Figure 4 This is a schematic diagram of the working principle of the sludge sensor in Embodiment 1 of this application; Figure 5 This is a structural schematic diagram of Embodiment 3 of this application. Detailed Implementation
[0033] The following combination Figures 1 to 5 This application will be described in further detail.
[0034] Example 1: This example discloses an intelligent monitoring and alarm method for buried oil-water separators, referring to... Figure 1 The method includes: S1 data acquisition, S2 vector construction, S3 classification, and S4 output. The execution process of each step in this embodiment is as follows: S1 Data Acquisition: Acquire target data within a preset time window prior to the current moment. The target data includes oil layer thickness signals acquired using an oil layer sensor, overflow signals acquired using an overflow sensor, and sludge accumulation signals acquired using a sludge sensor.
[0035] Reference Figure 2 The oil layer sensor employs a capacitive dual-electrode structure and a dielectric constant detection principle. The sensor includes one measuring electrode and one reference electrode, arranged in parallel. The overall diameter of the sensor is approximately 25mm, its total length is approximately 219mm, the effective measuring length of the electrodes is approximately 172mm, and the alarm switching point is located approximately 130mm from the bottom. The electrodes are covered with insulating sleeves, with only a designated length at the lower end exposed to contact the liquid. For separator tanks made of insulating materials such as fiberglass (FRP), the oil layer sensor utilizes its own dual electrodes to form an equivalent capacitor, with the measured liquid acting as the dielectric. The internal oscillation circuit of the oil layer sensor generates a 10-20MHz high-frequency signal, which is applied between the dual electrodes. After detection, the signal outputs a DC voltage reflecting the dielectric constant of the medium.
[0036] In this embodiment, the oil layer sensor is suspended 50-100mm below the static water level, near the coalescence unit. Its alarm status includes both normal and alarm states. The normal state of the oil layer sensor refers to: the sensor being submerged in water, where the relative permittivity of water is approximately 80, the equivalent capacitance between the two electrodes is large, and the detector output voltage is low (typically 500-1200mV). The alarm state of the oil layer sensor refers to: the thickening of the floating oil layer causing the oil-water interface to shift below the alarm switching point, the sensor leaving the aqueous phase and entering the oil or gas phase, where the relative permittivity of oil is approximately 2.2, and the relative permittivity of air is approximately 1.0, the equivalent capacitance drops sharply by approximately 20-40 times, and the detector output voltage jumps to a high level (typically >2500mV), triggering an alarm.
[0037] The equivalent capacitance model of the oil layer sensor is shown below:
[0038] Where C is the equivalent capacitance between the two electrodes; The vacuum permittivity (a physical constant, approximately equal to 8.854 × 10⁻⁶) is given by the standard value of the vacuum permittivity. -12 F / m); The relative permittivity of the medium between the electrodes (dimensionless, approximately 80 for water, approximately 2.2 for oil, and approximately 1.0 for air). d represents the effective area of the two electrodes facing each other; d is the distance between the two electrodes.
[0039] The relationship between the detector output voltage and capacitive reactance is as follows:
[0040]
[0041] in, This is the DC voltage output after detection; R is the power supply voltage for the internal oscillation circuit; R is the load resistance (or detector matching resistor) in the circuit; j is the imaginary unit. ω is the angular frequency of the applied high-frequency signal; C is the equivalent capacitance between the two electrodes; Pi; The frequency of the high-frequency signal ranges from 10 to 20 MHz.
[0042] The alarm logic of the oil layer sensor is a reverse alarm, specifically: when the sensor is immersed in water (normal state), it outputs a low voltage; when it leaves the water phase and enters the oil / gas phase (abnormal state), it outputs a high voltage to trigger an alarm. The reverse alarm logic adopted in this embodiment can effectively avoid false alarms during normal operation.
[0043] Reference Figure 3 The overflow sensor employs the piezoelectric tuning fork resonance principle, where the piezoelectric ceramic drives the fork to vibrate mechanically at approximately 1200Hz, while simultaneously detecting the vibration amplitude. In this embodiment, the sensing element of the overflow sensor is a piezoelectrically driven stainless steel tuning fork, approximately 125 mm in length, with a housing diameter of approximately 25 mm and a housing length of approximately 125 mm. The alarm switching point is located approximately 25 mm above the bottom of the tuning fork. In other embodiments, a corresponding tuning fork can be selected according to specific requirements.
[0044] The overflow sensor probe is installed downwards in the coalescing unit extension well, 100mm above the top of the inlet pipe. The overflow sensor's alarm status information includes normal and alarm states. The normal state of the overflow sensor refers to: the overflow sensor is suspended in the air, the tuning fork vibrates freely at a resonant frequency of 1200 Hz, air damping is minimal, the tuning fork amplitude is large, and the feedback voltage is high (typically 2000–3000 mV). The alarm state of the overflow sensor refers to: when the inlet flow is too large or the outlet is blocked, causing an abnormal rise in water level that submerges the tuning fork to the alarm switching point, the damping caused by the liquid density causes the tuning fork amplitude to decrease sharply, and the feedback voltage drops sharply to a low level (typically <1500 mV), triggering the alarm.
[0045] The formula for calculating the tuning fork quality factor Q of the overflow sensor is as follows:
[0046] in, This is the resonant frequency of the tuning fork; The bandwidth of the tuning fork vibration refers to the frequency width corresponding to when the vibration amplitude drops to about 0.707 times the peak value.
[0047] The quality factor Q of a tuning fork in air is approximately 1000, while the quality factor Q of a tuning fork in a liquid is approximately 10.
[0048] The alarm logic of the overflow sensor adopts a positive alarm, specifically: the overflow sensor outputs a high voltage when suspended and dry (normal state), and outputs a low voltage to trigger the alarm when immersed in water (abnormal state).
[0049] Reference Figure 4 The sludge sensor uses the ultrasonic pulse attenuation method. The ultrasonic probe has a pair of piezoelectric crystals built in, one for transmitting and one for receiving. The transmitting crystal generates a 1MHz ultrasonic pulse, which passes through the medium in front of the probe, reaches the reflector, and returns to the receiving crystal. The received signal is detected and output as a DC voltage.
[0050] The sludge sensor adopts the detection principle of gap blocking ultrasonic pulse attenuation method. The sludge sensor has a detection gap with a width of 50 mm and an overall length of about 142 mm. The alarm trigger point is located at a designated position, about 16 mm from the bottom of the sludge sensor.
[0051] The sludge sensor is suspended above the sludge chamber at the bottom of the tank, with the height determined by calculation based on the designed sludge hopper volume. In this embodiment, the alarm trigger point of the sludge sensor is 16mm from its bottom. After installation, when the upper surface of the sludge layer reaches a height h from the bottom of the tank, it exactly covers the alarm trigger point (gap blockage). The calculation model is shown below: h = H_sensor + 16 Where H_sensor is the installation height of the sensor bottom from the bottom of the tank; h is the height of the sludge layer.
[0052] For a horizontal cylindrical tank (inner diameter D, radius r=D / 2, axial length of sludge chamber L), the maximum allowable sludge volume is... The relationship between the height h of the sludge layer and the cross-sectional area of the arc is derived from the following formula:
[0053] in, denoted as the maximum allowable sludge volume; L is the axial length of the sludge chamber in the horizontal cylindrical tank; r is the radius of the horizontal cylindrical tank; h is the sludge layer height; and arccos is the inverse cosine trigonometric function.
[0054] The calculation process is as follows: First, determine the maximum allowable sludge volume. The corresponding h is obtained by solving the numerical value of the above formula, and then the installation height of the sensor at the bottom, H_sensor=h−16mm, is calculated.
[0055] For example, a horizontal tank has a diameter D = 2.2m (r = 1.1m) and an axial length L = 3.0m for the sludge chamber. What is the maximum designed sludge volume? If the volume is 4.66 m³, then we can solve for h ≈ 0.941 m = 941 mm. Therefore, H_sensor = 941 − 16 = 925 mm, meaning the bottom of the sensor is installed 925 mm above the bottom of the tank.
[0056] The alarm status information of the sludge sensor includes normal status and alarm status. The normal status of the sludge sensor refers to: the probe is immersed in clean water or oil, the detection gap is unobstructed, the emitted detection signal (ultrasound) can pass through the gap normally and be received, the echo is strong, the received signal is strong, and the detector output voltage is high (typical value 1500-2500mV). The alarm status of the sludge sensor refers to: when sludge accumulates to the set height of the alarm trigger point, the probe is buried by sludge / sand, and the detection gap is blocked by sediment. The scattering and absorption of ultrasound by solid particles causes extreme attenuation of the echo, a significant attenuation of the received signal, and the received voltage drops to a low level (typical value <800mV), triggering the alarm.
[0057] The calculation model for ultrasonic wave attenuation is shown below:
[0058] in, The amplitude (or sound pressure, intensity) of the ultrasonic signal received after propagation through a medium. The initial emission signal amplitude (or sound pressure, intensity) of the ultrasonic wave. is the base of the natural logarithm (approximately 2.71828), indicating exponential decay; The attenuation coefficient represents the degree of attenuation of ultrasound waves per unit distance and unit frequency. A higher value indicates faster attenuation. The attenuation coefficient for clean water is 0.002 dB / cm / MHz, and for sludge it is 5 dB / cm / MHz. –10 dB / cm / MHz; x is the propagation distance of the ultrasonic wave in the medium (or the thickness of the medium layer), which here refers to the filling thickness of the sludge in the sensor gap.
[0059] The alarm logic of the sludge sensor is a positive alarm, specifically: when the gap is unobstructed (normal state), it outputs a high voltage; when the gap is blocked by sludge (abnormal state), it outputs a low voltage to trigger the alarm.
[0060] In this embodiment, the cables of each sensor are led out through the plastic top hole of the extension well at the top of the tank and laid along the wall of the extension well to the ground control box.
[0061] The areas where the oil layer sensor, overflow sensor, and sludge sensor are located are marked as hazardous areas, while other areas are marked as safe areas. In other embodiments, the safe areas are equipped with signal acquisition and conditioning modules, which are connected to the various sensors in the hazardous areas via intrinsically safe barriers. The intrinsically safe barriers limit the electrical energy entering the hazardous areas to intrinsically safe levels, i.e., Uo=14.5V, Io=78mA, and Po=367mW. The signal conditioning circuit includes three low-pass filters (cutoff frequency approximately 10 Hz) and a voltage follower, with the output connected to the ADC input pin of the microcontroller.
[0062] In this embodiment, the microcontroller of the intelligent control module adopts the STM32F103C8T6 chip, a 32-bit ARM Cortex-M3 microprocessor from the STM32F103 series. This microcontroller integrates a 12-bit successive approximation ADC, a DMA controller, an independent watchdog timer (IWDG), and a window watchdog timer (WWDG), meeting the reliability requirements for long-term unattended operation in industrial settings. The core characteristics of the microprocessor are: maximum clock frequency of 72MHz; 12-bit ADC resolution; Flash capacity ≥ 64KB; RAM capacity ≥ 20KB; and operating temperature range of -40°C to +85°C. In other embodiments, other types of microcontrollers can be selected according to requirements.
[0063] In this embodiment, the sensor module periodically acquires target data from each sensor and determines its operating status according to the following hierarchical logic: Reference state calibration: After the tank is initially filled with water and run, the output signal values of each sensor under normal operating conditions are calibrated as a reference. The oil layer sensor is calibrated to the voltage value corresponding to its dielectric constant in clean water; the overflow sensor is calibrated to the voltage value of its open circuit state in air; and the sludge sensor is calibrated to the voltage value of its unobstructed gap state in clean water.
[0064] Scenario 1 (Oil Layer Alarm): When the oil layer sensor signal changes from water state to oil / air state (i.e., the voltage jumps from 500~1200 mV to >2500 mV), and the overflow sensor does not alarm (the voltage remains at 2000~3000 mV), it is determined that the oil layer is too thick, an oil stain cleaning prompt is issued, and a yellow warning light is lit.
[0065] Scenario 2 (Overflow Alarm): When the overflow sensor signal changes from an air state to a water state (i.e., the voltage drops from 2000-3000 mV to <1500 mV), regardless of the status of other sensors, it is determined that there is an overload of water inlet or a blockage of water outlet, and an emergency overflow alarm is issued, illuminating the red alarm light and emitting a high-decibel buzzer.
[0066] Scenario 3 (Sludge Alarm): When the sludge sensor signal changes from water / oil state to sludge state (i.e., the voltage drops from 1500-2500 mV to <800 mV), and the overflow sensor does not alarm, it is determined that the sludge accumulation is excessive, a sludge discharge prompt is issued, and a yellow warning light is lit.
[0067] In the above logic, the oil layer sensor adopts reverse alarm logic (i.e., alarm only when water is discharged), the overflow sensor adopts forward alarm logic (i.e., alarm only when water is discharged), and the sludge sensor adopts forward alarm logic (i.e., alarm only when the gap is blocked), forming a hierarchical alarm system to accurately distinguish between the three fault types of oil full, sludge full, and overflow.
[0068] Based on the hierarchical reverse alarm logic, the microcontroller further runs the following intelligent monitoring algorithm: This embodiment performs fault diagnosis on each sensor based on target data, preset open circuit thresholds, and short circuit thresholds, obtaining fault diagnosis results. Fault information for each sensor is then marked based on these results. Specifically, when any target data is below the open circuit threshold (e.g., 50mV) or above the short circuit threshold (e.g., 3200mV), it is determined that the sensor corresponding to the target data below or above the threshold has a hardware fault. In other embodiments, the open circuit threshold and short circuit threshold can be set according to requirements.
[0069] In this embodiment, three sensors installed inside the buried oil-water separator tank continuously acquire the target signals output by each sensor via DMA at a sampling frequency of 1Hz. The target data is then conditioned and converted from analog to digital to obtain the target data, which is stored in a ring buffer with a length of 60. In other embodiments, the sampling frequency and the length of the ring buffer can be set according to requirements.
[0070] At each preset time window (e.g., 60 seconds), it is determined whether the circular buffer has been filled with a preset number (60) of data points. If so, S2 is executed to construct the vector; otherwise, no processing is performed.
[0071] In other embodiments, before executing S2 to construct the vector, the method further includes: performing a threshold judgment with a preset delay on the statistical characteristics of various target data, that is, if any target data triggers a preset alarm condition and the duration reaches the preset delay, the acquisition device corresponding to the target data is marked as a threshold warning state (inclusive), and the timestamp of the target data triggering the preset alarm condition is recorded.
[0072] In this embodiment, threshold judgments with a 10-second delay are performed on the three sensors to effectively filter out instantaneous false alarms caused by liquid level fluctuations: an oil layer sensor voltage value >2500mV for 10 seconds triggers an oil layer over-thickness warning; an overflow sensor voltage value <1500mV for 10 seconds triggers an overflow warning; and a sludge sensor voltage value <800mV for 10 seconds triggers a sludge fullness warning. In other embodiments, the above parameters can be set according to requirements.
[0073] S2 constructs a feature vector: Features are extracted from the target data to obtain statistical features, and feature vectors are constructed based on these statistical features.
[0074] In this embodiment, the following statistical characteristics are calculated every 60 seconds: Oil layer voltage sliding average Oil layer voltage sliding standard deviation Used to reflect signal fluctuations and to distinguish between actual oil layers and oil adhering to the probe; sliding average value of overflow voltage. Sludge voltage moving average ; Slope k of oil layer voltage change over 60 seconds oil (mV / hour); Slope of sludge voltage change over 60 seconds, k sludge (mV / hour).
[0075] The above statistical features are integrated into a feature vector: [ , , , k oil k sludge ] S3 Classification: This embodiment uses an isolated forest model as the anomaly detection model and performs offline pre-training on the isolated forest model to obtain a pre-trained isolated forest model. The training data is collected from the actual operation data of a buried oil-water separator at a gas station for 30 consecutive days. The isolated forest model has 100 isolated trees, each with a maximum depth of 8. The decision paths generated after training are fixed into C language functions in the form of if-else rules, occupying approximately 4 KB of Flash memory.
[0076] The pre-trained isolated forest model is converted into a decision tree lookup table, resulting in the converted isolated forest model. This converted model is stored in the microcontroller's Flash memory. During runtime, the path length of a sample in each decision tree is quickly calculated by looking up the table and normalized to an anomaly score. The calculation model for the anomaly score is as follows:
[0077] in, y represents the normalized outlier score, with a higher score indicating a more outlier sample; y is the current input feature vector (containing features such as mean oil layer voltage, standard deviation of oil layer voltage, mean overflow voltage, mean sludge voltage, and sludge voltage drop slope). Let y be the average path length of sample y across all decision trees in the isolated forest; This is the expected average path length of the tree when the number of training set samples is n, used for normalization.
[0078] Based on the normalized outlier scores described above, this embodiment solidifies them into a decision tree lookup table, including: If the average oil layer voltage is >2400mV, the abnormality score is increased by 0.3. If the standard deviation of the oil layer voltage is >150mV, the anomaly score is increased by 0.4. If the average overflow voltage is <1400mV, the abnormal score is increased by 0.3. If the average voltage of the sludge is <750mV, the abnormal score is increased by 0.4. If the slope of the sludge voltage drop is less than -50mV / hour, the abnormal score is increased by 0.2.
[0079] If the abnormal score is greater than or equal to the first preset threshold (e.g., 0.7), the alarm status information of the sensor corresponding to each target data is obtained, and the alarm status information and statistical features are input into the pre-trained decision tree classifier to obtain the root cause diagnosis result.
[0080] If the anomaly score is less than the first preset threshold (e.g., 0.7) and greater than or equal to the second preset threshold (e.g., 0.5), only logs are recorded and S4 output is not executed, thus distinguishing between real-world operating condition anomalies and sensor contamination.
[0081] If the abnormal score is less than the second preset threshold (e.g., 0.5), no action is taken.
[0082] In this embodiment, the decision tree classifier is generated based on the C4.5 algorithm and has 12 leaf nodes. The classification rules of the decision tree classifier are formulated based on the alarm status information and the statistical characteristics of each target data, specifically: If the oil layer alarm is triggered and the standard deviation is <50mV, it is determined that the actual oil layer is too thick. If an oil layer alarm is triggered and the standard deviation is >150mV, it is determined that the probe is oily / dirty (it needs to be cleaned). If an overflow alarm is triggered and the sludge is normal, it is determined to be an overflow hazard (inlet overload / outlet blockage). If the sludge alarm is triggered and the rate of decrease is <-20mV / hour, it is determined to be rapid sludge accumulation. If the sludge alarm is triggered and the rate of decrease is >-5mV / hour and the voltage is <500mV, it is determined that the probe is scaled or has not been cleaned for a long time.
[0083] S4 Output: This step includes S41 general alarm and S42 fault alarm.
[0084] S41 General Alarm: When the alarm status information of any sensor indicates that the sensor is in an alarm state or the fault information indicates that the sensor has a hardware failure, an alarm signal is issued, and the normally closed contact of the first relay is opened at the same time.
[0085] S42 Fault Alarm: When a fault message from any sensor indicates a hardware failure in that sensor, the second relay is controlled to cut off the power supply to that sensor.
[0086] Example 2: This example differs from Example 1 in that the method further includes: Based on the voltage change slope in the statistical characteristics, the remaining time for the oil layer sensor and / or sludge sensor to reach the corresponding alarm threshold is predicted, specifically: A first-order linear fit is performed on the signals collected by the oil layer sensor and / or sludge sensor to obtain the signal time relationship curve of the oil layer sensor and / or sludge sensor. The calculation model of the first-order linear fit is as follows:
[0087] in, The signal collected by the oil layer sensor and / or sludge sensor at time t; t represents the slope of the voltage change; t represents time; b represents the initial value of the oil layer sensor and / or sludge sensor.
[0088] The remaining time is calculated based on the signal-time relationship curve of the oil layer sensor and / or sludge sensor and the alarm threshold, specifically as follows: In this embodiment, when a first-order linear fitting calculation model is used to fit the voltage change of the oil layer sensor to predict the remaining time to reach the alarm threshold, the value of b is 2500mV, and k is the voltage rise slope (mV / day). When the first-order linear fitting calculation model is used to fit the voltage change slope of the sludge sensor to predict the remaining time to reach the alarm threshold, the value of b is 800mV, and k is the voltage fall slope (mV / day), in which case k is negative.
[0089] When the remaining time for the oil layer sensor and / or sludge sensor to reach the corresponding alarm threshold is less than the preset early warning time threshold (e.g., 2 days), a predictive maintenance prompt message is generated.
[0090] Example 3: Reference Figure 5 This embodiment discloses an intelligent monitoring and alarm system for buried oil-water separators, the system comprising: The sensor module is used to collect target data. The sensor module includes an oil layer sensor, an overflow sensor, and a sludge sensor. The oil layer sensor is used to monitor the oil layer thickness, the overflow sensor is used to monitor the overflow, and the sludge sensor is used to monitor sludge accumulation. The signal acquisition and conditioning module is used to process target data, including an intrinsically safe isolation barrier, signal conditioning circuit, and analog-to-digital conversion unit.
[0091] The signal conditioning circuit uses an LMV358 voltage follower and a first-order RC low-pass filter (cutoff frequency approximately 10Hz), connected to PA0 / PA1 / PA2. The power supply is an HLK-PM01 (AC100-240V / DC5V) and an AMS1117-3.3 (LDO). The intrinsically safe isolation barrier is a P+FKFD0 series.
[0092] The intelligent control module includes a microcontroller, which uses an STM32F103C8T6 chip to perform reverse alarm logic judgment and root cause diagnosis.
[0093] This embodiment sets up an intrinsically safe isolation barrier between the intelligent control module and the sensor module to meet the explosion-proof requirements, and can be directly applied to hazardous areas; it adopts an STM32 industrial-grade microcontroller with built-in independent watchdog and window watchdog, supports wide temperature range of -40°C to +85°C, and is suitable for the harsh field environment of buried oil-water separators; the relay adopts a power failure alarm mode, and automatically enters the alarm state when the wire is disconnected or the power is cut off, which complies with the fail-safe principle.
[0094] The output execution module is used to output alarm signals or perform protection actions, including relays, audible and visual alarm units and remote communication units. The relays adopt optocoupler EL817 isolation drive with 5A / 250VAC contact capacity.
[0095] The system's workflow is as follows: After power-on: Configure the system clock to 72MHz, and enable the clocks for GPIOA, GPIOB, ADC1, DMA1, and TIM2. Configure PA0 / PA1 / PA2 as analog input mode. Configure ADC1 as multi-channel scanning mode with a sampling time of 55.5 cycles, triggered by the TRGO event of TIM2. Configure DMA1 channel 1 as loop mode, automatically transferring the ADC conversion results to the memory array. Configure TIM2 to generate a 1 Hz update event to trigger ADC sampling. Configure an independent watchdog timer (IWDG) with a timeout period of approximately 2 seconds. Initialize the circular buffer, feature variables, and historical data array. Start the timer and ADC.
[0096] The system executes the following steps repeatedly during its operation: Step 1. Every 1 second (triggered by TIM2), the ADC completes a three-channel scan, and the DMA stores the results in the adc_values[3] array. The main loop detects the sampling completion flag and converts the original ADC value into a voltage value (mV).
[0097] Step 2. Perform fault diagnosis for each sensor: set the fault flag when the voltage value is <50 mV or >3200 mV.
[0098] Step 3. Perform threshold alarm check (with 10-second delay state machine).
[0099] Step 4. Store the current voltage value into a circular buffer of length 60 and update the index.
[0100] Step 5. Check if 60 data points have been collected (approximately 60 seconds). If not, skip intelligent inference, update the output directly, feed the dog, and continue the loop.
[0101] Step 6. If 60 seconds have elapsed, call the feature extraction function to calculate the mean and standard deviation of the oil layer voltage, the slope of change over 60 seconds, and the mean and slope of the sludge voltage.
[0102] Step 7. Call the Isolation Forest scoring function to return the outlier scores.
[0103] Step 8. Call the trend prediction function to calculate the predicted remaining days for the oil layer and sludge, respectively.
[0104] Step 9. If an alarm state exists, call the decision tree classification function and output the root cause diagnostic code.
[0105] Step 10. Update relay outputs: Relay 1 outputs a low level (power off) when any alarm is activated or any fault is activated; Relay 2 outputs a low level only when a fault is activated.
[0106] Step 11. The buzzer sounds when relay 1 is activated.
[0107] Step 12. Feed the stand-alone watchdog, then return to Step 1.
[0108] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A buried oil-water separator intelligent monitoring and alarm method, characterized in that, include: Data acquisition: Acquire target data within a preset time window prior to the current moment. The target data includes oil layer thickness signals acquired using an oil layer sensor, overflow signals acquired using an overflow sensor, and sludge accumulation signals acquired using a sludge sensor. Feature vector construction: Extract features from the target data to obtain statistical features, and construct feature vectors based on the statistical features; Classification: The feature vector is input into the pre-trained anomaly detection model to obtain anomaly scores. If the anomaly score is greater than or equal to a first preset threshold, the alarm status information of the sensor corresponding to each target data is obtained. The alarm status information and statistical features are input into the pre-trained decision tree classifier to obtain the root cause diagnosis results.
2. The buried oil-water separator intelligent monitoring alarm method according to claim 1, characterized in that, The method further includes: Based on the voltage change slope in the statistical characteristics, predict the remaining time for the oil layer sensor and / or sludge sensor to reach the corresponding alarm threshold, respectively. When the remaining time for the oil layer sensor and / or sludge sensor to reach the corresponding alarm threshold is less than the preset early warning time threshold, a predictive maintenance prompt message is generated.
3. The buried oil-water separator intelligent monitoring alarm method according to claim 2, characterized in that, The process of predicting the remaining time includes: First-order linear fitting is performed on the signals collected by the oil layer sensor and / or sludge sensor to obtain the signal time relationship curve of the oil layer sensor and / or sludge sensor. The remaining time is calculated based on the signal-time relationship curve of the oil layer sensor and / or sludge sensor and the alarm threshold.
4. The buried oil-water separator intelligent monitoring alarm method according to claim 1, characterized in that, Before performing the step of constructing the vector, the method further includes: performing a threshold judgment with a preset delay on the statistical features of various target data, specifically: If any target data triggers a preset alarm condition and the duration reaches a preset delay, the acquisition device corresponding to the target data is marked as a threshold warning state, and the timestamp of the target data triggering the preset alarm condition is recorded.
5. The buried oil-water separator intelligent monitoring alarm method according to claim 1, characterized in that, The anomaly detection model is an isolated forest model, and the method further includes: The isolated forest model is pre-trained offline to obtain a pre-trained isolated forest model; The pre-trained isolated forest model is converted into a decision tree lookup table to obtain the converted isolated forest model, which is then stored in the microcontroller's Flash memory.
6. The buried oil-water separator intelligent monitoring alarm method according to any one of claims 1-5, characterized in that, The decision tree classifier is generated based on the C4.5 algorithm, and the classification rules of the decision tree classifier are formulated based on the alarm status information and the statistical characteristics of each target data.
7. The buried oil-water separator intelligent monitoring alarm method according to any one of claims 1-5, characterized in that, Before performing the vector construction step, the method further includes: The target signal is collected by three sensors installed in the buried oil-water separator tank. The target data is conditioned and converted from analog to digital to obtain the target data. The target data is stored in a ring buffer at a preset sampling frequency. At each preset time window interval, it is determined whether the circular buffer has been filled with a preset number of data points. If so, the vector construction step is executed; otherwise, no processing is performed.
8. The buried oil-water separator intelligent monitoring alarm method according to claim 7, characterized in that, After obtaining the target data, the method further includes: Based on the target data, preset open circuit threshold and short circuit threshold, fault diagnosis is performed on each sensor to obtain fault diagnosis results, and the fault information of each sensor is marked according to the fault diagnosis results. Based on the target data, the alarm status information of each sensor is determined according to the preset hierarchical logic.
9. The buried oil-water separator intelligent monitoring alarm method according to claim 8, characterized in that, After obtaining the root cause diagnosis results, the method further includes: Total Alarm: An alarm signal is issued when the alarm status information of any sensor indicates that the sensor is in an alarm state or the fault information indicates that the sensor has a hardware failure; Fault alarm: When a fault message from any sensor indicates a hardware failure, the power supply to that sensor is cut off.
10. An intelligent monitoring and alarm system for buried oil-water separators, said system being suitable for use in the method according to any one of claims 1-9, characterized in that, include: The sensor module is used to collect target data. The sensor module includes an oil layer sensor, an overflow sensor, and a sludge sensor. The oil layer sensor is used to monitor the oil layer thickness, the overflow sensor is used to monitor the overflow, and the sludge sensor is used to monitor sludge accumulation. The signal acquisition and conditioning module is used to process target data, including an intrinsically safe isolation barrier, signal conditioning circuit, and analog-to-digital conversion unit; The intelligent control module, including a microcontroller, is used to perform reverse alarm logic judgment and root cause diagnosis; The output execution module is used to output alarm signals or perform protection actions, including relays, audible and visual alarm units, and remote communication units.
