# MAC Layer Energy Consumption and Routing Protocol Optimization Algorithm for Mobile Ad Hoc Networks

Authors: Yaohua Chen; Waixi Liu
Journal: Complexity
 (2021)

---

## Abstract

Mobile ad hoc network is a network composed of mobile terminals without infrastructure. Due to its fast-networking ability, it is widely used in smart cities, car networking, military, agriculture, medicine, and other fields. Routing technology is a key technology in the field of MANET (mobile ad hoc network). The energy consumption is optimized through the technical network simulator NS-3, and the nodes in the MANET routing protocol can accurately simulate the problem, thereby optimizing the MAC layer of important research tools. This article combines the advantages of the lithium-ion (lithium) battery model. Compared with the KiBaM battery model, the effective charge in the KiBaM model simulates the output voltage well, which can reflect the battery capacity effect rate and the recovery effect of the lithium-ion-KiBaM battery model. The model can respond to the characteristics of the output voltage as the society gets lower and lower. In order to solve the problem that the analytic solution of differential equations cannot be obtained in the model, a numerical solution of the optimization algorithm is proposed based on the implicit Runge–Kutta method. The MAC layer energy consumption and routing protocol optimization algorithm proposed in this paper can be applied well in various fields.


---

## Body

## 1. Introduction

With the popularization of mobile terminals, smart devices such as mobile phones and tablet computers, Internet of things, Internet of vehicles, smart city, and other applications have increasingly higher requirements for wireless communication. There are usually two modes of wireless communication, cellular and self-organizing. A cellular network contains base station facilities and terminals. The communication between the base station and the base station is carried out in wired form, and the terminal communicates with the base station in the coverage area of the base station. The coverage area of each base station is a regular hexagon. The base station is deployed in advance and covers a whole area to ensure that when a terminal leaves the coverage area of one base station, it can enter the communication range of the next base station. Because base stations are deployed to look like cells, they are called cellular networks. Ad hoc network is a kind of centreless, autonomous, multihop network [1], which does not need any pre-established infrastructure and can be built only by communication between terminals, as shown in Figure 1.Figure 1
The structure of cellular networks and self-organizing network.Terminal devices can freely join and exit ad hoc network during the operation of the network. After joining the network, any terminal node has the authority to send and receive data, or to forward data as a relay node. The node finds the forwarding path through different routing protocols, and the intermediate node forwards the data to the destination. Ad hoc network has the advantage of being fast and flexible.Mobile ad hoc network, on the other hand, is an ad hoc network formed by mobile nodes carrying wireless transceiver devices and is often used in military, disaster relief, field investigation, smart city, Internet of vehicles, man-machine network, and other fields. Because of the mobility of terminal nodes, the topology structure of wireless networks is uncertain; that is, the topology structure may change at any time, which brings a lot of trouble to the management of network nodes and links, and greatly increases the difficulty of routing. Therefore, the research on MANET has become a very key and very popular research field at present.Corresponding to the seven-layer OSL model, MANET can be divided into five layers, as shown in Table1.Table 1
The layers of MAC.
OSIMANETRoleThe application layerThe application layerThe physical layerThe presentation layerThe session layerThe transport layerProvide application servicesThe data transferThe network layerThe transport layerPacket forwarding and routingData link layerThe network layerLink control/channel selectionThe physical layerThe link layerSignal mediumIn the MAC layer, from top to bottom are the application layer, transport layer, network layer, link layer, and physical layer, respectively. The application layer, as the name implies, provides support for applications installed on nodes. The transport layer is used for end-to-end connectivity between two hosts, usually using TCP or UDP protocols. The network layer realizes the function of network construction; the support of service quality and the choice of route all need to depend on the network layer. The link layer encapsulates the bits of the physical layer into frames and transfers the data of the network layer to the network layer of the destination node. The link layer is divided into two parts. The MAC layer is mainly used for error control framing, etc., and the LLC layer assigns transmission channels to the upper layer. The physical layer determines parameters such as the coding rules and frequency of wireless signals. This paper mainly studies MAC layer-related problems.MAC layer has the characteristics of independence and autonomy, dynamic change of network topology, multihop network, and dynamic network configuration. Independence means that the MAC layer is decentralized and each node has the same status. No matter whether each node exits the network freely or is forced to exit the network unexpectedly due to the failure of the node, it should not affect the normal operation of the whole network. So the nodes in our MAC layer are independent. The MAC layer is also a self-organizing network, allowing each node to join and quit the network at any time. Therefore, the network should be able to enable nodes to join the network quickly and deal with nodes that have just quit in time. In other words, the MAC layer network is autonomous [2].The dynamic change of network topology is due to the mobility of nodes in MAC layer network, and the position of nodes will change with time. With the movement of nodes, it is possible for one node to walk in or out of the communication range of another node, and for one node to walk in or out of the physically blocked position (such as the reinforced concrete wall that has a serious impact on the signal), etc., resulting in dynamic changes of network topology. Since there is no base station equipment that can cover the whole world in MAC layer, in order to solve the communication problem between two nodes beyond the communication distance, other intermediate nodes are needed to forward the data; that is, the MAC layer adopts the method of multihop networking. It can perform dynamic network configuration, dynamic localization, and discovery and reconnection functions. The MAC layer enables dynamic flow control and dynamic configuration by allowing nodes to join, exit, suddenly appear, or disappear quickly. Dynamic network configuration is the reason why the MAC layer can be implemented and become a research hotspot [3].The related work on mobile ad hoc network is a prerequisite, and the mobile model of mobile ad hoc network needs to be determined according to the specific application scenarios. The Internet of Vehicles (IoV) is constrained by urban roads and the complex urban environment, such as pedestrians, traffic lights, and so on. Generally, the movement model of the Internet of Vehicles can be set as a random waypoint model, in which the direction and speed of nodes are randomly selected. For example, on the freeway, the nodes are all moving on a fixed path, so mobility can be predicted. Ad hoc network of UAV is a network that moves in the air. In this network, node movement is very flexible and is usually restricted by the flight destination or task. In some multidrone scenarios, nodes move along a pre-designed path, and the movement model is normalized. But in a practical system, the path of the UAV cannot be predesigned, because the environment changes or the mission changes and so on; the path will be recalculated. And the high speed mobility of UAVs is different from the structure of UAVs which directly affects the mobility of UAVs. Therefore, a distributed mobility model needs to be considered, where mobility is jointly determined by members within the cluster. The battlefield environment will be integrated with the ground and air environment, and the movement model needs to consider more factors.Scholars have studied and put forward a lot of movement models to simulate the motion characteristics of nodes in real life as accurately as possible. At present, the movement model can be divided into two categories: tracking model and composite model. Tracking model refers to the movement pattern of a specific object that is recorded in a certain period of time and within a certain area in real life. This generates a lot of data and requires a lot of parameters to be designed and long-term observation time. Under the composite model, the movement model can be divided into solid movement model and mass movement model.The second section introduces the subject background of this study and expounds the research value. This paper briefly introduces the characteristics and key technologies of MAC layer network and analyzes the basic architecture of routing protocol and the research status at home and abroad. The third section introduces the energy consumption of MAC layer and the basic algorithm of routing protocol, introduces the design standard and evaluation index of MAC layer routing protocol, and then classifies and compares these routing protocols from different angles, and then elaborates the operation mechanism of routing protocol. During the simulation of routing protocol, some shortcomings of the protocol were found [4]. In Section 4, the specific optimization algorithm of MAC layer energy consumption and routing protocol for mobile ad hoc networks is described. A battery model and its numerical solution for NS-3 simulation are proposed. At present, computer simulation is one of the main means of wireless network routing research, but the current network simulator is not accurate in the calculation of node power. The experimental and simulation results show that the proposed optimization scheme can obtain effective, accurate, and consistent results with the actual measurements, thus solving the problem of inaccurate estimation of node energy consumption in the process of NS-3 simulation. Finally, the prospect of conclusion and follow-up research is given.


