Soil solution nitrate nitrogen dynamic prediction method based on sensor data flow

By constructing a VAR model based on sensor data streams and combining it with multivariate time series data, the problem of insufficient ability to capture the rapid changes and fluctuation characteristics of the soil solution nitrate nitrogen prediction model was solved, and efficient and accurate prediction of soil solution nitrate nitrogen concentration was achieved, reducing monitoring costs and reducing environmental pollution risks.

CN120600144APending Publication Date: 2025-09-05INST OF AGRI ENVIRONMENT & RESOURCES YUNNAN ACAD OF AGRI SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510687975.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-05

Smart Images

  • Figure CN120600144A_ABST
    Figure CN120600144A_ABST
Patent Text Reader

Abstract

The invention discloses a soil solution nitrate nitrogen dynamic prediction method based on sensor data flow, and belongs to the field of soil nitrate nitrogen prediction.The method comprises the following steps that samples are collected to construct original data, and the original data are processed to obtain processed data; and constructing a soil solution nitrate nitrogen prediction model based on the multivariable time sequence data, and inputting the processed data into the soil solution nitrate nitrogen prediction model to realize dynamic monitoring and prediction of the nitrate nitrogen concentration of the soil solution. According to the method, the sensor data flow is combined with the machine learning model, and an important breakthrough is made in the field of time sequence prediction. The combination not only reduces the cost of long-term positioning monitoring, but also improves the efficiency of data acquisition, so that the data excavation potential of agricultural basic long-term work is further exerted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of soil nitrate nitrogen prediction, and in particular relates to a soil solution nitrate nitrogen dynamic prediction method based on sensor data stream. Background Art

[0002] In agricultural production, the pursuit of high yields necessitates the use of large amounts of nitrogen fertilizers, leading to frequent nutrient overload and nitrogen loss, which in turn triggers soil degradation and non-point source pollution. Nitrate nitrogen in soil solution is the primary source of nitrogen uptake by crops and groundwater nitrogen pollution. Its dynamic changes are directly linked to nitrogen utilization efficiency in farmland and the risk of non-point source pollution in plateau lakes. Accurately monitoring the dynamics of nitrate nitrogen in soil solution is crucial for dynamic precision fertilization and early warning of non-point source pollution risks.

[0003] However, the current monitoring of soil solution nitrate nitrogen levels mainly relies on traditional soil sample collection and indoor testing methods, which is not only costly but also time-sensitive. After collecting soil in the field, it needs to be sent back to the laboratory and homogenized, then extracted with a strong salt solution (KCl solution) and the soil solution nitrate nitrogen concentration is measured on a continuous flow analyzer. Since the current soil solution nitrate nitrogen standard is calculated on an air-dried basis, it is also necessary to determine the moisture content of the soil by drying it in an oven to a constant mass and then perform numerical conversion again. The whole process is time-consuming and laborious. In addition, delays can cause detection errors. During the process of collecting and sending it to the laboratory for storage, the soil solution nitrate nitrogen will still be affected by soil nitrogen mineralization. The laboratory analysis results are very different from the actual soil levels, and this situation is even more serious for soils in different seasons and at different depths.

[0004] In recent years, with the development of sensor technology, research on soil solution nitrate nitrogen sensors has begun to attract widespread attention. Their application principles mainly include potentiometry, amperometry, and spectroscopy. However, these sensors have certain limitations in terms of sensitivity, production cost, convenience, and service life. For example, while the amperometry method has certain advantages in terms of detection limit, detection cost, and operational ease, its service life and stability of the response potential still need to be further improved. While the spectroscopy method has high detection efficiency, the instrumentation is expensive and bulky, and the test results are easily affected by environmental factors such as soil texture, composition, and moisture content.

[0005] With the rapid development of the internet and information technology, digital agriculture has emerged as an emerging scientific field. Leveraging big data to improve agricultural productivity and the agricultural environment has become a key development direction for modern smart agriculture. Leveraging the comprehensive implementation of long-term agricultural infrastructure, the widespread deployment of temperature, humidity, and salt sensors has laid a solid foundation for acquiring data for in-situ online monitoring indicators. The continued maturity of data mining technology has provided new opportunities for predicting soil solution nitrate nitrogen. Soil solution nitrate nitrogen itself has the characteristics of easily accessible influencing factors, high spatial mobility, large dynamic variability, and high predictive application value, making soil solution nitrate nitrogen prediction promising.

[0006] However, existing soil solution nitrate prediction models are mostly based on empirical summaries of small amounts of data and are insufficient to accurately predict soil solution nitrate levels. These models are limited in their ability to handle the interplay of multiple variables and are unable to effectively capture the rapid changes and fluctuations in soil solution nitrate concentrations. Therefore, leveraging existing sensor data streams and machine learning techniques to construct efficient and accurate soil solution nitrate prediction models, enabling dynamic monitoring and precise management of soil nitrogen status, remains a pressing technical challenge. Summary of the Invention

[0007] In order to solve the above technical problems, the present invention proposes a method for dynamic prediction of nitrate nitrogen in soil solution based on sensor data stream to solve the problems existing in the above-mentioned prior art.

[0008] To achieve the above objectives, the present invention provides a method for dynamically predicting nitrate nitrogen in soil solution based on sensor data streams, comprising:

[0009] Collecting samples to construct raw data, and performing data processing on the raw data to obtain processed data;

[0010] A soil solution nitrate nitrogen prediction model is constructed based on multivariate time series data, and the processed data is input into the soil solution nitrate nitrogen prediction model to realize dynamic monitoring and prediction of the soil solution nitrate nitrogen concentration.

[0011] Optionally, the process of obtaining the processed data includes:

[0012] The test area is divided into several test plots, and in-situ sensors are installed in each test plot;

[0013] Collect soil solution samples using a suction-pressure soil solution sampler according to a preset schedule;

[0014] Determining the content of the soil solution sample to obtain nitrate nitrogen and soil indicators in the soil solution, and recording soil environmental data when the soil solution sample is collected based on the in-situ sensor;

[0015] The nitrate nitrogen solution, soil indicators and soil environmental data corresponding to the soil solution sample are processed to obtain processed data.

