#### Abstract

As energy-harvesting wireless sensor networks (EHWSNs) are increasingly integrated with all walks of life, their security problems have gradually become hot issues. As an attack means, malicious programs often attack sensor nodes in critical locations in the networks to cause paralysis and information leakage of the networks, resulting in security risks. Based on the previous works and the introduction of solar charging, we proposed a novel model, namely, Susceptible-Infected-Low (energy)-Recovered-Dead (SILRD) with solar energy harvesters. Meanwhile, this paper takes Logistic Growth as the drop rate of sensor nodes and the infection rate of multitype malicious programs under nonlinear condition into consideration. Finally, an -Susceptible-Infected-Low (energy)-Recovered-Dead (SILRD) model is proposed. Based on the Pontryagin Maximum Principle, this paper proposes the optimal strategies based on the SILRD with solar energy harvesters and the SILRD. The effectiveness of SILRD with solar energy harvesters was demonstrated by comparison with the general epidemic model. At the same time, by analyzing different charging strategies, we conclude that solar charging is highly efficient. Moreover, we further analyze the influence of controllable and uncontrollable input and various node degrees on SILRD model.

#### 1. Introduction

With the rapid development of wireless sensor networks (WSNs) in the past few years, the unique characteristics of WSNs have enabled them to play a key role in many fields, such as military strike, agricultural production, intelligent transportation, medical and health systems, and industrial fields. Typical WSNs consist of a series of sensor nodes with different functions of gathering environment information and transmitting processed information, which is either fixed or randomly distributed. Generally, the coverage area of the networks is much larger than the maximum transmission distance of each sensor node. Therefore, transmission between sensor nodes and terminal computers or control centers is normally conducted in multihop. However, the limited energy vastly confines the lifetime of the networks. Renewable natural resources, such as wind, solar, and tidal energy, can be transferred to electricity by certain energy harvesters, which can greatly mitigate the impact of energy shortage on the lifetime of energy-harvesting wireless sensor networks (EHWSNs) which is equipped with energy harvesters on each sensor node.

However, the structure of WSNs provides a hotbed for the propagation of malicious programs. Furthermore, low defense capabilities render sensor nodes more vulnerable to malicious programs. With the booming of WSNs in all walks of life, paralysis and information leakage owing to malicious programs will cause unpredictable economic losses. Along with the ceaseless invasion of malicious programs, many scholars have studied the behavior characteristics of malicious programs and develop corresponding countermeasures. Due to the similarity of propagation mechanisms between malicious programs and infectious disease, epidemic models which are suitable for WSNs have been further developed after decades of study based on the initial Susceptible-Infected-Recovered (SIR) model proposed by Kermack and McKendrick in 1927 [1]. Unlike computer viruses, the spread of malicious programs in WSNs is affected by node distribution density and communication radius [2]. Also, geospatial limitation [3], spatial correlation [4], coupling degree [5], and transmission delay [6] have effects on it. In addition to a series of removal methods, predicting the risk of infection of sensor nodes is also one of the current research hotspots [7]. Furthermore, a two-level bidirectional data prediction model proposed by Wang et al. can effectively reduce the data collection cost of the underwater acoustic sensor network and improve the utilization rate of bandwidth [8]. Li et al. applied machine learning methods to improve the efficiency of malware detection [9]. Han et al. proposed a DMPPR scheme to protect usersâ€™ privacy of WSNs [10]. Zhao et al. proposed a method to detect an undetectable false data-injection attack in cyber-physical systems [11]. In the prevention of malicious programs, Li et al. [12] and Liu et al. [13], respectively, proposed a LightLRFMS algorithm and TPE-FTED algorithm to screen false data caused by malicious attacks and system failures. Dynamic defenses are also valid methods [14, 15] compared with static approaches. Wu et al. proposed a novel model and defense mechanism to effectively protect big data in the networks owing to its vulnerability to virus attacks [16].

Although few scholars discuss the issue of energy in the sensor network attacked by malicious programs, effectively, the increase in the energy of WSNs is always a hot topic. For example, Mo et al. used multiple mobile chargers to supplement the energy of WSNs [17, 18]. It is worth mentioning that the control of multiagent is one of the research hotspots in recent years [19, 20]. In this paper, sensor nodes have been divided into five states based on the remaining energy, and the energy-harvesting technology is introduced to supplement the energy of sensor nodes to extend the lifespan of the EHWSNs. On the basis of [21], this paper changes the charging method to solar charging and constructs a new model, namely, Susceptible-Infected-Low (energy)-Recovered-Dead (SILRD) with solar energy harvesters. At the same time, considering networks input and multitypes of malicious programs attacks with nonlinear infection rates, a novel model named -Susceptible-Infected-Low (energy)-Recovered-Dead (SILRD) is proposed.