## 2. The Basic Information Architecture of MAC Layer Routing Protocol in Mobile Ad Hoc Networks

### 2.1. Contents, Design Standards, and Evaluation Indexes of Routing Protocol

Routing protocols must satisfy the following basic conditions.Low energy consumption. Network nodes are usually single-chip microcomputer devices powered by portable batteries, which are characterized by limited computing power and limited energy. Therefore, energy consumption is one of the most important indicators in the evaluation of MAC routing algorithm. We must try to reduce the unnecessary energy consumption in the network and reduce the power consumption of each node. In addition, the energy consumption level of each node in the network should be consistent as far as possible so as to prevent the network cavity caused by the premature depletion of the power of some nodes. In addition, the amount of node computation must be reduced, and the energy consumed by CPU in the process of computation is also a non-negligible loss. Loopless. Routing avoids loops in the forward path. If there is a loop in the forwarding path of data, the data cannot be delivered to the destination in a timely manner, and the network bandwidth resources and node power will be wasted in addition, or even the phenomenon of endless loop will be generated, which will make the network paralyzed. So the absence of loops is a key fundamental condition for routing algorithms. Efficient maintenance. Since nodes in MANET are in a mobile state and the topology of the network is in a state of constant change, the routing protocol that can be maintained by colleges and universities can effectively improve the performance of the network. High quality transmission. While ensuring the level of energy consumption, routing protocol should also improve QoS, so that data can be stable and timely transmitted, so that the network is with higher bandwidth, lower delay, and lower packet loss rate. Extensibility. Since MAC layer network is an ad hoc network, which builds a network in a self-organizing form, it is required that the routing algorithm used can provide excellent extensibility for the network. When new nodes are available, make sure that they are quickly added to the MANET. When a node exits the network due to problems such as node power depletion, node failure, or node moving out of the communication range, etc., the node can be quickly detached from the MANET without affecting the normal operation of the entire network, so as to ensure timely response to dynamic topology changes of the network [5].The mobility of mobile ad hoc network nodes is analyzed, and the existing clustering protocols are investigated and analyzed. In this paper, a cluster-routing protocol based on fuzzy logic reasoning is designed, considering the shortcomings of classical protocols and the characteristics of mobile ad hoc networks, combined with the properties of nodes. Considering the characteristics of the mobility model, the increased trust model is adapted to the group mobility model. The simulation analysis of the protocol is carried out under two entity mobility models and two group mobility models. The experimental results show that the proposed protocol can delay the death rate of network nodes and prolong the network lifetime.When quantitatively evaluating MAC layer routing, the main indicators are as follows.Energy consumption. As network nodes are powered by non-rechargeable or difficult-to-charge batteries and have limited energy, the power consumption of nodes is the most critical index for evaluating a routing protocol. In addition to the joule value of absolute energy consumption, the failure time of the first node and the failure time of half the nodes are also equivalent evaluation indexes. Packet delivery rate. In mobile ad hoc network, data needs to be accurately sent to the destination node. The ratio of packet delivery ratio (PDR) to the number of packets received and sent is used to express the proportion of data that has been received successfully.(1)Pa=Nrp⋅100%+n!/r!n−r!limr⟶∞Nsp.Pa means the average packet delivery rate of the whole network within a certain period, Nrp means the total number of packets received from all nodes of the whole network within a certain period, and Nsp means the total number of packets sent from all nodes of the whole network within a certain period. The index of packet loss rate is 100% minus the delivery rate, which can also be used as the equivalent evaluation index of this index. Average delay. In mobile ad hoc network, the data detected by the sensor on the node is time-sensitive, especially in some real-time monitoring application scenes. Therefore, the average end-to-end delay (REED) of network transmission is also very important:(2)Da=∑tr−tslimr⟶∞Nrp.Among them,Da means the average end-to-end delay of the whole network within a certain period of time, Nrp means the total number of packets received by all nodes of the whole network during that period, tr means the moment when a packet is received, and Ts means the moment when it is sent. Average jitter. The average jitter of the network refers to the variance of the delay of each packet received. This index represents the stability of the network and plays a key role in many applications sensitive to delay:(3)Ja=∑tr−Da−ts2limr⟶∞Nrp.Network throughput. Ta is the total amount of data passing through a local connection divided by the time it takes to transfer the data. It can describe the upper limit of network transmission capacity:(4)Ta=limr⟶∞NrbTtra.Specifically, throughput refers to the averageNrp of the entire network during a period of time, bits refers to the total number of bits of data received by all nodes in the network during this period, and Ttra refers to the duration of this period.


