In soil cultivation, multiple sensors of the same type (e.g., moisture sensors) are deployed in a farm field. Therefore, two sensors of a same type placed within a short distance can automatically test each other. This process is called the mutual test for sensors of the same type or the “homogeneous” mutual test. Two highly related sensors of different types can also test each other. Similarly, a sensor and an actuator that are highly related can test each other (typically, the actuator is controlled by the sensor). Such process is called the “heterogeneous” mutual test. Based on the characteristics of the sensors and the actuators used in AgriTalk, the mutual test methods for failure detection are described in this section.
4.1. Homogeneous Mutual Test
The homogeneous mutual test involves two sensors of the same type, which are not located far away from each other. An example is the barometric pressure sensor that is most stable among all sensors used in AgriTalk. In
Figure 4, the barometric pressure curves are almost flat. These output readings are affected by temperature, and the relationship between pressure and temperature is described by the Gay–Lussac Law. Due to air molecule collisions, this law says that, if the air temperature is increased, the pressure decreases. Different altitudes impact the temperature effect on air pressure due to disparities in air density. At a higher altitude, a higher temperature is required for the same air pressure as that at a lower altitude.
In
Figure 4, the barometric pressure readings at Wufeng (in a high altitude mountain) are higher than that at the Bao field (at low altitude). An AgriTalk farm field typically deploys two micro weather stations at appropriate locations in the farm to report the weather conditions covering the whole farm field. If only one weather station is installed in the farm, we will use the nearby government weather station as the standard reference. Since the locations of the micro weather stations are at the same altitude, the barometric pressure readings are almost identical even if there is a distance of 10 m between them (see the (a)–(b) pair and the (c)–(d) pair in
Figure 4).
Therefore, these two barometric pressure sensors are highly related and can be mutually tested by an AgriTalk project “BPdetect” (barometric pressure detect;
Figure 5 (1)) described as follows. The BPdetect configuration identifies the inconsistency of two barometric pressure sensors (BARP-Is) in the micro weather stations (
Figure 5 (2) and (3)). This project develops a cyber IoT device called BARPtest (barometric pressure tester) with two ODFs and one IDF. BARP1-O and BARP2-O in the BPtest output device (
Figure 5 (4)) receive the data from BARP1-I and BARP2-I, respectively, for a mutual test. The BARPtest device detects potential sensor failures in real time and outputs them through the BPalert-I IDF in its input device (
Figure 5 (5)). This IDF is connected to the Admin-O and the Farmer-O ODFs of the Alert device (
Figure 5 (6)). Admin-O then sends an alert message (through email, short message, or an announcement of a phone call) to the AgriTalk administer so that she/he can take action for sensor calibration described in the next section. The message is also sent to alert the farmer.
Another good candidate for the homogeneous mutual test is the CO
2 sensor. CO
2 concentration in the air is affected by wind speed/direction, solar radiation, air temperature, rainfall, ultra-violet (UV) radiation, air pollution, and so on.
Figure 6 shows that, although the CO
2 concentration values produced by two sensors in the same area (Wufeng or Longtan) severely fluctuate, they are limited in small ranges with almost the same means. Therefore, these two sensors are good targets for the mutual test. If the CO
2 concentrations are significantly affected by other factors (e.g., wind speed/direction), then the homogeneous mutual test with extra input factors described in
Section 4.3 is conducted to better identify the failed sensor.
More difficult cases are those sensors inserted in the soils. The same types of soil sensors at nearby locations may give very different readings (
Figure 7). However, if they show a relationship, they can still be tested (to be elaborated in
Section 4.2 and
Section 4.3).
Note that, when the homogeneous mutual test shows a negative result, both sensors may fail as illustrated in
Figure 8a,b. The correct readings of humidity are given in
Figure 8c. In this case, both sensors should be calibrated.
4.2. The Heterogeneous Mutual Test
The sensors of different types installed at the same location can be good candidates for the heterogeneous mutual test because they experience the same environment conditions. An example of the heterogeneous mutual test is for UV and luminance (they are installed in the same micro weather station).
Figure 9 shows that a UV sensor and a luminance sensor at the same location are highly related. The AgriTalk project of failure detections for UV and luminance are the same as the BPdetect project, except that the IDFs are replaced by the UV and the luminance sensors. The details are omitted.
In AgriTalk, every sensor affects at least one actuator. In [
15] and the references therein, faults have been detected in the sensor and actuator interaction. If a sensor is used to control an actuator, then they are highly related and can be paired to mutually test each other. For example, in the AgriTalk irrigation system, the dripper is controlled by the moisture sensor as illustrated in Join 1 of
Figure 2. Therefore, the moisture sensor and the dripper are highly related, and the heterogeneous mutual test can be performed by modifying the Bao project in
Figure 2. The new project is called Bao1 (
Figure 10 (1)), which is a subproject of the irrigation control system that only involves the moisture sensor (Moisture-I in
Figure 10 (2)) and the dripper (Drip-O in
Figure 10 (3)). We create a cyber test device “MDtest” (Moisture-Dripper tester) that has two ODFs and one IDF. In the output device (
Figure 10 (4)), Drip-O receives the instruction sent from Join 1. Therefore, when it receives the value “1,” the MDtest knows that the dripper is turned on. When Drip-O receives the value “0,” the dripper is turned off. Moisture-O receives the measured moisture data through Join 2.
When the dripper is turned on, the MDtest starts monitoring the moisture readings until the dripper is turned off. If the irrigation system functions normally, then in a certain period of time
, the moisture should increase to reach a threshold value (e.g., 40% relative humidity). If the irrigation system does not work this way, then either the moisture sensor or the dripper actuator fails, and MDalert-I in
Figure 10 (5) sends the alert message to the administrator and the farmer through Join 3. Note that the Alert device in
Figure 10 (6) is the same cyber device in the BPdetect project (
Figure 5 (6)). When both projects are activated, the administrator and the farmer will receive alerts from both projects if any IoT devices in these projects fail.
Note that
is not a fixed value and can be appropriately described as a distribution. In
Figure 10, MDtest accumulates the samples that are the periods between when Drip-O receives 1 and when it receives 0. The histogram of the measured data illustrated in
Figure 11 indicates that the expected value E[
tT] = 30.6 min, and the variance V[
tT] = 0.094 E[
tT]
2 for the activation periods of Drip-O. In probability theory, the Erlang distribution is a two-parameter distribution. One is the scale parameter
and the other is the shape parameter
. The shape parameter
can control the skewness of the distributions. From the histogram illustrated in
Figure 11, the distribution of
has a right skew; therefore,
data are fit by an Erlang density function
with the shape parameter
and the scale parameter
:
where
After estimating the parameters of the Erlang distribution, the Kolomogorov–Smirnov (K-S) test [
16] is used to validate whether the distribution is actually an Erlang distribution.
If the moisture reading does not reach the threshold value (e.g., 40% in the case for
Figure 11) in the period
, then we suspect that either the moisture sensor or the dripper actuator fails. It is clear that the actual
value cannot be obtained, and we have to predict
by another estimator
. If the moisture reading does not reach the threshold value by the period
an alert message is sent to the administer to check if the sensor or the actuator fails. Period
is called the detection delay. If
is set too large, then the detection of failure is seriously delayed. On the other hand, if
is set too small, then false alarms occur often (i.e.,
is likely to happen). In other words, when both the sensor and the actuator are normal,
is the probability of false alarm. A detection delay
should be selected such that
is small enough to detect failure early and that false alarm does not frequently occur.
Appendix A develops an analytic model to derive
, which indicates that it is appropriate to select a
distribution with small variance and where
so that false detection probability is less than 7%, and if we select
, the false detection probability is less than 0.7%.
The soil sensors are good targets for the heterogeneous mutual test because in AgriTalk, the soil sensors are integrated in one piece of hardware (the so-called three-in-one sensor device for EC, moisture, and temperature). In
Figure 7a,c,e are placed in one location, and
Figure 7b,d,f are in another. Based on the discussion in
Section 4.1 and
Section 4.2, we have the following fact.
Fact 1. A mutual test (either homogeneous or heterogeneous) of two IoT devices (two sensors or one sensor and one actuator) detects one of two situations. In Situation 1, the test shows the positive result that both IoT devices are normal. In Situation 2, the test shows the negative result that one or both IoT devices fail.
Situation 2 of Fact 1 cannot tell which device fails in one mutual test. Under certain conditions, we can identify the failed IoT device. Details are given in the next subsection.
4.3. The Combined Mutual Test
Both homogeneous and heterogeneous mutual tests identify that the tested sensors may fail but cannot determine which of the two sensors fails. If heterogeneous and homogeneous mutual tests are combined, then it can be considered as a “homogeneous test with extra input factors.” In other words, in the combined mutual test, there are two same-type sensors under test, and different types of sensors or actuators can be used as extra input factors that assist in identifying which sensor fails. An example is the temperature sensor test in AgriTalk.
Figure 12 shows the temperature readings of two micro weather stations in each of the Bao and the Wufeng fields. The figure indicates that the two reading curves in the same field are correlated. Therefore, the homogeneous mutual test applies to air temperature sensors. As we pointed out in
Section 4.1, air temperature affects other air sensors, in particular, barometric pressure. If the readings of a barometric pressure sensor are correct, then they reflect the impact of the air temperature. In a mutual test of temperature, the temperature sensor with more accurate readings will relate better with the readings of the barometric pressure sensor. Therefore, an accurate barometric pressure sensor can be used in a mutual test to produce better results. In
Figure 12, the temperatures in Wufeng are lower than that in Bao. At the same time, the barometric pressures in Wufeng are also lower than that in Bao as illustrated in
Figure 4. Therefore, by conducting two homogeneous mutual tests and two heterogeneous mutual tests, there is a much better opportunity to identify the failed sensor.
To further elaborate on the above statement, consider the UV and the luminance sensors in Longtan (
Figure 13). It is fairly easy to identify that UV2 fails through the combined mutual test. When the homogeneous mutual test is conducted on the UV sensors, we find that they are not related correctly, and suspect that one of them may fail. When the homogeneous mutual test is conducted on the luminance sensors, we find that they are normal. Similarly, we conducted the heterogeneous mutual test on UV1 and Luminance1 to find that they are normal. We then conducted the heterogeneous mutual test on UV2 and Luminance2, and the result indicates that they are not related well. Based on the results of the four tests, we may conclude that Luminance1 is normal, UV1 and Luminance2 are likely to be normal, and UV2 is likely to fail. To identify that a sensor/actuator fails, we have the following fact:
Fact 2. A sensor/actuator fails if there exists a set of sensors/actuators such that, for every , Situation 2 in Fact 1 occurs for the mutual test involving and , and there exists such that Situation 1 in Fact 1 occurs for a mutual test involving and another sensor/actuator.
Facts 1 and 2 assume that when a mutual test indicates a positive (negative) result, Situation 1 (2) holds. In some cases, the results may only guarantee that the situations are likely to hold with some probabilities. For example, although a mutual test indicates that both IoT devices are normal, an experienced IoT expert/farmer may still doubt that a device fails. Therefore, based on the expert’s experience, a probability may be given to an observed test result. Consider the example in
Figure 13. Define the following events: A = {UV1 fails}, B = {UV2 fails}, C = {Luminance1 fails}, and D = {Luminance2 fails}. Denote
= {UV1 is normal} as the complementary event of A. Similarly,
,
, and
are complementary events of B, C, and D, respectively. Let
be the probability (estimated by experienced experts) that the event
occurs (Situation 2 of Fact 1), Similarly,
, and
. It is clear that
is the probability that Situation 1 of Fact 1 occurs. Therefore,
Based on the above derivation,
Similarly,
which results in
Suppose that . If , then we obtain the result , which provides no information at all, and we cannot be sure that event B does happen. In other words, in these mutual tests, either or should approach 0 to provide useful information.