Abstract

The Internet of Things (IoT) technology focuses on the application of information-sensing equipment, transmission network, and intelligent information processing technology. Through scientific management, it can achieve the rational use of agricultural resources, thus improving the ecological environment, reducing production costs, and improving the yield and quality of agricultural products. At present, the application of agricultural IoT technology faces problems including small network coverage, limited monitoring projects, high transmission cost, and short power supply time, which limit the popularity and ability of farmland environmental monitoring. In this paper, ns-3 is used to simulate the IoT for farmland environmental monitoring based on the long-range wide-area network (LoRaWAN) protocol. The simulation results show the transmission distance with good transmission quality under the LoRaWAN protocol. Furthermore, we analyze the comparison of the combination range of network transmission quality parameters under the two acknowledgment (ACK) mechanisms. Finally, we present the parameter combination range and suggestions to improve the network transmission quality, which provide a new basis for guiding the farmland environmental monitoring system.

1. Introduction

In the process of modern agricultural production environmental monitoring, a large number of sensor nodes are used to form an environmental monitoring network for collecting environmental information. This can help agricultural producers, operators, and researchers to understand the situation of agricultural production in real time and provide first-hand data for analysis and decision-making. The effective acquisition of more agricultural environmental parameters not only plays an important role in improving the decision-making level of agricultural environmental regulation but also poses new challenges to the construction and operation of the whole monitoring network.

The first concept of the Internet of Things (IoT) was put forward in 1999 when the MIT Auto-ID Laboratory researched the radio frequency identification (RFID) system based on the Internet. With the development of network transmission, modern control technology, information perception, artificial intelligence, and other technologies, IoT has also been more comprehensively developed, and it plays an increasingly important role in various fields of production and life [1]. At present, there is no unified definition of agricultural IoT; many researchers have put forward relevant concepts from different focuses. Generally speaking, agricultural IoT is a kind of network that can sense the information in an agricultural system and achieve the scientific management of the agricultural production process through effective information transmission and intelligent processing. The core of the agricultural IoT technology is perception-sensing equipment, transmission network, and intelligent information processing technology. Agricultural IoT achieves the rational use of agricultural resources, improves the ecological environment, reduces production costs, and improves the yield and quality of agricultural products.

Generally, the planting area of farmland crops is large, and the planting area often reaches several thousand mu, and the distribution of monitoring demand is uneven; so, it is impossible to collect field information by wire. A wireless sensor network (WSN) is composed of many sensor nodes deployed in a specific environment; it transmits signals wirelessly through a single hop or multihop in a self-organized way. WSN has the advantages of having no wiring, simple networking, flexible deployment, and low cost ([2]; Lavanya et al., [36]); so, WSN has become the main application and research target of IoT technology for farmland environmental monitoring. Due to the large monitoring area of farmlands, the use of WSN multihop networking will result in a certain amount of information loss in each hop. The larger the coverage area and the more the hops, the greater the loss rate of information transmission. Also, the corresponding effective transmission distance between nodes will be greatly reduced, resulting in the excessive density of sensor terminal nodes in the field. In addition, the monitoring nodes on the data packet transmission path need to forward the information packets in real time, resulting in large energy consumption. All these above-mentioned issues limit the popularity of WSN technology in the field of farmland environmental monitoring. In recent years, the emergence of low-power wide-area network (LPWAN) provides a new choice for the transmission of agricultural IoT. With a transmission distance of more than 10 km in the field, LPWAN can network in a single hop mode, which greatly reduces the transmission loss of data packets and the limit of terminal node distribution density.

LPWAN has the characteristics of low power, low bandwidth, and long transmission distance. These advantages can accommodate a large number of sensor nodes to access the network. Generally, the LPWAN can be divided into unlicensed spectrum and authorized spectrum according to band authorization. Compared with narrow band IoT (NB-IoT), the representative of authorized spectrum technology, LoRaWAN networking technology using unauthorized spectrum has a freer networking mode. The comparison of several common transport protocol parameters is presented in Table 1.

The LoRaWAN protocol is a typical LPWAN application. It is a set of protocols specially designed for long-distance transmission and networking of equipment using long-range radio (LoRa) technology. The LoRaWAN protocol has the characteristics of typical LPWAN technology and the advantages of independent networking without wireless operators. Abbreviations illustrate all acronyms used in this paper.