### 2.2. MAC Layer Routing Protocol Classification

MAC layer network routing protocols can be classified from the following perspectives:(1)
According to forwarding path. Routing protocols can be divided into single-path routing and multipath routing. A protocol that holds only one routing information in a routing table for a destination node is called a single-path protocol. The multipath protocol saves several different paths in the routing table and selects one of the best paths in the routing table when it is necessary to forward packets. If a path is found to be unavailable during transmission, other available forward paths can also be found in the routing table, thus reducing the number of times the routing table is maintained. The multipath routing protocols include ad hoc on-demand multipath distance vector (AOMDV), wireless ad hoc network multiroute distance vector on demand, temporally ordered routing algorithm (TORA), and so on.(2)
According to the routing discovery strategy, there are active routing protocols and passive routing protocols. Active routing actively builds and stores routing tables that contain routing information for the entire network or part of the network. When a node receives a packet that needs to be forwarded, it determines the next hop of the forwarding path according to the instruction of the routing table. Common active routing protocols are destination sequenced distance vector (DSDV), wireless routing protocol (WRP), and optimized link state routing (OLSR). Passive routing protocols, also known as on-demand or reactive routing protocols, are only calculated temporarily when a node in the network needs to send data. Ad hoc on-demand distance vector (AODV) and dynamic source routing (DSR) are common on-demand routing protocols.(3)
According to topology structure. Some routing protocols form plane topology, while others form cluster tree topology. Clustering routing nodes in the network into several clusters, each cluster in the cluster head, belong to the same cluster by cluster head communication between nodes, communication between nodes belonging to different clusters through their respective cluster head forward; common clustering routing protocol is low energy adaptive clustering hierarchy (LEACH), and OLSR has some characteristics of clustering protocol. In the planar routing protocol, all nodes have equal status and the same function, and they can send, forward, or receive data. Common routing protocols such as AODV, DSR, and DSDV are planar routing protocols.(4)
Geographic location information. It will greatly facilitate the improvement of service quality if the real geographic location of each node can be known during the routing process. Geographic location information is usually provided by the satellite positioning module such as GPS carried by the node, but GPS module has disadvantages in price and energy consumption. Therefore, common routing protocols do not directly obtain geographic location information through GPS. Location-aided routing (LAR) and perimeter routing protocol (GPSR) are commonly used. The common routing protocols are classified and summarized in Figure 2.Figure 2
Common MANETs protocolsIn this paper, NS-3 simulation software is used to simulate and test the energy consumption, throughput, delay, delivery rate, and jitter of the three routing protocols. The specific simulation conditions are shown in Table2.Table 2
The specific simulation conditions.
ProjectScene scope (km2)The number of nodes is 10Network protocolMobile modelPropagation modelThe energy modelParameter0.5∗0.520∼60There are ten sending nodes and ten receiving nodes80011 mbpsRandom waypoint model sm/sTest itemsLogarithmic distance diffusion model\Li-ion battery model\Wi-Fi equipment energy consumption model\average package delivery rate\average end-to-end delay\the average jitter\times 1 median residual energyIn the simulation process, the random waypoint movement model was adopted, the movement speed was fixed at 5 m/s, the residence time was set as 0, the number of adjusted nodes was 20, 30, 40, 50, and 60, and the DSDV, AODV, and OLSR protocols were simulated for each node number, with each simulation time of 100 seconds. In each case, a UDP datagram is sent from 10 sending nodes to 10 receiving nodes. Average PDR is shown in Figure3.Figure 3
Average PDR.Since DSDV updates routing tables regularly, packet loss will occur when routing information stored in nodes becomes unavailable due to the movement of nodes, while AODV protocol that creates and updates routing tables dynamically and OLSR protocol that frequently updates routing tables will not [6]. As the AODV protocol updates the routing table on demand, when the network density increases, the options of the relay nodes become more and more, which reduces the packet loss rate. With the increase of network size, OLSR and DSDV protocols are both protocols for periodically updating routing tables. Because of the MPR mechanism unique to OLSR, the PDR of OLSR protocol does not increase like that of DSDV protocol, while PDR decreases instead. Figure 4 shows the comparison of average delay.(1)
Network intrusion attack. It uses the vulnerability of industrial control system to break into the actual physical system and can obtain the user’s privacy information, key operating parameters of the system, and even cause the paralysis of the entire distributed energy system with forged control commands. A large number of intelligent devices in energy stations are widely distributed, and the corresponding protection measures are relatively weak, easily becoming the object of invasion and attack. Once an attacker penetrates the private communication network of an enterprise through intelligent devices, the control system of the energy station, etc., may be damaged [7].(2)
Password cracking attack. This kind of attack is to gain access rights of the device. Illegal users attack a password system and can obtain passwords, access rights, and users’ privacy information by means of traffic monitoring or brute force cracking.(3)
Malware attack. This type of attack involves looking for vulnerabilities in network communications, planting malicious code or spyware, and targeting critical power infrastructure. For example, in Ukraine, monitoring and control system of the power sector in December 2015 was attacked by a malicious code, and at least three regional power monitoring and control systems were destructive malware attacks, resulting in the destruction of a substation control system, power monitoring management system and also malicious invasion, power generation equipment malfunction, and power blackouts in a few hours. At the same time, the power line repair system was also attacked by the malicious software of automatic dialing, which caused the system to block and to not carry out the maintenance work normally. In recent years, the number, scale, and complexity of malware attacks have increased rapidly [8]. With the continuous development of the energy Internet, such attacks will have a broader impact on the energy Internet.Figure 4
The comparison of average delay.


