Design of Multi-Rate Multi-Zone Wireless Fuzzy Temperature Control System for Greenhouse Application

sensor sampling rate (SSR) may be an effective and crucial field in networked control systems. Changing sensor sampling period after designing the networked control system is a critical matter for the stability of the system. In this article, a wireless networked control system with multi-rate sensor sampling is proposed to control the temperature of a multi-zone greenhouse. Here, a behavior based Mamdany fuzzy system is used in three approaches, first is to design the fuzzy temperature controller, second is to design a fuzzy gain selector and third is to design a fuzzy error handler. The main approach of the control system design is to control the input gain of the fuzzy temperature controller depending on the current zone and current sensor rate for each zone. Due to the low input gain of the fuzzy controller, the steady state output error of the greenhouse temperature is in the range (0.55 – 11.22) % when the system using five sensors of different sampling rates and in the range (2.43 16.74) % when the system using five sensors with the same sampling rates. Next, after designing the fuzzy error handler, this error doesn’t exceed 1.6%, but in most cases it is less than 0.15%. The work is Simulink designed and implemented using Matlab R2012b. The Zigbee wireless network is proposed for the system, it is implemented in Matlab using True time 2.0 library.


INTRODUCTION
As a forked field, different studies were introduced in the networked control systems. (Ismail & AL-Jewari, 2014) designed a multi-choice fuzzy control system to control temperature and humidity in multi-zone Greenhouse over multi-hope wireless network. This system used external climate; if possible, as a first choice to tune the temperature or humidity depending on the mode of operation in each zone, then if it is needed, use cooling-heater and/or humidifier-dehumidifier to reach the desired value. They used a fuzzy error correction to overcome the external disturbances, with steady state error less than 0.1%. This article will develop this system to produce a multi-rate sensor sampling frequency. In multi-rate systems, (Safari et al., 2014) used multi-sensor system to observe a linear system, each sensor having a different sampling rate. They used kalman filter for each sensor, the output of the kalman filters are fused by a neural network to estimate the state vector of the system. (Kim et al., 2006) suggested a dual-rate digital control for the discrete-time Takagi-Sugeno fuzzy system for a class of nonlinear systems. The stability conditions are derived in terms of the linear matrix inequalities (LMI) using Lyapunov asymptotic stability to control the difference of rates between digital to analog (D/A) and analog to digital (A/d) converters. (Sala et al., 2009) used a networked control system based on retuning a multi-rate PID controller with detecting a variable delays. In this system, the controller is directly connected with the actuator, where is the sensor sends its samples through the network. The basic idea is minimizing the first-order Taylor terms of a performance measure via gain scheduling, to make the controller gains delay dependent. Because the network delay is time-variant, so the stability is considered in terms of LMI. (Zhu et al., 2016) modeled the multi-rate NCS with short time delay and packet dropout as switched stochastic system when the actuator is event driven, and switched system when the actuator is time driven and state noise is not considered. They proposed a state feedback controller to guarantee the stability of such systems using LMI. On the other hand, in sampling delay and packet losses approach, (Ko et al., 2011) used the timedelayed system approach, The network-induced delays are modeled as two additive time-varying delays in the closed-loop system. They proposed an appropriate Lyapunov functional for stability criteria and applied Jensen inequality lemma to the integral terms that are derived from the derivative of the Lyapunov functional. (Montestruque & Antsaklis, 2004) used model-based networked control systems (MB-NCSs), an estimate of the plant state behavior is produced by an explicit model of the plant. The transmission time is varying either within a time interval or are driven by a stochastic process with identically independently distributed and Markov-chain driven transmission times are studied. Lyapunov stability is derived with sufficient conditions. For stochastically modeled transmission times almost sure stability and mean-square sufficient conditions for stability are introduced. As with (Montestruque & Antsaklis, 2004), (Zhang et al., 2009) used an estimator. They studied the robust stability of a networked control system via a fuzzy estimator (FE), where the controlled plant is a class of nonlinear systems with external disturbances, which can be represented by a Takagi-Sugeno fuzzy model. Both network-induced delay and packet dropout are concerned. To reduce the network burden, the FE is used to estimate the states of the controlled plant. They also attenuated the influence of modeling errors and external disturbances on the system. The sufficient condition for the robust stability with H∞ performance of the closed-loop system is obtained. However, in multi-rate sensor approach; (Lin & Sun, 2016) proposed a non-augmented state estimator in a system that updates its state uniformly and samples the measurements randomly. During the state update period, a developed state model suggested to depict the dynamics of the system. This system deals with different sensors that can have different sampling rates and each one can have asynchronous sampling rates. In case of multi-sensor system; an optimal and suboptimal fusion estimator at the state update points is proposed. In general, the term (multi-rate control system), refers to the difference between the sampling frequency of the sensor, controller and actuator. In this article, this term refers to the range of sampling frequencies that a group of sensors can operate simultaneously in a single-core multizone control system. Practically, it is convenient to have flexibility in replacing sensors in a control system when it is needed, without the constraint of sampling frequency. Also, it is a good idea to change the sampling rate of any sensor in a system at any time when the network has a heavy burden of communication data, without losses the stability of the whole system. More over; losses of sampling data or control signal in the network, means losses of system state update according to this instant. The same effect may be caused by packet delay for a dedicated time interval. From these motivations, this article is proposed to design a wireless fuzzy control system that controls the temperature of multi-zone greenhouse (GH). Each zone has its own sensor; each sensor can operate in a range of sampling rate. As a behavior based fuzzy control system, it is independent on the system model. But, for the simulation purposes the GH model is used here, with the seconds as a time measurement (Ismail & AL-Jewari, 2014). This type of control strategy is necessary for multi-zone system; each has its own SSR to be controlled simultaneously. The multi-rate sensor sampling gives the system an operation flexibility, within the range (1-20) sample/second which leads to reduce the burden on the network communication. The paper is organized as follows: section 2, System Description. Section 3, Design of the Fuzzy Temperature Controller (FTC). Section 4, Wireless Fuzzy Control Systems. section 5, Design of the Fuzzy Gain Selector (FGS). Section 6, Design of the Fuzzy Error Handler (FEH). Section 7, Enhanced Wireless FTC (EWFTC) System. Section 8, System Comparison. Section 9, Conclusion.