Similar to conflict of interest in a game, game theory can be applied to get optimal solutions, like optimal Dissemination of Security Patches [22], optimal power control [23], optimal detection rate [24], optimal data transmission strategy [25], optimal hardware deployment cost in EHWSNs [26], optimal delay and transmission times in the networks [27], suitable game strategy and price adjustment principle in cyber-physical-social systems (CPSS) [28], maximization of energy efficiency [29], and optimal multipath routing [30]. As an essential part of game theory, the differential game can describe the dynamic process with differential equations. Mylvaganam et al. find the optimal control in multiagent collision avoidance [31]. Miao and Li [32] derive the optimal strategies for the attackers and the intrusion prevention systems. Miao et al. [33] find an optimal solution based on tradeoff between network throughput and energy efficiency. In this paper, the differential game will be applied to solve the confrontation problem between malicious programs and EHWSNs, and the optimal attack-defense strategies for both parties have been proposed.

Our contributions are summarized in the following paragraphs.

The low-energy state is introduced into the basic epidemic model considering the limited energy of sensor nodes. To suppress the spread of malicious programs, the method of charging by solar energy harvesters is put forward which is helpful to alleviate the security problems and maintenance of the networks. Thus, a model named SILRD with solar energy harvesters which better fits EHWSNs has been proposed. The effectiveness of SILRD with solar energy harvesters is obtained by comparison with existing epidemic models. The efficiency of solar charging is demonstrated by comparing with different charging strategies.

Three nonlinear factors will be considered in this paper, including Logistic Growth, nonlinear infection rate, and charging power provided by solar energy harvesters. At the same time, this paper takes the impact of multitypes of malicious programs into consideration. Finally, a novel attack-defense game model named SILRD is proposed in this paper. Meanwhile, the influence of controllable input, uncontrollable input, and various node degree on SILRD model and EHWSNs has been discussed.

Based on the SILRD model, the optimal dynamic control strategies for EHWSNs and malicious programs under various node degrees are proposed by applying Pontryagin Maximum Principle.

The rest of the paper is organized as follows. In Section 2, the nonlinear factors involved in SILRD model will be proposed first, and then SILRD model will be introduced in detail. In Section 3, the Pontryagin Maximum Principle will be used to find the optimal dynamic control strategies and the optimality will be proved briefly after the introduction of the expressions of control variables and game cost. In Section 4, the effectiveness of SILRD with solar energy harvesters and solar charging, the influence of controllable and uncontrollable input, and node degree on SILRD will be demonstrated through simulations. Section 5 is the conclusion and prospect of this paper.

#### 2. SILRD Model in EHWSNs

This section explains the nonlinear factors at first, including Logistic Growth, nonlinear infection rate, and solar charging power. Then, on the premise of considering multiple types of malicious programsâ€™ attacks, the SILRD model is proposed.

##### 2.1. Nonlinear Factors in SILRD Model

In this paper, EHWSNs consist of identical sensor nodes equipped with solar energy harvesters, which are distributed statically. The solar energy harvesters energize sensor nodes according to the duration of sunlight. In the case of the diurnal period, the charging power generally goes through a process of increasing firstly and then decreasing. Specifically, the charging power increases slowly at first since the sunlight intensity is weak at dawn. With the arrival of noon, sunlight intensity increasingly reaches the maximum value of the day, while charging power at this time is also at a maximum. However, the charging power will show a downward trend when night falls. In this paper, 24 hours is assumed as a period and the case of fine days is only considered. In particular, (1) is used to describe the trend of solar charging power over a day [34]:where is the intensity of solar charging power and and are the mean value and variance value of the power distribution, respectively.

To maintain the functioning of EHWSNs, it is indispensable to deploy new nodes when conditions permit. This paper considers Logistic Growth as input rate of new nodes. Logistic Growth is formulated bywhere represents the node degree, represents the capacity of EHWSNs, and represents the quantity of susceptible nodes at time .

