# Location Optimization Model of a Greenhouse Sensor Based on Multisource Data Fusion

Authors: DianJu Qiao; ZhenWei Zhang; FangHao Liu; Bo Sun
Journal: Complexity
 (2022)

---

## Abstract

In the traditional case, the uncertainty of the ambient temperature measured by the experiential distributed sensor is considered. In this paper, a model based on the moving least square method in the fusion algorithm is proposed to study the optimal monitoring point of the sensor in the greenhouse and determine the most suitable installation position of the sensor in the greenhouse to improve the control effect of the temperature control device of the system. MATLAB simulation software is used to simulate each working condition of the greenhouse. Temperature data measured at 15 locations in the greenhouse were used to evaluate all possible combinations of monitoring locations and to estimate the optimal location for indoor temperature sensors. Compared with the traditional method, the error is reduced to 0.373, and the data are more accurate.


---

## Body

## 1. Introduction

At present, China has implemented greenhouse energy-saving planting projects and intelligent technology is applied to the modern greenhouse control system. Proper control of temperature, humidity, and carbon dioxide concentration in greenhouse can effectively improve the growth speed, quality, and yield of crops [1]. All biochemical reactions of crops in the whole growth cycle require appropriate temperature. Compared with other environmental factors, temperature is a decisive factor for crop growth and development. Therefore, the study is of great importance to the high efficiency, energy saving, and high yield under the premise of greenhouse temperature analysis.During the temperature data measurement in a greenhouse, a limited number of sensors are usually installed to improve the overall cost performance. In general, sensor locations are determined by experience. However, according to the empirical distribution measurement results, the correct representation of the whole temperature environment in the greenhouse is uncertain. Therefore, it is necessary to select the best installation location for a limited number of sensors to accurately monitor the internal temperature of larger greenhouses.Currently, the studies on the optimal sensor placement are mainly to measure the stability of the internal detection system in a specific environment and to determine the optimal sensor location in different measurement environments. The new technology based on truck GPS trajectory optimization deployment strategy in the California highway has been investigated: one is to establish a flow measurement based on the intercepting model flow weighting factor with emphasis on different body position and another is to set up the truck and choose different relative position recognition model to determine the best position of identification of heavy truck movement [2].A unified TWLS framework was proposed for the joint location estimation of multiple disconnected sources and sensors based on a more general measurement model, which can be applied to many different localization scenarios [3]. A sensor network design strategy for monitoring nonlinear dynamic chemical processes using UKF was proposed to approximate the true mean and covariance of a nonlinearly transformed random variable, till the third order was correctly performed with a low computational workload [4]. A four-stage program for a practical solution was developed to predict seismic displacement responses on all building floors using accelerometer measurements in optimized sensor positions. A recursive neural network based on multiscale attention was proposed [5]. Based on the response mode analysis, the position optimization scheme of monitoring sensor for a deep-water drilling riser was proposed to predict the optimal position according to the principle of maximum response acceleration amplitude by selecting main excitation modes and considering the tilt angle of riser [6]. Wang Xiaoping et al. established a two standard model for the optimal sensor placement, by which gas concentration could reach the given value and the maximum in the shortest time [7]. Bowen et al. selected the position and number of measuring points of a scramjet combustion chamber with a genetic algorithm and obtained the best sensor position and number by using the global optimal search and large-scale parallel computing capability of the genetic algorithm [8]. A probabilistic scheme for sensor monitoring in a discrete nonlinear state space was proposed to estimate the probability density function of the state and the measurement noise covariance, which is considered as a random variable. With the variable decibel Bayesian method, a quantitative index characterizing the measurement quality and satisfactory state estimation was obtained [9].However, the existing studies in sensor placement method enhances unceasingly perfectness, but the precision control is largely limited by the accuracy of the model and the complexity of measurement environment conditions. Due to the crop growth models, greenhouse temperature, forecast model, and so on, there is a certain distance from the actual production requirement of greenhouse.Based on the crop growth model and performance index function, the Pontryagin’s maximum principle (PMP) was used to calculate the optimal set value of greenhouse daytime temperature at different temperature and light levels [10]. The computer optimization system of greenhouse heating control target based on energy consumption prediction model was established [11], which can optimize and calculate the greenhouse temperature setting points during the day and night. A SVM prediction model for the photosynthetic rate was established to realize the increase of CO2 application on demand [12]. All possible combinations of monitoring positions were evaluated in [13] and the best sensor position was selected by many sensors. Two methods were used for the optimization: sensor placement based on error and sensor placement based on entropy. By the former method, the sensor locations can be selected where the monitoring data are close to the reference value, i.e., the average data of all measured positions. By the latter method, sensor locations that are subject to poor environmental control due to external weather conditions can be selected.In view of the disadvantages of reference setting as the average value and the demand objectives of crop growth characteristics, energy consumption, economic benefit, etc., the simulation temperature of indoor environment was calculated by the moving least square (MLS) method, which was proposed systematically by P. Lancaster and K. Salkauskas in the early 1980s [14]. The MLS has two major improvements [15]: (1) it is more convenient to establish the fitting functions instead of the traditional polynomials or other functions and (2) it introduces the concept of compact support, i.e., the value y at point x is regarded as only affected by nodes in the subdomain near point x, which is called the support domain of point x, while nodes outside the support domain have no influence on the value of x. In the process of fitting, different basis functions can be used to obtain different precision, and the same weight function can be used to change the smoothness of the fitting curve.The mobile least squares method is developed based on the traditional least squares method with the high numerical accuracy for good mathematical theory support. This is also unmatched by other meshless methods, such as smooth particle method, unit decomposition method, reconstructed kernel particle method, and radial basis function method [16].Therefore, by the moving least square method, the present study aims to investigate the best monitoring point of the sensor in the greenhouse, determine the most suitable installation position of the sensor in the greenhouse, and improve the control effect of the system temperature control device and the temperature environment quality in the greenhouse.