SYSTEM DESCRIPTION
The networked system is to control the temperature of a multi-zone GH using fuzzy inference system via a ZigBee wireless network. The block diagram of such system is shown in Fig. 1. The Simulink implementation of the system will be the same as that system with (Ismail & AL-Jewari, 2014). Also the external disturbances will not be discussed her, as it is solved there. The contribution is to operate each zone with a multi-rate sensor sampling and to ensure the stability of each zone simultaneously. Another reason, is to reduce the steady state error (SSE) due to the decreasing of the SSR. A one core fuzzy system called a fuzzy temperature controller (FTC) with two inputs (error and change of error), to be available to control the multi-zone GH, its input gain (eg) value will be assigned differently for each zone depending on its SSR. A fuzzy gain selector (FGS) is proposed to assign a proper gain for each zone, where each sensor sends its sampling rate with its temperature's reading in the same packet to the FGS, which is deciding the proper gain to be used by the FTC. To stabilize the GH zone, if the SSR is decreased, the input gain (eg) of the FTC is decreased too for appropriate value. Experimentally founded in fuzzy inference system, that if the input gain (eg) is decreased bellow some value, the SSE is increased, and cannot be avoided even if the structure of the system and membership functions are retuned. For this reason, and because of the error that produced due to the packet losses, a fuzzy error handler (FEH) is introduced to overcome these errors. The second input of the FTC is the change of error (e) which is the difference between the current and previous error values (or the difference between the current and previous temperature values). In proposed multi-zone GH system, the previous temperature value (Tgi-p) is either stored in the FTC core or in the corresponding sensor and it is transmitted with the current value (Tgi) for the ith zone.

Design of the Fuzzy Temperature Controller (FTC)
Two input signals are used to fed the FTC, the error (e) and change of error (e) signals: Where, Ts, Tg, ek and ek-1 are the desired temperature, greenhouse temperature, present and previous error signals respectively. The error is normalized by dividing it by (100 -0), the range of excessive controlled temperature. The output signal of the fuzzy temperature controller is (u). The input linguistic variables (e) and (e), each are fuzzified into seven Gaussian membership functions, Fig. 2, while the output linguistic variable is fuzzified into three single-tone membership functions, Fig. 3. The rule base of the fuzzy controller is shown in Table 1, with these membership functions, there are 49 rules, where the membership functions are described next.

Input membership functions:
Positive Big: Positive Small: Negative Mid: Negative Big: Where x is either e or .e.

Output membership functions:
Heating: TH = 1 Zero: TZ = 0 Cooling: TC = -1    TZ TC TC TC TC TC TC  PM TH TZ TC TC TC TC TC  PS TH TH TZ TC TC TC TC  ZE TH TH TH TZ TC TC TC  NS TH TH TH TH TZ TC TC  NM TH TH TH TH TH TZ TC  NB TH TH TH TH TH TH TZ