## 2.1. Contents, Design Standards, and Evaluation Indexes of Routing Protocol

Routing protocols must satisfy the following basic conditions.Low energy consumption. Network nodes are usually single-chip microcomputer devices powered by portable batteries, which are characterized by limited computing power and limited energy. Therefore, energy consumption is one of the most important indicators in the evaluation of MAC routing algorithm. We must try to reduce the unnecessary energy consumption in the network and reduce the power consumption of each node. In addition, the energy consumption level of each node in the network should be consistent as far as possible so as to prevent the network cavity caused by the premature depletion of the power of some nodes. In addition, the amount of node computation must be reduced, and the energy consumed by CPU in the process of computation is also a non-negligible loss. Loopless. Routing avoids loops in the forward path. If there is a loop in the forwarding path of data, the data cannot be delivered to the destination in a timely manner, and the network bandwidth resources and node power will be wasted in addition, or even the phenomenon of endless loop will be generated, which will make the network paralyzed. So the absence of loops is a key fundamental condition for routing algorithms. Efficient maintenance. Since nodes in MANET are in a mobile state and the topology of the network is in a state of constant change, the routing protocol that can be maintained by colleges and universities can effectively improve the performance of the network. High quality transmission. While ensuring the level of energy consumption, routing protocol should also improve QoS, so that data can be stable and timely transmitted, so that the network is with higher bandwidth, lower delay, and lower packet loss rate. Extensibility. Since MAC layer network is an ad hoc network, which builds a network in a self-organizing form, it is required that the routing algorithm used can provide excellent extensibility for the network. When new nodes are available, make sure that they are quickly added to the MANET. When a node exits the network due to problems such as node power depletion, node failure, or node moving out of the communication range, etc., the node can be quickly detached from the MANET without affecting the normal operation of the entire network, so as to ensure timely response to dynamic topology changes of the network [5].The mobility of mobile ad hoc network nodes is analyzed, and the existing clustering protocols are investigated and analyzed. In this paper, a cluster-routing protocol based on fuzzy logic reasoning is designed, considering the shortcomings of classical protocols and the characteristics of mobile ad hoc networks, combined with the properties of nodes. Considering the characteristics of the mobility model, the increased trust model is adapted to the group mobility model. The simulation analysis of the protocol is carried out under two entity mobility models and two group mobility models. The experimental results show that the proposed protocol can delay the death rate of network nodes and prolong the network lifetime.When quantitatively evaluating MAC layer routing, the main indicators are as follows.Energy consumption. As network nodes are powered by non-rechargeable or difficult-to-charge batteries and have limited energy, the power consumption of nodes is the most critical index for evaluating a routing protocol. In addition to the joule value of absolute energy consumption, the failure time of the first node and the failure time of half the nodes are also equivalent evaluation indexes. Packet delivery rate. In mobile ad hoc network, data needs to be accurately sent to the destination node. The ratio of packet delivery ratio (PDR) to the number of packets received and sent is used to express the proportion of data that has been received successfully.(1)Pa=Nrp⋅100%+n!/r!n−r!limr⟶∞Nsp.Pa means the average packet delivery rate of the whole network within a certain period, Nrp means the total number of packets received from all nodes of the whole network within a certain period, and Nsp means the total number of packets sent from all nodes of the whole network within a certain period. The index of packet loss rate is 100% minus the delivery rate, which can also be used as the equivalent evaluation index of this index. Average delay. In mobile ad hoc network, the data detected by the sensor on the node is time-sensitive, especially in some real-time monitoring application scenes. Therefore, the average end-to-end delay (REED) of network transmission is also very important:(2)Da=∑tr−tslimr⟶∞Nrp.Among them,Da means the average end-to-end delay of the whole network within a certain period of time, Nrp means the total number of packets received by all nodes of the whole network during that period, tr means the moment when a packet is received, and Ts means the moment when it is sent. Average jitter. The average jitter of the network refers to the variance of the delay of each packet received. This index represents the stability of the network and plays a key role in many applications sensitive to delay:(3)Ja=∑tr−Da−ts2limr⟶∞Nrp.Network throughput. Ta is the total amount of data passing through a local connection divided by the time it takes to transfer the data. It can describe the upper limit of network transmission capacity:(4)Ta=limr⟶∞NrbTtra.Specifically, throughput refers to the averageNrp of the entire network during a period of time, bits refers to the total number of bits of data received by all nodes in the network during this period, and Ttra refers to the duration of this period.