## 2. Materials and Methods

### 2.1. Multisensor Distribution Model Based on Data Fusion

Multisensor data fusion refers to the fusion of data collected by different knowledge sources and sensors to achieve a better understanding of observed phenomena. The moving least square method selected in this paper belongs to data layer fusion, as shown in Figure1. First, the observation data of all sensors are fused, and then feature vectors are taken from the fused data for judgment and recognition. Data layer fusion does not have the problem of data loss, and the result is the most accurate, but it has a high requirement on system communication bandwidth [17].Figure 1
Flowchart of data layer fusion.


### 2.2. Moving Least Squares

#### 2.2.1. Establishment of Fitting Function

In the local region of a fitting function selected, the fitting function is [18–23]: (1)fx=∑i=1mhixβix=hTxβx.In formula (1), fx=∑i=1mhixβix=hTxβx, hx=h1x,h2x,…,hmxT is called the basis function vector, which is a complete polynomial of order k, and m is the number of terms of the basis function. βx=β1x,β2x,…,βmxT is the undetermined coefficient of the fitting function, which is compared with the traditional least square method. βx≠C, the undetermined coefficient is the spatial coordinate function of x.Consider the weighted discrete normal form of residuals below:(2)J=∑I=1nωx−xIfx−yI2=∑I=1nωx−xIhTxβx−yI2.In formula (2), n is the number of nodes in the solution region, fx is the fitting function, yI is the node value at x=xI, yI=yxI and ωx−xI is the weight function of the node xI. In order to determine the coefficient βx, formula J should take a minimum value, so the partial derivative of its coefficient βx should be calculated as follows:(3)∂J∂β=Axβx−Bxy=0,βx=A−1xBxy.Substitute the following equations into formula (3)(4)Ax=∑I=1nωx−xIhxIhTxI,Bx=ωx−x1hx1,ωx−x2hx2,…,ωx−xnhxn,yT=y1,y2,…,yn.By substituting the formulaβx into f(x), the moving least square function is obtained as follows:(5)fx=∑I=1nθIkxyI=ϑkxy,where ϑkx is called the form function and k represents the order of the basis function.(6)ϑkx=θ1kx,θ2kx,…,θnkx=pTxA−1xBx.


#### 2.2.2. Weight Function