Compared with the linear infection rate, the nonlinear infection rate can better describe the ability of malicious programs to propagate in a limited area. Models with linear infection rates, where the quantity of infected nodes grows linearly, are impractical. Actually, the quantity of infections is bound to increase exponentially at first. As time progresses, the quantity grows steadily until it eventually infects the entire networks. According to the above description of infection process, (3) is applied to express it:where is the probability of infection, is the quantity of infected nodes at time , and represents the connectivity of nodes.

##### 2.2. Model with Solar Energy Harvester

There exist two-time intervals without sunlight in one day. Specifically, one is from 0 am to 5 am and the other is from 8 pm to 12 pm [34]. In these two intervals, solar energy harvesters knock off and sensor nodes may be dysfunctional since electricity drains out. According to the energy levels and the infection status, sensor nodes have been divided into five states.â€‰*Susceptible () State*. Sensor nodes in the susceptible state are with high-energy level and can complete assignment normally. Without defense measures, susceptible sensor nodes are vulnerable to malicious programs.â€‰*Infected () State.* Sensor nodes in the infected state are transformed from susceptible, recovered, or low-energy sensor nodes by running malicious programs. In the early stage of infection or after charging, infected sensor nodes are still at a high-energy level because the extent of damage has not yet been reached.â€‰*Low-Energy () State.* Sensor nodes in the low-energy state are with energy which are too insufficient to function properly, including information transmission. Therefore, malicious programs attached to low-energy sensor nodes do not have the ability to continue infecting. Similarly, low-energy sensor nodes will not be patched.â€‰*Recovered () State.* Sensor nodes in the recovered state have installed the patches successfully. Also, recovered sensor nodes are all in high-energy level. The patches are only applicable to relevant malicious programs. In the face of attacks by inhomogeneous malicious programs, these sensor nodes will also be helpless and transform to infected state.â€‰*Dead () State.* Sensor nodes in the dead state are absolute dysfunction compared with low-energy sensor nodes. Dead sensor nodes no longer own the ability to collect, process, and transmit information.

At time *t*, the proportion of the number of sensor nodes in susceptible, infected, recovered, low-energy, and dead states is , , , , and , respectively. And the following equation must be met:

In the absence of sunlight, the networks rely on the residual energy to maintain functioning. New sensor nodes are cast randomly to keep the connectivity of EHWSNs. Susceptible nodes still consume electricity at night to continue data acquisition, processing, and transmission. Under the attack of malicious programs, susceptible sensor nodes are transformed into infected sensor nodes with probability . Some susceptible sensor nodes are fortunately enough to be patched to possess immunity with probability . The rest stick at their daily tasks normally with probability .

Infected sensor nodes transmit data to neighbors at higher frequencies to spread malicious programs rapidly and disrupt the transmission mechanism. Therefore, infected sensor nodes will consume the remaining electricity at a faster rate and transform to low-energy or dead state with probability and according to the attack power of malicious programs. While malicious programs are spreading arbitrarily, patches carried by unmanned aerial vehicles (UAVs) transmitted to the infected sensor nodes located at the corresponding district with probability .

The existence of multiple types of malicious programs is considered and the common feature of these malicious programs is that their attack mechanisms are embodied in the accelerated consumption of sensor nodesâ€™ energy. For this reason, even recovered sensor nodes will be infected again with probability . Similarly, few recovered sensor nodes work normally until low-energy level with probability .

Sensor nodes at high-energy levels include sensor nodes in susceptible, infected, and recovered state. Energy consumption owing to damage or normal operation will eventually convert sensor nodes in high-energy state to low-energy state. Sensor nodes at low-energy levels suspend some functions, including data transmission, for their own subsistence. Therefore, low-energy sensor nodes will not receive and transmit malicious programs. Even if the consumption is lower, the energy will eventually run out with probability . With the use of solar energy harvesters, the probabilities of sensor nodes in low-energy state converting into susceptible, infected, and recovered states are , , and , respectively. Among them, is related to the number of sensor nodes that transformed from susceptible state to low-energy state at the previous moment, is related to the number of sensor nodes that transformed from infected state to low-energy state at the previous moment, and is related to the number of nodes that switched from an infected state to a low-energy state at the previous moment. In particular, Figure 1 is used to visualize the evolution of sensor nodes. Figure 1 shows a part of sensor nodes in EHWSNs. Among them, the letter in the circle represents the node state. Specifically, Figure 1(a) shows the initial node state when the patch-carrying UAV has not yet passed the sensor nodes and the solar energy harvesters have started working. Figure 1(b) shows the evolution of sensor nodes after the UAV drives over a part of sensor nodes and the solar energy harvesters charge sensor nodes.