## 2.2. MAC Layer Routing Protocol Classification

MAC layer network routing protocols can be classified from the following perspectives:(1)
According to forwarding path. Routing protocols can be divided into single-path routing and multipath routing. A protocol that holds only one routing information in a routing table for a destination node is called a single-path protocol. The multipath protocol saves several different paths in the routing table and selects one of the best paths in the routing table when it is necessary to forward packets. If a path is found to be unavailable during transmission, other available forward paths can also be found in the routing table, thus reducing the number of times the routing table is maintained. The multipath routing protocols include ad hoc on-demand multipath distance vector (AOMDV), wireless ad hoc network multiroute distance vector on demand, temporally ordered routing algorithm (TORA), and so on.(2)
According to the routing discovery strategy, there are active routing protocols and passive routing protocols. Active routing actively builds and stores routing tables that contain routing information for the entire network or part of the network. When a node receives a packet that needs to be forwarded, it determines the next hop of the forwarding path according to the instruction of the routing table. Common active routing protocols are destination sequenced distance vector (DSDV), wireless routing protocol (WRP), and optimized link state routing (OLSR). Passive routing protocols, also known as on-demand or reactive routing protocols, are only calculated temporarily when a node in the network needs to send data. Ad hoc on-demand distance vector (AODV) and dynamic source routing (DSR) are common on-demand routing protocols.(3)
According to topology structure. Some routing protocols form plane topology, while others form cluster tree topology. Clustering routing nodes in the network into several clusters, each cluster in the cluster head, belong to the same cluster by cluster head communication between nodes, communication between nodes belonging to different clusters through their respective cluster head forward; common clustering routing protocol is low energy adaptive clustering hierarchy (LEACH), and OLSR has some characteristics of clustering protocol. In the planar routing protocol, all nodes have equal status and the same function, and they can send, forward, or receive data. Common routing protocols such as AODV, DSR, and DSDV are planar routing protocols.(4)
Geographic location information. It will greatly facilitate the improvement of service quality if the real geographic location of each node can be known during the routing process. Geographic location information is usually provided by the satellite positioning module such as GPS carried by the node, but GPS module has disadvantages in price and energy consumption. Therefore, common routing protocols do not directly obtain geographic location information through GPS. Location-aided routing (LAR) and perimeter routing protocol (GPSR) are commonly used. The common routing protocols are classified and summarized in Figure 2.Figure 2
Common MANETs protocolsIn this paper, NS-3 simulation software is used to simulate and test the energy consumption, throughput, delay, delivery rate, and jitter of the three routing protocols. The specific simulation conditions are shown in Table2.Table 2
The specific simulation conditions.
ProjectScene scope (km2)The number of nodes is 10Network protocolMobile modelPropagation modelThe energy modelParameter0.5∗0.520∼60There are ten sending nodes and ten receiving nodes80011 mbpsRandom waypoint model sm/sTest itemsLogarithmic distance diffusion model\Li-ion battery model\Wi-Fi equipment energy consumption model\average package delivery rate\average end-to-end delay\the average jitter\times 1 median residual energyIn the simulation process, the random waypoint movement model was adopted, the movement speed was fixed at 5 m/s, the residence time was set as 0, the number of adjusted nodes was 20, 30, 40, 50, and 60, and the DSDV, AODV, and OLSR protocols were simulated for each node number, with each simulation time of 100 seconds. In each case, a UDP datagram is sent from 10 sending nodes to 10 receiving nodes. Average PDR is shown in Figure3.Figure 3
Average PDR.Since DSDV updates routing tables regularly, packet loss will occur when routing information stored in nodes becomes unavailable due to the movement of nodes, while AODV protocol that creates and updates routing tables dynamically and OLSR protocol that frequently updates routing tables will not [6]. As the AODV protocol updates the routing table on demand, when the network density increases, the options of the relay nodes become more and more, which reduces the packet loss rate. With the increase of network size, OLSR and DSDV protocols are both protocols for periodically updating routing tables. Because of the MPR mechanism unique to OLSR, the PDR of OLSR protocol does not increase like that of DSDV protocol, while PDR decreases instead. Figure 4 shows the comparison of average delay.(1)
Network intrusion attack. It uses the vulnerability of industrial control system to break into the actual physical system and can obtain the user’s privacy information, key operating parameters of the system, and even cause the paralysis of the entire distributed energy system with forged control commands. A large number of intelligent devices in energy stations are widely distributed, and the corresponding protection measures are relatively weak, easily becoming the object of invasion and attack. Once an attacker penetrates the private communication network of an enterprise through intelligent devices, the control system of the energy station, etc., may be damaged [7].(2)
Password cracking attack. This kind of attack is to gain access rights of the device. Illegal users attack a password system and can obtain passwords, access rights, and users’ privacy information by means of traffic monitoring or brute force cracking.(3)
Malware attack. This type of attack involves looking for vulnerabilities in network communications, planting malicious code or spyware, and targeting critical power infrastructure. For example, in Ukraine, monitoring and control system of the power sector in December 2015 was attacked by a malicious code, and at least three regional power monitoring and control systems were destructive malware attacks, resulting in the destruction of a substation control system, power monitoring management system and also malicious invasion, power generation equipment malfunction, and power blackouts in a few hours. At the same time, the power line repair system was also attacked by the malicious software of automatic dialing, which caused the system to block and to not carry out the maintenance work normally. In recent years, the number, scale, and complexity of malware attacks have increased rapidly [8]. With the continuous development of the energy Internet, such attacks will have a broader impact on the energy Internet.Figure 4
The comparison of average delay.