Weight function plays an important role in moving least square method. The weight functionωx−xI in the moving least squares method should be compactly supported, that is, the weight function is not equal to zero in a subdomain of x, but is zero outside this subdomain, which is called the support domain of the weight function (that is, the influence region of x). Generally, the circle is chosen as the supporting domain of the weight function (see Figure 2), and its radius is denoted as Rmax. Due to the compact support of the weight function, only these data points contained in the influence region have an effect on the value of point x.Figure 2
Weight function support domain.The selection process of the influence radius is as follows:(1)
First, the overall characteristic line is obtained through linear fitting;(2)
Cycle each discrete pointx again:(2.1)
Determine the support domain size of discrete pointx;(2.2)
Determine the key nodes contained in the support domain of point x:(2.2.1)
Translate the overall feature line to pointx;(2.2.2)
Calculate the distance between all nodes inx support domain and the overall feature line;(2.2.3)
Select several nodes closest to the overall feature line as key nodes and eliminate other nodes in the support domain;(3)
End the cycle of discrete points and use the moving least square method for curve fitting.The weight function,ωx−xI, should be nonnegative and decreasing monotonically as x−xI2 increases. The weight function should also have some smoothness because the fitting function inherits the continuity of the weight function. The commonly used weight function is spline function, R=x−xI, R¯=R/Rmax then cubic spline weight function is shown in formula (10):(7)ωR¯=23−4R¯2+4R¯3,0≤R¯≤12,43−4R¯+4R¯2−43R¯3,12<R¯≤1,0,R¯>1.Figure3 shows the cubic spline function curve, where the independent variables are the values of R¯, and the dependent variables are the values of the mapped spline function. The influence region should contain enough nodes to make Ax in (5) invertible.Figure 3
Cubic spline function curve.Verified in the literature [15], in using the moving least-square method of curve fitting, the right to choose seven times spline function fitting curve effect is the best, but the large amount of calculation, and according to the example of this chapter, choose three to five times spline weight function was proposed to fit, take the high number of elected five or six times spline weight function. The fitting result is not as good as choosing cubic and quartic spline weight function. In general curve fitting, we can get better fitting results by using cubic spline weight function.The derivation of the square matrixAx invertibility condition of the weight function is as follows: Suppose there is a node xi1,xi2,…,xin in the support domain of point x, and the total number of nodes is N. xi is the i node. Due to Wx=diagw1x,w2x,…,wnx, when node xi is in the support domain of x, there is wi>0, otherwise there is wi=01≤i≤N, so there is a permutation matrix B, which makes BWBT=diagwi1wi2,...,win,0,...,0, so there is A=PTWP=PTBTBWBTBP=BPTBWBTBP.Moreover, the firstn behavior of the matrix BP:(8)PI=p1xi1p1xi2⋮p1xinp2xi1p2xi2⋮p2xin……⋱…pmxi1pmxi2⋮pmxin.WriteW11x=diagwi1x,wi2x,…,winx, P2 as the matrix formed by the last N−n lines of BP, then(9)A=BPTBWBTBP=P1TP2TW11000P1P2=P1TW11P1.BecauseW11 is positive definite, so rankA=rankP1TW11P1=rankP1.If and only if the column vectorPI is linearly independent, px is linearly independent with respect to this node xi1,xi2,…,xin, rankP1=m, so Ax is invertible if and only if our basis vector px is linearly independent with respect to these n nodes. In this way, when px is a two-dimensional linear basis, the column vectors of P1 are linearly independent if and only if there are at least three non-collinear points in the support domain. When px is a two-dimensional quadratic basis, the column vectors of P1 are linearly independent if and only if there are at least six points in the support domain, and these points are not on any one of the conics.


#### 2.2.3. Optimal Sensor Position Model

The method based on moving least squares is used to select sensor locations that best represent the overall greenhouse environment. In addition, statistical indicators such as root mean square error (RMSE) and mean absolute percentage error (MAPE) are calculated to verify the accuracy of the measured data at the location selected by the moving least squares method.RMSE is a measure of the difference between a composite trend and a reference trend. MAPE is a measure of predictive accuracy as a percentage of errors. Therefore, MAPE is used to assess the accuracy of the composite trend relative to the reference trend.The comparison between RMSE and standard deviation is needed: Standard deviation is used to measure the dispersion degree of a set of numbers, while root mean square error is used to measure the deviation between the observed value and the true value. Their research objects and purposes are different, but the calculation process is similar. MAPE is expressed as a percentage, independent of proportion and can be used to compare predictions of different proportions.Using these two statistics, the difference between the reference trend and the combined trend based on the number of sensors installed can be assessed.RMSE and MAPE are calculated using equations, and detailed calculations are shown in formulas (10) and (11).(10)RMSE=∑i=1ZSi−Ci2Z,(11)MAPE=100Z⋅∑i=1ZSi−CiSi.Here,RMSE is expressed in ℃, MAPE is expressed in percentage %, Z is the total amount of data, Si is the value of the reference trend at a particular time, and Ci is the combined value of the trend at a particular time.Compared with the traditional error method, the method based on the lower basis function is adopted to obtain the shape function with higher continuity and compatibility by selecting appropriate weight function, and the numerical error after fitting is smaller. Substitute formulas (10) and (11) into A(x) and B(x) to obtain formulas (12) and (13).(12)Ax=∑I=1nRMSEMAPE×hxIhTxI,(13)Bx=RMSEMAPE1⋅hx1,RMSEMAPE2⋅hx2,…,RMSEMAPEn⋅⋅hxn.


## 2.1. Multisensor Distribution Model Based on Data Fusion

Multisensor data fusion refers to the fusion of data collected by different knowledge sources and sensors to achieve a better understanding of observed phenomena. The moving least square method selected in this paper belongs to data layer fusion, as shown in Figure1. First, the observation data of all sensors are fused, and then feature vectors are taken from the fused data for judgment and recognition. Data layer fusion does not have the problem of data loss, and the result is the most accurate, but it has a high requirement on system communication bandwidth [17].Figure 1
Flowchart of data layer fusion.


## 2.2. Moving Least Squares

### 2.2.1. Establishment of Fitting Function