The application of LoRa technology in large-scale farmlands can better reflect its characteristics of wide coverage and low energy consumption and provide strong support for the large-scale development of agricultural IoT [710]. The LoRaWAN transmission protocol has been applied in agricultural fields. Based on the LoRaWAN transmission protocol, the field agriculture monitoring system has been developed, which can measure the temperature, relative humidity, wind speed, and carbon dioxide in a farmland environment. After data processing, storage, and other operations on the built network server, the measured values can be displayed on the visual interface [11]. A terminal node based on the LoRaWAN transmission protocol, equipped with an asynchronous serial protocol sensor group, can measure 13 types of environmental parameters including atmospheric pressure, lightning stroke number, and soil conductivity [12]. An intelligent irrigation system based on the LoRaWAN transmission protocol can reduce water consumption by about 23% when combined with the irrigation strategy calculated from the weather forecast information obtained from the Internet [13]. A remote environment awareness platform has been developed based on the LoRaWAN transmission protocol. The developed sensor and driver control unit were used to collect soil moisture and surface temperature information at two depths: 5 cm and 30 cm (Takin et al., [14]).

Using network simulation before large-scale deployment of IoT in farmlands has great practical value for studying the network topology and transmission quality. At present, the commonly used network simulation software mainly includes ns-2, ns-3, OMNeT++, OPNET, and LoRaSim. These software packages have achieved good results in network transmission mechanism, signal collision, parameter optimization, load balancing, and other aspects of simulation ([15]; Dawaliby et al., [1619]). ns-3 simulation software, developed in 2006, is an open-source network simulation software driven by discrete events, which is mainly used to simulate computer networks and wireless transmission networks. ns-3 can simulate various types and sizes of network structures in the real world on a computer. Users can simulate through C++ or Python code on the Linux platform. ns-3 has strong scalability and still maintains the update frequency of 1–2 times a year. It can support WiFi, 4G-LTE, Ad-Hoc, and other network models. An ns-3 network simulation system can set the following simulation parameters: network node, network protocol, propagation loss model, gateway, and server. Through the simulation of agricultural IoT, it can verify whether the actual requirements can be met. Through the optimization of the LoRaWAN protocol parameters, we obtain a new method to optimize the transmission quality of agricultural IoT.

From the analysis of the above-mentioned state of research, the research on IoT still needs to be improved in the following aspects: (1) for the monitoring of IoT in agricultural fields, we need improve the distribution density strategy of the sensor network. At present, the layout of agricultural fields is mostly based on the actual application, which lacks strong theoretical support for the layout density of nodes. Also, the strong randomness can easily lead to the wastage of resources and the decline of transmission quality. (2) The published research on farmland LPWAN is not detailed enough; most studies have been at the application level, and there is a lack of research on the adjustment of the internal mechanism of LPWAN to optimize agricultural IoT.

3. Motivations and Contributions

In order to formulate an answer to these questions above, this paper uses ns-3 with a LoRaWAN simulation module downloaded from the ns-3 official platform to simulate the transmission protocol and node distribution of farmland environmental monitoring IoT. We evaluate the overall network transmission quality, obtain the comparison of the combination range of network transmission quality parameters under the two ACK mechanisms, and provide the parameter combination range and suggestions to improve the network transmission quality.

This provides solutions for the following contents. First, we provide an effective method for the deployment of monitoring nodes in a large-scale farmland environment monitoring network. Second, we give the means to improve the transmission quality of long-distance network.

4. Proposed ns-3-Based LORAWAN Simulation Framework

4.1. LoRaWAN Frame Structure

LoRaWAN is a medium access control (MAC) layer solution developed by LoRa alliance based on LPWAN technology. It defines the network topology, device classification, and transmission mechanism of the MAC layer. As an official technical solution, LoRaWAN has the highest integrity and reliability to date. LoRaWAN makes detailed settings in the network transmission design such as the terminal power consumption, capacity, transmission quality control, and other aspects. The structure relationship among the main components of the physical frame, MAC frame, and data frame is shown in Figure 1.

The frame header (FHDR) contains the information needed by various LoRaWAN networks, as shown in Figure 2, including the device address DevAddr, packet counter FCnt, control bit FCtrl, and other important fields.

4.2. ACK and Retransmission Mechanism of Data

The fctrl field is a very important field in the LoRaWAN protocol, including adaptive data rate (ADR), ACK, and other key control parameters. The format is shown in Figures 3 and 4.