[0016] Optionally, the soil environment data includes: time, temperature, moisture, and electrical conductivity;

[0017] The soil indicators include: soil organic matter, total nitrogen, and alkaline nitrogen.

[0018] Optionally, the in-situ sensor includes a soil temperature and humidity sensor and a conductivity sensor;

[0019] The in-situ sensor is deployed at a soil depth of 20 cm.

[0020] Optionally, the process of processing the nitrate nitrogen solution and soil environment data corresponding to the soil solution sample includes:

[0021] constructing original data based on the nitrate nitrogen solution and soil environmental data corresponding to the soil solution sample;

[0022] Preprocessing the original data to obtain preprocessed data;

[0023] Creating a time series object based on the preprocessed data with soil solution nitrate nitrogen as the target variable;

[0024] Converting the time series object into a day series by linear interpolation, and filling the day series to obtain a filled day series;

[0025] The filled day series is converted into an equally spaced time series according to weekly interpolation, and processed data is obtained based on the equally spaced time series.

[0026] Optionally, the process of constructing a soil solution nitrate nitrogen prediction model includes: constructing a VAR model based on the equally spaced time series; wherein the expression of the VAR model is:

[0027]

[0028] Where Y t is a vector containing nitrate nitrogen concentration, soil environmental data, and soil indicators, A k is the coefficient matrix of lag k, ε t is the error term, and p is the lag order.

[0029] Optionally, the method further comprises evaluating the soil solution nitrate nitrogen prediction model based on an evaluation index;

[0030] The evaluation indicators include: mean absolute error, root mean square error, determination coefficient, and Ljung-Box_P test.

[0031] Compared with the prior art, the present invention has the following advantages and technical effects:

[0032] The present invention achieves efficient and accurate prediction of soil solution nitrate nitrogen concentration by combining sensor data streams and machine learning technology. Compared with traditional monitoring methods, this technology does not rely on time-consuming and labor-intensive laboratory testing. It uses real-time collected soil temperature, moisture, electrical conductivity and other data, combined with machine learning models, to quickly and dynamically predict changes in nitrate nitrogen concentration. Under different fertilization treatments, the model shows good adaptability, especially in capturing rapid changes and fluctuations in concentration, significantly improving prediction accuracy. In addition, this technology reduces monitoring costs and reduces the risk of environmental pollution caused by improper fertilization, providing strong support for precision agriculture and environmental protection, and has significant economic and environmental benefits. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:

[0034] Figure 1 This is the temporal variation characteristics of nitrate nitrogen in the 20cm soil solution of the embodiment of the present invention;

[0035] Figure 2 This is the temporal variation trend of nitrate nitrogen in the 20cm soil solution according to the embodiment of the present invention;

[0036] Figure 3 This is the time variation characteristic of the moisture content at 20 cm according to the embodiment of the present invention;

[0037] Figure 4 The temperature-time variation characteristics at 20 cm in the embodiment of the present invention are shown;

[0038] Figure 5 This is the time variation characteristic of 20cmEc in the embodiment of the present invention;

[0039] Figure 6 For example, the present invention predicts the correlation analysis of factors;

[0040] Figure 7 The results show the prediction effect of the ARIMA model and the VAR model on the nitrate nitrogen concentration in the soil solution under different treatment conditions in the embodiment of the present invention.

[0041] Figure 8 This is a technical roadmap for an embodiment of the present invention. DETAILED DESCRIPTION

[0042] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0043] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0044] Example 1

[0045] The present invention aims to provide a method for dynamically predicting soil nitrate nitrogen based on a VAR model and multi-sensor data streams. This method fully considers the interactions between multiple factors in the soil environment, improving the accuracy and timeliness of soil nitrate nitrogen dynamics predictions. The superiority of the present method is further demonstrated by comparison with the traditional ARIMA model.

[0046] like Figure 8 As shown, this embodiment provides a method for dynamically predicting nitrate nitrogen in soil solution based on sensor data stream, comprising the following steps:

[0047] The location test of this embodiment is located in a subtropical plateau monsoon climate region with an average annual temperature of 15°C, an average annual sunshine of 2200 hours, and an annual precipitation of 1035 mm. The test soil is typical mountain red soil farmland.

[0048] Experimental Design: This experiment adopted a completely randomized block design with a rice-broad bean rotation cropping system. Rice seedlings were transplanted in April and harvested in October, while broad beans were transplanted in October and harvested in April of the following year.

[0049] This example includes five different fertilization treatments: ① No fertilization (CK), ② 100% chemical nitrogen (CF), ③ 20% organic nitrogen + 80% chemical nitrogen (OF1), ④ 60% organic nitrogen + 40% chemical nitrogen (OF2), and ⑤ 100% organic nitrogen (OF3). Each treatment was replicated three times, with a total of 15 plots (each 45 m2). Each plot was separated by cement stalks 30 cm wide and 30 cm high. The total nitrogen application rate was the same, but the organic nitrogen sources were different. During the rice season (N: 150 kg / ha, P2O 5: 300 kg / ha, K2O: 150 kg / ha) and broad bean season (N: 75 kg / ha, P2O 5: 150 kg / ha, K2O: 112.5 kg / ha), and the total application rates of nitrogen, phosphorus, and potassium were the same for all treatments.

[0050] The five different fertilization treatment monitoring areas were modeled and evaluated using the same experimental process to obtain the predicted results of soil solution nitrate nitrogen in different treatment areas. The specific implementation process includes:

[0051] Data collection and sample collection: In-situ sensors are deployed in the monitoring area to collect real-time soil environmental data, including time, temperature, moisture, and electrical conductivity (Ec). At the same time, a suction-pressure soil solution sampler is used to collect soil solution and measure nitrate nitrogen and soil indicators, including soil organic matter (SOM), total nitrogen (TN), and alkaline nitrogen (AN).

[0052] The in-situ sensors are soil temperature and humidity sensors and electrical conductivity sensors, which are deployed at a soil depth of 20 cm and are used to collect real-time time series data of soil temperature, moisture, and Ec.