In the local region of a fitting function selected, the fitting function is [18–23]: (1)fx=∑i=1mhixβix=hTxβx.In formula (1), fx=∑i=1mhixβix=hTxβx, hx=h1x,h2x,…,hmxT is called the basis function vector, which is a complete polynomial of order k, and m is the number of terms of the basis function. βx=β1x,β2x,…,βmxT is the undetermined coefficient of the fitting function, which is compared with the traditional least square method. βx≠C, the undetermined coefficient is the spatial coordinate function of x.Consider the weighted discrete normal form of residuals below:(2)J=∑I=1nωx−xIfx−yI2=∑I=1nωx−xIhTxβx−yI2.In formula (2), n is the number of nodes in the solution region, fx is the fitting function, yI is the node value at x=xI, yI=yxI and ωx−xI is the weight function of the node xI. In order to determine the coefficient βx, formula J should take a minimum value, so the partial derivative of its coefficient βx should be calculated as follows:(3)∂J∂β=Axβx−Bxy=0,βx=A−1xBxy.Substitute the following equations into formula (3)(4)Ax=∑I=1nωx−xIhxIhTxI,Bx=ωx−x1hx1,ωx−x2hx2,…,ωx−xnhxn,yT=y1,y2,…,yn.By substituting the formulaβx into f(x), the moving least square function is obtained as follows:(5)fx=∑I=1nθIkxyI=ϑkxy,where ϑkx is called the form function and k represents the order of the basis function.(6)ϑkx=θ1kx,θ2kx,…,θnkx=pTxA−1xBx.


### 2.2.2. Weight Function

Weight function plays an important role in moving least square method. The weight functionωx−xI in the moving least squares method should be compactly supported, that is, the weight function is not equal to zero in a subdomain of x, but is zero outside this subdomain, which is called the support domain of the weight function (that is, the influence region of x). Generally, the circle is chosen as the supporting domain of the weight function (see Figure 2), and its radius is denoted as Rmax. Due to the compact support of the weight function, only these data points contained in the influence region have an effect on the value of point x.Figure 2
Weight function support domain.The selection process of the influence radius is as follows:(1)
First, the overall characteristic line is obtained through linear fitting;(2)
Cycle each discrete pointx again:(2.1)
Determine the support domain size of discrete pointx;(2.2)
Determine the key nodes contained in the support domain of point x:(2.2.1)
Translate the overall feature line to pointx;(2.2.2)
Calculate the distance between all nodes inx support domain and the overall feature line;(2.2.3)
Select several nodes closest to the overall feature line as key nodes and eliminate other nodes in the support domain;(3)
End the cycle of discrete points and use the moving least square method for curve fitting.The weight function,ωx−xI, should be nonnegative and decreasing monotonically as x−xI2 increases. The weight function should also have some smoothness because the fitting function inherits the continuity of the weight function. The commonly used weight function is spline function, R=x−xI, R¯=R/Rmax then cubic spline weight function is shown in formula (10):(7)ωR¯=23−4R¯2+4R¯3,0≤R¯≤12,43−4R¯+4R¯2−43R¯3,12<R¯≤1,0,R¯>1.Figure3 shows the cubic spline function curve, where the independent variables are the values of R¯, and the dependent variables are the values of the mapped spline function. The influence region should contain enough nodes to make Ax in (5) invertible.Figure 3
Cubic spline function curve.Verified in the literature [15], in using the moving least-square method of curve fitting, the right to choose seven times spline function fitting curve effect is the best, but the large amount of calculation, and according to the example of this chapter, choose three to five times spline weight function was proposed to fit, take the high number of elected five or six times spline weight function. The fitting result is not as good as choosing cubic and quartic spline weight function. In general curve fitting, we can get better fitting results by using cubic spline weight function.The derivation of the square matrixAx invertibility condition of the weight function is as follows: Suppose there is a node xi1,xi2,…,xin in the support domain of point x, and the total number of nodes is N. xi is the i node. Due to Wx=diagw1x,w2x,…,wnx, when node xi is in the support domain of x, there is wi>0, otherwise there is wi=01≤i≤N, so there is a permutation matrix B, which makes BWBT=diagwi1wi2,...,win,0,...,0, so there is A=PTWP=PTBTBWBTBP=BPTBWBTBP.Moreover, the firstn behavior of the matrix BP:(8)PI=p1xi1p1xi2⋮p1xinp2xi1p2xi2⋮p2xin……⋱…pmxi1pmxi2⋮pmxin.WriteW11x=diagwi1x,wi2x,…,winx, P2 as the matrix formed by the last N−n lines of BP, then(9)A=BPTBWBTBP=P1TP2TW11000P1P2=P1TW11P1.BecauseW11 is positive definite, so rankA=rankP1TW11P1=rankP1.If and only if the column vectorPI is linearly independent, px is linearly independent with respect to this node xi1,xi2,…,xin, rankP1=m, so Ax is invertible if and only if our basis vector px is linearly independent with respect to these n nodes. In this way, when px is a two-dimensional linear basis, the column vectors of P1 are linearly independent if and only if there are at least three non-collinear points in the support domain. When px is a two-dimensional quadratic basis, the column vectors of P1 are linearly independent if and only if there are at least six points in the support domain, and these points are not on any one of the conics.