## 3. Analysis of MAC Layer Energy Consumption and Routing Protocol Correlation Algorithm of Mobile Ad Hoc Network

### 3.1. MAC Layer Energy Consumption and Routing Protocol Algorithm Model Analysis

Li-ion battery model. The Li-ion model describes the voltage drop of the battery during discharge. This model only takes the SoC (state-of-charge) as the input and can accurately predict the discharge curve of lead-acid battery, ni-Fu battery, ni-Mh battery, file battery, and other batteries of any kind that conform to the following characteristics: 1. the internal resistance of the battery is constant, which does not change much in the process of charging and discharging; 2. charging and discharging curves are reversible, and battery life attenuation is not considered in a charge and discharge cycle; 3. the discharge of the battery is not related to the discharge current, and the nonlinear characteristics of the battery are not considered; 4. the battery is in constant temperature state; 5. the self-discharge characteristics of the battery are not considered; 6. batteries have no memory effect. The mathematical model of Li-ion model is as follows [9–13]:(5)E=n!r!n−r!+A⋅e−B⋅∫idt−qr⋅Kqr−∫idt+E0K=n!r!n−r!+ef−en+ef−ee⋅e−Bqn−1⋅qr−qnqnE0=K+Ri+ee+12.The exponential region of the discharge curve, the nominal region, is shown in Figure5. However, the Li-ion battery model does not reflect the rate capacity effect and self-recovery characteristics of the battery. Therefore, the model can only describe the state of the battery under the condition of constant current discharge and is not applicable to the scene where the power is on and off and the load is on and off, similar to the sensor network node.Figure 5
The exponential region of the discharge curve.NS-3 provides another battery model that can describe the nonlinear characteristics of a battery: the RV battery model. The study shows that the RV model is equivalent to the continuous kinetic battery model (KiBaM), or KiBaM is a discretized RV model. KiBaM model is an analytical model with high abstractness. KiBaM treats the battery as two parts, as shown in Figure6.Figure 6
Two parts as KiBaM treats the battery.They are called bound charge wells (BCW) and available charge wells (ACW), respectively. ACW provide energy directly to the load, while BCW do not directly export, but exchange energy with ACW through a “narrow” channel. The transfer speed of energy in the channel is related to the “height difference” between the two wells and a hypothetical coefficient related to the nature of the battery. The model is expressed by differential equations.(6)dy1dt=h2−h1⋅k−I+Kdy2dt=R−h2−h1⋅k.


### 3.2. Simulation and Analysis of MAC Layer Energy Consumption and Routing Protocol Optimization Numerical Solution Method

The performance of the proposed numerical method is evaluated by simulation. The simulation platform is Matlab. Due to the performance of the simulated numerical solution method only, in order to exclude the influence of model factors, the proposed numerical solution method is adopted to solve the original KiBaM model. The battery voltage is 3.7 V, the battery capacity, and the discharge state is 2 A current intermittent discharge of 10 seconds’ reciprocating cycle. The ODE solver with an iterative step of 0.001 seconds provided by Matlab is selected as the comparison benchmark, which is the numerical solution of differential equation with the best accuracy under the condition that no analytical solution can be obtained. As a comparison, the four-stage classic Runge–Kutta solution with an iterative step of 0.1 seconds is compared with the solution proposed in this paper with an iterative step of 1 second. The simulation results are shown in Figure7.Figure 7
The simulation results.It can be seen from the simulation results that the error of the classical Runge–Kutta solution is still greater than that of the implicit second-order and fourth-order Runge–Kutta solution, even if the solution accuracy is improved 10 times. With one-tenth of the solution precision of the classical solution, the proposed solution obtained the accurate results of the classical solution with standard deviation of 32.27% and maximum deviation of 26.98%, respectively [14–17]. Moreover, the classical method has a serious problem of accumulated error. With the passage of simulation time, the accumulated error will become larger and larger, and finally diverging results will be obtained, as shown in Table 3.Table 3
The accumulated error.
MethodsThe standard deviationThe largest deviationThe final deviationClassical solution4.310.410.4Solution in this paper1.42.81.5


## 3.1. MAC Layer Energy Consumption and Routing Protocol Algorithm Model Analysis

