Dissolved oxygen and water temperature time sequence prediction method based on PID (Proportion Integration Differentiation) error corrector
By applying PID error corrector and data preprocessing technology in aquaculture, the problem of low prediction accuracy of dissolved oxygen and water temperature is solved, and higher prediction accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411094059.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-22
AI Technical Summary
The prior art has low prediction accuracy of dissolved oxygen and water temperature in aquaculture and is susceptible to water quality and meteorological factors. Traditional models are difficult to capture data patterns and are susceptible to outliers and noise, causing the prediction results to deviate from the actual value.
The timing prediction method based on the PID error corrector is adopted to obtain the initial prediction value, and the PID error corrector calculates the control quantity to correct the prediction results. Combined with data preprocessing such as mean filling, linear interpolation and wavelet transformation, the prediction accuracy is improved.
It effectively improves the accuracy of time sequence prediction of dissolved oxygen and water temperature, reduces deviations in prediction results, and improves the accuracy of aquaculture environmental data.
Smart Images

Figure CN119002233A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of data prediction, and in particular to a dissolved oxygen and water temperature time series prediction method based on a PID error corrector. Background Art
[0002] In the aquaculture industry, the dissolved oxygen content and water temperature of aquaculture water are key factors affecting the healthy growth of aquatic products. Since the oxygenation and temperature rise of aquaculture water is a slow-changing process, if the aquaculture personnel take corresponding measures based on the current monitoring variables, the dissolved oxygen and water temperature will not reach the safe range in the short term, and the occurrence of aquaculture risks cannot be avoided. Therefore, studying the prediction method of dissolved oxygen and water temperature in aquaculture water will help to timely and accurately grasp the changing laws of dissolved oxygen content and water temperature in the future, provide support for taking corresponding preventive measures in advance, and have important significance for reducing aquaculture risks and optimizing aquaculture management.
[0003] Existing machine learning models are used to predict monitoring variables that change over time. However, because dissolved oxygen content and water temperature are easily affected by water quality and meteorological factors, and have characteristics such as nonlinearity, large time lag and instability, traditional machine learning models cannot capture the true patterns in the data, resulting in distorted prediction results. Dissolved oxygen content and water temperature are also easily affected by outliers and noise, which may have a significant impact on the parameter estimation of traditional models, causing the prediction results to deviate from the actual values. Summary of the invention
[0004] In order to solve the technical problem that the above-mentioned existing prediction methods have low prediction accuracy for dissolved oxygen and water temperature, the purpose of the present invention is to provide a technical solution, and the specific technical solution adopted is as follows:
[0005] An embodiment of the present invention provides a method for time series prediction of dissolved oxygen and water temperature based on a PID error corrector, the method comprising the following steps:
[0006] Obtain the initial predicted values of dissolved oxygen content and initial predicted values of water temperature in aquaculture environment;
[0007] The PID error corrector is used to correct the initial predicted value of dissolved oxygen content and the initial predicted value of water temperature, so as to obtain the final predicted value of dissolved oxygen content and the final predicted value of water temperature under the aquaculture environment;
[0008] Calculating a correction value of the initial prediction result by the PID error corrector includes:
[0009] Obtain the error value between two adjacent target moments, use the error value between the two adjacent target moments to improve the integral term in the PID error corrector, obtain the control amount at the current moment, and use the control amount as the correction value of the initial prediction result; wherein the error value is equal to the difference between the predicted value and the actual value.
[0010] Furthermore, the PID error corrector is used to correct the initial predicted dissolved oxygen content value and the initial predicted water temperature value to obtain the final predicted dissolved oxygen content value and the final predicted water temperature value under the aquaculture environment, including:
[0011] Calculating the correction value of the initial predicted dissolved oxygen content, and adding the initial predicted dissolved oxygen content value and the corresponding correction value to obtain a value as the final predicted dissolved oxygen content value;
[0012] The correction value of the initial water temperature prediction value is calculated, and the value obtained by adding the initial water temperature prediction value and the corresponding correction value is used as the final water temperature prediction value.
[0013] Furthermore, the use of the error values at the two adjacent target moments to improve the integral term in the PID error corrector to obtain the control amount at the current moment includes:
[0014] In the formula, u(t) represents the initial control value at the current moment, e(t) represents the error value at the moment t-τ, τ represents the prediction time interval, and K p (e(t-τ)) represents the proportional term at time t-τ, e(t-τ-1) represents the error value at the moment before time t-τ, represents the improved integral term, K d (e(t-τ)-e(t-τ-1)) represents the differential term; the two adjacent target moments are t-τ and t-τ-1; the initial control amount at the current moment is compared with the saturator limit threshold to obtain the control amount at the current moment.
[0015] Further, the comparing the initial control amount at the current moment with the saturator limit threshold to obtain the control amount at the current moment includes:
[0016] Where γ(t) represents the control amount at the current moment, and K represents the saturator limit threshold.
[0017] Further, the obtaining of the predicted value of the initial dissolved oxygen content and the predicted value of the initial water temperature in the aquaculture environment includes:
[0018] Obtaining a dissolved oxygen content sequence and a water temperature sequence in the current period, performing data preprocessing on the dissolved oxygen content sequence and the water temperature sequence, and obtaining a preprocessed dissolved oxygen content sequence and a water temperature sequence;
[0019] The preprocessed dissolved oxygen content sequence and water temperature sequence are input into the pre-built and trained optimal benchmark network model to obtain the initial dissolved oxygen content prediction value and initial water temperature prediction value under the aquaculture environment.
[0020] Furthermore, the performing data preprocessing on the dissolved oxygen content sequence and the water temperature sequence to obtain the preprocessed dissolved oxygen content sequence and the water temperature sequence includes:
[0021] The mean filling method is used to process the dissolved oxygen content series and the water temperature series to obtain the dissolved oxygen content series and the water temperature series processed by the mean filling method;
[0022] The linear interpolation method is used to process the dissolved oxygen content sequence and the water temperature sequence processed by the mean filling method to obtain the dissolved oxygen content sequence and the water temperature sequence processed by the linear interpolation method;
[0023] The dissolved oxygen content sequence and the water temperature sequence processed by the linear interpolation method are denoised by wavelet transform to obtain the pre-processed dissolved oxygen content sequence and the water temperature sequence.
[0024] The present invention has the following beneficial effects:
[0025] The present invention provides a dissolved oxygen and water temperature time series prediction method based on a PID error corrector. The method applies the PID feedback control principle to the error correction of the time series prediction system. When there is an error between the predicted value and the actual value, the PID controller can be used to calculate the control amount to correct the prediction result of the benchmark model, which effectively improves the accuracy of the dissolved oxygen and water temperature time series prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 It is a flow chart of a method for predicting dissolved oxygen and water temperature time series based on a PID error corrector of the present invention;
[0028] Figure 2 It is a schematic diagram of the prediction performance verification result based on the PID error corrector in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0030] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0031] This embodiment provides a method for predicting dissolved oxygen and water temperature time series based on a PID error corrector. Figure 1 As shown, the following steps are included:
[0032] S1, obtain the initial predicted value of dissolved oxygen content and initial predicted value of water temperature in aquaculture environment.
[0033] First of all, it should be noted that time series prediction is one of the more popular research directions, and it has a large number of applications in different fields. Its main purpose is to predict the target variables at future moments based on historical observation data, so as to grasp the changing trend of the target variables in advance and provide a theoretical basis for decision-making. Therefore, it is necessary to predict the dissolved oxygen content and water temperature in the aquaculture environment so that the breeders can take corresponding measures according to the predicted monitoring variables to avoid the occurrence of breeding risks. Among them, the monitoring variable can be the dissolved oxygen content or water temperature. Of course, the monitoring variable can also be any type of monitoring data in the aquaculture environment.
[0034] The above step S1 can be implemented through steps S11 to S12:
[0035] S11, obtaining a dissolved oxygen content sequence and a water temperature sequence in the current period, performing data preprocessing on the dissolved oxygen content sequence and the water temperature sequence, and obtaining a preprocessed dissolved oxygen content sequence and water temperature sequence.
[0036] In this embodiment, the acquisition interval for obtaining the dissolved oxygen content sequence and the water temperature sequence is set to 10 minutes. The implementer can set the acquisition interval according to the specific situation without specific limitation. The dissolved oxygen prediction in this embodiment is mainly the prediction of dissolved oxygen content, and the prediction variables in the aquaculture environment can also be pH, chlorophyll, turbidity, atmospheric temperature, atmospheric humidity, solar radiation, rainfall, etc.
[0037] The aquaculture environment is highly complex, and the collected monitoring variables often have missing values, abnormal values, and contain a lot of noise, which easily affects the reference value of the data. In order to improve the data quality of monitoring variables in the aquaculture environment, data preprocessing is performed on the monitoring variables. The specific implementation steps include:
[0038] In the first step, the mean filling method is used to process the dissolved oxygen content series and the water temperature series to obtain the dissolved oxygen content series and the water temperature series processed by the mean filling method.
[0039] In the second step, the linear interpolation method is used to process the dissolved oxygen content series and water temperature series after the mean filling method is processed to obtain the dissolved oxygen content series and water temperature series after the linear interpolation method is processed.
[0040] In the third step, wavelet transform is used to denoise the dissolved oxygen content sequence and water temperature sequence processed by linear interpolation method to obtain the preprocessed dissolved oxygen content sequence and water temperature sequence.
[0041] It should be noted that during data preprocessing, the dissolved oxygen content series and water temperature series are analyzed separately; the ultimate goal of the mean filling method and linear interpolation method is to avoid missing values in the series to a certain extent, so the implementer can choose one or both methods; wavelet transformation can realize data smoothing and remove the influence of noise, which further enhances the data quality of the dissolved oxygen content series and water temperature series.
[0042] Among them, the implementation process of the mean filling method, the linear interpolation method and the wavelet transform is the existing technology, which is not within the protection scope of the present invention and will not be elaborated in detail here.
[0043] S12, inputting the preprocessed dissolved oxygen content sequence and water temperature sequence into a pre-built and trained optimal benchmark network model to obtain the initial dissolved oxygen content prediction value and the initial water temperature prediction value under the aquaculture environment.
[0044] In this embodiment, the specific content of the optimal reference network model may include:
[0045] Select historical monitoring data collected over a period of time and divide them into training set, validation set and test set according to a certain ratio; the prediction model can be any network model with prediction capability, the most commonly used ones include but are not limited to LSTM (Long Short-Term Memory), GRU (Gated Recurrent Unit), Transformer (deep neural network model based on self-attention mechanism), etc.; first use the training set to train the network model with prediction capability to obtain a benchmark network model, and perform verification and evaluation on the validation set, adjust the model parameters according to the performance, such as the number of network layers, number of nodes, number of iterations, batch size, learning rate, etc., and test again on the test set. Repeat the above training steps until the optimal benchmark network model is obtained, which is a prediction model that can be used to predict dissolved oxygen content and water temperature.
[0046] It should be noted that this embodiment predicts the dissolved oxygen content and water temperature at the same time. The optimal benchmark network model can predict the dissolved oxygen content and water temperature at the same time. There are two output nodes. A PID (Proportion Integration Differential, proportional integral differential control system) error controller can be used to correct the initial prediction results of dissolved oxygen and water temperature. The construction and training process of the prediction model is a prior art and is not within the scope of protection of the present invention, and will not be elaborated in detail.
[0047] S2, determining the correction values of the initial predicted value of dissolved oxygen content and the initial predicted value of water temperature.
[0048] First of all, it should be noted that after obtaining the initial predicted value of dissolved oxygen content and the initial predicted value of water temperature, in order to improve the accuracy of the prediction results, a PID error corrector is used to determine the correction value of the initial prediction result, so that the correction value can be used to correct the initial prediction result later.
[0049] The PID error corrector is derived from the PID control principle in the field of automation. Its core idea is to obtain the system deviation based on the system feedback output, and then calculate the control quantity. PID has the advantages of strong robustness and few adjustable parameters. Only three parameters need to be set, namely the proportional coefficient, the integral coefficient and the differential coefficient. The main function of the PID error corrector in this embodiment is to calculate the control quantity based on the deviation of the system, correct the output of the system, and maintain it near the ideal set value. It helps to improve the prediction accuracy and provide theoretical support for dissolved oxygen and water temperature control.
[0050] The discrete form of the original PID is as follows:
[0051] In the formula, u(k) represents the control quantity at the kth moment, K p represents the proportional term, K i represents the integral term, K d represents the differential term, e(k) represents the error at the kth moment, e(n) represents the error at the nth moment, k≠n, and e(k-1) represents the error at the k-1th moment.
[0052] In this embodiment, the calculation process of the correction value of the initial dissolved oxygen content prediction value and the initial water temperature prediction value is similar. In order to reduce repeated description, the initial dissolved oxygen content prediction value and the initial water temperature prediction value are collectively referred to as the initial prediction result. The correction value of the initial prediction result can be determined by the PID error corrector, including:
[0053] The error value between two adjacent target moments is obtained, and the integral term in the PID error corrector is improved by using the error value between two adjacent target moments to obtain the control amount at the current moment, and the control amount is used as the correction value of the initial prediction result; wherein the error value is equal to the difference between the predicted value and the actual value.
[0054] The first step is to obtain the error value between two adjacent target moments.
[0055] In this embodiment, the predicted value and the actual value of the target time are obtained, and the absolute value of the difference between the predicted value and the actual value is used as the error value corresponding to the target time.
[0056] It should be noted that when there is an error between the predicted value and the actual value, the PID controller can be used to calculate the control amount (correction value) to correct the prediction result of the benchmark model and improve the prediction accuracy. However, it should be noted that time series prediction is generally an advance prediction, and the actual value corresponding to the predicted value at the future moment is unavailable. Therefore, when calculating the control amount at the future moment according to the PID controller, the error value at the target moment is used as the controller input deviation.
[0057] In the second step, the error value between two adjacent target moments is used to improve the integral term in the PID error corrector to obtain the control quantity at the current moment.
[0058] First, determine the improved control amount at the current moment, and its calculation formula can be:
[0059] In the formula, u(t) represents the improved control value at the current moment, e(t) represents the error value at the current moment, and K p (e(t)) represents the proportional term, e(t-1) represents the error value of the previous moment, represents the improved integral term, K d (e(t)-e(t-1)) represents the differential term.
[0060] In the calculation formula of the improved control quantity, the integral term in the original PID takes into account all the accumulated errors from the beginning to the current moment, which will generate a large calculation overhead and cause instability in the calculation results. The reason is that long-term error accumulation will make the error value of the integral term too large, and it is very likely to generate excessive control quantity in the later stage, resulting in instability.
[0061] This embodiment improves the integral term in the PID controller by adopting the trapezoidal error integration method, that is, using the average value of the sum of the current error and the previous error to replace the integral term in the original PID controller. Using the current two errors can avoid error accumulation, reduce the amount of calculation, and increase stability.
[0062] The improved PID mentioned above is applied to the time series prediction task. Since time series prediction belongs to advance prediction, the actual value corresponding to the predicted value output by the prediction model cannot be obtained. The historical prediction error of two adjacent target moments obtained according to the prediction time interval is required as the input of the improved PID, so as to calculate the initial control amount at the current moment.
[0063] Assuming that the preset time interval is τ, the calculation formula of the initial control amount at the current moment can be:
[0064] In the formula, u(t) represents the initial control value at the current moment, e(t-τ) represents the error value at the moment t-τ, τ represents the prediction time interval, and K p (e(t-τ)) represents the proportional term, e(t-τ-1) represents the error value at the moment before t-τ, represents the improved integral term, K d (e(t-τ)-e(t-τ-1)) represents the differential term; the two adjacent target times are t-τ and t-τ-1.
[0065] Secondly, the initial control amount at the current moment is compared with the saturator limit threshold to obtain the control amount at the current moment.
[0066] It should be noted that in order to prevent system instability caused by excessive control quantity, a saturation limit is adopted for the output control quantity of the PID controller. The constraint condition is as follows:
[0067] Where γ(t) represents the control amount at the current moment, that is, the control amount after saturation limitation, that is, the correction value of the prediction result, and K represents the saturator limitation threshold, which is generally set manually according to the actual situation.
[0068] With reference to the calculation process of the correction value of the above prediction result, the correction value of the initial predicted value of dissolved oxygen content and the correction value of the initial predicted value of water temperature can be obtained.
[0069] S3, correcting the initial predicted dissolved oxygen content value and the initial predicted water temperature value based on the correction value to obtain the final predicted dissolved oxygen content value and the final predicted water temperature value in the aquaculture environment.
[0070] First of all, it should be noted that in the PID control system, the change law of the PID output control quantity is closely related to the system deviation. It is generally believed that the larger the system deviation, the larger the control quantity; the smaller the system deviation, the smaller the control quantity. Therefore, the PID feedback control principle can be used in the error correction of the time series prediction system. When there is an error between the predicted value and the actual value, the PID controller can be used to calculate the control quantity and correct the prediction result of the benchmark prediction model to improve the prediction accuracy.
[0071] Specifically, a correction value of the initial predicted dissolved oxygen content is determined, and the value obtained by adding the initial predicted dissolved oxygen content value and the corresponding correction value is used as the final predicted dissolved oxygen content value. A correction value of the initial predicted water temperature value is determined, and the value obtained by adding the initial predicted water temperature value and the corresponding correction value is used as the final predicted water temperature value.
[0072] The proposed PID error correction method is verified using the public chaotic time series. The specific contents include:
[0073] First, the Mackey Glass system can express the chaotic phenomena in time-delay systems and is often used as a test standard for model prediction performance. Mackey Glass is a chaotic time series generated by a time-delay differential equation.
[0074] Secondly, in MATLAB, the fourth-order Runge-Kutta method was used to generate a nonlinear time series consisting of 10,000 points, and a single-input single-output prediction model was constructed. The training set and test set were divided into 8:2 ratios, that is, the first 8,000 samples of the generated sequence were used to train the model, and the last 2,000 samples were used for testing, of which 20% of the tail of the training set was used as a validation set. The nonlinear time series was used as the model input, and the future sequence was output.
[0075] Then, LSTM is selected as the benchmark model, and a one-step forward prediction experiment is conducted to verify the PID error correction performance. The schematic diagram of the prediction performance verification results based on the PID error corrector is shown in the figure. Figure 2 As shown by Figure 2It can be seen that the prediction error of LSTM (LSTM-PID) after PID correction is significantly smaller than the LSTM prediction error, which can indicate that this embodiment can effectively improve the accuracy of the prediction model output results. Similarly, a benchmark prediction model corresponding to dissolved oxygen content and water temperature can be constructed, and then two PID error correctors can be constructed to perform error correction on the prediction results of dissolved oxygen content and water temperature of the benchmark prediction model, which effectively improves the prediction accuracy.
[0076] The present invention provides a dissolved oxygen and water temperature time series prediction method based on a PID error corrector. By combining the PID error corrector with a time series prediction model, the error compensation amount can be used to realize the correction of the prediction result of the prediction model, which effectively improves the accuracy of the dissolved oxygen and water temperature time series prediction.
[0077] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A time series prediction method for dissolved oxygen and water temperature based on PID error corrector, It is characterized in that The following steps are involved: Obtain the initial predicted values of dissolved oxygen content and initial predicted values of water temperature in aquaculture environment; The PID error corrector is used to correct the initial predicted value of dissolved oxygen content and the initial predicted value of water temperature, so as to obtain the final predicted value of dissolved oxygen content and the final predicted value of water temperature under the aquaculture environment; Calculating a correction value of the initial prediction result by the PID error corrector includes: Obtain the error value between two adjacent target moments, use the error value between the two adjacent target moments to improve the integral term in the PID error corrector, obtain the control amount at the current moment, and use the control amount as the correction value of the initial prediction result; wherein the error value is equal to the difference between the predicted value and the actual value.
2. According to claim 1, a method for predicting dissolved oxygen and water temperature time series based on a PID error corrector, It is characterized in that The method of using a PID error corrector to correct the initial predicted value of dissolved oxygen content and the initial predicted value of water temperature to obtain a final predicted value of dissolved oxygen content and a final predicted value of water temperature in an aquaculture environment includes: Calculating the correction value of the initial predicted dissolved oxygen content, and adding the initial predicted dissolved oxygen content value and the corresponding correction value to obtain a value as the final predicted dissolved oxygen content value; The correction value of the initial water temperature prediction value is calculated, and the value obtained by adding the initial water temperature prediction value and the corresponding correction value is used as the final water temperature prediction value.
3. According to the method for predicting dissolved oxygen and water temperature based on PID error corrector according to claim 1, It is characterized in that The step of improving the integral term in the PID error corrector by using the error values at the two adjacent target moments to obtain the control amount at the current moment includes: In the formula, u(t) represents the initial control value at the current moment, t represents the current moment, e(t) represents the error value at the moment t-τ, τ represents the prediction time interval, and K p (e(t-τ)) represents the proportional term at time t-τ, e(t-τ-1) represents the error value at the moment before time t-τ, represents the improved integral term, K d (e(t-τ)-e(t-τ-1)) represents a differential term; the two adjacent target moments are t-τ and t-τ-1; The initial control amount at the current moment is compared with the saturator limit threshold to obtain the control amount at the current moment.
4. A method for predicting dissolved oxygen and water temperature time series based on a PID error corrector according to claim 3, It is characterized in that The comparing the initial control amount at the current moment with the saturator limit threshold to obtain the control amount at the current moment includes: Where γ(t) represents the control amount at the current moment, and K represents the saturator limit threshold.
5. A method for predicting dissolved oxygen and water temperature time series based on a PID error corrector according to claim 1, It is characterized in that The obtaining of the predicted value of the initial dissolved oxygen content and the predicted value of the initial water temperature in the aquaculture environment comprises: Obtaining a dissolved oxygen content sequence and a water temperature sequence in the current period, performing data preprocessing on the dissolved oxygen content sequence and the water temperature sequence, and obtaining a preprocessed dissolved oxygen content sequence and water temperature sequence; The preprocessed dissolved oxygen content sequence and water temperature sequence are input into the pre-built and trained optimal benchmark network model to obtain the initial dissolved oxygen content prediction value and initial water temperature prediction value under the aquaculture environment.
6. A method for predicting dissolved oxygen and water temperature time series based on a PID error corrector according to claim 5, It is characterized in that The step of performing data preprocessing on the dissolved oxygen content sequence and the water temperature sequence to obtain the preprocessed dissolved oxygen content sequence and the water temperature sequence comprises: The mean filling method is used to process the dissolved oxygen content series and the water temperature series to obtain the dissolved oxygen content series and the water temperature series processed by the mean filling method; The linear interpolation method is used to process the dissolved oxygen content sequence and the water temperature sequence processed by the mean filling method to obtain the dissolved oxygen content sequence and the water temperature sequence processed by the linear interpolation method; The dissolved oxygen content sequence and the water temperature sequence processed by the linear interpolation method are denoised by wavelet transform to obtain the pre-processed dissolved oxygen content sequence and the water temperature sequence.
Citation Information
Cited By
Remote control system and method for three-dimensional shrimp and crab culture facility
CN119225166A
A remote control system and method for three-dimensional shrimp and crab breeding facilities
CN119225166B
