Microcontroller-based precision irrigation system for rice fields
By using hydrodynamic benchmark reconstruction and disturbance simulation injection, ideal water level curves and simulated disturbance curves are generated. Dual-track differential extraction and cross-correlation analysis are then performed, solving the problem of distinguishing between real water demand signals and environmental noise in traditional paddy field irrigation systems. This enables precise irrigation control, reduces energy consumption and mechanical wear, and improves system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI MUEN AGRICULTURAL PROFESSIONAL COOP
- Filing Date
- 2026-04-02
- Publication Date
- 2026-06-05
Smart Images

Figure CN122139642A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart agriculture and automated control technology, specifically a microcontroller-based precision irrigation system for paddy fields. Background Technology
[0002] In the automated control scenario of precision irrigation in paddy fields, the microcontroller needs to make irrigation decisions based on the water level time series data collected by the sensor. Existing solutions generally adopt a direct feedback control architecture based on a single threshold, that is, reading the sensor value in real time and comparing it with the set value to trigger the water pump action.
[0003] Because paddy fields are open and dynamic, water level signals are often coupled with high-frequency fluctuations caused by weather and waves. Furthermore, during long-term operation, sensor probes are prone to nonlinear signal drift due to sediment buildup. Traditional threshold triggering mechanisms lack the ability to decouple the physical source of the signal from its topological characteristics, making it impossible to effectively distinguish between genuine water shortage caused by crop physiological consumption and spurious fluctuations caused by environmental noise. This leads to frequent misjudgments and malfunctions in the control system when there is no water shortage. This control oscillation phenomenon not only causes ineffective energy consumption but also exacerbates the mechanical wear of actuators such as pumps, reducing the long-term stability of the system.
[0004] Therefore, how to accurately isolate environmental noise, identify real water demand signals, and achieve robust feedforward verification control under complex meteorological and physical conditions has become an urgent technical problem to be solved. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention provides a microcontroller-based precision irrigation system for paddy fields. Specifically, the technical solution of this invention includes:
[0006] The microcontroller is configured to perform the following operations:
[0007] Hydrodynamic baseline reconstruction: real-time water level time series data and environmental meteorological data are collected from the sensor terminal; based on the water balance physical model, crop growth coefficient is loaded to construct an ideal water layer decay model that reflects water level changes under undisturbed conditions, and an ideal water level curve is generated;
[0008] Interference simulation injection: Call the preset interference mode generator to generate wind and wave interference factor and sedimentation drift factor; superimpose the wind and wave interference factor and sedimentation drift factor onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms;
[0009] Dual-track differential extraction: Construct parallel calculation paths to calculate the difference between real-time water level time series data and ideal water level curve to obtain the actual residual vector, and calculate the difference between simulated interference curve and ideal water level curve to obtain the theoretical residual vector.
[0010] Correlation determination: Perform cross-correlation analysis between the actual residual vector and the theoretical residual vector; distinguish between real water shortage signals and environmental noise artifacts based on the cross-correlation analysis results, and execute irrigation commands or sensor maintenance commands by the microcontroller.
[0011] Preferably, the methods for constructing an ideal water layer attenuation model that reflects water level changes under undisturbed conditions and generating an ideal water level curve include:
[0012] Analyze the light, temperature and wind speed parameters in environmental meteorological data, and calculate the theoretical crop transpiration rate using the Penman-Monteith formula;
[0013] Load the preset soil basic permeability parameters and rice growth stage coefficients;
[0014] Based on theoretical crop transpiration, basic soil permeability parameters, and rice growth stage coefficients, the initial water level is reduced by time-domain integral to generate an ideal water level curve.
[0015] Preferably, the method of superimposing the wind and wave interference factor and the sedimentation and drift factor onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms includes:
[0016] Real-time wind speed is extracted from environmental meteorological data and mapped to the amplitude parameter of a sinusoidal wave function to generate a wind and wave interference factor.
[0017] Based on the sensor runtime, an accumulation drift factor simulating the probe coverage effect is generated using an exponential decay function.
[0018] The wind and wave interference factor and the sedimentation and drift factor are linearly superimposed onto the ideal water level curve to complete the parameterized injection and generate the simulated interference curve.
[0019] Preferably, the methods for performing cross-correlation analysis between the actual residual vector and the theoretical residual vector include:
[0020] Align the actual residual vector with the theoretical residual vector using a time window;
[0021] The waveform similarity coefficient between the actual residual vector and the theoretical residual vector is calculated using either the sliding window cross-correlation algorithm or the dynamic time warping algorithm.
[0022] The waveform similarity coefficient is output to the topology coupling decision unit.
[0023] Preferably, the method of distinguishing between real water shortage signals and environmental noise artifacts based on cross-correlation analysis results, and then having the microcontroller execute irrigation commands or sensor maintenance commands, is configured as follows:
[0024] If the waveform similarity coefficient is greater than or equal to the preset overlap threshold, the current water level fluctuation is determined to be environmental interference, and the microcontroller refuses to execute the irrigation action.
[0025] If the waveform similarity coefficient is lower than the preset overlap threshold, calculate the linear regression slope of the actual residual vector. If the slope is negative, it is determined to be a real water shortage, and the microcontroller triggers an irrigation command.
[0026] If the waveform similarity coefficient is lower than the preset overlap threshold and the linear regression slope of the actual residual vector is non-negative, it is judged as an atypical anomaly, the current state is maintained and the anomaly log is recorded.
[0027] Preferably, it also includes leak diagnosis and model correction mechanisms:
[0028] When the determination result is a real water shortage, calculate the descent slope of the actual residual vector;
[0029] If the absolute value of the downward slope exceeds the preset theoretical maximum transpiration-permeability sum after time-scale normalization, that is, the sum of theoretical crop transpiration and soil basic permeability parameter, it is judged as physical leakage of the field ridge.
[0030] The microcontroller generates a leakage alarm signal and corrects the soil base permeability parameters in the ideal water layer decay model based on the descent slope.
[0031] Preferably, the triggering logic for sensor maintenance commands includes:
[0032] When the current water level fluctuation is determined to be an environmental disturbance, the sedimentation drift factor and wind and wave disturbance factor used when generating the simulation disturbance curve are obtained.
[0033] Calculate the proportion of the magnitude of the siltation drift factor in the total magnitude of the theoretical residual vector;
[0034] If the percentage is higher than the preset drift threshold, it is determined that the sensor has a risk of accumulation and obstruction.
[0035] The microcontroller triggers the automatic cleaning device or sends a manual maintenance request.
[0036] Preferably, the microcontroller adopts a feedforward model verification architecture:
[0037] The microcontroller is configured to ignore direct threshold triggering signals that ignore real-time water level timing data;
[0038] The microcontroller only responds to the control commands output by the correlation decision unit after verification by the dual-track residual, in order to achieve anti-vibration control of the physical pump valve.
[0039] Compared with the prior art, the present invention has the following beneficial effects:
[0040] 1. This invention constructs a dual-track differential extraction mechanism that includes hydrodynamic benchmark reconstruction and interference simulation injection. It calculates the actual residual between real-time water level time series data and ideal water level curve, as well as the theoretical residual between simulated interference curve and ideal water level curve, and performs cross-correlation analysis. This enables precise decoupling of the topological features of water level signals in complex paddy field environments, thereby effectively distinguishing between real water shortage signals and environmental noise artifacts caused by wind, waves, or siltation. This solves the core pain point of traditional threshold-triggered irrigation systems being unable to distinguish between real and false fluctuations, leading to malfunctions.
[0041] 2. This invention constructs an ideal water layer decay model that reflects water level changes under undisturbed conditions by analyzing the light, temperature, and wind speed parameters in environmental meteorological data and combining them with the Penmanmont formula and soil basic permeability parameters. It can generate an ideal water level curve that only includes crop physiological consumption and natural soil infiltration based on the first principles of physics, thereby providing the system with an objective reference system independent of direct sensor readings. This ensures that irrigation decisions conform to the agronomic water requirements of rice growth and significantly reduces ineffective irrigation under non-water-required conditions.
[0042] 3. This invention generates wind and wave interference factors and sedimentation drift factors by calling a preset interference mode generator, and superimposes the above factors onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms. This allows the microcontroller to deduce the water level pattern caused by pure noise under the current meteorological conditions, and then determine whether the sensor is at risk of obstruction by comparing the proportion of sedimentation drift factor in the theoretical residual. This achieves preventive maintenance diagnosis of the sensor's health status and avoids signal distortion and control failure caused by long-term sedimentation of the probe.
[0043] 4. This invention introduces a leakage diagnosis and model correction mechanism and a feedforward model verification architecture. When determining actual water shortage, it calculates the descent slope of the actual residual vector and compares it with the theoretical maximum evapotranspiration and infiltration. This enables timely detection of physical leakage on field ridges and adaptive correction of soil infiltration parameters. At the same time, it cuts off the direct triggering path of real-time data at the logic level and only responds to control commands verified by dual-track residuals. This completely eliminates the phenomenon of frequent start-stop oscillation of water pumps caused by water surface fluctuations. While ensuring the mechanical life of the irrigation system, it improves the safety and intelligence level of water resource management. Attached Figure Description
[0044] The present invention will be further explained below with reference to the accompanying drawings and embodiments:
[0045] Figure 1 This is a structural diagram of the system of the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0047] Example 1:
[0048] Please see Figure 1 A microcontroller-based precision irrigation system for paddy fields includes a microcontroller configured to perform the following operations: hydrodynamic baseline reconstruction: acquiring real-time water level time-series data and environmental meteorological data from the sensor end; loading crop growth coefficients based on a water balance physical model to construct an ideal water layer decay model reflecting water level changes under undisturbed conditions, and generating an ideal water level curve;
[0049] Interference simulation injection: Call the preset interference mode generator to generate wind and wave interference factor and sedimentation drift factor; superimpose the wind and wave interference factor and sedimentation drift factor onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms;
[0050] Dual-track differential extraction: Construct parallel calculation paths to calculate the difference between real-time water level time series data and ideal water level curve to obtain the actual residual vector, and calculate the difference between simulated interference curve and ideal water level curve to obtain the theoretical residual vector.
[0051] Correlation determination: Perform cross-correlation analysis between the actual residual vector and the theoretical residual vector; distinguish between real water shortage signals and environmental noise artifacts based on the cross-correlation analysis results, and execute irrigation commands or sensor maintenance commands by the microcontroller.
[0052] This embodiment details the core operating logic of the microcontroller-based precision irrigation system for paddy fields. The system introduces an Analysis by Synthesis mechanism, which aims to solve the core pain point of traditional threshold-triggered irrigation systems that cannot distinguish between real water shortage and environmental noise.
[0053] The system performs a hydrodynamic baseline reconstruction step. The microcontroller does not directly accept sensor readings, but instead acquires real-time water level data and environmental meteorological data including light, temperature, and wind speed from the sensor via the I / O interface. Based on this, the system constructs a shadow model based on first principles of physics, that is, based on the water balance physical model and loading the crop growth coefficient, constructing an ideal water layer decay model that reflects water level changes under undisturbed conditions, and generating an ideal water level curve. This curve represents the trajectory of water level decline caused only by crop physiological consumption and natural soil infiltration under ideal vacuum conditions. The system then performs an interference simulation injection step. The microcontroller calls a pre-set interference mode generator to generate wind and wave interference factors and sedimentation drift factors, and superimposes these two factors onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms. This step aims to allow the microcontroller to deduce the water level pattern under current meteorological conditions if only noise exists and there is no water shortage.
[0054] The system performs dual-track differential extraction, constructing two parallel computational paths to separate signal features. The first track calculates the difference between the real-time water level time series data and the ideal water level curve to obtain the actual residual vector, and the second track calculates the difference between the simulated interference curve and the ideal water level curve to obtain the theoretical residual vector. The microcontroller performs correlation judgment, performs cross-correlation analysis on the two residual vectors. If the two are highly correlated, it indicates that the actual fluctuation is caused by noise. If they are not correlated and the water level drops, it is determined to be a real water shortage. Thus, the microcontroller accurately executes irrigation commands or sensor maintenance commands.
[0055] This embodiment achieves topological decoupling of water level signals in complex paddy field environments by constructing a dual reference system of ideal benchmark and simulated noise. This scheme effectively filters out instantaneous fluctuations caused by wind and waves and false drift caused by sensor siltation, avoiding frequent false starts and stops of water pumps in non-water-scarce conditions. While ensuring the water needs of crops, it significantly reduces the mechanical wear and energy consumption of irrigation equipment.
[0056] Example 2:
[0057] An ideal water layer decay model reflecting water level changes under undisturbed conditions is constructed. The method for generating the ideal water level curve includes: analyzing the light, temperature, and wind speed parameters in environmental meteorological data, and calculating the theoretical crop transpiration using the Penman-Monteith formula; loading preset soil basic permeability parameters and rice growth stage coefficients; and performing time-domain integral decrease on the initial water level based on the theoretical crop transpiration, soil basic permeability parameters, and rice growth stage coefficients to generate the ideal water level curve.
[0058] This embodiment is a further concretization of the ideal water layer attenuation model constructed in Embodiment 1. The generation of the ideal water level curve follows a strict hydrophysical process. The microcontroller analyzes the solar radiation, ambient temperature, relative humidity (RH), and wind speed parameters from the environmental meteorological data. For the physical mapping of low-cost sensor data, the following conversion logic is defined: For solar radiation data, the microcontroller collects the illuminance value of the photodiode. The empirical conversion coefficient is used to convert it into shortwave radiation. The calculation formula is as follows:
[0059]
[0060] in, For Lux to Approximate conversion factor, The spectral correction factor is set to 0.95. This factor is chosen to account for the deviation between the peak spectral response of ordinary photodiodes and the full-spectrum solar radiation distribution. A reduction factor of 0.95 corrects for the oversensitivity of silicon photovoltaic cells in the infrared band, making the converted radiation value closer to agricultural meteorological standards. The approximate net radiation is calculated using a simplified radiation balance equation. Considering that the daytime longwave radiation loss accounts for a relatively small proportion during the peak growing season of rice, this embodiment adopts the following simplified formula, which is:
[0061]
[0062] in, The rice canopy albedo coefficient is set to 0.23 in this embodiment. This value is obtained based on the recommended range of 0.20 to 0.25 for paddy fields during flooding in the FAO-56 Crop Water Requirements Calculation Standard, and is calibrated by weighted average of the measured reflectance data of net radiation meters deployed in the field at noon. This value is set as a fixed constant for the entire monitoring period, representing the average level of canopy reflectance characteristics of rice from tillering to yellow ripening, ignoring the small fluctuations caused by changes in leaf area index, so as to reduce the computational load of the embedded system.
[0063] It should be noted that this formula intentionally ignores the net loss of long-wave radiation. This is based on the computational power trade-off of low-power embedded systems; during the peak rice growing season, shortwave radiation dominates during the daytime, and the calculation error for longwave radiation is typically less than 10%, as determined by the conservative model coefficients discussed later. Overall compensation is performed to maintain the logical requirement that the ideal water level drops slower than the actual water level while ensuring real-time calculation. To ensure the consistency of physical dimensions, the microcontroller performs unit standardization before substituting the radiation data into the Penman-Monteith formula. The calculation formula is as follows:
[0064]
[0065] Among them, 0.0864 is to The time integral transformation coefficient, i.e. A day has 86,400 seconds. Thus ensuring The dimensions of the quantities strictly match those of other parameters in the PM formula; for soil heat flux To meet the real-time computing requirements of the microcontroller, the system reads the extreme temperature values from the past 24 hours through a circular buffer. The calculation formula is as follows:
[0066]
[0067] in, The soil heat capacity coefficient is used in this embodiment to represent a typical saturated soil environment in paddy fields. Set as an empirical constant This empirical constant is not arbitrarily assigned, but obtained through in-situ thermophysical property testing: the specific procedure involves excavating a profile at a depth of 20cm in the target field, taking an undisturbed saturated soil sample, and measuring its volume. The volumetric heat capacity of an insulated container is determined by heating it with a constant-power heater. Combined with the effective thermal diffusion layer depth Approximately 0.15m, for integration. Finally, it is converted into the area-normalized daily heat capacity coefficient;
[0068] It should be noted that this empirical value This method is suitable for typical paddy field saturated clay loam environments. For sandy soils or other soil types with significant differences in organic matter content, it is recommended that users recalibrate on-site according to the above calorimetric method process.
[0069] To accurately quantify the physiological water requirement of crops, this embodiment introduces a standardized Penman-Monteith computational model suitable for embedded computing to calculate the transpiration rate of a reference crop. The specific calculation logic is as follows, to meet the requirement of explicitness in code-level implementation, and the calculation formula is:
[0070]
[0071] The MCU calculation methods for each parameter are as follows: The slope of the saturated water vapor pressure curve is calculated using the following formula:
[0072]
[0073] The formula for calculating saturated water vapor pressure is:
[0074]
[0075] The actual water vapor pressure is calculated using the following formula:
[0076]
[0077] Wet / dry constant: Calculated according to FAO-56 standard, the calculation formula is as follows:
[0078]
[0079] in, The local atmospheric pressure is given in kPa; to ensure the algorithm's universality across different altitudes, the microcontroller reads the preset deployment altitude parameters. m, expressed by the formula:
[0080]
[0081] Dynamically calculate the current air pressure to obtain accurate readings. The value, instead of a fixed value applicable only to sea level;
[0082] During this process, the rice growth stage coefficient The method for obtaining the growth days is as follows: the microcontroller reads the system's real-time clock, calculates the difference between the current date and the set transplanting date to obtain the number of growth days, and then obtains the current growth stage-coefficient mapping by consulting a preset growth stage-coefficient mapping table and performing linear interpolation. value;
[0083] To establish clear parameter boundaries to support code reproduction, this embodiment fully discloses the data content of a pre-defined growth stage-coefficient mapping table. This table is defined in the microcontroller as a lookup array containing key growth nodes, with the specific configuration as follows:
[0084]
[0085] The data pairs are in the following format: The above nodes correspond sequentially to: transplanting date, late greening stage, peak tillering stage, jointing and booting stage, heading and flowering stage, i.e., peak water requirement, grain filling and ripening stage, and yellow ripening stage; the specific calculation logic executed by the microcontroller is: determine the current number of growth days. Does it exceed the maximum number of days covered by the mapping table? If so, then directly lock the coefficient value of the last node as the current Kg value; if Then, traverse the above nodes to determine the current number of growth days. The interval The linear interpolation algorithm is executed, and its calculation formula is as follows:
[0086]
[0087] This results in a continuous, smooth growth coefficient curve that conforms to agronomic principles;
[0088] The microcontroller performs crop water requirement correction calculations: This step ensures that the theoretical calculations include the specific physiological characteristics of rice.
[0089] The microcontroller loads preset soil foundation permeability parameters. Based on the above parameters, the initial water level is discretized and the time-domain integral decreases to generate an ideal water level curve. subscript Represents an ideal benchmark; specifically, to accommodate the wind and wave disturbance simulation in Example 3, analysis is required. To obtain the waveform, the system must employ a high-frequency sampling strategy that satisfies the Nyquist sampling theorem, rather than the traditional low-frequency recording; therefore, the time step and dimension definitions in the integral formula are modified as follows:
[0090]
[0091] in, The system's real-time sampling interrupt period, in seconds; the value is set to... ,Right now To ensure an effective reconstruction cycle of approximately The shortwave wave characteristics of seconds are used to avoid waveform distortion caused by frequency aliasing; This is the seconds / day conversion constant used to convert daily-scale calculations. and ( Precisely mapped to second-level control loops;
[0092] To set as The conservative model coefficients are empirical safety margins, and their values are based on the fitting of the lower envelope of natural evaporation data of water layers under historical conditions without water shortage. The aim is to ensure that under normal water consumption conditions, the rate of decline of the ideal water level is artificially slower than the rate of decline of the physical water level, thereby forming a physically significant negative residual drift in the subsequent residual calculation. This allows the system to clearly distinguish between normal water consumption and sensor failure by detecting negative slopes, which are usually manifested as zero slope or positive slope.
[0093] Example 3:
[0094] The method of superimposing the wind and wave interference factor and the sedimentation drift factor onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms includes: extracting real-time wind speed from environmental meteorological data, mapping it to the amplitude parameter of a sinusoidal wave function to generate the wind and wave interference factor; generating a sedimentation drift factor simulating the probe coverage effect based on the sensor running time using an exponential decay function; and linearly superimposing the wind and wave interference factor and the sedimentation drift factor onto the ideal water level curve to complete parameterized injection and generate the simulated interference curve.
[0095] This embodiment is a further refinement of the simulated interference curve generation in Embodiment 2. In order to simulate complex interference in the real environment, this embodiment synthesizes the simulated interference curve through parameterized injection. The system extracts the real-time wind speed from the environmental meteorological data, maps it to the amplitude parameter of the sinusoidal wave function, and generates the wind and wave interference factor. The calculation model is as follows:
[0096]
[0097] in, The real-time wind speed mentioned above; express The offset of wind and wave interference at any given moment; Derived from empirical calculations based on field geometric features, the formula is:
[0098]
[0099] in, The preset effective length of the field, i.e., the effective blowing distance, is specifically calculated as follows: taking the location where the sensor is installed as the center, calculate the weighted average of the straight-line distances from the sensor to the four boundaries of the field ridge. In regular rectangular fields, this can be simplified to the vertical distance from the geometric center of the field to the longer side.
[0100] This parameter is a fixed configuration value set based on the average distance from the geometric center to the edge of the field, and does not rely on real-time wind direction data. The empirical wave height coefficient ranges from 0.003 to 0.005. The specific value of this coefficient is determined through a synchronous observation fitting process: In a typical field, an anemometer is installed 2 meters above the water surface, and a high-frequency 10Hz capacitive wave height sensor is deployed underwater; wind speed-wave height data pairs are collected for 14 consecutive days, and periods with wind speeds greater than 2 m / s are selected. The least squares method is used to fit the wave height data. The formula is as follows:
[0101]
[0102] Regression analysis was performed to extract coefficients specific to the surface roughness of the paddy field. ; Derived from meteorological sensors, its physical meaning is real-time wind speed;
[0103] Derived from empirical statistical values, its physical meaning is wave frequency; here we clarify its relationship with the physical quantity wave period. The mathematical relationship is Considering that the water depth in paddy fields is usually in the range of 5-15cm, which is a shallow water environment, this embodiment... The value range is set to Based on the above formula, this frequency range precisely corresponds to the main wave cycle. The time is approximately 1.26 to 3.14 seconds, covering the range of approximately 1.2 to 3 seconds mentioned in the text. This parameter can be calibrated on-site according to the field scale.
[0104] Derived from a random number generator, its physical meaning is a fixed random phase offset within the calculation window, used to simulate the initial phase characteristics of waves; and stored as a global constant, which remains constant in all subsequent correlation analysis calculation windows to ensure that the generated simulation interference curve maintains phase continuity on the time axis and avoids pseudo high-frequency noise caused by phase abrupt changes at window switching points;
[0105] Meanwhile, based on the sensor's operating time since the last cleaning, the system uses an exponential decay function to generate a sedimentation drift factor that simulates the probe coverage effect. The calculation formula is as follows:
[0106]
[0107] in, Derived from the time decay model, its physical meaning is the amount of signal drift caused by accumulation;
[0108] Derived from the sensor datasheet, its physical meaning is the signal attenuation value corresponding to the maximum saturation deposition thickness;
[0109] Derived from the system timer, its physical meaning is the continuous running time of the sensor after self-cleaning; here, the system's global time variable is used directly. To maintain consistency with the time variables in the wind and wave disturbance model;
[0110] Derived from historical maintenance data, its physical meaning is the siltation rate constant;
[0111] Based on the common adhesion characteristics of algae and sediment, this embodiment sets This corresponds to a characteristic time constant of approximately 5 days. The rate constant was obtained through accelerated experimental fitting: muddy water with a turbidity of 500 NTU was prepared in a laboratory environment to simulate extremely turbid field water. The sensor was immersed in the mud and kept still, with readings recorded every 10 minutes for 72 hours. After normalizing the obtained reading decay curves, an exponential model was fitted using a nonlinear regression algorithm. This allows for the precise extraction of the rate constant, which is used to quantify the nonlinear, progressive signal decay process. It should be noted that this constant is positively correlated with the concentration and viscosity of suspended particulate matter in the water. For paddy fields with different soil types, such as clay or sand, users can input a new decay constant through the system settings interface or re-obtain the parameter through the aforementioned static calibration method.
[0112] The above factors are linearly superimposed onto the ideal water level curve to generate a simulated interference curve; this leads to higher readings. The model here uses additive superposition to maintain consistency in the physical logic, and the calculation formula is as follows:
[0113]
[0114] in, The synthesized simulated disturbance curve is derived from the ideal water level. superimposed wind and wave interference With siltation and drift constitute.
[0115] Example 4:
[0116] The methods for performing cross-correlation analysis between the actual residual vector and the theoretical residual vector include: aligning the actual residual vector and the theoretical residual vector with time windows; using a sliding window cross-correlation algorithm or a dynamic time warping algorithm to calculate the waveform similarity coefficient between the actual residual vector and the theoretical residual vector; and outputting the waveform similarity coefficient to the topological coupling decision unit.
[0117] This embodiment is a further specification of the cross-correlation analysis in Embodiment 3; before executing the decision, the microcontroller aligns the actual residual vector with the theoretical residual vector in a time window to ensure that the two are compared in the same time domain dimension; the system can choose a sliding window cross-correlation algorithm or a dynamic time warping algorithm according to computing resources and real-time requirements.
[0118] When using the sliding window cross-correlation algorithm, it is considered that the wind and wave interference factor generated in Example 3 contains random phase. Direct zero-delay alignment may lead to pseudo-uncorrelation, i.e., waveforms are similar but phase misaligned. Therefore, the microcontroller performs a maximum hysteresis cross-correlation search and introduces a numerically stable term to prevent division-by-zero errors. The formula for calculating the waveform similarity coefficient is as follows:
[0119]
[0120] The square root operation in the denominator is used to achieve energy normalization, ensuring... The value strictly falls within the interval [-1, 1] and is not affected by the physical dimensions of the measured data;
[0121] in, The waveform similarity coefficient, in physical terms, is the waveform similarity coefficient, and its value ranges from [-1, 1].
[0122] Derived from the preset configuration, its physical meaning is the number of sample points in the sliding window;
[0123] Derived from the algorithm specification, its physical meaning is the number of phase search lag steps; its search range The setting is based on the wind and wave cycle specified in the aforementioned embodiment 3. It is usually set to correspond to the wind and wave cycle. The time window covered by 1 / 2; in specific calculations, the system sampling time interval is taken into account. , and thus This ensures that the search range covers half a wave cycle;
[0124] Derived from numerical safety design, its physical meaning is to prevent the use of tiny constants with a denominator of zero, such as... This solves the problem when the theoretical model predicts no disturbances, i.e. The problem of system computational crashes when the line is straight and the variance is 0;
[0125] The first real residual vector One sampling point;
[0126] The theoretical residual vector of the th One sampling point;
[0127] Derived from statistical calculations, their physical meanings are the mean of the actual residual and the theoretical residual within the window, respectively;
[0128] When using the Dynamic Time Warping (DTW) algorithm, it is suitable for scenarios with phase nonlinear shifts. The microcontroller performs the following steps: Constructing a... Distance matrix ,in Euclidean distance is used; the cumulative distance matrix is calculated. The recursive formula is:
[0129]
[0130] Symbols are used here This indicates the cumulative distance, to distinguish it from the symbol used to represent the tidal constant in the aforementioned embodiments. The normalized distance of the optimal regularized path is obtained by using the following formula:
[0131]
[0132] The distance is converted into a similarity coefficient, and the calculation formula is as follows:
[0133]
[0134] at this time The closer the similarity coefficient is to 1, the more similar the waveforms are; the calculated waveform similarity coefficient is output to the topology coupling decision unit.
[0135] This embodiment utilizes a normalized cross-correlation algorithm, which can ignore the difference in absolute signal amplitude and focus on the similarity of waveform shape. This means that even if the size of the wind and waves deviates slightly from the prediction, as long as the frequency and phase characteristics of the fluctuation are consistent, the system can still accurately identify that it is wind and waves rather than water leakage, which significantly improves the adaptability of the identification algorithm in dynamic environments.
[0136] Example 5:
[0137] Based on the cross-correlation analysis results, the system distinguishes between genuine water shortage signals and environmental noise artifacts. The microcontroller is configured to execute irrigation commands or sensor maintenance commands as follows: If the waveform similarity coefficient is greater than or equal to a preset overlap threshold, the current water level fluctuation is determined to be environmental interference, and the microcontroller refuses to execute the irrigation action; if the waveform similarity coefficient is lower than the preset overlap threshold, the linear regression slope of the actual residual vector is calculated. If the slope is negative, it is determined to be genuine water shortage, and the microcontroller triggers the irrigation command; if the waveform similarity coefficient is lower than the preset overlap threshold, and the linear regression slope of the actual residual vector is non-negative, it is determined to be an atypical anomaly, the current state is maintained, and an anomaly log is recorded.
[0138] This embodiment further specifies the decision logic in Embodiment 4. The microcontroller is configured with three levels of decision logic to perform precise control; it performs environmental interference determination, i.e., suppression logic, in response to the waveform similarity coefficient being greater than or equal to a preset overlap threshold, which is set in this embodiment as follows: The current water level fluctuation is determined to be due to environmental disturbances, such as wind waves or silt drift. The threshold is not arbitrarily selected, but is determined based on the specific characteristics of the dataset and ROC curve analysis.
[0139] Those skilled in the art can determine this threshold for a specific paddy field environment through the following steps: Construct a calibration dataset: Collect raw water level sensor data in this environment, with a recommended duration of more than 72 hours. This dataset must clearly include three types of labeled events: still and windless, strong wind and wave interference, wind speed greater than 3 m / s, and artificially simulated water shortage, i.e., controlled drainage.
[0140] Running the model: Input the data into the residual generation module of this system to calculate the cross-correlation coefficients for all time windows. ;
[0141] Statistical analysis: Using manually labeled values as the true values, the thresholds range from 0.1 to 0.9. The true positive rate and false positive rate are calculated for each threshold, and ROC curves are plotted.
[0142] Threshold selection: Calculating the Youden index Select The maximum value corresponding to The value is used as the optimal threshold; in the test set of this embodiment, when At that time, the system achieved a 98.5% accuracy rate in identifying wind and wave interference, with a false negative rate of less than 1% for actual water shortages. Given the differences in wind field characteristics at different latitudes and terrains, it is recommended that local data be collected and thresholds adjusted according to the aforementioned ROC process during the initial system deployment. A second calibration is performed; at this time, the microcontroller refuses to execute irrigation actions to prevent frequent pump start-stop due to false signals.
[0143] The system executes a real water shortage determination, i.e., action logic. In response to a waveform similarity coefficient falling below a preset overlap threshold, indicating that the current fluctuation does not conform to a known noise pattern, the system further calculates the linear regression slope of the real residual vector. The microcontroller uses least squares OLS to regress the data within the most recent time window. The data within the specified time window is fitted, and the total number of sampling points within that time window is set to [value missing]. , The slope is derived from the window duration divided by the system sampling period. The calculation formula is as follows:
[0144]
[0145] In this step, to prevent the calculated original slope value from being too small (in mm / s) due to a high sampling frequency, such as the Hz level set in Example 2, and thus failing to match the conventional engineering judgment threshold (in mm / hour), the microcontroller performs time dimension standardization before constructing the regression matrix. By explicitly mapping the time axis to an hourly scale, the calculated slope is ensured. It has a clear physical meaning in mm / hour;
[0146] In response to the calculated slope It is a negative value, and its absolute value , For example, dead zone threshold The system is determined to be experiencing a genuine water shortage. The dead zone threshold is determined based on the system's background noise level and the minimum distinguishable physical water consumption. Specifically, the standard deviation of the reading fluctuation is calculated by placing the sensor in a sealed, non-evaporating water tank for 24 hours. ,Pick The equivalent water level change rate corresponding to the confidence interval is used as the lower limit of the dead zone, and an engineering margin of 0.1 mm / h is added to ensure that the system will not malfunction due to the thermal noise or quantization error of the sensor itself.
[0147] The physical basis for this determination lies in the conservatism coefficient introduced in Example 2. Since the ideal model is designed to underestimate water consumption, in the actual physical water consumption process, the actual water level will inevitably drop faster than the ideal water level, resulting in the actual residual vector exhibiting a definite negative slope characteristic. This characteristic constitutes the key logical closed loop that distinguishes between real water shortage and sensor drift, which is usually non-directional or positive drift.
[0148] Once the determination is successful, the microcontroller immediately triggers the irrigation command. Simultaneously, to prevent control oscillations caused by water flow disturbances, the system enters a buffering period. During the pump's operation and the set stabilization time after its shutdown, all residual calculations and decision-making processes are suspended. Once the water surface stabilizes, the current water level is re-anchored as the new level. Reset the integrator and start the next round of monitoring;
[0149] Perform atypical anomaly judgment: If the residual vector shows a continuous positive slope or disordered large fluctuations during the monitoring period, which violates the principle of unidirectional decrease in physical water consumption, the system will judge it as a non-water shortage anomaly; in this case, the microcontroller will block irrigation commands to prevent overflow and accumulate anomaly count; if the duration of the anomaly exceeds the preset threshold, the system will trigger a sensor fault alarm.
[0150] In addition, if the water level does not rise as expected after the filling shielding period following the issuance of the irrigation command, it will be determined that the water pump has failed or the pipeline has ruptured. The system will then be forcibly shut down and locked, awaiting manual reset.
[0151] Example 6:
[0152] It also includes a leak diagnosis and model correction mechanism: when the judgment result is a real water shortage, the descent slope of the actual residual vector is calculated; if the absolute value of the descent slope exceeds the preset theoretical maximum transpiration-permeability sum after time-scale normalization, that is, the sum of theoretical crop transpiration and soil basic permeability parameters, it is judged as a physical leak in the field ridge; the microcontroller generates a leak alarm signal and corrects the soil basic permeability parameters in the ideal water layer decay model according to the descent slope.
[0153] This embodiment is a further optimization of embodiment 5, adding a leak diagnosis and model correction mechanism; in response to the determination result being a true water shortage, the microcontroller calculates the descent slope of the actual residual vector. The system sets a theoretical maximum evapotranspiration and threshold; considering the previous embodiments... and The slope is a daily-scale parameter in mm / day. Real-time window calculations are typically performed on a time scale of mm / hour. To ensure dimensional consistency, the system performs time normalization, and the calculation formula is as follows:
[0154]
[0155] in, The preset leakage judgment tolerance margin is recommended to have a range of values within which... mm / hour, used to cover the sensor's own thermal noise and calculate the truncation error; in response to the detection of the absolute value of the descent slope. Greater than this threshold The system determines that there is a physical leak in the field ridge; at this time, the microcontroller generates a high-priority leak alarm signal and performs model adaptive correction.
[0156] To ensure system robustness, the specific parameter update logic employs the Exponentially Weighted Moving Average (EWMA) algorithm, and a saturation clamping mechanism is introduced to guarantee system safety. Similarly, to ensure that the correction amount matches the time scale of the basic parameters, the slope term undergoes a daily conversion, the calculation formula of which is:
[0157]
[0158]
[0159] in, Intermediate variables derived from EWMA calculations;
[0160] This is derived from a system-preset safety limit, such as three times the initial penetration rate; this limit ensures that even if the model attempts to adapt to leakage, the corrected... It will not completely absorb huge leakage slopes; this ensures that in the next calculation cycle, the residual slope will still trigger the over-limit judgment, so that the leakage alarm signal can be maintained until manual repair and manual system reset, effectively preventing the risk of fault signals being covered by adaptive algorithms. The learning rate parameter is derived from a preset value, ranging from 0.01 to 0.05.
[0161] This parameter determines how quickly the model forgets leakage errors; a smaller value means the model is more inclined to trust historical parameters and is more resistant to sudden disturbances; a larger value allows it to adapt to real changes in the physical environment more quickly; in this embodiment, 0.02 is selected as the default value to ensure the smooth evolution of model parameters on a daily scale and to avoid drastic fluctuations in model parameters due to noise from a single measurement.
[0162] Example 7:
[0163] The triggering logic for sensor maintenance commands includes: when the current water level fluctuation is determined to be due to environmental interference, the sedimentation drift factor and wind and wave interference factor used when generating the simulation interference curve are obtained; the proportion of the magnitude of the sedimentation drift factor in the total magnitude of the theoretical residual vector is calculated; if the proportion is higher than the preset drift threshold, it is determined that the sensor is at risk of sedimentation and obstruction; the microcontroller triggers the automatic cleaning device or sends a manual maintenance request.
[0164] This embodiment is a further specification of the sensor maintenance command triggering logic in Embodiment 5. In response to the determination that the current water level fluctuation is due to environmental interference, the system enters the preventative maintenance diagnostic process. The microcontroller acquires the siltation drift factor and wave interference factor used when generating the simulated interference curve. It calculates the proportion of the siltation drift factor's amplitude in the total amplitude of the theoretical residual vector. Given that the microcontroller processes discrete time series, the system transforms continuous integration into discrete summation within a sliding window to achieve code-level executability. The calculation formula is as follows:
[0165]
[0166] in, It originates from discrete summation calculations and its physical meaning is the dominant proportion of sedimentation. This is derived from the system configuration and corresponds to the total number of sampling points within the time window of Example 4. Derived from cached data, its physical meaning is the first [number]th ... Discrete values of the siltation drift factor generated at each sampling time; here, the mapping relationship between the discrete sequence and the continuous model of Example 3 is clearly established, and its calculation formula is as follows:
[0167]
[0168] in, For the first The system time at each sampling moment It is a continuous-time function;
[0169] Derived from cached data, its physical meaning is the first [number]th ... Discrete values of wind and wave interference factors generated at each sampling time; similarly, a mapping relationship is established, and its calculation formula is:
[0170]
[0171] in, This is a continuous-time function as defined in Example 3;
[0172] To ensure computational stability, before performing the division, the microcontroller checks whether the denominator, i.e., the sum of the total theoretical interference amplitudes, exceeds a preset minimum noise floor, such as a cumulative amount corresponding to 0.5 cm·s. To ensure that the physical dimensions of this floor threshold are consistent with the discrete sampled data, the system multiplies the cumulative amount in the denominator by the sampling time interval when calculating the cumulative amount. The unit is s, and its calculation formula is:
[0173]
[0174] If the value is less than this base, the system determines that the current environment is too calm and skips the sedimentation determination; in response to this proportion The drift threshold is set to 0.65 in this embodiment, which means that the accumulated components account for more than 65% of the total interference. This threshold is set as the inflection point of the economic efficiency of sensor cleaning and maintenance. The determination method is based on the energy consumption comparison experiment: when the additional power consumption caused by the signal distortion caused by the accumulation, which requires the algorithm to frequently perform high-frequency compensation calculations, is equal to the average power consumption of starting an automatic cleaning device or manual maintenance, the corresponding percentage value is the inflection point.
[0175] When the signal distortion energy caused by sedimentation exceeds this proportion of the total fluctuation, the computational cost of continuing to compensate through algorithms will be higher than the energy cost of performing a physical cleaning, and the confidence of signal recovery will decrease significantly; indicating that the current interference is mainly due to the sedimentation and obstruction of the sensor rather than wind and waves; at this time, the microcontroller determines that the sensor is at risk of failure and triggers the automatic cleaning device or sends a manual maintenance request through the wireless module.
[0176] Example 8:
[0177] The microcontroller adopts a feedforward model verification architecture: the microcontroller is configured to ignore the direct threshold trigger signal of real-time water level time series data; the microcontroller only responds to the control command output by the correlation decision unit after verification by dual-track residual, so as to achieve anti-oscillation control of physical pump valves.
[0178] The microcontroller employs a feedforward model verification architecture. Specifically, the microcontroller is configured to cut off the direct triggering path of real-time water level timing data to the physical actuator at the logic level. That is, regardless of whether the sensor reading is lower than the traditional low water level threshold, the microcontroller ignores the signal as long as it has not been confirmed by the correlation decision unit. The microcontroller only responds to the control commands output by the correlation decision unit after verification by the dual-track residual. This means that all control actions must be verified by the dual logic gates of the ideal model and the disturbance model.
[0179] This embodiment fundamentally changes the topology of the control system, transforming it from traditional feedback control to feedforward verification control. This architecture provides extremely high anti-vibration capability, solves the common problem of water pump malfunction caused by sensor fluctuations in paddy field irrigation, significantly extends motor life, and improves the overall stability of the system.
[0180] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A microcontroller-based precision irrigation system for paddy fields, characterized in that, Includes a microcontroller configured to perform the following operations: Hydrodynamic baseline reconstruction: real-time water level time series data and environmental meteorological data are collected from the sensor terminal; based on the water balance physical model, crop growth coefficient is loaded to construct an ideal water layer decay model that reflects water level changes under undisturbed conditions, and an ideal water level curve is generated; Interference simulation injection: Invoke the preset interference mode generator to generate wind and wave interference factors and siltation drift factors; The wind and wave interference factor and the siltation and drift factor are superimposed on the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms. Dual-track differential extraction: Construct parallel calculation paths to calculate the difference between real-time water level time series data and ideal water level curve to obtain the actual residual vector, and calculate the difference between simulated interference curve and ideal water level curve to obtain the theoretical residual vector. Correlation determination: Perform cross-correlation analysis between the actual residual vector and the theoretical residual vector; distinguish between real water shortage signals and environmental noise artifacts based on the cross-correlation analysis results, and execute irrigation commands or sensor maintenance commands by the microcontroller.
2. The microcontroller-based precision irrigation system for paddy fields according to claim 1, characterized in that, The methods for constructing an ideal aquifer attenuation model that reflects water level changes under undisturbed conditions and generating an ideal water level curve include: Analyze the light, temperature and wind speed parameters in environmental meteorological data, and calculate the theoretical crop transpiration rate using the Penman-Monteith formula; Load the preset soil basic permeability parameters and rice growth stage coefficients; Based on theoretical crop transpiration, basic soil permeability parameters, and rice growth stage coefficients, the initial water level is reduced by time-domain integral to generate an ideal water level curve.
3. The microcontroller-based precision irrigation system for paddy fields according to claim 2, characterized in that, The method of superimposing the wind and wave interference factor and the sedimentation and drift factor onto the ideal water level curve to synthesize a simulated interference curve containing theoretical abnormal waveforms includes: Real-time wind speed is extracted from environmental meteorological data and mapped to the amplitude parameter of a sinusoidal wave function to generate a wind and wave interference factor. Based on the sensor runtime, an accumulation drift factor simulating the probe coverage effect is generated using an exponential decay function. The wind and wave interference factor and the sedimentation and drift factor are linearly superimposed onto the ideal water level curve to complete the parameterized injection and generate the simulated interference curve.
4. The microcontroller-based precision irrigation system for paddy fields according to claim 3, characterized in that, The methods for performing cross-correlation analysis between the actual residual vector and the theoretical residual vector include: Align the actual residual vector with the theoretical residual vector using a time window; The waveform similarity coefficient between the actual residual vector and the theoretical residual vector is calculated using either the sliding window cross-correlation algorithm or the dynamic time warping algorithm. The waveform similarity coefficient is output to the topology coupling decision unit.
5. The microcontroller-based precision irrigation system for paddy fields according to claim 4, characterized in that, The method of distinguishing between real water shortage signals and environmental noise artifacts based on cross-correlation analysis results, and then having the microcontroller execute irrigation commands or sensor maintenance commands, is configured as follows: If the waveform similarity coefficient is greater than or equal to the preset overlap threshold, the current water level fluctuation is determined to be environmental interference, and the microcontroller refuses to execute the irrigation action. If the waveform similarity coefficient is lower than the preset overlap threshold, calculate the linear regression slope of the actual residual vector. If the slope is negative, it is determined to be a real water shortage, and the microcontroller triggers an irrigation command. If the waveform similarity coefficient is lower than the preset overlap threshold and the linear regression slope of the actual residual vector is non-negative, it is judged as an atypical anomaly, the current state is maintained and the anomaly log is recorded.
6. The microcontroller-based precision irrigation system for paddy fields according to claim 5, characterized in that, It also includes leak diagnosis and model correction mechanisms: When the determination result is a real water shortage, calculate the descent slope of the actual residual vector; If the absolute value of the downward slope exceeds the preset theoretical maximum transpiration-permeability sum after time-scale normalization, that is, the sum of theoretical crop transpiration and soil basic permeability parameter, it is judged as physical leakage of the field ridge. The microcontroller generates a leakage alarm signal and corrects the soil base permeability parameters in the ideal water layer decay model based on the descent slope.
7. The microcontroller-based precision irrigation system for paddy fields according to claim 5, characterized in that, The triggering logic for the sensor maintenance command includes: When the current water level fluctuation is determined to be an environmental disturbance, the sedimentation drift factor and wind and wave disturbance factor used when generating the simulation disturbance curve are obtained. Calculate the proportion of the magnitude of the siltation drift factor in the total magnitude of the theoretical residual vector; If the percentage is higher than the preset drift threshold, it is determined that the sensor has a risk of accumulation and obstruction. The microcontroller triggers the automatic cleaning device or sends a manual maintenance request.
8. The microcontroller-based precision irrigation system for paddy fields according to claim 1, characterized in that, The microcontroller employs a feedforward model verification architecture: The microcontroller is configured to ignore direct threshold triggering signals that ignore real-time water level timing data; The microcontroller only responds to the control commands output by the correlation decision unit after verification by the dual-track residual, so as to achieve anti-vibration control of the physical pump valve.