**(a)**

**(b)**

Considering the Logistic Growth (2) and the nonlinear incidence rate (3), the above dynamic processes are formulated in (5)â€“(9), and the flow diagram of propagation is shown in Figure 2:

#### 3. Optimal Controls in Attack-Defense Game

In this section, control variables between malicious programs and EHWSNs are introduced at first. Then, the process of attack-defense game has been analyzed and the overall cost has been formulated. Finally, the Hamiltonian function has been built and constructed and the optimal strategies of both sides are obtained on the basis of proving the existence and the uniqueness.

##### 3.1. Control Variables in the SILRD Model

The attacks of malicious programs are mainly reflected in the propagation performance and the damage capacity. The more contagious malicious programs are, the more sensor nodes they can infect. Infected sensor nodes can spread malicious programs by increasing communication frequency. The damage capacity is incarnated in the consumption of energy and the destruction of hardware. Some malicious programs can overload sensor nodes so that they can become dysfunctional quickly, and other malicious programs cannot directly destroy sensor nodes because damage capacities are not powerful enough [35].

The defense measures applied by EHWSNs are the deployment of patch-carrying UAVs and the installing and running of solar energy harvesters. Because of the periodicity of sunlight, patching is the only countermeasure at night. By identifying and analyzing multitype malicious programs, UAVs will download corresponding patches from the base station. Energy supplements do not cure infected sensor nodes but only alleviate their severe consumption.

It is not hard to find that the propagation performance of malicious programs is the process of transformation from susceptible or recovered state to infected state. The attacks on the above transformations are defined as and . At the same time, the damage capacities are reflected in the process of transformation from infected state to low-energy or dead state. Thus, the attacks are defined as and . The defenses of EHWSNs are embodied in all sensor nodes that are transformed into recovered state. Therefore, the defense measures are defined as and .

According to the above statement, the corresponding probability can be replaced by the equations containing the control variables. Specifically, can be replaced by , can be replaced by , can be replaced by , can be replaced by , and can be replaced by . In particular, for the convenience of calculation, will be directly multiplied by the term corresponding to the nonlinear incidence rate. The subscripts and , respectively, represent the maximum and the minimum values of the attacks or defenses, and the letter represents the probability of the successful attacks or defenses and its subscript represents relevant state transition relationship.

##### 3.2. Cost Function in SILRD Model

The continuous confrontation between malicious programs and EHWSNs constitutes the attack-defense game. The purposes of malicious programs as attacker are to infect and destroy as many nodes as possible, while EHWSNs as defender aim to keep as many nodes immune and alive as possible. Both sides achieve their goals through the control means mentioned in the previous part. The cost function is applied to indicate the consequence of attack-defense game.

Deployment costs include production costs and human costs. Cost factor times the drop rate formulated in (2) is used to represent the deployment costs at time , where is greater than 0. By completing daily assignments, sensor nodes in susceptible state which send involved information to clients to meet their requirements will generate positive benefits.

Although the unstoppable spread of malicious programs causes more sensor nodes to be infected, infected sensor nodes do not initially incur additional costs until malicious programs begin to run. is used to describe the costs incurred after malicious programs run at time , where is greater than 0.

As a defense means for EHWSNs, the transmission of patches to susceptible and infected sensor nodes will incur costs. is used to describe the cost of transmitting patches to susceptible sensor nodes at time , and is used to describe the cost of transmitting patches to infected sensor nodes at time , where and are greater than 0.

Recovered sensor nodes are similar to susceptible nodes. Because they have immunity to certain types of malicious programs, the revenue generated by recovered nodes at time will be higher than that of the susceptible sensor nodes.

Low-energy sensor nodes cannot operate normally compared with the high-energy sensor nodes, so that they can incur the cost at time , where is greater than 0. The generation of dead sensor nodes will lead to the interruption of the connection of sensor nodes, or even the paralysis of the networks, and is used to describe the cost at time , where is greater than 0. It is worth noting that since solar energy harvesters capture natural resources, the cost of energy harvesting and transformation is not considered.