[0053] In this example, a total of 1085 samples were collected, the predicted dependent variable was soil solution nitrate nitrogen, and the prediction factors included time, temperature, moisture, Ec, SOM, TN, and AN.

[0054] Sampling time: 2022 (once a month from January to March, twice a month from April to December), 2023 (once a week in January, March 9, and once a week from May to December), 2024 (once a week from January to March, and May to August).

[0055] A suction-pressure soil solution sampler was used for collection. The sampler was placed in one layer per plot at a distance of 20 cm. 100 mL was collected from each layer per plot each time.

[0056] Determination Method: Nitrate nitrogen in soil solution. Water samples were uniformly filtered through a 0.45 μm water filter and stored for analysis. Soil solution nitrate nitrogen was determined using a continuous flow analyzer. Soil total nitrogen was determined using a carbon and nitrogen analyzer, and SOM was calculated based on TOC values. AN was determined using the alkaline hydrolysis method. Soil temperature, moisture, and Ec were collected using in-situ sensors.

[0057] Model evaluation indicators (MAE, RMSE, R 2 、Ljung-Box_P) calculation method:

[0058] a. MAE (mean absolute error) is used to measure the average absolute error between the predicted value and the actual value, reflecting the average error between the predicted value and the true value. The calculation formula is:

[0059]

[0060] Where n is the number of samples, y i is the actual observed value, is the predicted value.

[0061] b. RMSE (root mean square error) is used to measure the standard deviation between the predicted value and the actual value, reflecting the degree of dispersion between the predicted value and the true value. The calculation formula is:

[0062]

[0063] Where n is the number of samples, y i is the actual observed value, is the predicted value.

[0064] cR 2 The coefficient of determination indicates how well the model fits the data, and its value ranges from 0 to 1. The closer the value is to 1, the better the model fit is. The calculation formula is:

[0065]

[0066] Among them, y i is the actual observed value, is the predicted value, is the mean of the observations.

[0067] d. Ljung-Box_P test is used to test whether the residuals of the time series have autocorrelation to determine the applicability of the model. The test statistic calculation formula is:

[0068]

[0069] P=1-chi2.cdf(Q,h)

[0070] Where n is the sample size, h is the lag order, is the sample autocorrelation coefficient for lag k. At a given significance level, if Q is greater than the chi-squared distribution critical value, the null hypothesis of no autocorrelation in the residuals is rejected. The P-value reflects the probability of observing the current Q-statistic or a more extreme value if the null hypothesis (no autocorrelation in the residuals) is true. If the P-value is less than the given significance level (e.g., 0.05), the null hypothesis is rejected and the residuals are considered to have autocorrelated.

[0071] Data processing and analysis: The experimental data was initially organized in Excel. Based on R language packages such as xts, tseries, vars, dplyr, forcats, metrics, and caret, two time series prediction models, ARIMA and VAR, were used to construct the model. The construction steps are as follows:

[0072] (1) Data preprocessing. Before data analysis, the raw data must be preprocessed to obtain preprocessed data. This includes data cleaning, removing outliers, processing missing values, etc. Data cleaning ensures the quality and integrity of the data, laying the foundation for subsequent analysis.

[0073] (2) Create a time series object (using soil solution nitrate nitrogen as the target variable). Using soil solution nitrate nitrogen as the target variable, create a time series object using the relevant package. This step arranges the data in chronological order, forming a sequence with time attributes, preparing for subsequent time series analysis.

[0074] (3) Processing irregular time series: Use linear interpolation to convert time series objects into daily series. Actual collected time series data is often irregular, with inconsistent time intervals. To make the data more suitable for time series analysis, linear interpolation is used to convert it into daily series. Linear interpolation can fill in the time axis based on existing data points, making the data more continuous in time.

[0075] (4) Linear interpolation to fill missing values. Even after converting the data into a daily series, some missing values ​​still exist. These missing values ​​are further filled using linear interpolation to obtain a filled daily series, ensuring data integrity and ensuring that each time point has a corresponding soil solution nitrate nitrogen value.

[0076] (5) Convert to an evenly spaced time series (evenly spaced after weekly interpolation). To meet the requirements of some time series models for evenly spaced data, the padded daily series is interpolated weekly to convert it into an evenly spaced time series. This makes the time intervals of the data even, which is more consistent with the model's assumptions.

[0077] Linear interpolation and weekly interpolation are used to make the time series data interval uniform to 7 days.

[0078] (6) VAR model construction and prediction: Based on the equally spaced time series, a vector autoregression model (VAR) is constructed, the model lag order is determined and trained to achieve dynamic prediction of soil nitrate nitrogen concentration.

[0079] The expression of the VAR model is:

[0080]

[0081] in, is a vector containing nitrate nitrogen concentration, soil environmental data, and soil indicators, A k is the coefficient matrix of lag k, ε t is the error term, and p is the lag order.

[0082] In order to perform comparative analysis, this embodiment also constructs an ARIMA model to compare the prediction results of the ARIMA model with those of the VAR model.

[0083] (7) Divide the training set into a test set (the last 10 weeks are used as the test set). Divide the processed equally spaced time series data into a training set and a test set. Typically, the last 10 weeks of data are used as the test set, and the remaining data are used as the training set. The training set is used for model training and parameter estimation, and the test set is used to evaluate the model's predictive performance.

[0084] (8) Training the model (explicitly specifying seasonality). When training the model, explicitly specify seasonality. This is because time series data often have seasonal characteristics, and considering seasonal factors can improve the prediction accuracy of the model. For the ARIMA model, it is necessary to determine the model order (p, d, q) and seasonal order (P, D, Q); an autoregressive integrated moving average model (ARIMA) is constructed as a comparison model. The ARIMA model is constructed only based on the univariate time series of soil solution nitrate nitrogen to capture the time trend and seasonal fluctuations of a single variable. For the VAR model, parameters such as the lag order need to be determined.

[0085] (9) Model prediction. Use the trained ARIMA and VAR models to predict the test set. After obtaining the predicted values, you can plot a comparison chart between the actual values ​​and the predicted values ​​to visually observe the model's prediction effect.

