# Proposed Fuzzy-NN Algorithm with LoRa Communication Protocol for Clustered Irrigation Systems
## 3 Irrigation Systems Algorithms  
There are different types of algorithms that can be used by the farmer at the AS. All these algorithms are mainly implemented at the microcontroller unit and they receive information about the thresholds and metric values from the AS. A short description of existing irrigation algorithms follows:  
* Least Watering Algorithm (LWA): This algorithm bases its \"on\" watering decision when at least a number of two soil moisture sensors out of \(N\) sensors (\(N>2\)), values are above a _Athres_ threshold value set by the farmer [2; 15; 16]. * Precise Time Controlled algorithm (PTC): This algorithm is an assisted algorithm either by the farmer or an external mechanism such as meteorological predictions. The farmer/external mechanism sets at the Application Service (AS) the precise time per month that the actuator will be set to the \"on\" state as well as the time duration that it will remain at this state. This algorithm may also use sensor measurements as feedback in order to perform adaptively, reducing daily watering time. It is the case that the sensors indicate an excitation value above statically set sensory thresholds PTC\({}_{\text{thres}}\)[3; 10; 13]. * Majority Vote Algorithm (MVA): MVA algorithm is similar to the LWA algorithm and requires more than two sensors (a majority of sensors to approve irrigation). MVA algorithm sets the actuator to the \"on\" position when the average value of the soil moisture sensors is above an _Athres_ threshold value. MVA _Athres_ and lower-upper bound sensor values are set by the farmer using the AS web interface [2; 6]. For error detection, the MVA algorithm uses two boundary values, the Upper and Lower sensor value bounds. If the sensor's value is above or below of the Upper and Lower values accordingly then this sensor is not taken into account by the MVA for the actuator \"on\"/\"off\" selection process. * Exponential Weight Moving Watering Algorithm (EWMWA):This algorithm requires at least one soil moisture sensor and averages its sensor values based on the following equation: \(Sv=a\cdot Sv_{c}+b\cdot Sv_{avg}\), where coefficient \(b=1-a\). Coefficient a is a parameter that adjusts the current soil moisture sensor value influence on the final sensor value assessment, over the average sensor value. Coefficient parameter a value is between \(0.1<a<0.9\) and it is set by the farmer at the AS web interface. In case of multi-sensors, EWMWA algorithm follows the LWA algorithm approach and sets the actuator to the \"on\" position when the majority of sensor values ceil (\(N/2\)) + 1 is above _Athres_ threshold value set by the farmer. Average sensor values are reset daily and re-calculated at the AS, based on the previous day measurements [6; 14]. * **Proportional Integral Control algorithm (PIC):** This is a control loop feedback process based on an average daily water consumption metric value measured in It or m\({}^{3}\). The PIC algorithm does not use feedback information from soil moisture sensors but from a flow meter sensor placed before the actuator. In OWS architecture the PIC algorithm can be used at the flow meter placed before the actuator for the purpose of identification and reporting of erroneous states. The PIC algorithm uses a maximum water consumption metric \(Wm\), set by the farmer at the AS. The PIC algorithm will reach up to that daily water consumption. In existing implementation of the PIC algorithm the watering time is also statically set by the farmer at the AS. When the PIC algorithm sets the actuator to the \"on\" state it starts to measure water consumption using the flow meter value \(Fv\). When the daily \(Fv\) value is close to the \(Wm\) value or exceeds this value, then an error metric is measured as \(Error_{i}=Wv-Fv/i\) per daily basis. All daily Errors are added to a total Error value: \(Error_{total}=\Sigma_{i=1}\text{n}Error_{i}\).