At the end of the game, each type of sensor nodes will incur a series of termination payoff. Among them, susceptible sensor nodes and recovered sensor nodes will still generate revenue in the future, so their terminal costs should be less than 0; that is, and are both less than 0. Conversely, sensor nodes at infected, low-energy, and dead states will still cause loss in the future; that is, , , and are greater than 0.

Based on the above statement, the cost function (10) is constructed as follows:

##### 3.3. Optimal Strategies in the SILRD Model

Suppose the duration of the game is . Within , according to (5)â€“(9), it is not difficult to find that the state variables are continuous and uninterrupted. Meanwhile, the state variables are continuous in the cost function (10).

For the control variables, they are not only continuous in state functions (5)â€“(9) and cost function (10), but also linear. Specifically, according to the assumptions in Section 3.1, each control variable has a maximum value and a minimum value; that is, each control variable is bounded. Furthermore, we define as a set of control strategies of attacker (malicious programs), that is, , and as a set of control strategies of defender (EHWSNs), that is, .

Thus, according to the conditions put forward by [36], there must exist a saddle point in (10), which satisfieswhere represents the cost incurred when only the optimal strategy is selected by EHWSNs, denotes that only malicious programs choose the optimal strategy and indicates that both EHWSNs and malicious programs choose the optimal strategies.

Specifically, the inequality on the left indicates that when strategy chosen by EHWSNs is unchanged, the cost will be maximized when the malicious programs choose the optimal strategy; the inequality on the right indicates the cost will be minimized when EHWSNs select the optimal strategy, while the strategy chosen by malicious programs remains unchanged. When both parties choose the optimal strategies, an equilibrium point, the saddle point, will be formed between the maximum cost generated by the malicious programs and the minimum cost generated by EHWSNs.

According to [37] and the characteristics of this model, we can further know that there must be satisfying the following equation:where represents the cost incurred by EHWSNs in selecting the optimal strategy after the malicious programs make an optimal decision, while denotes the cost incurred when the order of two sides is switched.

Theorem 1. *In the attack-defense game based on the SILRD model, the optimal dynamic strategies of EHWSNs and malicious programs arewhere discriminant parameters are shown in Table 1.*

*Proof. *Define in the SILRD model. For all which belongs to , if is satisfied, there must be an optimal set of strategies according to [38].

First, the generalization of the cost function in the game will be described as follows:Define a new function as follows:Then, the above general cost function will be simplified as follows:where corresponds to the integral term in (10) and corresponds to the nonintegral term in (10).

According to the definition of Hamiltonian function in differential game, we have the following formula:where is the set of costate variables; that is, , and is the differential equation of node state corresponding to (5)â€“(9).

Among them, when the costate functions satisfy the following equations, there exists an optimal strategy :where represents the terminal moment when the game ends.

Therefore, the Hamiltonian function, the differential equations, and the end-value constraints of costate variables in this paper can be formulated from (24) to (30):When is satisfied, if is greater than 0, takes the maximum value, and if is less than 0, takes the minimum value; if is greater than 0, takes the maximum value, and if is less than 0, takes the minimum value; if is greater than 0, takes the maximum value, and if is less than 0, takes the minimum value; if is greater than 0, takes the maximum value, and if is less than 0, takes the minimum value. On the contrary, when is to be satisfied, if is greater than 0, chooses the minimum value, and if is less than 0, chooses the maximum value; if is greater than 0, chooses the minimum value, and if is less than 0, chooses the maximum value.

#### 4. Simulation

In this section, we will expand into three parts. The first part is to compare with the existing general epidemic models in turn. The second part is to analyze the impact of charging on the SILRD model. The third part is to discuss the impact of controllable and uncontrollable system input and node degree on the SILRD model. In all three parts, the simulations are implemented in MATLAB R2017b. The abbreviations are applied in the section list in Table 2.

##### 4.1. Comparison with General Epidemic Model

In this part, three general epidemic models will be compared, namely, Susceptible-Infected-Recovered (SIR) model [39], Susceptible-Exposed-Infected-Recovered (SEIR) model [40], and EiSIRS model [41]. Among the three models, SIR model is the basic, SEIR model extends the E state on the basis of the SIR model, and EiSIRS adds the corresponding sleeping state on the basis of the SIR model.

For the unification and reasonability of the analysis, we did not consider the multiple rounds of infection in the EiSIRS model, and EiSIRS model would be renamed as Susceptible-Susceptible & sleep-Infected-Infected & sleep-Recovered-Recovered & sleep-Dead (SsIiRrD) model to facilitate understanding, where lowercase letters represent the sleep state of the corresponding state.