[0086] Model evaluation. To quantify the model's predictive performance, appropriate evaluation metrics, such as mean squared error (MSE) and mean absolute error (MAE), are used to evaluate the model. By comparing the evaluation metrics of different models, we can determine which model performs better on the current dataset, thus providing a basis for final model selection.

[0087] The prediction accuracy of the VAR model is significantly better than that of the ARIMA model. Specifically, under the same fertilization treatment, the determination coefficient (R 2 ) is improved by more than 20% compared with the ARIMA model, and the mean absolute error (MAE) is reduced by more than 10%.

[0088] Analysis of the temporal dynamic changes of soil solution nitrate nitrogen and its prediction factors:

[0089] (1) Temporal dynamic changes of nitrate nitrogen in soil solution. Figure 1As shown, soil solution nitrate nitrogen values ​​generally fluctuated between 0 mg / L and 8 mg / L. The fluctuation characteristics of soil solution nitrate nitrogen were quite dramatic, exhibiting distinct peaks and valleys. From January 2022 to January 2023, soil solution nitrate nitrogen experienced multiple distinct peaks and valleys. For example, around May 2022, there was a high peak value near 8 mg / L, which then rapidly declined, reaching a low valley value near 0 mg / L around October 2022. From January to July 2023, the fluctuation range of soil solution nitrate nitrogen decreased relatively, but still showed frequent fluctuations, with values ​​fluctuating between 0 mg / L and 4 mg / L. From July 2023 to January 2024, the fluctuation range of soil solution nitrate nitrogen increased again, with multiple distinct peaks and valleys. For example, around November 2023, there was a high peak value near 8 mg / L, which then declined rapidly.

[0090] ①Seasonal fluctuation trend of soil solution nitrate nitrogen: Figure 2 As shown, the seasonal fluctuation range of nitrate nitrogen in soil solution is between -1.2 mg / L and 3 mg / L, showing a certain periodic pattern, alternating between positive and negative, with a cycle of about one year. The fluctuation amplitude increases in certain time periods, indicating that seasonal factors have a more significant impact on the data, and the data has a seasonal fluctuation pattern. Starting from mid-2022, the value gradually climbed from -1.2 mg / L to around 1.8 mg / L, and remained at a high level in the subsequent time period. Then in mid-2024, the value fell rapidly from about 1.8 mg / L to about -1.2 mg / L. ② The overall change trend of nitrate nitrogen in soil solution: As shown in the figure below: Figure 2 As shown, the overall change of nitrate nitrogen in soil solution shows a slow downward fluctuation trend. The change is relatively stable without drastic fluctuations. There is a certain long-term trend, but the trend change is relatively slow and stable. Although the value has gradually increased slightly from mid-2022 to around 1.5 mg / L in mid-2023 and remained at this high level thereafter, it then dropped rapidly from around 1.5 mg / L to 0 mg / L in mid-2024, and overall it still shows a downward trend. ③ Fluctuation residuals of nitrate nitrogen in soil solution: As shown in Figure 2 As shown, the residual fluctuation of soil solution nitrate nitrogen ranged from -4 mg / L to 4 mg / L. With the exception of the early and mid-2022 periods and the late 2023 and 2024 periods, the values ​​fluctuated between -2 mg / L and 2 mg / L. While the fluctuation range increased during these four periods, the overall fluctuation remained relatively limited. The fluctuation range was relatively small and stable. After eliminating seasonal and trend factors, the remaining fluctuations were relatively small and largely exhibited random fluctuation characteristics.

[0091] (2) Temporal dynamic changes of moisture: Figure 3 As shown, soil moisture content generally fluctuates between 0% and 100%. From July 2022 to January 2023, moisture values ​​fluctuate roughly between 40% and 100%. From January 2023 to January 2024, the range widens to between 20% and 100%. From January 2024 to July 2024, the range widens again, to between 10% and 100%.

[0092] Moisture content fluctuates relatively gently, though with some notable variations. From July 2022 to January 2023, moisture content fluctuated slightly between 40% and 60%, with relatively regular patterns. From January 2023 to January 2024, the fluctuations increased significantly, with values ​​beginning to decline from around 60%, reaching a low of around 20%, before gradually rising to around 100%. From January 2024 to July 2024, moisture content fluctuated between 10% and 100%, showing an overall trend of first decreasing and then increasing.

[0093] (3) Temporal dynamic changes of temperature: Figure 4 As shown, soil water temperature generally fluctuates between 10°C and 30°C. Overall, temperature fluctuations exhibit a seasonal pattern, with distinct peaks and troughs, with the peak occurring around July and the trough around January. On an annual basis, temperatures are higher in summer and lower in winter, closely related to the natural cycle of seasons. From January of the beginning of the year to January of the following year, temperatures rise first and then fall.

[0094] (4) Time dynamic changes of sensor Ec: Figure 5 As shown, the soil sensor Ec values ​​generally fluctuated between 0ms and 1ms. From July 2022 to January 2023, Ec values ​​fluctuated roughly between 0.25ms and 0.75ms. From January 2023 to July 2024, the fluctuation range widened to 0ms-1ms. From July 2022 to January 2023, Ec values ​​fluctuated between 0.25ms and 0.75ms, with some small peaks and valleys. For example, around October 2022, there was a small peak close to 0.5ms. From January 2023 to July 2024, Ec's fluctuations widened, fluctuating between 0ms and 1ms. The overall frequency of fluctuations accelerated, with multiple distinct peaks and valleys.

[0095] Correlation analysis of prediction factors: Correlation analysis was conducted on the prediction factors affecting soil solution nitrate nitrogen. The results of the correlation analysis are as follows: Figure 6As shown. Analysis of soil water solution data revealed no significant correlation between changes in soil solution nitrate nitrogen and changes in Ec, with a correlation coefficient of 0, indicating no significant correlation between the two. However, when soil water solution temperature increased, soil solution nitrate nitrogen showed a slight downward trend, with a weak negative correlation of -0.13 between the two. This is because increasing temperature affects the decomposition and conversion rate of soil solution nitrate nitrogen. At higher temperatures, soil solution nitrate nitrogen is more easily decomposed by microorganisms or converted into other forms of nitrogen compounds, resulting in a decrease in its concentration. Simultaneously, soil solution nitrate nitrogen content showed a weak negative correlation with moisture content, with a correlation coefficient of -0.23. When moisture content increased, soil solution nitrate nitrogen concentration showed a slight downward trend. This is related to the decrease in soil solution nitrate nitrogen concentration caused by increased irrigation or rainfall. Excess moisture promotes leaching or dilution of soil solution nitrate nitrogen, thereby reducing its concentration.