The ACK frame of the fctrl data segment indicates whether the message is transmitted in the acknowledgement mode. When the ACK bit is set to 1, it indicates that the uplink (downlink) data are in the confirmed mode. When it is set to 0, the uplink (downlink) data are in the unconfirmed mode. If the uplink message takes the acknowledgement mode, the gateway must reply to an ACK message after receiving the message. After the terminal sends the confirmation message, the server will reply to the ACK data and complete a data receiving process. If the terminal does not receive ACK data, it will retransmit the message according to LoRaWAN retransmission mechanism. In the unconfirmed mode, ACK confirmation is not required. The number of uploads N can be adjusted according to different duty cycle configurations, ranging from 1 to 15. If the received value is 0, it means that the existing retransmission mechanism remains unchanged.

4.3. Simulation Environment

We used ns-3 software with LoRaWAN simulation module downloaded from the ns-3 official platform to simulate the transmission protocol and node distribution of IoT for farmland environmental monitoring. The simulation module can establish a model of network modulation and channel transmission for LoRaWAN through a series of classes and models. LoRaWAN simulation module uses general LoRaPhy (LoRa physical) and LoRaMac (LoRa medium access control) classes as the base of other classes. The LoRaPhy class is related to the physical layer of LoRa, mainly including the LoRa transmission chip setting and behavior control of transmission. The LoRaMac class is associated with the MAC layer, which is mainly used for LoRaWAN protocol simulation.

Through these two basic classes, we can establish a model for the terminal node and gateway server to extend these classes. Furthermore, we can generate the classes enddeviceloraphy and enddeviceloramac, applied to the terminal node, and the classes gatewayloraphy and gatewayloramac, applied to the gateway. These classes will be further subdivided according to different attributes. The software and hardware configuration of the simulation system is presented in Table 2.

4.4. Simulation Parameter Setting
4.4.1. Physical Layer Propagation Loss Model

According to 3GPP [20], the calculation of propagation loss (also known as external path loss) is as follows:

The height of the gateway antenna is closely related to the path loss [21]. Simulation parameter frequency  MHz, and  m; the results are as follows:

The path loss model can be expressed as follows:

4.4.2. Receiver Sensitivity

In this simulation, and are used to represent the sensitivity of the gateway and terminal equipment receivers under different SFs (spreading factors), respectively, as shown in Table 3; the unit is dB.

4.4.3. Operation Parameter Setting

In the simulation, we set the upload time interval to s seconds for different terminal nodes. For each terminal device, we randomly select one of the evenly distributed variables from as the starting time of transmission, and the subsequent data transmission still follows the principle of uploading every s seconds. The payload of the simulation packet is 20 bytes. Before passing the packet to PHY packet, LoRaWANMac class adds the MAC payload: 1 byte LoRaWANMacHeader and 4 bytes virtual MIC.

For all simulations, the packet loss rate is measured to reflect the overall network transmission quality. It also supports viewing the sending/receiving packet loss rate of a single point according to each terminal node and gateway.

The simulation also includes the processing of the ACK mechanism. When the ACK confirmation message mode is turned on, it is marked as CON (confirmed), and when it is turned off, it is marked as UNC (unconfirmed). According to the LoRaWAN protocol, whether the terminal node uploads data or the gateway sends messages, all packet transmissions comply with the duty cycle limit.

5. Experimental Results and Performance Evaluation

5.1. Simulation Results and Analysis
5.1.1. Coverage of Monitoring Nodes

First, we simulated the radius that the gateway can cover. Through the simulation of more than 1000 data transfers between a single monitoring node and the gateway, we tested the packet loss rate of a single gateway. When the packet loss rate is 5%, the radius is 6.2 km, which is the maximum distribution radius of the monitoring node for the gateway, as shown in Table 4.

Simulation results show that the LoRaWAN protocol is suitable for environmental monitoring systems with multiple monitoring nodes. It has good transmission distance in farmland areas, and the packet loss rate of a single node can be controlled below 5% within the radius of 6.2 km from the gateway.

5.1.2. Packet Loss Rate under Different Transmission Mode

We chose seven common data transmission intervals of agricultural IoT from 1 minute to 1 hour. The number of monitoring nodes is 0–1000, and the number of gateways is 1. Figure 5 shows the comparison of the relationship between the number of nodes and the packet loss rate in the CON mode and the UNC mode under transmission intervals of 60, 180, 300, 600, 1200, 1800, and 3600 s.