Experimental parameters are set as follows: , , , , , , , , , .

Three general epidemic models have the same parameter settings except for their own defensive measures. Similarly, the SILRD with UAVs and the SILRD with solar energy harvesters have the same parameter settings except for the introduction of the state and the corresponding defensive measures. In particular, the difference between the two SILRD models lies in the different charging methods. The first method is to use energy harvesters to capture solar energy and convert light energy into electrical energy to supplement the energy of sensor nodes. The second method is to deploy UAVs to charge sensor nodes [21].

It is worth noting that the purpose of this part is to highlight the characteristics of the two SILRD model by comparing with other general epidemic models, so the system input, multiple types of malicious programs, and the nonlinear infection rate will be ignored. Figure 3 shows the evolution of sensor node under five epidemic models.

**(a)**

**(b)**

**(c)**

**(d)**

It can be seen from Figure 3(a) that the changes in the quantity of susceptible sensor nodes in the five models are very close. Except for SEIR, the other models had a high infection rate in the first few days, as depicted in Figure 3(b). Because the SEIR model exists an exposed state between the susceptibility and infection state, some infected sensor nodes were cleared during the exposure period. For recovered sensor nodes, the decline was more pronounced in SsIiRrD, followed by SEIR and SIR, as depicted in Figure 3(c). Among them, the quantity of recovered sensor nodes in SIRLD model decreased the most slowly and stay around 96% after 20 days. As shown in Figure 3(d), the order of increasing quantity of dead sensor nodes from fast to slow is SIR, SEIR, SsIiRrD, SILRD with UAVs, and SILRD with solar energy harvesters.

It can be seen from the comparison with other general epidemic models that the SILRD model can more effectively increase the quantity of recovered sensor nodes and reduce the quantity of dead sensor nodes. The phenomenon is more obvious in SILRD with solar energy harvesters. At the same time, the two SILRD model directly charges low-energy sensor nodes, which will effectively reduce the energy depletion of sensor nodes due to infections or daily work.

##### 4.2. Effect of Charging on SILRD Model

Charging factors as one of the features of SILRD model will be discussed here. In this part, variations in the quantity of five node states, control variables and the quantity of high- and low-energy nodes, and the overall costs will be applied as indicators to explain the impact of charging.

Three scenarios will be discussed here, namely, SILRD model with solar energy harvesters, SILRD model with UAVs [21], and SILRD model without charging capability. In order to facilitate the analysis of the impact of charging, this part will ignore the impact of system input but will consider multiple types of malicious programsâ€™ attacks and nonlinear infection rates.

Unlike the previous section, the simulation here only considers one day, so the relevant simulation parameters have also been modified. Experimental parameters are set as follows: , , , , , , , , , .

###### 4.2.1. Evolution of Sensor Node under Various Charging Strategies

The solar charging power is formulated in (1). It is worth noting that SILRD with UAVs considers the situation of patching and charging at the same time, so low-energy sensor nodes will be transformed to recovered state directly. Figure 4 shows the evolution of sensor nodes under three charging strategies.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

As can be seen from Figure 4(a), SILRD with solar energy harvesters can effectively increase the quantity of susceptible sensor nodes. However, under the attack of multiple types of malicious programs, the SILRD model with charging strategy cannot effectively restrain the growth of malicious programs, among which the case with solar charging is the most serious, as shown in Figure 4(b). Nevertheless, charging can effectively reduce the quantity of low-energy sensor nodes, as shown in Figure 4(c). Similarly, the quantity of recovered sensor nodes also increased due to the charging strategies, as depicted in Figure 4(d). The situation of energy depletion is very close as shown in Figure 4(e). Among them, the more accurate sorting from high to low should be SILRD with UAVs, followed by SILRD without charging and SILRD with solar energy harvesters.

Under the attack of multitype of malicious programs, the strategies with charging cannot inhibit the increase of the quantity of infected sensor nodes effectively, but it can greatly reduce the quantity of low-energy sensor nodes so as to increase the quantity of recovered sensor nodes. The strategy with solar charging is more widely distributed, so it can increase the quantity of recovered sensor nodes in highly efficient to keep the networks running well.

###### 4.2.2. Variation on Dynamic Control Level