[0096] On the other hand, the correlation coefficient between soil sensor Ec and temperature is 0.47, indicating a moderate positive correlation between the two. Furthermore, Ec values ​​also tend to increase with increasing temperature, which is a significant relationship. Temperature changes affect the solubility and migration rate of other ions in the soil, thereby affecting electrical conductivity. Furthermore, the correlation coefficient between soil water solution temperature and moisture content is 0.73, indicating a strong positive correlation between the two. As moisture content increases, temperature tends to rise. This relationship is particularly pronounced in natural environments, as temperature and moisture are often influenced by similar seasonal factors. For example, during the rainy season, both temperature and moisture increase simultaneously.

[0097] Model prediction and evaluation:

[0098] Comparison of the effects of ARIMA model and VAR model Figure 7 As shown in the figure, ARIMA and VAR models predict soil solution nitrate nitrogen concentration differently under different treatment conditions. In the ARIMA model, the predicted values ​​(red line) and the actual values ​​(blue line) are generally consistent in terms of temporal trends, but there are deviations in some peaks and fluctuation details. In contrast, the VAR model shows a better fit between the predicted and actual values ​​in some cases, especially when multiple variables interact. The VAR model can capture more dynamic relationships between variables, thereby improving prediction accuracy.

[0099] Specifically, (1) for the samples treated with CK, after being predicted by the ARIMA model, the overall trend of the predicted values ​​and the actual values ​​was relatively consistent, but the prediction accuracy was poor in certain periods when the concentration of nitrate nitrogen in the soil solution changed rapidly. Relatively speaking, the predicted values ​​of the VAR model under the CK treatment were more consistent with the actual values, especially in capturing the rapid changes and fluctuations in the concentration of nitrate nitrogen in the soil solution. Its MAE of 0.4363 was smaller than that of the ARIMA model, and the prediction effect was better; R 2 0.3607 is also higher than the ARIMA model, indicating that it has a stronger ability to explain the nitrate nitrogen concentration in soil solution.

[0100] (2) The overall trend of the samples treated with CF was consistent with the actual value under the ARIMA model prediction, but there was a lag or deviation in the prediction of the peak and fluctuation details of the soil solution nitrate nitrogen concentration. The MAE of the ARIMA model was 2.5209, which was large, and the prediction effect was not ideal; the RMSE of 3.2513 also showed that the square error between the predicted value and the actual value was large; R 2 The value of 0.3618 indicates that the model has a moderate ability to explain the concentration of nitrate nitrogen in soil solution, and there is room for improvement. The Ljung-Box_P value of 0.0222 is less than 0.05, indicating that the residuals have autocorrelation and need to be optimized. In contrast, the predicted values ​​of the VAR model under the CF treatment are in good agreement with the actual values, especially in capturing the rapid changes and fluctuations in the concentration of nitrate nitrogen in soil solution. Its MAE of 2.2439 is smaller than that of the ARIMA model, and its RMSE of 2.7324 is also smaller than that of the ARIMA model. 2 0.3716 is higher than that of the ARIMA model, indicating that the VAR model has a stronger ability to explain the soil solution nitrate nitrogen concentration and capture rapid changes under the CF treatment.

[0101] (3) For samples treated with OF1, the predicted values ​​of the ARIMA model are relatively consistent with the actual values ​​in terms of overall trend, but the prediction of the rapid change of nitrate nitrogen concentration in soil solution in certain periods is not accurate enough. Specifically, the MAE is 1.4972, indicating that the prediction error is relatively large and the prediction effect is not ideal; R 2 The value is only 0.0205, which means that the model has a weak ability to explain the concentration of nitrate nitrogen in soil solution and is unable to effectively capture its rapid changes and fluctuations. However, the VAR model performed better in the OF1 treatment, and its predicted values ​​were consistent with the actual values, especially in capturing the rapid changes and fluctuations of the concentration of nitrate nitrogen in soil solution. Although the MAE of the VAR model is 1.5157, which is slightly higher than that of the ARIMA model, its R 2 The value reaches 0.1109, indicating that it has a strong explanatory power for the nitrate nitrogen concentration in soil solution and can better capture its rapid changes and fluctuation characteristics.

[0102] (4) Under the OF2 treatment, the overall trend of the ARIMA model prediction value and the actual value is relatively consistent, but the prediction accuracy is poor during the period of rapid change of soil solution nitrate nitrogen concentration. Specific data show that the MAE of the ARIMA model is 1.0244, the prediction error is large, and the effect is not ideal; R 2 The value is 0.0237, indicating that its ability to explain the concentration of nitrate nitrogen in soil solution is weak and it is difficult to effectively capture the rapid changes and fluctuations in concentration. In comparison, the VAR model has better prediction performance under the OF2 treatment, and its predicted values ​​are more consistent with the actual values, especially in capturing the rapid changes and fluctuations in the concentration of nitrate nitrogen in soil solution. Specifically, the MAE of the VAR model is 0.9575, which is smaller than that of the ARIMA model, and the prediction effect is better; R 2 The value was as high as 0.4695, indicating that it has a strong explanatory power for soil solution nitrate nitrogen concentration and can more effectively capture the rapid changes and fluctuations in concentration. Furthermore, the Ljung-Box P value of the VAR model was 0.9266, which was greater than 0.05, indicating that there was no significant autocorrelation in the residuals and that the model performed well under the OF2 treatment.