Inference Mechanism:
The MIN operator is used to represent the AND operation in the premise part between the inputs of each rule to produce the rule certainty. And the PRODUCT operator is used to combine rule certainty of the premise part with the consequent part for each rule. The defuzzification process is the center of average (COAv) as follows: where R is the number of the rules in the rule base. µi is the input membership function of the ith rule. bi is the center of the output membership function of the ith rule. sup(.) is the supermom, the least upper value.

Input and Out Gains:
Depending on the controlled system requirements, the fuzzy controller gains will be selected. These gains are: 1. Error signal gain (eg).

Wireless Fuzzy Temperature Control Systems 4.1 Wireless Fuzzy Temperature Control System with One Sensor
Different sensor sampling rates are studied, for each case eg = 0.01 and ug = 100000, while eg is adjusted to get the best response, as shown in Table 2, each case with its response figure.
As the sensor sampling interval is increased from (1-20)s, the sequences of the control signal (u) will be slower and cannot be able to subsequent the excessive change of the GH temperature, then; the maximum peak becomes greater and the system may be oscillated or uncontrolled. To overcome this effect, the input gain (eg) is decreased to a proper value. But, due to the lower gain, it is clear that the steady state error is increased from (100-99.45 = 0.55)% to (100-97.1 = 2.9)% when the desired value Ts = 100. On the other hand, when Ts = 0; the steady state error is between (0.15, -0.2)%, and will reach 0 for the next time.  . System response for one sensor, 1s sampling rate. Figure 5. System response for one sensor, 5s sampling rate.  Ts __ Tg ---

Wireless Fuzzy Temperature Control System with Five Sensors of Different Sampling Rates
When five sensors processed simultaneously, the packet collision and losses will effect on system stability. Therefor eg will be readjusted to get the best response. eg and ug stay unchanged. Table 3 shows these system readings. Fig. 9 shows system simultaneous response for combined five sensors. As in section 4.1, when the sensor sampling interval is increased from (1-20) s, the maximum peak becomes greater and the system may be oscillated or uncontrolled. Therefore, the input gain (eg) is decreased to a proper value for each rate and this causes the steady state error to be increased from (100-99.45 = 0.55) % to (100-88.78 = 11.22) % when the desired value Ts = 100. Again, when Ts = 0; the steady state error is between (0, 0.09) %, and will reach 0 for the next time. As compared with section 4.1, the steady state error at Ts = 100 is become greater due to the more decreased in input gain (eg); except the case when SSR = 1s, where there is no change.  Figure 8. System response for one sensor, 20s sampling rate. Figure 9. System response for combined five sensors, (1-20) s sampling rates.
As compared with the single sensor system, the five sensors system required more decreasing in the input gain (eg) to control the system due to the packets collision. In Fig. 10 which is the focused view of the Fig. 9, the row points to the GH response (Tg) where SSR = 20s. At this point where the time sequence is 220s, the sensor should send a new reading to the controller to update the next state of its GH. In fact the sensor's packet was not sent due to the collision, and this GH will not change its state until the next sensor sampling at time sequence 240s. Therefore, the state period will be 40s instead of 20s. Fig. 11 shows the time line of the controller and five sensors when they are sending packets over the network. In time; so, all packets are dropped out due to the collision. Then, they are remaining at poised state to sense the network and try randomly to resend the same packets. Therefore, at point 2: only A and E try to resend their packets simultaneously and dropout again. Next, E will send its packet, C and D in collision then D after F will send, after that C succeeds to send, then F and F again. During this interval from point 2 till point 3, A exhausts its time of resending its packet, where the network is busy along this time in random fashion. Therefore, at point 3, A fails to send its packet and the data (sensor reading) will be lose. So, as a result there is no change in that GH state as it is clear in Fig. 10 at time 220s.

Wireless Fuzzy Temperature Control System with Five Sensors all of the Same
Sampling Rates Table 4 shows the system readings when all sensors have the same sampling rates, for each rate the corresponding response figure. In this case when all sensors operate at the same rate simultaneously, the probability of collisions is increased and more losses in the sensors readings which leads to an oscillation or unexpected behavior as follows: 1-At SSR = 1s: because of higher input gain (eg = 2), the system exponentially oscillates in each zone then enters a stable steady state. 2-At SSR = 5s: one of the zones has unexpected behavior when Ts = 0 and approximately at the instant 213s. 3-At SSR = 10s: at normal case, the system behaves well Fig. 15.a. But, in more test, one of the zones has unexpected behavior at rising edge of Ts (from -100 to 0) and approximately the instant 1840s Fig. 15.b. 4-At SSR = 15s and 20s: the same behavior as in the SSR = 5.
Table4. Tg readings for five sensors system, all of the same sampling rates.    Ts __ All Tg Rates= 1s --- Figure 16. System response for combined five sensors, all 15s sampling rate. Figure 17. System response for combined five sensors, all 20s sampling rate.

