# Proposed Fuzzy-NN Algorithm with LoRa Communication Protocol for Clustered Irrigation Systems
## 3 Irrigation Systems Algorithms
### FITRA Communication Protocol
Each system actuator is capable of storing to its EEPROM up to 256 days of \"on\" valve time statistical data (1 byte long), starting from day 0 (actuator startup day) up to day 0 xFF and start over again from day 0. If signaled by a gateway ACK frame the actuator can send the daily on valve value in minutes for a specific day. By default, the actuator transmits only the \"on\" valve time value of its current counted day. Since these values are stored to the EEPROM, in case of power outage, the actuator controller can identify from its EEPROM the last EEPROM address that has a value different than zero as the current count day. If all EEPROM addresses have values different than zero then the controller zeros all EEPROM values and starts from day 0. 8. **Valve on Time field** is a statistical field that indicates the minutes that the actuator was in a position other than \"off\". It is a 1 octet value meaning that the maximum daily \"on\" actuator time cannot exceed 255 irrigation minutes per day (4.25 h/day). If this happens then the valve on time field does not overflow to zero but it remains at the value of 0 xFF. For each transmitted LoRa frame by the actuator controller using the FITRA application protocol, an appropriate acknowledgment packet is send back through the FITRA gateway. The response ACK packet is illustrated in Figure 6c and includes the following fields: if it is a single ACK packet, then it includes the gateway Application ID the actuator's valve ID, and the ACK number which is the same as the transmitted frame sequence number that this ACK frame responds to. Apart from acknowledging frame reception, the FITRA protocol is capable of sending commands to the actuator. There are three types of commands that the FITRA protocol supports: (i) statistical commands; (ii) actuator control commands and (iii) both statistical and control commands:  
**Statistical commands** include the monitor day request field and use padding of 1 for the values of next status and next tx interval fields. The monitor day request field pinpoints to the actuator the day that the actuator will send on its next frame upload its valve \"on\" time in minutes. **Control commands** may include one or more of the following fields:  
1. **Valve next status field:** This value corresponds to the actuator's valve status. If the value is 0x00 then the actuator has to be set to \"off\" state immediately. If the value is 0x01 then the actuator must move to the \"on\" state. Any other value between 0x02 and 0 xFD indicates either the degrees or steps that the actuator must set the servo or stepper valve state. 2. **Valve next transmission interval value**: This value increases or decreases the actuator's periodic data transmission interval. In case of nodes frame collision or node frame loss, the gateway is responsible for modifying microcontroller nodes processing module transmission periods in order to enforce an adequate data transmission gap upon devices registered in the network. The microcontroller node next transmission interval value is a 2 octet value and is measured in seconds. This gives as an approximate maximum increase or decrease (\(\Delta t_{x}\)) of periodic transmission interval up to 18.2 h: \(T_{period}=(T_{p}+\Delta t_{x})+T_{k}+T_{off}\), where \(T_{p}\) is the statically assigned microcontroller processing module period, \(T_{k}\) is the receive device time usually set to 1-2 s and \(T_{off}\) is the channel idle time restriction set by the ITU for the 433 MHz band. The ITU restriction for LoRa transmissions on the 433 MHz band is of 1% duty cycle channel utilization. This means that the same 43 3 MHz sub-band cannot be used by the same transponder again for duration of \(T_{off}\) seconds: \(T_{off}=(T_{time\_on\_air}/0.01)-T_{time\_on\_air}\). For FITRA communication protocol the \(T_{time\_on\_air}\leq 128\) ms, thus giving a maximum \(T_{off}\) value of: \(T_{off}=12.672\) s. A value of 0 xFFFF indicates no transmission interval variations (\(\Delta t_{x}\)) for the device.