[0103] (5) For the samples treated with OF3, the overall trend of the ARIMA model predictions and actual values ​​is relatively consistent, but the predictions are not accurate enough during certain periods when the concentration of nitrate nitrogen in the soil solution changes rapidly. From the specific data, the MAE of the ARIMA model is 0.4849, the prediction error is small, and the effect is good; R 2 The value was 0.3331, indicating strong explanatory power for soil solution nitrate nitrogen concentration and its ability to capture rapid changes and fluctuations in concentration. The VAR model's predictions for the OF3 treatment were highly consistent with the actual values, particularly in capturing rapid changes and fluctuations in soil solution nitrate nitrogen concentration. Compared to the ARIMA model, the VAR model had a smaller MAE of 0.4361, indicating better prediction performance.

[0104] The Ljung-Box test was used to verify the autocorrelation of the model residuals. When the P value was greater than 0.05, it was determined that the residuals had no significant autocorrelation and the model prediction stability met the requirements of agricultural applications.

[0105] After systematically analyzing the forecasting performance of ARIMA and VAR models under different processing conditions, the results show that the VAR model exhibits better comprehensive forecasting capabilities in most scenarios. The specific technical effects are as follows:

[0106] Under the CK treatment, the VAR model significantly outperformed the ARIMA model in forecasting accuracy, with its MAE reduced by 42.3% (0.4363 vs. 0.756) and its R² increased by 10.9 times (0.3607 vs. 0.033), fully demonstrating the ability of the vector autoregressive method to capture changes in nitrate concentration. Especially during periods of significant concentration fluctuations, the VAR model's predicted trajectory matched the actual values ​​23.6% better than the ARIMA model.

[0107] For the CF-processed samples, the VAR model optimizes the MAE index by 11.0% (2.2439 vs 2.5209) while maintaining the residual autocorrelation at a level similar to that of the ARIMA model (LB_P value 0.0173 vs 0.0222), and reduces the RMSE by 16.0% (2.7324 vs 3.2513). 2 The value increased by 2.7% (0.3716 vs 0.3618), achieving a double improvement in prediction accuracy and stability.

[0108] In the OF series treatment scenarios, the VAR model showed significant technical advantages: MAE decreased by 6.5% (0.9575 vs 1.0244) under OF2 treatment and R 2 The value of the VAR model surged 18.8 times (0.4695 vs 0.0237), and its LB_P value reached 0.9266, demonstrating that the model has ideal residual independence. Of particular note, in the OF3 treatment, the VAR model compressed the forecast error to 0.4361, a 10.1% reduction compared to the ARIMA model, while keeping the residual autocorrelation within a controllable range.

[0109] By establishing a multivariate dynamic correlation model, this solution can control the average absolute error of soil solution nitrate concentration prediction in the range of 0.436-2.732 mg / L, and improve the accuracy of capturing fluctuation characteristics during key periods by 21.4%-37.2%. Compared with traditional time series methods, the model explanatory power (R 2 ) is improved by up to 46.95%, and the residual autocorrelation problem is effectively controlled in most scenarios, providing a more reliable technical solution for nitrate nitrogen prediction.

[0110] Comparison of the prediction effects of the same model on different treatments The VAR model can accurately capture the changing characteristics of soil solution nitrate nitrogen concentration. The predicted values ​​are highly consistent with the actual values ​​in terms of trends, fluctuations and peaks, showing good prediction ability and the ability to capture multivariate relationships. For example, the MAE under the CF treatment is 2.2439, the RMSE is 2.7324, and the R 2The value of Ljung-Box_P is 0.3716 and 0.0173, which indicates that the prediction error of the model under this treatment is small and the prediction effect is good.

[0111] Model prediction effect:

[0112] In the present invention, an ARIMA model and a VAR model were constructed to predict the nitrate nitrogen concentration in soil solution, and the prediction effects of the two models under different fertilization treatments were compared.

[0113] In terms of forecasting performance, the ARIMA model was inaccurate in predicting rapid changes and peak values ​​in soil solution nitrate nitrogen concentration under the CF, OF1, and OF2 treatments, with significant deviations. This is because the ARIMA model is primarily suitable for univariate time series forecasting. It processes non-stationary series through differencing and combines autoregressive and sliding average terms for modeling. Its strength lies in capturing temporal trends and seasonal variations in a single variable, but its ability to handle the interactions of multiple variables is limited.

[0114] The VAR model has a better ability to capture the rapid changes and fluctuations of soil solution nitrate nitrogen concentration under most treatments, and the predicted values ​​are consistent with the actual values. 2 The values ​​are relatively high. For example, the MAE of the VAR model under CF treatment is 2.2439, the RMSE is 2.7324, and R 2 The value of the VAR model is 0.3716, and the Ljung-Box_P value is 0.0173, indicating that the prediction error of the model under this treatment is small and the prediction effect is good. This shows that the VAR model can better capture the dynamic relationship between multiple variables and is suitable for analyzing complex systems.

[0115] Technical principles and advantages of this model:

[0116] This invention significantly improves the predictive reliability of soil solution nitrate nitrogen concentration through multivariate time series modeling and dynamic interaction capture mechanisms. Its core principle is that the VAR model integrates multi-source sensor data streams and soil background indicators to construct a dynamic coupling relationship between the "environment-soil-nitrate nitrogen" system, thereby accurately quantifying the interactions of complex variables. Compared with the traditional ARIMA model, the technical advantages and variable contribution mechanism of the VAR model are reflected in the following aspects:

[0117] 1. Multivariable dynamic interaction modeling improves system analysis capabilities

[0118] The VAR model is based on a vector autoregression framework. It incorporates soil solution nitrate nitrogen concentration into a time series system along with variables such as soil temperature, moisture, electrical conductivity (Ec), soil organic matter (SOM), total nitrogen (TN), and alkaline nitrogen (AN). The dynamic lag relationship between multiple variables is solved by matrix equations. (1) Dynamic coupling between temperature and microbial activity. The temperature lag term (e.g., p = 1 order) can quantify its delayed effect on the decomposition and transformation of nitrate nitrogen. Under high temperature conditions, microbial activity is enhanced, and nitrate nitrogen is more easily converted into gaseous nitrogen. The VAR model directly captures the dynamic attenuation of this process through the lag effect coefficient of the temperature variable. (2) Instantaneous response of moisture to leaching effects. The negative correlation between moisture variables and nitrate nitrogen concentration is explicitly expressed through the model weight parameters. When moisture increases suddenly (e.g., during the rainy season or after irrigation), the model immediately corrects the predicted value of nitrate nitrogen concentration to reflect its downward trend due to dilution or leaching. The ARIMA model cannot respond to such instantaneous changes due to the lack of external variable input. (3) Steady-state correction of soil background indicators. Soil indicators such as SOM, TN, and AN influence the accumulation rate of nitrate nitrogen through long-term mineralization and transformation processes. By incorporating historical data on these variables, the VAR model can dynamically adjust the baseline prediction of nitrate nitrogen concentration, enhancing the model's adaptability to fertilization types.