The variation of dynamic control will further reveal the cause of the evolution of node state, as depicted in Figure 5. Specifically, Figure 5(a) shows the changes in control variables in SILRD with solar energy harvesters, Figure 5(b) shows the changes in control variables in SILRD with UAVs, and Figure 5(c) shows the changes in control variables in SILRD without charging.

**(a)**

**(b)**

**(c)**

In all three cases, the malicious programs stopped spreading at the beginning and peaked when . After propagation stops, the malicious programs still exist in the infected sensor nodes. After patching with maximum effort, due to the accumulation of costs, the networks stop patching after weighing. If the networks were patched again, the cost of patching would be higher than the cost of damage caused by malicious programs, so the networks stopped using the UAVs.

After UAVs stop patching, there are still exist malicious programs with strong and weak ability to destroy in the networks. Among them, the strategy with UAVs can quickly eliminate the malicious programs with weak damage ability (), followed by the solar charging strategy () and finally the noncharging strategy (). However, malicious programs with strong destructive ability still present in the networks without completely clearing away.

###### 4.2.3. Variation on the Quantity of High- and Low-Energy Nodes

In order to directly express the quantity of high- and low-energy sensor nodes in the networks, the form of histogram has been applied to show the variation on the quantity of high- and low-energy sensor nodes over time under different charging strategies, as depicted in Figure 6.

**(a)**

**(b)**

As can be seen from Figure 6(a), sensor nodes with high energy show a downward trend under the three strategies. Among them, the strategy without charging fell by the most quickly. The degree of elevation of the strategy with UAVs is determined by the quantity of UAVs. This paper assumes a small quantity of UAVs deployed because too many deployments would be costly. The strategy with solar energy harvesters assumes that each sensor node is equipped with the energy harvester, which is close to reality. Based on the analysis of Figures 6(a) and 6(b), it can be seen that, due to the comprehensive deployment of sensor nodes equipped with solar energy harvesters, the quantity of high-energy sensor nodes declines slowly. Moreover, the low-energy sensor nodes not only did not rise but also fell.

###### 4.2.4. Overall Cost under Various Charging Strategies

Figure 7 shows the cost trends of the three strategies. The cost of solar charging is the lowest, followed by the strategy of deploying UAVs and finally the strategy of noncharging. For solar charging, since each sensor node is equipped with a solar energy harvester, there is no additional cost during capturing solar energy compared to the deployment of UAVs. In the conclusion of the previous section, charging can effectively improve the immunity of EHWSNs and reduce the quantity of dead sensor nodes, so as to achieve the purpose of reducing costs.

##### 4.3. Influence of Networks Input and Node Degree on SILRD Model

This section mainly discusses the influence of controllable and uncontrollable input and node degree on SILRD model. The formulation of networks input adopts (17). Node degrees are set to 5, 15, 30, and 50, respectively.

Similar to the previous section, this section also discusses the variation trend of four aspects, which are sensor nodes in various states, control variables, quantity of high- and low-energy sensor nodes, and overall costs.

The experimental parameters are the same as those in Section 4.2.

###### 4.3.1. Evolution of Sensor Nodes in SILRD Model

As a control group, uncontrollable input into the system will be considered. Figures 8(a)â€“8(e) show the evolution of node state when networks input contains control variables, and Figures 8(f)â€“8(j) show the evolution with uncontrollable input.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(g)**

**(h)**

**(i)**

**(j)**

In both cases, evolutions of sensor nodes change uniformly except when node degree equals 5, as depicted in Figure 8. The quantity of susceptible sensor nodes fell rapidly in the first hour before reaching equilibrium, as depicted in Figures 8(a) and 8(f). In the case of input with control variables, the final stable value of the quantity of susceptible sensor nodes is related to node degree, as shown in Figure 8(a). With the increase of node degree, the stable value of the quantity of susceptible sensor nodes becomes lower. On the contrary, in the case of input without control variables, the quantity of susceptible nodes experienced a process of rapid decrease and then a slow rise and finally reached an equilibrium, as shown in Figure 8(f).

The changes of the quantity of infected sensor nodes, low-energy sensor nodes, and dead sensor nodes are very similar, as shown in Figures 8(b), 8(c), 8(e), 8(g), 8(h), and 8(j). In the case of input with control variables, the quantity of recovered sensor nodes remained stable except when the node degree equals 5, as shown in Figure 8(d). In the case of input without control variables, the quantity of recovered sensor nodes increased rapidly after a period of stabilization, as shown in Figure 8(i). In a word, as the node degree increases, the infection will become more severe, and the quantity of low-energy and death sensor nodes will increase.