### 2.2.3. Optimal Sensor Position Model

The method based on moving least squares is used to select sensor locations that best represent the overall greenhouse environment. In addition, statistical indicators such as root mean square error (RMSE) and mean absolute percentage error (MAPE) are calculated to verify the accuracy of the measured data at the location selected by the moving least squares method.RMSE is a measure of the difference between a composite trend and a reference trend. MAPE is a measure of predictive accuracy as a percentage of errors. Therefore, MAPE is used to assess the accuracy of the composite trend relative to the reference trend.The comparison between RMSE and standard deviation is needed: Standard deviation is used to measure the dispersion degree of a set of numbers, while root mean square error is used to measure the deviation between the observed value and the true value. Their research objects and purposes are different, but the calculation process is similar. MAPE is expressed as a percentage, independent of proportion and can be used to compare predictions of different proportions.Using these two statistics, the difference between the reference trend and the combined trend based on the number of sensors installed can be assessed.RMSE and MAPE are calculated using equations, and detailed calculations are shown in formulas (10) and (11).(10)RMSE=∑i=1ZSi−Ci2Z,(11)MAPE=100Z⋅∑i=1ZSi−CiSi.Here,RMSE is expressed in ℃, MAPE is expressed in percentage %, Z is the total amount of data, Si is the value of the reference trend at a particular time, and Ci is the combined value of the trend at a particular time.Compared with the traditional error method, the method based on the lower basis function is adopted to obtain the shape function with higher continuity and compatibility by selecting appropriate weight function, and the numerical error after fitting is smaller. Substitute formulas (10) and (11) into A(x) and B(x) to obtain formulas (12) and (13).(12)Ax=∑I=1nRMSEMAPE×hxIhTxI,(13)Bx=RMSEMAPE1⋅hx1,RMSEMAPE2⋅hx2,…,RMSEMAPEn⋅⋅hxn.


## 2.2.1. Establishment of Fitting Function

In the local region of a fitting function selected, the fitting function is [18–23]: (1)fx=∑i=1mhixβix=hTxβx.In formula (1), fx=∑i=1mhixβix=hTxβx, hx=h1x,h2x,…,hmxT is called the basis function vector, which is a complete polynomial of order k, and m is the number of terms of the basis function. βx=β1x,β2x,…,βmxT is the undetermined coefficient of the fitting function, which is compared with the traditional least square method. βx≠C, the undetermined coefficient is the spatial coordinate function of x.Consider the weighted discrete normal form of residuals below:(2)J=∑I=1nωx−xIfx−yI2=∑I=1nωx−xIhTxβx−yI2.In formula (2), n is the number of nodes in the solution region, fx is the fitting function, yI is the node value at x=xI, yI=yxI and ωx−xI is the weight function of the node xI. In order to determine the coefficient βx, formula J should take a minimum value, so the partial derivative of its coefficient βx should be calculated as follows:(3)∂J∂β=Axβx−Bxy=0,βx=A−1xBxy.Substitute the following equations into formula (3)(4)Ax=∑I=1nωx−xIhxIhTxI,Bx=ωx−x1hx1,ωx−x2hx2,…,ωx−xnhxn,yT=y1,y2,…,yn.By substituting the formulaβx into f(x), the moving least square function is obtained as follows:(5)fx=∑I=1nθIkxyI=ϑkxy,where ϑkx is called the form function and k represents the order of the basis function.(6)ϑkx=θ1kx,θ2kx,…,θnkx=pTxA−1xBx.


## 2.2.2. Weight Function