[0119] 2. Multivariate collaboration captures nonlinearity and hysteresis effects

[0120] The dynamic changes in soil solution nitrate nitrogen are essentially the result of multi-factor nonlinear interactions. The VAR model can simultaneously analyze the immediate and delayed effects between variables by setting the lag order (p). (1) Dynamic analysis of the lag order. The mineralization process of soil TN after fertilization takes several days to significantly affect the nitrate nitrogen concentration. The VAR model captures this delayed effect through the TN variable coefficient of the lag order 2. In contrast, the ARIMA model only relies on the historical data of nitrate nitrogen itself and cannot associate the fertilization event with the lagged response of nitrate nitrogen. (2) Nonlinear compensation of multi-variable linkage. Although the Ec value has no direct linear correlation with nitrate nitrogen, its positive correlation with temperature indirectly reflects the impact of soil salinity on nitrate nitrogen migration. The VAR model can implicitly correct the deviation of the nitrate nitrogen prediction value through the interaction term weight of Ec and temperature, while the univariate ARIMA model completely ignores such indirect correlation.

[0121] 3. Comparing the Univariate Limitations of the ARIMA Model

[0122] The traditional ARIMA model only performs autoregressive and sliding average modeling based on historical data of nitrate nitrogen concentration, and has the following main limitations: (1) The lack of external variables leads to prediction lags. ARIMA cannot incorporate real-time changes in environmental variables such as temperature and moisture, resulting in a significant decrease in its prediction accuracy during periods of sudden changes in nitrate nitrogen concentration (such as leaching after rainfall). For example, under CF treatment, the MAE of ARIMA (2.5209) is 11.0% higher than that of the VAR model (2.2439) because it cannot respond to the immediate dilution effect of sudden water increase on nitrate nitrogen; (2) Static modeling cannot analyze dynamic interactions. ARIMA processes non-stationary series through differences, but can only fit the time trend and seasonal fluctuations of a single variable. For complex systems with multivariate coupling (such as the dynamic chain reaction of temperature-microorganism-nitrate nitrogen), its model structure lacks interaction terms between variables, resulting in R 2 The values ​​are generally low (such as R of ARIMA under OF2 treatment). 2 =0.0237, while the VAR model improved to 0.4695).

[0123] 4. Data-driven and model generalization capabilities

[0124] The VAR model significantly improves the generalization ability of the model by integrating high-dimensional variables (time, environment, soil indicators). (1) Multi-scenario adaptability: In the OF series treatments where organic nitrogen and chemical nitrogen are mixed, the VAR model accurately captures the delayed contribution of organic nitrogen mineralization to nitrate nitrogen concentration by dynamically adjusting the weight coefficients of SOM and TN. Its R 2 The value is improved compared with ARIMA (OF2 processing). (2) Residual independence verification: The Ljung-Box_P value of the VAR model is greater than 0.05 in most scenarios, indicating that its residuals have no significant autocorrelation and the model is more robust to noise interference. However, the ARIMA model ignores external variables, and the residual autocorrelation (such as CF processing P = 0.0222) leads to insufficient prediction stability.

[0125] In summary, the VAR model, through multivariate dynamic interaction modeling, transforms the systematic coupling relationship between sensor data streams and soil background indicators into quantifiable matrix parameters, thereby achieving high-precision prediction of soil solution nitrate nitrogen concentration. Compared with the ARIMA model, its technical advantage stems from the multivariate synergistic mechanism's precise analysis of nonlinearity, hysteresis effects, and external interference. This invention provides an innovative solution for time-series prediction of complex agricultural ecosystems, significantly improving the model's scientific nature and engineering applicability.

[0126] As a key component of plant nitrogen nutrition, soil solution nitrate nitrogen (SNI) concentration prediction accuracy is crucial for optimizing fertilization strategies, improving fertilizer utilization efficiency, and reducing environmental pollution. Traditional soil solution nitrate nitrogen monitoring methods are limited in practical agricultural production due to high cost and poor timeliness. With technological advancements, sensor technology is increasingly being used in agriculture, enabling real-time acquisition of multiple soil and environmental parameters. Simultaneously, advances in machine learning algorithms are facilitating the processing and analysis of this complex data. By combining sensor data with machine learning, efficient and accurate soil solution nitrate nitrogen prediction models can be constructed, enabling dynamic monitoring and precise management of soil nitrogen status. This approach not only helps farmers optimize fertilization decisions, reducing fertilizer waste and environmental pollution, but also provides technical support for sustainable agricultural development. Furthermore, with increasing data accumulation and model optimization, the accuracy and reliability of prediction models will continue to improve, further promoting their widespread application in agricultural production and providing strong support for precision agriculture and environmental management.

[0127] The present invention proposes to construct a prediction model for nitrate nitrogen in farmland soil solution based on easily available indicators (in-situ online monitoring sensors for temperature, humidity and salt, climate data, soil background indicators, and tillage data) using machine learning methods, providing a low-cost, high-efficiency solution for identifying the level of nitrate nitrogen in soil solution. The results of the present invention have brought new opportunities for agricultural fertilization and environmental protection. Enterprises and farmers can now use affordable traditional sensors and easily accessible meteorological data to make time-series predictions of nitrate nitrogen in soil solution. This innovative method not only helps to formulate more accurate fertilization plans, but also effectively reduces the risk of non-point source pollution and achieves green and sustainable development of agricultural production. By combining sensor data streams with machine learning models, important breakthroughs have been made in the field of time-series prediction. This combination not only reduces the cost of long-term positioning monitoring, but also improves the efficiency of data acquisition, allowing the data mining potential of basic long-term agricultural work to be further utilized. These advances together provide strong support for the sustainable and green development of plateau agriculture.