Tuning Wireless Fuzzy Temperature Control System with Five Sensors all of the Same Sampling Rates
After tuning eg, Table 5 shows the system readings when all sensors have the same sampling rates, for each rate the corresponding response figure. The system is stable in each zone and at any SSR value, but it is clear that at Ts = 100, the steady state error is between (100 -97.57 = 2.43)% to (100 -83.3 = 16.7)%. This error will be handled in the next sections.
Table5. Tg readings for five sensors tuned system, all of the same sampling rates.  Figure 19. Tuned system response for combined five sensors, all 5s sampling rate.

Design of the Fuzzy Gain Selector (FGS)
Three reasons that motivate the design of the FGS: 1. Any Greenhouse zone can use and replace any sensor sampling rate. 2. Use a continuous range for sensors sampling rate, any value (from 1 to 20) sample/second. 3. With single core multi-zone multi-rate control system, there must be a methodology to deal with each zone depending on its rate and select the corresponding gain.
Each sensor will send its operating rate to the fuzzy control system which receives this information and convert it to the control signal called sensor rate signal (SR). The FGS specifications are: 1. The input signal SR.
( 3) Connecting FGS with the FTC is shown in Fig. 25.

Design of the Fuzzy Error Handler (FEH)
As shown in Table 5 and corresponding figures, there is a steady state error that is produced from the output of the FTC. It is increased as sensor sampling rate is increased. It is asymmetric, where it is approximately zero when Ts = 0 and it reaches its maximum value when Ts = 100. Practically examined, that is the steady state error cannot be handled effectively, even if the membership functions are changed in its type, increased in its number or shifting each one of them. For this reason, the FEH is proposed to compensate the effect of this error. Its specifications are as follows: 1. The input signal SR.
2. The output signal, fuzzy error handling signal (FE). 3. The same as FGS in section (5) point (3), five triangular input membership functions, as shown in Fig. 23. 4. Depending on the steady state error in Table 5, fore single tone output membership functions, as shown in Fig. 26 ( 3) 8. The FE signal is added to the error input signal of the FTC iff Ts > 0. The connection of the FEH with the FTC is shown in Fig. 27.

Enhanced Wireless FTC (EWFTC) System
The block diagram of EWFTC system that combining the three fuzzy systems is shown in Fig. 28, which represents the finalization of the system. In this enhanced fuzzy system, for each zone the corresponding sensor samples the temperature at any rate of interval between (1-20)s and sends packets over a wireless network that contains the current and previous temperatures (Tgi, Tgi_p) and the corresponding sampling rate. The system will assign the appropriate input gain eg for the FTC for each input signal depending on the sensor's rate.
Figs. 29-37 shows system response of the EWFTC with five GH zones operate at different rates.
The system is stable and the steady state error is handled for different Ts values as it is clear in Fig.  37. In EWFTC the steady state error doesn't exceed 1.6%, but in most cases it is less than 0.15%.      Figure 36. System response of the EWFTC with five GH sensors all of 2.8s rate. Figure 37. System response of the EWFTC with five GH sensors rates (1s, 5s, 10s, 15s, 20s)

System Comparison
The design method of the EWFTC is completely different from the regular design approaches that are tightly collected by various mathematics fields. Multi-rate Support Support

CONCLUSION
A simple and effective control strategy to deal with multi-zone of multi-rate sensor sampling frequency over the wireless network can be implemented with the standard fuzzy inference system. As was seen in the introduction, the complicated mathematics and calculations that was presented by different articles can be avoided by using the behavior based fuzzy control system. The fuzzy inference system can be effectively used in different applications as was implemented here. Where it is used to control the stability of the system, it can deal with different disturbances such as that is produced by changing sensor sampling rate. It is used in two other approaches, first as a fuzzy gain selector to tune the input gain of the FTC, and second as a fuzzy error handler to process system's steady state error. This error represents a degradation in FTC performance, where when reducing the input gain below some value (depending on the type and number of the membership functions and other parameters such as inference mechanism), the system cannot reach the desired response in the steady state case. This case motivates the use of FEH.