Weight function plays an important role in moving least square method. The weight functionωx−xI in the moving least squares method should be compactly supported, that is, the weight function is not equal to zero in a subdomain of x, but is zero outside this subdomain, which is called the support domain of the weight function (that is, the influence region of x). Generally, the circle is chosen as the supporting domain of the weight function (see Figure 2), and its radius is denoted as Rmax. Due to the compact support of the weight function, only these data points contained in the influence region have an effect on the value of point x.Figure 2
Weight function support domain.The selection process of the influence radius is as follows:(1)
First, the overall characteristic line is obtained through linear fitting;(2)
Cycle each discrete pointx again:(2.1)
Determine the support domain size of discrete pointx;(2.2)
Determine the key nodes contained in the support domain of point x:(2.2.1)
Translate the overall feature line to pointx;(2.2.2)
Calculate the distance between all nodes inx support domain and the overall feature line;(2.2.3)
Select several nodes closest to the overall feature line as key nodes and eliminate other nodes in the support domain;(3)
End the cycle of discrete points and use the moving least square method for curve fitting.The weight function,ωx−xI, should be nonnegative and decreasing monotonically as x−xI2 increases. The weight function should also have some smoothness because the fitting function inherits the continuity of the weight function. The commonly used weight function is spline function, R=x−xI, R¯=R/Rmax then cubic spline weight function is shown in formula (10):(7)ωR¯=23−4R¯2+4R¯3,0≤R¯≤12,43−4R¯+4R¯2−43R¯3,12<R¯≤1,0,R¯>1.Figure3 shows the cubic spline function curve, where the independent variables are the values of R¯, and the dependent variables are the values of the mapped spline function. The influence region should contain enough nodes to make Ax in (5) invertible.Figure 3
Cubic spline function curve.Verified in the literature [15], in using the moving least-square method of curve fitting, the right to choose seven times spline function fitting curve effect is the best, but the large amount of calculation, and according to the example of this chapter, choose three to five times spline weight function was proposed to fit, take the high number of elected five or six times spline weight function. The fitting result is not as good as choosing cubic and quartic spline weight function. In general curve fitting, we can get better fitting results by using cubic spline weight function.The derivation of the square matrixAx invertibility condition of the weight function is as follows: Suppose there is a node xi1,xi2,…,xin in the support domain of point x, and the total number of nodes is N. xi is the i node. Due to Wx=diagw1x,w2x,…,wnx, when node xi is in the support domain of x, there is wi>0, otherwise there is wi=01≤i≤N, so there is a permutation matrix B, which makes BWBT=diagwi1wi2,...,win,0,...,0, so there is A=PTWP=PTBTBWBTBP=BPTBWBTBP.Moreover, the firstn behavior of the matrix BP:(8)PI=p1xi1p1xi2⋮p1xinp2xi1p2xi2⋮p2xin……⋱…pmxi1pmxi2⋮pmxin.WriteW11x=diagwi1x,wi2x,…,winx, P2 as the matrix formed by the last N−n lines of BP, then(9)A=BPTBWBTBP=P1TP2TW11000P1P2=P1TW11P1.BecauseW11 is positive definite, so rankA=rankP1TW11P1=rankP1.If and only if the column vectorPI is linearly independent, px is linearly independent with respect to this node xi1,xi2,…,xin, rankP1=m, so Ax is invertible if and only if our basis vector px is linearly independent with respect to these n nodes. In this way, when px is a two-dimensional linear basis, the column vectors of P1 are linearly independent if and only if there are at least three non-collinear points in the support domain. When px is a two-dimensional quadratic basis, the column vectors of P1 are linearly independent if and only if there are at least six points in the support domain, and these points are not on any one of the conics.


## 2.2.3. Optimal Sensor Position Model

The method based on moving least squares is used to select sensor locations that best represent the overall greenhouse environment. In addition, statistical indicators such as root mean square error (RMSE) and mean absolute percentage error (MAPE) are calculated to verify the accuracy of the measured data at the location selected by the moving least squares method.RMSE is a measure of the difference between a composite trend and a reference trend. MAPE is a measure of predictive accuracy as a percentage of errors. Therefore, MAPE is used to assess the accuracy of the composite trend relative to the reference trend.The comparison between RMSE and standard deviation is needed: Standard deviation is used to measure the dispersion degree of a set of numbers, while root mean square error is used to measure the deviation between the observed value and the true value. Their research objects and purposes are different, but the calculation process is similar. MAPE is expressed as a percentage, independent of proportion and can be used to compare predictions of different proportions.Using these two statistics, the difference between the reference trend and the combined trend based on the number of sensors installed can be assessed.RMSE and MAPE are calculated using equations, and detailed calculations are shown in formulas (10) and (11).(10)RMSE=∑i=1ZSi−Ci2Z,(11)MAPE=100Z⋅∑i=1ZSi−CiSi.Here,RMSE is expressed in ℃, MAPE is expressed in percentage %, Z is the total amount of data, Si is the value of the reference trend at a particular time, and Ci is the combined value of the trend at a particular time.Compared with the traditional error method, the method based on the lower basis function is adopted to obtain the shape function with higher continuity and compatibility by selecting appropriate weight function, and the numerical error after fitting is smaller. Substitute formulas (10) and (11) into A(x) and B(x) to obtain formulas (12) and (13).(12)Ax=∑I=1nRMSEMAPE×hxIhTxI,(13)Bx=RMSEMAPE1⋅hx1,RMSEMAPE2⋅hx2,…,RMSEMAPEn⋅⋅hxn.


## 3. Results and Discussion

### 3.1. Descriptive Analysis of Environmental Data