[0128] The present invention adopts multivariate integrated modeling to break through the technical principle of single variable prediction limitation. The traditional ARIMA model is only based on the single variable time series modeling of soil solution nitrate nitrogen, which can only capture the time trend of a single indicator (such as seasonality, long-term fluctuations), but cannot incorporate the dynamic influence of soil environmental factors (temperature, moisture, Ec) and soil background indicators (SOM, TN, AN). The VAR model (vector autoregression model) of the present invention constructs a multivariate time series system by combining soil solution nitrate nitrogen with multi-sensor data streams (time, temperature, moisture, Ec) and soil indicators (SOM, TN, AN). The interaction between variables is solved by matrix equations, realizing the coupled modeling of the "environment-soil-nitrate nitrogen" complex system.

[0129] The VAR model used in the present invention has a strong ability to capture dynamic interactions. The model can capture the lagged effects of multiple variables in the time dimension by setting the lag order (p). When the moisture increases sharply during the rainy season, the model can immediately respond to the dilution / leaching effect of soil solution nitrate nitrogen. For example, in the peak forecast for November 2023, VAR captured the concentration decline trend 2 weeks earlier than ARIMA. In addition, the temperature-microorganism dynamic effect can be captured. The VAR model quantifies the delayed effect of this process on the concentration of soil solution nitrate nitrogen through the temperature lag 1 order term (p=1). In contrast, ARIMA relies on differential processing of non-stationary series, and only fits the historical fluctuations of a single variable through the autoregressive term (p) and the sliding average term (q). It cannot analyze the immediate or lagged effects of external factors (such as fertilization and irrigation) on soil solution nitrate nitrogen. For example, in the OF2 treatment (60% organic nitrogen + 40% chemical nitrogen), the R of ARIMA is 0. 2 Only 0.0237, while VAR integrates the transformation relationship between organic nitrogen input and soil TN, R 2 It increased to 0.4695 (18.8 times), proving the ability of multivariate interaction modeling to analyze complex fluctuations.

[0130] This invention has adaptability advantages in multiple fertilization scenarios in agricultural production. Different fertilization patterns in agricultural production lead to differences in the transformation mechanisms of nitrate nitrogen in soil solution (such as organic nitrogen mineralization and chemical nitrogen leaching). The VAR model, through its variable expansion capability, can flexibly incorporate external variables such as fertilization type (organic / chemical nitrogen ratio) and fertilizer amount (constructing a full-chain association model of "fertilization-soil indicators-environmental factors-nitrate nitrogen"). In addition, through residual characteristic optimization, it has stronger fitting stability for non-stationary fluctuations induced by fertilization.

[0131] In summary, single-variable models (such as ARIMA) only utilize historical nitrate nitrogen data and ignore the direct effects of environmental factors such as soil temperature and moisture on nitrate nitrogen conversion and migration (such as high temperature promoting denitrification and increased moisture causing leaching), resulting in a significant decrease in prediction accuracy during periods of drastic fluctuations after fertilization. Traditional multivariate models (such as multiple linear regression) assume a static linear relationship between variables and are unable to capture the dynamic lagged interaction between nitrate nitrogen and environmental factors in the time dimension (such as the effect of moisture changes on nitrate nitrogen concentration requires a delay of 1-2 days to manifest). However, the present invention, through dynamic lag modeling of the VAR model, has achieved the first quantitative analysis of this type of time-dependent relationship.

[0132] The above are merely preferred embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A method for dynamic prediction of nitrate nitrogen in soil solution based on sensor data stream, characterized in that: The following steps are involved: Collecting samples to construct raw data, and performing data processing on the raw data to obtain processed data; A soil solution nitrate nitrogen prediction model is constructed based on multivariate time series data, and the processed data is input into the soil solution nitrate nitrogen prediction model to realize dynamic monitoring and prediction of the soil solution nitrate nitrogen concentration.

2. The method according to claim 1, characterized in that The process of obtaining the processed data includes: The test area is divided into several test plots, and in-situ sensors are installed in each test plot; Collect soil solution samples using a suction-pressure soil solution sampler according to a preset schedule; Determining the content of the soil solution sample to obtain nitrate nitrogen and soil indicators in the soil solution, and recording soil environmental data when the soil solution sample is collected based on the in-situ sensor; The nitrate nitrogen solution, soil indicators and soil environmental data corresponding to the soil solution sample are processed to obtain processed data.

3. The method according to claim 2, characterized in that The soil environmental data include: time, temperature, moisture, and electrical conductivity; The soil indicators include: soil organic matter, total nitrogen, and alkaline nitrogen.

4. The method according to claim 2, characterized in that The in-situ sensors include soil temperature and humidity sensors and conductivity sensors; The in-situ sensor is deployed at a soil depth of 20 cm.

5. The method according to claim 2, characterized in that The process of processing the nitrate nitrogen solution and soil environment data corresponding to the soil solution sample includes: constructing original data based on the nitrate nitrogen solution and soil environmental data corresponding to the soil solution sample; Preprocessing the original data to obtain preprocessed data; Creating a time series object based on the preprocessed data with soil solution nitrate nitrogen as the target variable; Converting the time series object into a day series by linear interpolation, and filling the day series to obtain a filled day series; The filled day series is converted into an equally spaced time series according to weekly interpolation, and processed data is obtained based on the equally spaced time series.

6. The method according to claim 5, characterized in that The process of constructing a soil solution nitrate nitrogen prediction model includes: constructing a VAR model based on the equally spaced time series; wherein the expression of the VAR model is: Where Y t is a vector containing nitrate nitrogen concentration, soil environmental data, and soil indicators, A k is the coefficient matrix of lag k, ε t is the error term, and p is the lag order.

7. The method according to claim 6, characterized in that The method further includes evaluating the soil solution nitrate-nitrogen prediction model based on the evaluation index; The evaluation indicators include: mean absolute error, root mean square error, determination coefficient, and Ljung-Box_P test.