Temperature measurement sensor data processing method and system for chemical synthesis environment
Through adaptive filtering, intelligent predictive compensation, and dynamic optimization using a multi-module deep collaborative architecture, the problems of low measurement accuracy, slow response, and poor stability of traditional temperature sensors in chemical synthesis processes are solved, achieving high-precision and fast-response temperature measurement results and significantly reducing maintenance costs.
Patent Information
- Application Number
- CN202511543854.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-23
AI Technical Summary
Traditional temperature sensors suffer from low measurement accuracy, slow dynamic response, weak anti-interference ability, and poor long-term stability during chemical synthesis. Moreover, existing technologies struggle to overcome multi-dimensional interference simultaneously.
It adopts a multi-module deep collaborative architecture, including adaptive filtering, intelligent prediction compensation, dynamic optimization and anomaly calibration, and achieves high-precision temperature measurement through technologies such as adaptive Kalman filtering, LSTM drift prediction model, model predictive control and isolated forest algorithm.
Achieving a measurement accuracy of ±0.5°C within the 80-300°C range, improving dynamic response speed by 8 times, long-term stability by 15 times, and reducing annual maintenance costs by 65%.
Smart Images

Figure CN121388936A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of chemical synthesis, in particular to a temperature sensor data processing method and system for chemical synthesis environment. BACKGROUND
[0002] In view of the problems of high temperature, strong corrosion, temperature fluctuation and sensor drift in the chemical synthesis process, the traditional temperature sensor has defects such as low measurement accuracy (error > ±2℃), dynamic response lag (>500ms), weak anti-interference ability and poor long-term stability (drift rate >0.5℃ / day), and the existing technology mainly adopts single filtering or static compensation, which is difficult to overcome multi-dimensional interference at the same time. In view of the above problems, there is no effective solution at present. SUMMARY
[0003] In view of the above technical problems in the related art, the present application proposes a temperature sensor data processing method and system for chemical synthesis environment, which adopts a multi-module deep collaborative architecture, realizes high-precision temperature measurement through the integrated design of adaptive filtering, intelligent prediction compensation, dynamic optimization and abnormal calibration, and can overcome the above shortcomings of the prior art.
[0004] To achieve the above technical purposes, the technical scheme of the present application is as follows: A temperature sensor data processing method for chemical synthesis environment, comprising the following steps: S1, collecting original data and pre-processing the original data, specifically: based on the self-evolution filtering mechanism of dynamically adjusting the noise covariance matrix of the filtering residual, three filtering modes are adaptively switched through real-time monitoring of electromagnetic interference intensity; S2, predicting and compensating the sensor drift error based on a multi-feature LSTM drift prediction model fused with environmental parameters and working time length; S3, predicting and controlling the acceleration of sensor dynamic response by introducing a double-time-domain MPC prediction control algorithm; S4, abnormal detection and adaptive calibration: adopting an isolation forest algorithm to detect abnormalities and trigger a least square method for adaptive calibration; specifically: collecting multi-dimensional known temperature reference points in the synthesis system, dynamically fitting the nonlinear relationship between sensor output voltage U and temperature T by the least square method: T=aU+b, updating the coefficients a and b, and outputting the final temperature after calibration .
[0005] Further, the specific steps of step S1 are as follows: S11, real-time calculation of filtering residual and feature extraction; S111, Kalman filtering of the original signal of the sensor, real-time calculation of the filtering residual sequence wherein z(k) is the sensor observation value at time k, Here, H represents the filtered estimate, and H is the observation matrix. S112 calculates three core characteristics of residuals using a sliding window: residual variance. residual peak factor and residual frequency domain energy ; S12 sets interference thresholds for low, medium, and high interference based on residual characteristics, and compares the calculated residual characteristics with the interference thresholds in real time. If three consecutive sliding windows meet the same level condition, the current interference level is determined. S13 sets the mode switching trigger signal T. When the interference level of adjacent windows changes and two consecutive windows stabilize at the new level, T triggers the reset of filtering parameters and mode switching; when the interference levels of adjacent windows alternate, the original filtering mode is maintained. S14 dynamically adjusts the process noise covariance Q and observation noise covariance R of the Kalman filter based on the current interference level and residual characteristics: For low interference: , The initial process noise covariance matrix calibration value; α is the process noise covariance adjustment weight coefficient under low disturbance; β is the observation noise covariance adjustment factor under low disturbance; under medium disturbance: , , This is the process noise covariance adjustment factor when there is moderate interference. For residual variance; The observation noise covariance adjustment factor when there is moderate interference; These are the initial observation noise covariance matrix calibration values; Frequency domain energy; under high interference: , ;in, This is the process noise covariance adjustment factor under high interference conditions; Peak factor; This is the adjustment factor for the observation noise covariance under high interference.
[0006] Furthermore, in step S12, the interference threshold for low interference is: residual variance Peak factor <3, the proportion of interference frequency band energy to frequency domain energy Less than 10%; the interference threshold for medium interference is: residual variance for Peak factor The value is 3~5, and the energy of the interference frequency band accounts for 3% of the frequency domain energy. The interference threshold is 10%~30%; the interference threshold for high interference is: residual variance > Peak factor > 5, interference band energy proportion of frequency domain energy > 30%.
[0007] Further, the specific steps of step S2 are: S21 supplementing associated features on the basis of original features to form a three-dimensional feature matrix of environmental parameter characteristics and sensor state; S22 refining the link of LSTM model training in terms of the time sequence evolution law of multiple features with learning drift, including label definition, parameter definition, data preprocessing, and model structure and training parameters; S23 performing standardized construction of input time sequence on the acquired real-time features using the same standard as in the training phase, and inputting the input time sequence into the LSTM model to output the predicted drift ΔT_pred(t) at the current time.
[0008] Further, in step S21: the environmental parameters include humidity H(t) and environmental temperature T_env(t); the medium characteristics include medium type code M and concentration C(t); and the sensor state includes cumulative working time t_work and recent high load time t_high(t).
[0009] Further, the data preprocessing in step S22 includes outlier rejection, missing value filling, feature standardization, and time sequence sample construction.
[0010] Further, step S23 also includes dynamic feedback and model updating; specifically: periodically calibrate the sensor standard environment, use new samples to implement incremental updating of the model, when |ΔT_pred(t)|>1.5 times the historical maximum drift, trigger an audible alarm, and simultaneously switch to a backup compensation scheme; the backup compensation scheme is: based on the polynomial fitting ΔT_backup=a×t_total²+b×t_total+c of t_total, the coefficients a, b, and c are fitted through historical data, and t_total is the cumulative time working feature.
[0011] Further, the specific steps of step S3 are: S31 establishes a response lag model, based on the thermal inertia characteristics of the chemical sensor, uses a first-order inertia + pure lag transfer function as the basic model, uses least squares + gradient descent iteration, fits the collected data through MATLAB System Identification Toolbox, compares the residual sum of squares and the goodness of fit; if the fitting error exceeds the threshold, upgrade to use a second-order inertia + pure lag model to compensate for the thermal exchange nonlinearity of the probe and the reaction medium; S32 constructs a multi-objective constrained optimization objective function based on the prediction time domain and the control time domain ,in, The temperature tracking error at time t+k To set the temperature, To predict temperature; To control incremental smoothing, This represents the change in power. To constrain penalties, The calculation formula is: , To predict the length of the time domain, This represents the penalty coefficient for temperature constraints. for Predicted temperature at any time This is the lower limit of the safe temperature range. This is the upper limit of the safe temperature range. This is the penalty coefficient for power constraints. for Actual power at time, This is the lower limit of the rated power. This is the upper limit of the rated power. S33 employs a quadratic programming algorithm to solve the objective function within each control cycle, outputting the optimal predicted temperature sequence for the next Nc cycles. Take the first cycle As a hysteresis error compensation value; S34 outputs dynamically optimized temperature Simultaneously outputting the corresponding optimal heating / cooling power command. Every 5-10 control cycles, Compared with the true value of the reference thermocouple Compare and calculate the compensation error. If e > 0.5℃, update the sensor transfer function parameters using the recursive least squares method. ) and feedforward gain K f .
[0012] On the other hand, a temperature sensor data processing system for a chemical synthesis environment is provided, including: The raw data acquisition and preprocessing module is used to acquire raw data and dynamically adjust the noise covariance matrix based on the filter residuals using a self-evolving filtering mechanism. It also adaptively switches between three filtering modes by monitoring the electromagnetic interference intensity in real time. The sensor drift compensation module is used to predict and compensate for sensor drift errors based on a multi-feature LSTM drift prediction model that integrates environmental parameters and operating time. The dynamic response optimization module is used to predict and control the dynamic response of the sensor by introducing a dual time-domain MPC predictive control algorithm. Anomaly detection and adaptive calibration module is used for detecting anomaly by adopting isolated forest algorithm and triggering least square method adaptive calibration; specifically, a plurality of multi-dimensional known temperature reference points in a system are collected, a nonlinear relationship between sensor output voltage U and temperature T is dynamically fitted by least square method: T=aU+b, coefficients a and b are updated, and final temperature after calibration is output .
[0013] The application has the following beneficial effects: the application realizes a measurement accuracy of ±0.5°C in the range of 80-300°C by deep fusion of LSTM drift compensation and adaptive Kalman filtering, and meets the A-level accuracy requirement of temperature control of a drug synthesis process; the sensor thermal inertia lag is compressed from 500ms to ≤80ms by MPC predictive control, which can effectively capture the sudden rise / fall temperature in a synthesis reaction and avoid product decomposition caused by local overheating; the combination of isolated forest anomaly detection and least square calibration prolongs the maintenance period of the sensor in a strong corrosive environment from 7 days to 90 days, and reduces the annual maintenance cost by 65%. BRIEF DESCRIPTION OF DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0015] Figure 1 is a data processing flowchart of the temperature sensor data processing method of the chemical synthesis environment according to the embodiment of the present application; Figure 2 is a data processing LSTM drift compensation model structure diagram of the temperature sensor data processing method of the chemical synthesis environment according to the embodiment of the present application. DETAILED DESCRIPTION
[0016] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art belong to the scope of protection of the present application.
[0017] As shown in Figures 1-2 , the temperature sensor data processing method and system of the chemical synthesis environment according to the embodiment of the present application, the method comprises the following steps: S1. Raw data acquisition and preprocessing: Adaptive Kalman filtering is used to reduce noise in the original sensor signal: self-evolution filtering mechanism based on filtering residual error dynamic adjustment of noise covariance matrix, through real-time monitoring of electromagnetic interference intensity, adaptive switching of three filtering modes, anti-interference performance improved by 40dB; S2. Sensor drift compensation: Based on long short-term memory network (LSTM) to predict and compensate sensor drift error: multi-feature LSTM drift prediction model integrating environmental parameters (pH value concentration) and working time, drift prediction accuracy of 98.2%; S3. Dynamic response optimization: Model predictive control (MPC) is used to accelerate sensor dynamic response: double-time domain MPC prediction control algorithm (short-term 8 steps + long-term trend prediction) is introduced, and the dynamic response speed is improved to 1 / 8 of the traditional method; S4. Abnormal detection and adaptive calibration: Isolation forest algorithm is used to detect anomalies and trigger least squares adaptive calibration: Isolation forest anomaly detection based on temperature gradient features and multi-reference point least squares calibration linkage mechanism, fault diagnosis accuracy of 98.7%.
[0018] The specific implementation is as follows: 1. Raw data acquisition and preprocessing Step 1: Real-time calculation of filtering residuals and feature extraction Residual basic calculation: After Kalman filtering of the original sensor signal (such as acceleration, current signal), the filtering residual sequence is calculated in real time , where represents the filtering residual sequence, k is the sampling time, z(k) is the sensor observation value at time k, is the filtering estimate value, and H is the observation matrix; Residual feature quantization: Calculate 3 core features of residual through sliding window (window length is set to 50-100ms, adapt to sensor sampling rate): Residual variance (reflects the overall strength of interference, where N is the sample number and i is the sampling index); Residual peak factor (identify pulse-type electromagnetic interference, where k is the sampling time, n is the calculation window length, and i is the window sampling point index); Residual frequency energy E f : FFT transform is done on the residual sequence, and the energy proportion of 50Hz / 150Hz and other common industrial interference frequencies is extracted (locate the main frequency of interference).
[0019] Step 2: Electromagnetic interference intensity level determination Based on residual features, set 3-level interference threshold (threshold is calibrated through experiments, such as for industrial sensor scene): Interference level residual variance Peak factor Interference band energy proportion E f ]]> Low interference <3 Less than 10% Medium interference 3--5 10%--30% High interference > >5 >30% Real-time comparison of the calculated residual features with the threshold value, if the same level condition is met for 3 consecutive sliding windows, the current interference level is determined (avoiding instantaneous fluctuation misjudgment).
[0020] Step 3: Filter mode adaptive switching trigger Switching logic: Set the mode switching trigger signal T, when the interference level changes from low to medium, medium to high, high to medium, and medium to low, T triggers the filter parameter reset and mode switching, and the switching delay is controlled within 10ms (to adapt to real-time requirements); Anti-shake mechanism: If the interference levels of adjacent windows alternate (such as low to medium to low), the original filter mode is maintained until the new level is stable for 2 consecutive windows, to avoid filter divergence caused by frequent switching.
[0021] Step 4: Noise covariance matrix self-evolution adjustment Based on the current interference level and residual features, the process noise covariance Q and observation noise covariance R of Kalman filter are dynamically adjusted: Low interference: is the initial process noise covariance matrix calibration value; α is the process noise covariance adjustment weight coefficient under low interference, with a value of 0.5; β is the observation noise covariance adjustment factor under low interference; Medium interference: , The residual variance and frequency energy are weighted to enhance the ability to resist specific frequency band interference. : Process noise covariance adjustment coefficient under medium interference, with a value of 1.2; : Residual variance; : Observation noise covariance adjustment coefficient under medium interference, with a value of 1.5; : Initial observation noise covariance matrix calibration value; : Frequency energy); High interference: , Introduce peak factor weighting to improve the robustness of anti-impulse interference : Process noise covariance adjustment coefficient under high interference, with a value of 1.8; : Peak factor; : Residual variance; : Observation noise covariance adjustment coefficient under high interference, with a value of 2.0; : Initial observation noise covariance matrix calibration value; : Frequency energy).
[0022] Specific forms of three adaptive filter modes a. Low interference mode: Light-weighted Adaptive Kalman Filter (L-AKF) Core mechanism: Based on the minimum mean square error (MMSE) criterion, simplify the filter calculation, only through the residual variance fine-tuning ; Structural design: Adopt single state variable filter (such as for sensor zero drift correction), observation matrix H = [1], filter gain ( : discrete time index; : predicted covariance; : transpose of observation matrix H; Projection of the uncertainty of the prediction in the observation space; : observation noise covariance) Applicable scenario: Stable electromagnetic environment area (such as laboratory, control room without high-power equipment), sensor original signal signal-to-noise ratio (SNR) > 30dB; Performance: The SNR of the filtered signal is improved by 8-12dB, and the calculation time is <5ms / frame (adapted to 1kHz sampling rate sensor).
[0023] b. Medium interference mode: Band suppression type adaptive Kalman filter (B-AKF) Core mechanism: Fusion of "Kalman filter + adaptive notch", directional suppression for specific frequency band interference (such as 50Hz power frequency harmonic, 150Hz multiple frequency interference) under medium interference; Structural design: First, do FFT on the sensor original signal, locate the main frequency f0 of the interference; Add notch factor to the Kalman filter observation equation ( , weight the observation value of the frequency band for suppression); The observation value is modified to , and then substituted into the Kalman filter formula for calculation; Applicable scenario: Industrial workshop (such as near motor, frequency converter), intermittent, fixed frequency electromagnetic interference exists, SNR = 20-30dB; Performance: The energy suppression ratio of the interference frequency band reaches 25dB, the SNR after filtering is improved by 15-20dB, and the anti-interference performance is improved by 18dB compared with traditional KF.
[0024] c. High interference mode: Strong robustness adaptive Kalman filter (R-AKF) Core mechanism: Introduce residual weighting factor and double factor covariance adjustment, combined with the robustness of particle filter (PF), to deal with strong pulse interference and nonlinear interference; Structural design: Residual weighting: to abnormal residual ) Assign a weighting coefficient , correct the observation value ; Hybrid filtering: when the peak factor > 6, switch to a "Kalman filter + particle filter" hybrid structure (PF handles nonlinear impulse noise, AKF handles Gaussian noise); Covariance double-factor adjustment: Subject to residual variance and peak factor weighting, to avoid filter divergence under high interference; Applicable scenarios: areas with high-power electromagnetic equipment (such as near electric welders and high-voltage cabinets), SNR < 20 dB, with burst impulse noise; Performance: impulse noise suppression ratio up to 40 dB, SNR after filtering improved by 25-30 dB, 40 dB better than traditional KF anti-interference performance (matching the innovation point index).
[0025] 2, Sensor drift compensation module Problem: Corrosive media in chemical synthesis cause slow drift of sensor characteristic parameters (such as thermocouple Seebeck coefficient), introducing system errors.
[0026] Processing steps: drift prediction and compensation based on multi-feature fusion long short-term memory network (LSTM): (1) Input features: multi-dimensional time series feature system (clear feature definition and collection logic) On the basis of original features, supplement key associated features to form a "environment-medium-sensor" three-dimensional feature matrix, as follows: Environmental parameters (real-time collection, sampling frequency 1 Hz): Humidity H(t): humidity in the synthesis reactor (unit: %RH), obtained through the reactor humidity sensor; Ambient temperature T_env(t): ambient temperature outside the reactor (unit: °C), affecting medium evaporation rate and corrosion activity; Medium characteristics (static + dynamic combination): Medium type encoding M: represented by one-hot encoding (e.g. 100 for hydrochloric acid, 010 for sodium hydroxide, 001 for mixed acid, etc.), preset by process formula; Medium concentration C(t): real-time monitored medium mass fraction (unit: %), collected by online concentration meter (higher concentration, stronger corrosion, faster drift); Sensor state (cumulative + time series combination): Cumulative working time t_work: total running time of the sensor since it was put into use (unit: h), a key drift driving factor (corrosion accumulates over time); Recent high load duration t_high(t): cumulative duration of medium temperature > 150℃ in the past 24h (high temperature accelerates electrode oxidation, exacerbates drift); Historical measurement sequence T_meas(t-1) - T_meas(t-30): sensor measurement temperature (unit: ℃) in the past 30 sampling periods, reflecting the timing inertia of drift; (2) LSTM model training: full process design from data preprocessing to model iteration With "learning the timing evolution rule of drift with multiple features" as the core, the training process is refined: Label definition: clearly define the drift amount label ΔT_label(t) = T_standard(t) - T_meas(t), where: T_standard(t): true temperature at time t in the standard environment (synchronously measured under the same working condition by a high-precision calibrator, calibrated once a month, and 24h of continuous data is collected as reference data each time); T_meas(t): measured temperature of the sensor to be compensated at time t (original reading affected by drift).
[0027] Parameter definition: C(t): medium concentration feature; H(t): environmental humidity feature; T_env(t): environmental temperature feature; t_total: cumulative time working feature; t_high(t): high temperature cumulative time feature.
[0028] Data preprocessing (to ensure data quality): Outlier rejection: use a sliding window (window size 5s) to determine when T_meas(t) deviates from the mean in the window by > 3℃, it is determined to be an outlier caused by medium splashing / equipment shaking, and the mean values before and after the time are replaced; Missing value filling: for missing features caused by sensor communication interruption (such as C(t) missing), use KNN interpolation based on medium type (take the mean value of C(t) corresponding to similar H(t) and T_env(t) under the same type of medium); Feature standardization: for continuous features (H(t), T_env(t), t_total, etc.), use min-max normalization to [0, 1] interval (to eliminate dimensional differences), and discrete features (M) remain in one-hot encoding format; Time series sample construction: with "past 30 sampling period feature sequence (30x7 dimensions, 7 for total features)" corresponding to "current period ΔT_label(t)" as the sample, construct the time series dataset (total sample size > 50,000, covering more than 3 types of medium, 10 types of humidity / temperature working conditions).
[0029] Model structure and training parameters (adapt to drift timing characteristics): Network architecture: "LSTM + fully connected" structure - input layer (7-dimensional features) → LSTM layer (2 layers, 64 neurons in the first layer, 64 neurons in the second layer, both with dropout = 0.2 to prevent overfitting) → fully connected layer (16 neurons, ReLU activation) → output layer (1 neuron, linear activation, output ΔT_pred(t)); Training configuration: Optimizer is Adam (initial learning rate 0.001, decay 5% every 100 rounds), loss function is Huber loss (balances the sensitivity of MSE to outliers), batchsize = 128, maximum training rounds 500, uses early stopping method (terminates if the validation set loss does not decrease for 20 consecutive rounds, preserves the best model); Dataset division: divided by time sequence (avoid future data leakage), training set (first 70% samples), validation set (middle 20%), test set (last 10%), requires the average absolute error (MAE) of test set ΔT_pred(t) and ΔT_label(t) to be ≤0.2℃.
[0030] (3) Real-time compensation: dynamic prediction-compensation-feedback closed loop (ensures long-term reliability) Real-time prediction process: Feature real-time collection: synchronously acquire H(t), T_env(t), C(t), t_total, t_high(t) and the latest 30 T_meas(t) at 1Hz frequency; Feature preprocessing: perform standardization on real-time features consistent with the training phase (call the min / max parameters saved during training), construct a 30x7-dimensional time series input; Drift prediction: input the sequence into the LSTM model, output the predicted drift ΔT_pred(t) at the current time.
[0031] Compensation calculation: derive the compensation formula based on the label definition, the compensated temperature is: T_compensated(t) = T_meas(t) + ΔT_pred(t) (logic: since ΔT_label(t) = T_standard(t) - T_meas(t), T_standard(t) = T_meas(t) + ΔT_label(t), approximate ΔT_label(t) with ΔT_pred(t) to get the true temperature estimate).
[0032] Dynamic feedback and model updating: Regular calibration: calibrate the standard environment every 30 days (place the sensor in a non-corrosive constant temperature bath, obtain 24h T_standard(t) and T_meas(t), generate new ΔT_label samples); Incremental training: Incremental update of the model with new samples (freeze LSTM layer weights, only train fully connected layers, iterate for 50 rounds) to mitigate model degradation caused by long-term drift regularity changes. Freezing the pre-trained LSTM layer maintains its ability to generalize the extraction of temporal dynamic features, preventing the model from catastrophic forgetting of previously learned knowledge due to limited new samples; while only fine-tuning the fully connected layers encourages the model to quickly adapt to new trends of drift regularity. This partial freezing mechanism achieves efficient parameter updating (significantly reducing computational overhead) while ensuring model stability, and its long-term adaptability is guaranteed by regular full calibration (every 30 days), effectively suppressing model degradation while maintaining the ability to continuously track environmental dynamic changes.
[0033] Anomaly protection: When |ΔT_pred(t)| > 1.5 times the historical maximum drift (95th percentile of ΔT_label in the training set), trigger an audible alarm and switch to a backup compensation scheme (polynomial fitting based on t_total: ΔT_backup = a x t_total² + b x t_total + c, coefficients a, b, c are fitted by historical data).
[0034] Through the above refinement, the module can achieve dynamic tracking of thermocouple drift under corrosive media (prediction error reduced to within 0.2°C), and through regular updates and anomaly protection, ensure compensation accuracy in continuous operation for more than 1 year.
[0035] 3. Dynamic response optimization module Problem: Chemical synthesis exothermic / endothermic reactions cause rapid temperature changes (e.g. 100°C / s), sensor inherent thermal inertia causes response lag.
[0036] Processing steps: Dynamic response acceleration based on Model Predictive Control (MPC): (1) Establish a response lag model: System identification experimental design: Input excitation signal: Use "step-pulse composite excitation", in the empty state of the reaction kettle, apply 5-10 groups of step temperature signals (amplitude ±50°C, covering the commonly used temperature range 50-250°C for synthesis reactions) through the heating / cooling system, while superimposing 10-20ms pulse temperature disturbance to simulate rapid temperature fluctuations in actual reactions; Data acquisition: Use high-precision thermocouples (response time <10ms) as "true value reference" to synchronize temperature data acquisition with the sensor to be optimized, with a sampling frequency of 1kHz (much higher than the Nyquist frequency corresponding to the temperature change rate), and the acquisition duration is not less than 5 times the estimated lag time of the sensor; Abnormal data processing: remove outliers caused by electromagnetic interference by 3σ criterion, use sliding average filter (window size 5-10 sampling points) to retain dynamic characteristics while reducing noise.
[0037] Transfer function parameter identification: Model form selection: based on the thermal inertia characteristics of chemical sensors, use "first-order inertia + pure lag (FOPDT)" transfer function as the basic model: Where: K is the sensor gain (ideal state K=1, actual due to probe sensitivity deviation needs to be calibrated), T is the time constant (reflects the thermal inertia size, usually 20-100 ms), τ is the pure lag time (reflects the signal transmission and probe heat conduction delay, usually 30-150 ms); Parameter identification method: use "least squares method + gradient descent iteration", fit the collected data by MATLAB System Identification Toolbox, compare the residual sum of squares (SSE<0.01) and goodness of fit (R^2>0.98) to ensure model accuracy; if the fitting error exceeds the threshold, upgrade to "second-order inertia + pure lag (SOPDT)" model to compensate for the nonlinear heat exchange between the probe and the reaction medium.
[0038] Temperature change rate feedforward compensation channel design: Feedforward signal extraction: derive the real-time data of the reference thermocouple (use central difference method: ), get the instantaneous temperature change rate ; Feedforward coefficient tuning: introduce feedforward gain Kf, feedforward compensation amount , determine Kf by trial and error method (initial value set to 0.5-1.0 times pure lag time τ, gradually adjust to reduce sensor lag error by more than 60%); Channel fusion: superimpose the feedforward compensation amount and the sensor measurement value to get the corrected input signal , provide real-time dynamic reference for MPC.
[0039] (2) MPC prediction compensation (parameterization and constraint optimization) Input variable definition: clearly define the 3 types of core inputs of MPC: Dynamic correction input: T in (from feedforward-measurement fusion channel); Process disturbance input: reactor heating / cooling power P (real-time acquisition, reflects external control effort); Dynamics input: reaction exothermic / absorbing rate estimate based on historical data (computed by reaction enthalpy change and reactant concentration, compensates for the nonlinear disturbance of the reaction itself).
[0040] Prediction horizon and control horizon settings: Prediction horizon: based on typical time constant of synthesis reaction (e.g. polymerization =1-3s), take (e.g. =2s, =6-10 control periods), ensure covering full temperature fluctuation period, avoid prediction "breaks"; Control horizon: take (e.g. =9, =3), balance control flexibility and computational complexity, avoid frequent controller adjustments.
[0041] Optimization objective function construction (multi-objective constraints): Objective function takes "temperature tracking accuracy + control smoothness" as the core, the form is as follows: The first term: temperature tracking error ( is the set temperature, is the predicted temperature), the weight =10-20 (preferentially guarantee temperature accuracy); The second term: control increment smoothing ( is the power change amount), the weight =1-5 (avoid equipment damage caused by sudden heating / cooling power); The third term: constraint penalty term is an indicator function, where ( : prediction horizon length, : penalty coefficient of temperature constraint; : predicted temperature at time t; : lower limit of temperature safety interval; : upper limit of temperature safety interval; : penalty coefficient of power constraint; : actual power at time t; : lower limit of rated power; : upper limit of rated power); When overshoots the safety interval or P exceeds the rated power , =100-1000, force the constraint to take effect).
[0042] Optimal solution finding: A quadratic programming (QP) algorithm (such as the OSQP solver) is used to solve the objective function within each control cycle (set to 10-50ms, matching the temperature change rate), and outputs the optimal predicted temperature sequence for the next Nc cycles. Take the first cycle As a hysteresis error compensation value.
[0043] (3) Output and closed-loop execution Optimized output: Temperature after dynamic optimization Simultaneously outputting the corresponding optimal heating / cooling power command. ; Closed-loop correction: Every 5-10 control cycles, Compared with the true value of the reference thermocouple Compare and calculate the compensation error. If e > 0.5℃, update the sensor transfer function parameters using the recursive least squares method. ) and feedforward gain K f This enables the model to adapt and adjust itself.
[0044] Performance verification and optimization metrics: Simulation verification: A simulation model of "reactor-sensor-MPC" was built in MATLAB / Simulink. A temperature step signal of 100℃ / s was input, and the lag time was reduced from 200ms to less than 50ms, and the temperature overshoot was reduced from ±5℃ to ±0.5℃. Experimental verification: Styrene polymerization was carried out in a 5L batch reactor (exothermic rate 80-120°C / s). Compared with before and after optimization: the temperature response hysteresis was reduced by more than 70%, the peak reaction temperature control error was <±0.3℃, and the standard deviation of product molecular weight distribution was reduced by 15%. Robustness test: Under the scenarios of sensor aging (after 1000 hours of use) and changes in the viscosity of the reaction medium (±50%), the optimized temperature error is still <±1℃, which meets the requirements of the chemical synthesis process.
[0045] 4. Anomaly Detection and Adaptive Calibration Module Function: Identify sensor malfunctions (such as poor contact or aging) or synthesis anomalies (local overheating) and trigger calibration.
[0046] Processing steps: (1) Anomaly detection (Isolation Forest algorithm): Training samples: under normal operating conditions Sequence (integrating temperature gradient and rate of change features), construct an isolated tree model that integrates multiple features; Real-time detection: Calculate the current The abnormal score (S(t)) if Threshold ), as an anomaly (e.g., deviating from the normal temperature change rate (> 50 °C / s) or signal loss).
[0047] (2) Adaptive calibration (least squares fitting): Trigger condition: Abnormality detection trigger (innovation: real-time fault self-diagnosis trigger mechanism) or periodic calibration cycle (e.g., 24 hours) arrives; Calibration process: Collecting multiple dimensions of known temperature reference points in the system (e.g., ice water mixture 0 °C, water boiling point 100 °C, synthetic medium phase transition point), and dynamically fitting the nonlinear relationship between sensor output voltage (U) and temperature (T) by least squares method: (T = aU + b) (innovation: multi-reference point dynamic calibration algorithm), update coefficients (a, b).
[0048] (3) Output: Final temperature after calibration . DETAILED DESCRIPTION
[0049] Example 1: Temperature measurement application of drug synthesis reactor Experimental configuration: K-type corrosion-resistant thermocouple (model WRN-230) is used, sampling frequency = 100 Hz, and STM32H743 microprocessor is matched. The experiment is carried out in a 200 L stainless steel reactor for synthesis of cephalosporin intermediates (reaction temperature range 80-300 °C, medium is ethyl acetate-water mixture).
[0050] Algorithm parameter setting: Adaptive Kalman filter: initial covariance = 0.1, = 1.0, sensitivity coefficient k = 0.05; LSTM drift compensation: input feature dimension 128, hidden layer 2 layers (64 neurons per layer), training period 500 rounds, learning rate 0.001; MPC dynamic optimization: prediction time domain = 8 steps, control time domain = 3 steps, sampling period 0.01 s.
[0051] Experimental results: In the 250 °C exothermic reaction stage (heating rate 80 °C / s), the invention has achieved a breakthrough compared with traditional technology: ① Measurement accuracy is improved by 7 times (± 0.3 °C vs. traditional ± 2.1 °C); ② Dynamic response speed is improved by 8 times (72 ms vs. traditional 580 ms); ③ Long-term stability is improved by 15 times (30-day drift 0.4 °C vs. traditional 6.2 °C).
[0052] Example 2, Temperature Control Optimization Implementation of Recrystallization Process (Fusion of Adaptive Kalman Filter, LSTM Drift Compensation and MPC Dynamic Optimization) Step 1: Architecture Module Division and Function Definition 1.1 Core Control Layer Model Predictive Control (MPC) Module: As the dynamic optimization core, it receives the preset program cooling curve (such as nucleation stage -0.1℃ / min, growth stage -0.05℃ / min), and through the thermodynamic model, it optimizes the temperature trajectory in the future 30-60 seconds to generate the feedforward control amount (heating / cooling power coarse adjustment instruction).
[0053] Adaptive PID Module: As a closed-loop fine-tuning unit, it receives the coarse adjustment instruction output by MPC, combines the real-time temperature deviation (≤±0.1℃), and performs PID parameter adaptive tuning to output the final actuator control signal (such as electromagnetic valve opening, heating rod power).
[0054] 1.2 State Perception and Compensation Layer Adaptive Kalman Filter Module: Construct a thermodynamic state observer to estimate the unobservable disturbance (crystallization heat release rate, solvent evaporation rate) in real time, and output the disturbance compensation amount (superimposed on the MPC feedforward control amount).
[0055] LSTM Drift Compensation Module: Through historical data training, a nonlinear drift model (such as heat transfer efficiency decay caused by solution viscosity change) is trained to predict the time-varying parameter deviation of the sensor, and dynamically correct the MPC model parameters (such as time constant, pure lag time).
[0056] 1.3 Input / Output Interface Layer Feedforward Input: Receive the process preset program cooling curve (CSV format, containing time-temperature set value sequence).
[0057] Feedback Input: Collect real-time temperature of the reactor (sampling frequency 1kHz), heating / cooling power (0-100% range) characteristic parameters (viscosity, concentration, sampling frequency 1Hz).
[0058] Actuator Output: Control signal after D / A conversion drives jacket cooling water valve (0-10V analog quantity), electric heating rod (PWM pulse signal).
[0059] Step 2: Dynamic Configuration of Stage Precision Target 2.1 Nucleation Stage (0-2h) Temperature control target: ±0.1℃ (temperature fluctuation ≤0.05℃ / min).
[0060] Implementation: MPC prediction horizon is set to 10 steps (100 ms per step, covering temperature changes within 1 second), control horizon is 3 steps, weight coefficients λ1 (temperature tracking error) = 20, λ2 (power smoothing) = 1, priority is given to trajectory accuracy.
[0061] Adaptive Kalman filter enables high interference mode (R-AKF), which suppresses pulse interference when stirring is started (peak factor > 5 triggers particle filter hybrid structure).
[0062] 2.2 Main growth phase (2-8h) Temperature control target: ±0.2℃~±0.5℃ (temperature fluctuation ≤0.1℃ / min).
[0063] Implementation: MPC prediction horizon is reduced to 8 steps, control horizon is 2 steps, λ1 = 15, λ2 = 3, balance accuracy and energy consumption (such as reducing cooling power switching frequency).
[0064] LSTM module updates drift prediction model every hour (input features: cumulative working time, viscosity change rate, ambient temperature), compensation amount ≤0.05℃.
[0065] 2.3 Curing and cooling phase (8-12h) Temperature control target: ±1℃ (temperature fluctuation ≤0.2℃ / min).
[0066] Implementation: MPC switches to "energy saving mode", prediction horizon is 6 steps, control horizon is 1 step, priority is given to the maximum power consumption of the actuator (≤60% of the rated power).
[0067] Adaptive PID parameters switch to "robust group" (proportional gain Kp is reduced by 20%, integral time Ti is extended by 30%), to avoid over-regulation.
[0068] Step 3: Multi-module collaborative control process (1 control cycle = 100ms) 3.1 Feedforward control quantity generation (0-20ms) Read the preset cooling curve current set value T_set(t), calculate the basic cooling power P_ff(t) = K_ff·(T_set(t)-T_meas(t)) based on the reaction kettle thermodynamic model (first-order plus pure lag: G(s)=K / (Ts+1)e^(-τs), K=0.98, T=60ms, τ=50ms), where K_ff is the feedforward gain (0.8-1.2, dynamically adjusted according to the medium thermal conductivity).
[0069] 3.2 State observation and disturbance compensation (20-40ms) Adaptive Kalman filter module receives real-time temperature T_meas(t), heating power P(t), estimates disturbance term w(k) (such as crystallization exothermic Q=50-100 kJ / mol) through state equation x(k+1)=Ax(k)+Bu(k)+w(k), and outputs compensation amount ΔP_kalman=K_obs·w(k) (K_obs is observer gain, which is set by pole placement method).
[0070] 3.3 Time-varying characteristic drift compensation (40-60 ms) LSTM module input feature vector ([cumulative working time t_work, medium viscosity μ, environment temperature T_env, previous 30-step temperature sequence]), predicts sensor drift ΔT_lstm(t), and corrects MPC model parameters: T'=T+ΔT_lstm(t)·0.1, τ'=τ+ΔT_lstm(t)·0.05 (coefficients are fitted by historical data).
[0071] 3.4 MPC rolling optimization (60-80 ms) Based on the corrected model, MPC solves the optimization problem under the constraint condition (cooling rate ≤-0.2 ℃ / min, heating power ≤80%): min J=λ1∑(T_pred(t+i)-T_set(t+i))²+λ2∑(ΔP(t+i))², generates future 3-step power sequence [P_mpc(t), P_mpc(t+1), P_mpc(t+2)], and outputs current step coarse adjustment instruction P_coarse=P_ff(t)+ΔP_kalman+P_mpc(t).
[0072] 3.5 Adaptive PID closed-loop fine adjustment (80-100 ms) Calculate temperature deviation e(t)=T_set(t)-T_meas(t), call corresponding PID parameter set according to process stage (nucleation stage: Kp=2.5, Ti=10 s, Td=2 s; growth stage: Kp=1.8, Ti=15 s, Td=3 s), and output final control amount P_final=P_coarse+Kp·e(t)+(1 / Ti)∫e(t)dt+Td·de(t) / dt through anti-integral saturation algorithm (freeze integral term when valve opening ≥95%).
[0073] Step 4: System initialization and parameter calibration 4.1 Offline identification of model parameters Step response experiment in empty reactor: apply 5 ℃ step temperature signal, collect output curve, and fit FOPDT model parameters (K, T, τ) by least squares method, ensuring fitting goodness R²>0.98.
[0074] 4.2 LSTM model pre-training The drift prediction model is trained using historical data (3 months of operation records, including more than 10 types of media), the input features are standardized to the [0, 1] interval, the LSTM network structure is: 2 layers of hidden layers (64 neurons per layer, dropout = 0.2), training rounds 500, validation set loss < 0.01℃².
[0075] 4.3 Kalman filter initial value setting State covariance matrix P0 = diag([0.1, 0.1]), process noise covariance Q = 0.01I, observation noise covariance R = 0.05I, adaptively adjusted to steady state (residual variance < 0.05℃²) through the first 100 sampling period data.
[0076] Step 5: Run-time process monitoring and abnormality handling 5.1 Real-time state monitoring Every 500ms, calculate the key indicators: temperature deviation |e(t)|, MPC optimization objective function value J, LSTM prediction error |ΔT_lstm(t)-ΔT_actual(t)| (ΔT_actual is obtained through regular calibration), when any indicator exceeds the threshold (such as e(t)>±0.3℃), trigger an alarm.
[0077] 5.2 Abnormality handling mechanism Sensor failure: When the isolated forest algorithm detects temperature signal abnormalities (abnormal score S(t)>0.8), automatically switch to the backup sensor (redundant configuration), and enable LSTM prediction value to temporarily replace the measured value (duration < 5min).
[0078] Model mismatch: When the MPC prediction error > 0.5℃ (for 3 consecutive periods), trigger online model parameter update (use recursive least squares method to correct K, T, τ).
[0079] Through the above steps, the core architecture realizes the whole process optimization of "feedforward prediction-state compensation-closed loop fine tuning", ensuring that the temperature control accuracy of each stage of the recrystallization process meets the standards (nucleation ± 0.1℃, growth ± 0.2℃~±0.5℃), the standard deviation of crystal size distribution is reduced to below 40μm, and the crystal purity is improved to more than 99.5%.
[0080] In summary, by means of the above technical scheme of the present application, through multi-module deep fusion of LSTM drift compensation and adaptive Kalman filtering, ±0.5°C measurement accuracy is achieved in the range of 80-300°C, meeting the A-level precision requirement of temperature control of the drug synthesis process; the sensor thermal inertia lag is compressed from 500ms to ≤80ms by MPC predictive control, which can effectively capture the sudden rise / fall temperature in the synthesis reaction, avoiding the decomposition of the product caused by local overheating; the combination of isolated forest anomaly detection and least squares calibration enables the maintenance cycle of the sensor in the strong corrosion environment to be extended from 7 days to 90 days, and the annual maintenance cost to be reduced by 65%.
[0081] The above merely describes preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A temperature sensor data processing method for a chemical synthesis environment, characterized by, The method comprises the following steps: S1: collecting original data and pre-processing the original data, specifically: based on the self-evolution filtering mechanism of dynamically adjusting the noise covariance matrix of the filtering residual, three filtering modes are adaptively switched by real-time monitoring of electromagnetic interference intensity; S2: predicting and compensating sensor drift error based on a multi-feature LSTM drift prediction model that fuses environmental parameters and working time; S3: predicting and controlling the dynamic response of the acceleration sensor by introducing a double-time domain MPC prediction control algorithm; S4: anomaly detection and adaptive calibration: using the isolation forest algorithm to detect anomalies and trigger adaptive calibration by the least squares method; Specifically: collect the multi-dimensional known temperature reference points in the system, dynamically fit the non-linear relationship between the sensor output voltage U and the temperature T through the least square method: T=aU+b, update the coefficients a and b, and output the final temperature after calibration .
2. The data processing method of claim 1, wherein, The specific steps of step S1 are as follows: S11: real-time calculation and feature extraction of filtering residuals; S111 Kalman filtering is performed on the sensor raw signal to calculate a filtered residual sequence in real time wherein z(k) is a sensor observation value at time k, is a filtered estimation value, and H is an observation matrix. S112 calculates three core features of the residual: residual variance , residual peak factor , and residual frequency energy by a sliding window. S12: setting interference thresholds for low, medium and high interference based on residual features, and comparing the calculated residual features with the interference thresholds in real time, if the same level condition is met in three consecutive sliding windows, then the current interference level is determined; S13: setting a mode switching trigger signal T, when the interference level of adjacent windows changes and the last two windows are stable at a new level, T triggers filter parameter reset and mode switching; When the interference levels of adjacent windows alternate, the original filtering mode is maintained; S14 dynamically adjusts the process noise covariance Q and the observation noise covariance R of Kalman filter based on the current interference level and the residual characteristic: when the interference is low: , is the initial process noise covariance matrix calibration value; a is the process noise covariance adjustment weight coefficient when the interference is low; b is the observation noise covariance adjustment factor when the interference is low; when the interference is medium: , , is the process noise covariance adjustment coefficient when the interference is medium; is the residual variance; is the observation noise covariance adjustment coefficient when the interference is medium; is the initial observation noise covariance matrix calibration value; is the frequency energy; when the interference is high: , ; wherein, is the process noise covariance adjustment coefficient when the interference is high; is the peak factor; is the observation noise covariance adjustment coefficient when the interference is high.
3. The data processing method of claim 2, wherein, In step S12, the interference threshold of low interference is: residual variance , peak factor <3, the proportion of interference frequency band energy in frequency energy is less than 10%; the interference threshold of medium interference is: residual variance is , peak factor is 3~5, the proportion of interference frequency band energy in frequency energy is 10%~30%; the interference threshold of high interference is: residual variance > , peak factor >5, the proportion of interference frequency band energy in frequency energy >30%.
4. The data processing method of claim 1, wherein, The specific steps of step S2 are as follows: S21: supplementing associated features based on original features to form a three-dimensional feature matrix of environmental parameter characteristics and sensor state; S22: refining the LSTM model training process by learning the time evolution law of drift with multiple features, including label definition, parameter definition, data preprocessing, and model structure and training parameters; S23: inputting the real-time features obtained into the LSTM model to output the predicted drift ΔT_pred(t) at the current time.
5. The data processing method of claim 4, wherein, In step S21: environmental parameters include humidity H(t) and environmental temperature T_env(t), medium characteristics include medium type code M and concentration C(t), and sensor state includes cumulative working time t_work, recent high load time t_high(t), and historical measurement sequence T_meas(t-1) to T_meas(t-30).
6. The data processing method of claim 4, wherein, The data preprocessing in step S22 includes outlier rejection, missing value filling, feature standardization and time sequence sample construction.
7. The data processing method of claim 4, wherein, Step S23 also includes dynamic feedback and model updating; specifically: periodically calibrate the sensor in a standard environment, use new samples to implement incremental updating of the model, when |ΔT_pred(t)|>1.5 times the maximum historical drift, trigger an audible alarm and switch to a backup compensation scheme; the backup compensation scheme is: based on the polynomial fitting ΔT_backup=a×t_total²+b×t_total+c of t_total, the coefficients a, b and c are fitted by historical data, and t_total is the cumulative time working feature.
8. The method of claim 1, wherein, The specific steps of step S3 are as follows: S31 establish response lag model, based on the thermal inertia characteristics of chemical sensor, using a first-order inertia + pure lag transfer function as the basis model, using least squares + gradient descent iteration, through MATLAB System Identification Toolbox fitting data collection, comparison of residual sum of squares and goodness of fit; if the fitting error is more than the threshold, then upgrade to use the second-order inertia + pure lag model to compensate for the nonlinear heat exchange of the probe and the reaction medium; S32 build an optimization objective function of multi-objective constraint based on the prediction time domain and the control time domain wherein, is a temperature tracking error at time t+k, is a set temperature, is a predicted temperature; is a control increment smoothing, is a power change amount; is a constraint penalty term, the calculation formula of the constraint penalty term is: , To predict the length of the time domain, This represents the penalty coefficient for temperature constraints. for Predicted temperature at any time This is the lower limit of the safe temperature range. This is the upper limit of the safe temperature range. This is the penalty coefficient for power constraints. for Actual power at time, This is the lower limit of the rated power. This is the upper limit of the rated power. S33 adopts a quadratic programming algorithm to solve the objective function in each control cycle, and outputs the optimal predicted temperature sequence of the next Nc cycles , and the first cycle is taken as the lag error compensation value . S34 output dynamic optimized temperature , output the optimal heating / cooling power instruction at the same time ; every 5-10 control cycles, , compare with the reference thermocouple true value , calculate the compensation error , if e>0.5℃, update the sensor transfer function parameters (G) and feedforward gain K by recursive least squares method f . 9. A temperature sensor data processing system for a chemical synthesis environment, characterized by, Comprise: The original data acquisition and pretreatment module is used for collecting original data and dynamically adjusting the self-evolution filtering mechanism of the noise covariance matrix based on the filtered residual, and three filtering modes are adaptively switched by real-time monitoring of electromagnetic interference intensity; The sensor drift compensation module is used for predicting and compensening the sensor drift error based on the multi-feature LSTM drift prediction model of fused environmental parameters and working time length; The dynamic response optimization module is used for predicting and controlling the dynamic response of the acceleration sensor by introducing a double-time-domain MPC prediction control algorithm. Anomaly detection and adaptive calibration module is used to detect anomaly by using isolation forest algorithm and trigger least square adaptive calibration; Specifically: collect the multi-dimensional known temperature reference points in the system, dynamically fit the non-linear relationship between the sensor output voltage U and the temperature T by using the least square method: T=aU+b, update the coefficients a and b, and output the final temperature after calibration .
Citation Information
Cited By
Intelligent control method and system for corrosion-resistant mass flow sensor
CN121879439A
Electric actuator position detection temperature drift compensation method suitable for extremely cold environment
CN122129967A
Cooperative actuator linkage control method and system based on space humidity distribution mapping
CN122172880A