The internal environment of the experimental greenhouse was monitored, and temperature sensors were installed at 15 positions in the greenhouse [24], SHT 71, Sensirion, a Switzerland sensor, error range ±0.1 °C, as shown in Figure 4. The measured data were obtained by experimental temperature collection in summer (May-June), and the broken line graph of temperature data relative to position coordinates was drawn, as shown in Figure 5. After excluding missing data and rough error, the data were substituted into the moving least square model for verification experiment. Specific data are shown in Table 1.Figure 4
Sensor position.Figure 5
Measured temperature data.Table 1
Specific measurement data.
LocationTemperature measurement data (°C)t129.5t229.4t329.8t429.6t529.3t630.2t730.0t829.3t929.2t1029.6t1131.1t1230.5t1329.3t1430.5t1530.4The minimum value (°C)29.20The maximum value (°C)31.10The average (°C)29.85The standard deviation0.57The range1.90In order to verify the effectiveness of the moving least square method, this paper selects different weight functions for comparison simulation under the condition of using the same bar function and quadratic basis respectively. Suppose that during the simulation, the range of influence area is 0.3 m, and samples are taken every 10 minutes. Under the same conditions, three different weight functions are simulated and compared, and the simulation results are output as simulated temperature curves. The results are shown in Figure6, which is a simulated data graph by the moving least square method. Figure 7 is the actual measurement data connection diagram. The error function is analyzed, and the results are shown in Figure 8 and Table 2. The ordinate of Figures 6 and 7 is temperature in °C.Figure 6
Moving least square simulation curve.Figure 7
Error method to simulate the curve.Figure 8
Relative error.Table 2
Specific error data.
LocationThe relative error1+x1+x+x21+x+x2+ext10.030.040.02t2−0.13−0.13−0.13t30.220.200.18t4−0.02−0.05−0.08t5−0.35−0.36−0.38t60.510.540.54t70.270.330.34t8−0.49−0.40−0.39t9−0.65−0.58−0.56t10−0.34−0.29−0.28t111.081.081.07t120.380.350.36t13−0.91−0.94−0.84t140.230.230.42t150.060.08−0.02The minimum value (°C)1.081.081.07The maximum value (°C)−0.91−0.94−0.84The average (°C)0.3780.3730.374As can be seen from Figure8, when the system model is established and the weight function characteristics are known, the moving least squares method has a good curve fitting accuracy and memory stability. However, when the weight function changes, its error characteristics will change. It can be seen from Figure 7 that the weight function with higher order has better fitting effect. When the system adopts the moving least square method, the error data of T11 and T13 are excluded due to the fact that there are also sensors in the vent. During the whole simulation process, according to the analysis and calculation of the error and combined with the data in Table 2, the optimal sensor can be located at the T10 sensor with the error closest to the fitting value, namely, the central sensor.


### 3.2. Validation of Experimental Data

In order to further verify the practicability of the proposed algorithm and consider the feasibility of the experiment, root mean square error (RMSE) and mean absolute percentage error (MEAN absolute percentage error) of statistical indicators are used for experimental verification. The results are shown in Table3 and Figure 9.Table 3
Statistical index.
LocationStatistical index1+x1+x+x21+x+x2+exRMSEMAPERMSEMAPERMSEMAPEt10.030.0060.040.0090.020.004t20.090.030.090.030.090.03t30.140.080.130.080.120.07t40.120.080.120.090.110.09t50.190.160.190.170.200.17t60.270.280.280.290.280.29t70.270.340.290.360.290.37t80.300.450.300.450.300.46t90.360.600.340.590.340.59t100.360.670.340.650.330.65t110.470.910.460.880.450.88t120.460.990.450.960.440.96t130.511.200.501.170.491.15t140.491.250.491.220.481.24t150.481.260.471.240.461.24Figure 9
Quadric curve fitted out.As shown in Table3, the error variation trend of the data of statistical indicators and is basically the same as that of the moving least squares method, that is, the position prediction model based on the moving least squares method is verified. At the same time, it can be seen from the temperature simulation surface shown in Figure 9 that the temperature measurement error of the sensor in the center of the greenhouse is consistent with the trend of the simulation error [25, 26].


## 3.1. Descriptive Analysis of Environmental Data