From the figure, we can see that the overall packet loss rate of both CON and UNC modes is positively correlated with the number of monitoring nodes and negatively correlated with the data transmission interval.

Generally, we thought the ACK mechanism could reduce packet loss. However, the simulation results show that the overall packet loss rate of the CON mode is not always lower than that of the UNC mode. In some cases, the overall transmission quality of the UNC mode is even better. This is because although the ACK mechanism increases the reliability of information transmission, due to the duty cycle limitation of LoRaWAN protocol, the number of ACK messages in the downlink of the CON mode will increase when the number of nodes increases, the transmission interval decreases, or other situations that can cause the gateway to send and receive information intensively. As a result, the packet loss rate in the CON mode is significantly higher than that in the UNC mode under the same simulation condition.

5.1.3. Discussion on Network Communication Quality

In order to scientifically reflect the comparative relationship between the CON and UNC modes, through ns-3 simulation, we obtained the packet loss rate of 300 groups under different message sending intervals and node numbers. Then, we obtained the three-dimensional fitting diagram of the average packet loss rate in the CON and UNC modes under the condition of a single gateway using MATLAB, as shown in Figures 6 and 7.

Then, we carried out overlay projection of packet loss rate data for Figures 6 and 7 and subtracted the packet loss rates of the two modes. The area with an absolute value of the difference greater than 0.01 is identified as the advantage area of transmission quality, as shown in Figure 8. The green area is the part where the packet loss rate of the UNC mode is less than that of the CON mode and the difference is greater than 0.01. It is the advantage area of transmission quality in the UNC mode. The blue area is the part where the packet loss rate of the CON mode is less than that of the UNC mode and the difference is greater than 0.01, which is the advantage area of transmission quality of the CON mode. The red area is the part where the absolute value of the difference is less than 0.01. From Figure 8, we can see that when the transmission time is less than 200 s, the network transmission quality of the UNC mode has clear advantages, while when the transmission time is more than 200 s, it needs to be judged according to the specific parameters.

In the field of communication, it is generally believed that when the packet loss rate is greater than 5%, the communication quality is poor. We draw the projection of packet loss rate under the condition of single gateway through Figures 6 and 7. Moreover, the packet loss rate of 5% is used as the bound for identification. When the combination of the number of nodes and the interval time is in the red area, the packet loss rate is greater than 5%, and the communication quality is poor, as shown in Figures 9 and 10.

6. Conclusion and Prospects

6.1. Conclusion

In this paper, we provide an effective method for the deployment of monitoring nodes in a large-scale farmland environment monitoring network. The LoRaWAN protocol is suitable for environmental monitoring systems with multiple monitoring nodes. It has good transmission distance in farmland areas, and the packet loss rate of a single node can be controlled below 5% within the radius of 6.2 km from the gateway. Under the condition of low acquisition frequency, the transmission quality and distance can be guaranteed, which is suitable for farmland environmental information monitoring.

We obtain the parameters’ range of each network transmission quality advantage area under the two ACK mechanisms. The range of parameter combination to improve the quality of network transmission is given. When the transmission time interval is less than 200 s, the transmission quality of the network in the UNC mode has clear advantages. When the transmission time interval is more than 200 s, it needs to be judged according to the actual demand and the number of nodes. According to the range, we can improve the quality of network transmission by controlling the frequency of data transmission and the number of nodes in the field.

6.2. Prospects

There are two research axes we wish to develop in the future. First, continue to study mechanism on network transmission quality of low-power wide-area network and explore the relationship between other LoRaWAN protocol parameters and network transmission quality, such as ADR algorithms. Second, utilizing the multigateway LoRaWAN system to build a general purpose IoT platform with the higher reliability capability, we can build many IoT applications, such as the smart agriculture system.

Abbreviations

IoT:Internet of Things
ACK:Acknowledgment
LoRa:Long-range radio
RFID:Radio frequency identification
WSN:Wireless sensor network
LPWAN:Low-power wide-area network
NB-IoT:Narrow band Internet of Things
SF:Spreading factors
CON:Acknowledgment confirmation message mode is turned on
UNC:Acknowledgment confirmation message mode is turned off
ADR:Adaptive data rate
MAC:Medium access control
FHDR:Frame header
DevAddr:Device address
FCnt:Packet counter
FCtrl:Control bit.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

We are grateful for the grant obtained from the National Natural Science Foundation of China (NSFC): 32171913.