# SpaceSheep: Satellite Communications for Ovine Smart Grazing
## 2 Materials and Methods
### Weeding Alarm Setup  
The SheepIT alarm system was developed on the edge device because it can gather all the communications that the WSN network elements continuously send, while quickly detecting the undesired evolution in the behavior of any element of the infrastructure. The edge device continuously monitored the periodic communications related to the behavior and health of the animals as well as equipment-related events, and it detected various events that required the herd supervisor to promptly intervene, and generate an alarm.  
Furthermore, both the cloud system and the edge device can generate alarms. There was a set of events that required the analysis of a larger dataset, which required computational capabilities that were not available on our edge device. Therefore, these events were detected by the cloud application. Table 1 summarizes the list of alarms triggered by the SheepIT infrastructure. One of the worst events that can occur in a SheepIT vineyard has to do with the excess of infractions detected by a collar, which should notify the human supervisor through an infracting alarm to remove the animal from the vineyard weeding job since the animal is threatening the plants/ fruits.  
SheepIT network nodes are battery-powered, and they periodically report their battery status to allow the system to monitor their charge and inform the supervisor about it. Collars are the key system elements because they guarantee that the animals do not harm the plants or fruits. When the battery value drops below the minimum established threshold, the system triggers an alarm to the supervisor. In addition to the batteries running out, two more types of such events can occur: equipment failure and inactivity, which can be associated with the equipment becoming inoperable, thereby freeing the animals to endanger the vine leaves. The other is identified through uncommon static accelerations that occur when the sheep has abandoned the equipment on the ground; thus, leaving the animals free to roam the vineyard.  
The panic alarm is the last type of locally generated alarm. In particular, the gateway undergoes a continuous comparison between the collar accelerations and baseline acceleration values for each animal. This allows the system to detect disturbances affecting the herd, such as strangers or other animals (e.g., stray dogs).  
The information sent in alarm messages, illustrated in Table 2, includes the following attributes: a timestamp with the date when the alarm was generated, the device type that identifies the type of device that triggered the alarm, the ID that identifies the device's identifier, the alarm type, which defines the type of alarm situation, the priority level of the alarm situation, and additional information, which is an optional field with complementary information.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Type of Alarm** & **Alarm Source** & **Alarm Context** & **Message Size (Bytes)** \\ \hline Battery & Gateway & Network node (collar/beacon) battery level below a & 1134 \\  & & minimum threshold & \\ Absence & Gateway & Network node (collar/beacon) no longer detected after & \\  & & several communication cycles & 1147 \\ Infraction & Gateway & Number of infractions per unit of time crossed the & \\  & & predefined threshold by an animal & 1161 \\ Panic & Gateway & Abnormal accelerations from multiple elements of the & \\  & & herd were detected in the same period & 1159 \\ Inactivity & Gateway & Detection of a pattern of collar inactivity, evidencing that & 1134 \\ Health & Cloud & & the animal may have removed the collar. & \\ \hline \hline \end{tabular}
\end{table}
Table 1: System alarms.  
The cloud application, in turn, monitors the herd data and generates alarms-for example, signaling a continuous decrease in animal activity, thereby indicating a potential illness. Since these messages are generated in the cloud and are not exchanged in the satellite/WiFi links, their size was irrelevant, and therefore, their encoding was not optimized.