Li-ion battery model. The Li-ion model describes the voltage drop of the battery during discharge. This model only takes the SoC (state-of-charge) as the input and can accurately predict the discharge curve of lead-acid battery, ni-Fu battery, ni-Mh battery, file battery, and other batteries of any kind that conform to the following characteristics: 1. the internal resistance of the battery is constant, which does not change much in the process of charging and discharging; 2. charging and discharging curves are reversible, and battery life attenuation is not considered in a charge and discharge cycle; 3. the discharge of the battery is not related to the discharge current, and the nonlinear characteristics of the battery are not considered; 4. the battery is in constant temperature state; 5. the self-discharge characteristics of the battery are not considered; 6. batteries have no memory effect. The mathematical model of Li-ion model is as follows [9–13]:(5)E=n!r!n−r!+A⋅e−B⋅∫idt−qr⋅Kqr−∫idt+E0K=n!r!n−r!+ef−en+ef−ee⋅e−Bqn−1⋅qr−qnqnE0=K+Ri+ee+12.The exponential region of the discharge curve, the nominal region, is shown in Figure5. However, the Li-ion battery model does not reflect the rate capacity effect and self-recovery characteristics of the battery. Therefore, the model can only describe the state of the battery under the condition of constant current discharge and is not applicable to the scene where the power is on and off and the load is on and off, similar to the sensor network node.Figure 5
The exponential region of the discharge curve.NS-3 provides another battery model that can describe the nonlinear characteristics of a battery: the RV battery model. The study shows that the RV model is equivalent to the continuous kinetic battery model (KiBaM), or KiBaM is a discretized RV model. KiBaM model is an analytical model with high abstractness. KiBaM treats the battery as two parts, as shown in Figure6.Figure 6
Two parts as KiBaM treats the battery.They are called bound charge wells (BCW) and available charge wells (ACW), respectively. ACW provide energy directly to the load, while BCW do not directly export, but exchange energy with ACW through a “narrow” channel. The transfer speed of energy in the channel is related to the “height difference” between the two wells and a hypothetical coefficient related to the nature of the battery. The model is expressed by differential equations.(6)dy1dt=h2−h1⋅k−I+Kdy2dt=R−h2−h1⋅k.


## 3.2. Simulation and Analysis of MAC Layer Energy Consumption and Routing Protocol Optimization Numerical Solution Method

The performance of the proposed numerical method is evaluated by simulation. The simulation platform is Matlab. Due to the performance of the simulated numerical solution method only, in order to exclude the influence of model factors, the proposed numerical solution method is adopted to solve the original KiBaM model. The battery voltage is 3.7 V, the battery capacity, and the discharge state is 2 A current intermittent discharge of 10 seconds’ reciprocating cycle. The ODE solver with an iterative step of 0.001 seconds provided by Matlab is selected as the comparison benchmark, which is the numerical solution of differential equation with the best accuracy under the condition that no analytical solution can be obtained. As a comparison, the four-stage classic Runge–Kutta solution with an iterative step of 0.1 seconds is compared with the solution proposed in this paper with an iterative step of 1 second. The simulation results are shown in Figure7.Figure 7
The simulation results.It can be seen from the simulation results that the error of the classical Runge–Kutta solution is still greater than that of the implicit second-order and fourth-order Runge–Kutta solution, even if the solution accuracy is improved 10 times. With one-tenth of the solution precision of the classical solution, the proposed solution obtained the accurate results of the classical solution with standard deviation of 32.27% and maximum deviation of 26.98%, respectively [14–17]. Moreover, the classical method has a serious problem of accumulated error. With the passage of simulation time, the accumulated error will become larger and larger, and finally diverging results will be obtained, as shown in Table 3.Table 3
The accumulated error.
MethodsThe standard deviationThe largest deviationThe final deviationClassical solution4.310.410.4Solution in this paper1.42.81.5


## 4. MAC Layer Energy Consumption and Routing Protocol Algorithm Optimization

### 4.1. Routing Protocol of MAC Layer Dynamic Energy Consumption Cycle

HELLO packet undertakes more functions, such as link awareness, topology detection, and MPR set selection, so HELLO packet broadcasting has a great impact on routing performance. HELLO packet broadcasts more frequently under the default setting, causing a large additional routing overhead. In other words, the HELLO broadcast cycle has a significant impact on both routing performance and power consumption, and it is necessary to optimize this aspect. At present, there are few studies on HELLO broadcast cycle of OLSR routing protocol, and the optimization is relatively rough. For example, it is not possible to dynamically adjust the node speed of the network. This chapter presents an improved protocol that can detect node speeds in a network and dynamically adjust the HELLO broadcast cycle. The research methods of this chapter are shown in Figure8.Figure 8
The research methods of this chapter.In this paper, first of all, NS-3 simulation environment is established to change the network environment, and HELLO broadcast cycle of routing protocol is adjusted in each network environment, so as to carry out a large number of simulations and generate a large amount of data. With these data as the sample set, the BP neural network algorithm optimized by genetic algorithm was used to train and verify the neural network, and the weight and bias data of the single hidden layer neural network were obtained. Data according to the weights and bias, in OLSR routing protocol, “sends HELLO packets” subroutines in rebuilding the single hidden layer neural network, all nodes and the entire network movement speed data as the input parameters of neural network, and can output the HELLO broadcast cycle under this movement speed which will have a kind of routing performance, including energy consumption, AEED, PDR, jitter, throughput, etc. By combining the above information and making use of multiattribute decision, the optimal HELLO broadcast cycle is obtained, and the result is taken as the time of the next HELLO package broadcast [18–20].In order to obtain the moving speed of all other nodes in the network, you need to broadcast your moving speed to other nodes. According to the introduction in Sections2.1 and 2.2 of this paper, although TC packets will be forwarded to the entire network and the number of packets sent is less than HELLO packets, broadcasting the mobile speed information with TC as the carrier will save more routing overhead. However, this has a fatal disadvantage. The broadcast cycle of TC packet is longer than that of HELLO packet, and the interval of the next broadcast is determined after each broadcast. If the carrier is TC packet, the node moving speed cannot be updated timely.


### 4.2. Protocol Optimization Is Obtained by Using Simulation Algorithm