The internal environment of the experimental greenhouse was monitored, and temperature sensors were installed at 15 positions in the greenhouse [24], SHT 71, Sensirion, a Switzerland sensor, error range ±0.1 °C, as shown in Figure 4. The measured data were obtained by experimental temperature collection in summer (May-June), and the broken line graph of temperature data relative to position coordinates was drawn, as shown in Figure 5. After excluding missing data and rough error, the data were substituted into the moving least square model for verification experiment. Specific data are shown in Table 1.Figure 4
Sensor position.Figure 5
Measured temperature data.Table 1
Specific measurement data.
LocationTemperature measurement data (°C)t129.5t229.4t329.8t429.6t529.3t630.2t730.0t829.3t929.2t1029.6t1131.1t1230.5t1329.3t1430.5t1530.4The minimum value (°C)29.20The maximum value (°C)31.10The average (°C)29.85The standard deviation0.57The range1.90In order to verify the effectiveness of the moving least square method, this paper selects different weight functions for comparison simulation under the condition of using the same bar function and quadratic basis respectively. Suppose that during the simulation, the range of influence area is 0.3 m, and samples are taken every 10 minutes. Under the same conditions, three different weight functions are simulated and compared, and the simulation results are output as simulated temperature curves. The results are shown in Figure6, which is a simulated data graph by the moving least square method. Figure 7 is the actual measurement data connection diagram. The error function is analyzed, and the results are shown in Figure 8 and Table 2. The ordinate of Figures 6 and 7 is temperature in °C.Figure 6
Moving least square simulation curve.Figure 7
Error method to simulate the curve.Figure 8
Relative error.Table 2
Specific error data.
LocationThe relative error1+x1+x+x21+x+x2+ext10.030.040.02t2−0.13−0.13−0.13t30.220.200.18t4−0.02−0.05−0.08t5−0.35−0.36−0.38t60.510.540.54t70.270.330.34t8−0.49−0.40−0.39t9−0.65−0.58−0.56t10−0.34−0.29−0.28t111.081.081.07t120.380.350.36t13−0.91−0.94−0.84t140.230.230.42t150.060.08−0.02The minimum value (°C)1.081.081.07The maximum value (°C)−0.91−0.94−0.84The average (°C)0.3780.3730.374As can be seen from Figure8, when the system model is established and the weight function characteristics are known, the moving least squares method has a good curve fitting accuracy and memory stability. However, when the weight function changes, its error characteristics will change. It can be seen from Figure 7 that the weight function with higher order has better fitting effect. When the system adopts the moving least square method, the error data of T11 and T13 are excluded due to the fact that there are also sensors in the vent. During the whole simulation process, according to the analysis and calculation of the error and combined with the data in Table 2, the optimal sensor can be located at the T10 sensor with the error closest to the fitting value, namely, the central sensor.


## 3.2. Validation of Experimental Data

In order to further verify the practicability of the proposed algorithm and consider the feasibility of the experiment, root mean square error (RMSE) and mean absolute percentage error (MEAN absolute percentage error) of statistical indicators are used for experimental verification. The results are shown in Table3 and Figure 9.Table 3
Statistical index.
LocationStatistical index1+x1+x+x21+x+x2+exRMSEMAPERMSEMAPERMSEMAPEt10.030.0060.040.0090.020.004t20.090.030.090.030.090.03t30.140.080.130.080.120.07t40.120.080.120.090.110.09t50.190.160.190.170.200.17t60.270.280.280.290.280.29t70.270.340.290.360.290.37t80.300.450.300.450.300.46t90.360.600.340.590.340.59t100.360.670.340.650.330.65t110.470.910.460.880.450.88t120.460.990.450.960.440.96t130.511.200.501.170.491.15t140.491.250.491.220.481.24t150.481.260.471.240.461.24Figure 9
Quadric curve fitted out.As shown in Table3, the error variation trend of the data of statistical indicators and is basically the same as that of the moving least squares method, that is, the position prediction model based on the moving least squares method is verified. At the same time, it can be seen from the temperature simulation surface shown in Figure 9 that the temperature measurement error of the sensor in the center of the greenhouse is consistent with the trend of the simulation error [25, 26].


## 4. Conclusion

In this paper, a simulation system based on the moving least square method is proposed, which overcomes the divergence problem of traditional error analysis under different weight functions. Based on the moving least square method, the optimal sensor position algorithm selects the corresponding weight function by judging the statistical index. When the error appears divergence, the corresponding position can be eliminated in time to avoid mismeasurement. The shortcoming of the algorithm is that the error stability of the moving least square method needs to be further improved when the weight function of low order is adopted. Therefore, in this paper, the moving least square method is used to study the best monitoring point of the sensor in the greenhouse, and determine the most suitable installation position of the sensor in the greenhouse, and improve the control effect of the system temperature control device and the temperature environment quality in the greenhouse.An adaptive control model can be added to improve the control accuracy of greenhouse parameters. In order to further reduce static errors, a genetic factor proposed in [27] is used to summarize the historical errors, thus effectively improving the system stability. We can take advantage of the adaptive control system for the later research of the estimation error [28] and minimize the cost function of the fixed time by adaptive control scheme, in order to shorten the time of the system state to reach sliding mode surface [29] and the use of the finite time adaptive algorithm based on parameter estimation error [30], make more accurate measurement scheme, etc. In order to improve the stability of temperature measurement system, the Lyapunov stability theoretical analysis method proposed by [31] can be used.



---

*Source: 3258549-2022-04-28.xml*