###### 4.3.2. Variation of Control Variables

In both cases, the quantity of infected sensor nodes reaches its peak when , so the networks stop patching, as shown in Figure 9. When , as more vulnerable sensor nodes exist in the networks, there is a risk of reinfection by malicious programs, so the networks start to patch the vulnerable sensor nodes again, as depicted in Figures 9(a), 9(b), 9(d), 9(f), and 9(h). When , the existing quantity of vulnerable sensor nodes is enough to maintain the normal operation of the networks, and the deployment of new sensor nodes will only bring more extra burden, so the networks will stop casting new sensor nodes, as shown in Figure 9(a). With the increase of node degree, the control strategy will not change greatly, as shown in Figures 9(c)â€“9(h).

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(g)**

**(h)**

###### 4.3.3. Variation on the Quantity of High- and Low-Energy Sensor Nodes

Figure 10 shows the changing trend of the quantity of high- and low-energy sensor nodes in the networks. The variation trend of low-energy sensor nodes is the same in both cases, but the influence of node degree on both cases is different when *T* is greater than 16, as shown in Figures 10(b) and 10(d). As can be seen from Figure 10(a), when network input contains control variables, the quantity of high-energy sensor nodes basically remains at a very high level, about 90%. In the case of uncontrollable input, the quantity of high-energy sensor nodes will increase continuously, as shown in Figure 10(c). It is worth noting that, with the increase of node degree, the quantity of high-energy sensor nodes will increase. As the infection rate continues to rise, sensor nodes in susceptible state will quickly convert to infected state, so that the quantity of susceptible sensor nodes will rapidly decline. Therefore, it is necessary to quickly cast new sensor nodes to maintain the operation of the networks.

**(a)**

**(b)**

**(c)**

**(d)**

###### 4.3.4. Overall Cost

Figure 11 shows the cumulative cost in both cases. With the increase of node degree, the costs do not show the same growth trend but tend to be saturated. In Figure 11(a), the numerical difference between the cost of node degree equal to 5 and the cost of node degree equal to 15 is about 7000, but the difference between 15 and 30 is about 1000, and the difference between 30 and 50 is about 200. Figure 11(b) shows the same phenomenon. The costs are lower in the case of controllable input than uncontrollable input under the same node degree owing to the networks with controllable input which can reduce the quantity of new sensor nodes and cut the cost of patching new sensor nodes, as shown in Figures 11(a) and 11(b).

**(a)**

**(b)**

#### 5. Conclusion

By introducing Logistic Growth, nonlinear incidence, and charging by solar energy, this paper builds an SILRD model suitable for EHWSNs. At the same time, the introduction of multiple types of malicious programs refines the model. By comparing with the existing epidemic models, we found that the SILRD has obvious advantages in increasing the quantity of recovered sensor nodes and reducing the quantity of death sensor nodes, especially SILRD with solar charging. Meanwhile, compared with the three charging strategies, we found that the SILRD with solar charging has the lowest cost. Finally, the influence of controllable input, uncontrollable input, and node degree on SILRD model is revealed through the simulations. When the node degree is higher, the quantity of infected sensor nodes and dead sensor nodes will increase rapidly under the attack of multitype malicious programs with nonlinear infection rate but will tend to be saturated. At the same time, input that contains control variables can timely stop the delivery of new nodes and affect the subsequent network patching behavior, thereby reducing costs.

Although this paper proposes a malicious programsâ€™ propagation model that is close to reality, there are still many deficiencies. In the establishment of the solar charging model, this paper uses a simplified model and does not consider some random factors, like weather factors, human factors, and so on. At the same time, the topology of the EHWSNs and various delay phenomena are not further analyzed in this paper. However, in spite of this, the model and analytical methods proposed in this paper are believed to provide scholars in related fields some inspiration in the future.

#### Data Availability

The data used to support the findings of this study are included within the article, such as the coverage area of the WSNs, the maximum transmission radius of nodes, and transition probabilities among five nodal states.

#### Disclosure

All authors declare that (1) no support, financial or otherwise, has been received from any organization that may have an interest in the submitted work and (2) there are no other relationships or activities that could appear to have influenced the submitted work.

#### Conflicts of Interest

The authors have no conflicts of interest, financial or otherwise.