In a complete NS-3 program, the network environment is composed of the following parts. 1. In node NS-3, the network is regarded as a graph, and Node is the node on the graph, representing the host, router, and so on the physical network. 2. The channel represents the communication channel between nodes. 3. The network equipment represents the network card and driver attached to the node. Only when the node has installed the network equipment can it establish channels with other devices. 4. Applications represent network applications, such as TCP applications, UDP applications, etc. 5. The Helper uses various helpers to install network devices on nodes, establish channels between network devices of other nodes, configure various devices and channels, and assign IP addresses, etc.Although it is possible to simulate without using helpers, the existence of helpers greatly simplifies programming. Figure9 shows a Wi-Fi mobile self-organizing network with OLSR protocol. In most cases, a legitimate and complete NS-3 system must have all the parts as shown in Figure 9. Because the NS-3 has no convenient graphical interface, all operations are interacted on the command line. So each piece of structure in Figure 9 needs to be implemented programmatically (21).Figure 9
Structure of NS-3.


## 4.1. Routing Protocol of MAC Layer Dynamic Energy Consumption Cycle

HELLO packet undertakes more functions, such as link awareness, topology detection, and MPR set selection, so HELLO packet broadcasting has a great impact on routing performance. HELLO packet broadcasts more frequently under the default setting, causing a large additional routing overhead. In other words, the HELLO broadcast cycle has a significant impact on both routing performance and power consumption, and it is necessary to optimize this aspect. At present, there are few studies on HELLO broadcast cycle of OLSR routing protocol, and the optimization is relatively rough. For example, it is not possible to dynamically adjust the node speed of the network. This chapter presents an improved protocol that can detect node speeds in a network and dynamically adjust the HELLO broadcast cycle. The research methods of this chapter are shown in Figure8.Figure 8
The research methods of this chapter.In this paper, first of all, NS-3 simulation environment is established to change the network environment, and HELLO broadcast cycle of routing protocol is adjusted in each network environment, so as to carry out a large number of simulations and generate a large amount of data. With these data as the sample set, the BP neural network algorithm optimized by genetic algorithm was used to train and verify the neural network, and the weight and bias data of the single hidden layer neural network were obtained. Data according to the weights and bias, in OLSR routing protocol, “sends HELLO packets” subroutines in rebuilding the single hidden layer neural network, all nodes and the entire network movement speed data as the input parameters of neural network, and can output the HELLO broadcast cycle under this movement speed which will have a kind of routing performance, including energy consumption, AEED, PDR, jitter, throughput, etc. By combining the above information and making use of multiattribute decision, the optimal HELLO broadcast cycle is obtained, and the result is taken as the time of the next HELLO package broadcast [18–20].In order to obtain the moving speed of all other nodes in the network, you need to broadcast your moving speed to other nodes. According to the introduction in Sections2.1 and 2.2 of this paper, although TC packets will be forwarded to the entire network and the number of packets sent is less than HELLO packets, broadcasting the mobile speed information with TC as the carrier will save more routing overhead. However, this has a fatal disadvantage. The broadcast cycle of TC packet is longer than that of HELLO packet, and the interval of the next broadcast is determined after each broadcast. If the carrier is TC packet, the node moving speed cannot be updated timely.


## 4.2. Protocol Optimization Is Obtained by Using Simulation Algorithm

In a complete NS-3 program, the network environment is composed of the following parts. 1. In node NS-3, the network is regarded as a graph, and Node is the node on the graph, representing the host, router, and so on the physical network. 2. The channel represents the communication channel between nodes. 3. The network equipment represents the network card and driver attached to the node. Only when the node has installed the network equipment can it establish channels with other devices. 4. Applications represent network applications, such as TCP applications, UDP applications, etc. 5. The Helper uses various helpers to install network devices on nodes, establish channels between network devices of other nodes, configure various devices and channels, and assign IP addresses, etc.Although it is possible to simulate without using helpers, the existence of helpers greatly simplifies programming. Figure9 shows a Wi-Fi mobile self-organizing network with OLSR protocol. In most cases, a legitimate and complete NS-3 system must have all the parts as shown in Figure 9. Because the NS-3 has no convenient graphical interface, all operations are interacted on the command line. So each piece of structure in Figure 9 needs to be implemented programmatically (21).Figure 9
Structure of NS-3.


## 5. Conclusion

For mobile self-organizing networks, this paper studied the energy consumption of MAC layer and the routing protocol, and routing protocol of MAC layer important research tool network simulator NS-3 was improved, a new OLSR protocol HELLO on MANET and the characteristics of OLSR routing protocol and implementation, and with the development and research situation of OLSR protocol, this paper analyzed and summed up the current most advanced algorithm optimization scheme and its deficiency and facing difficulties. Routing protocol research is extremely dependent on the network simulation of the simulator, in view of the network simulator NS-3 in wireless sensor networks and mobile ad hoc network simulation to estimate the node energy consumption in the process of inaccurate problem, this paper put forward KiBaM-Li-ion battery model and corresponding numerical solution method, and through the experimental results showed the effectiveness of the proposed scheme and accuracy. Aiming at the unscientific setting of HELLO broadcast frequency in OLSR routing protocol, a dynamic HELLO broadcast cycle algorithm based on artificial neural network was proposed. The network simulator NS-3 was used to carry out a large number of simulations and obtain a large number of data. With these data as training samples, the BP neural network algorithm optimized by genetic algorithm was used to obtain a single hidden layer neural network model. It can accurately predict the effect of different HELLO broadcast cycle parameters of OLSR routing protocol on network performance under mobile self-organizing network with different node movements. TOPSIS multiattribute decision-making HELLO cycle selection algorithm based on AHP weight was proposed to comprehensively weigh each QoS index and energy consumption. The simulation results showed that the proposed method can achieve greater optimization of other performance indexes at a small cost of a certain performance index and can be applied to MANET with variable node movement.



---

*Source: 6687189-2021-02-09.xml*