1 Introduction

WSN are extensively used in todays life. WSN composed with many sensor nodes. Sensor node is a small device which assemble with four units sensing, processing, energy source and communicating. Sensor node may consist additional component depends upon purpose of use. In a sensor network, sensor node generates data by their surrounding and sends this data to the sink node with the help of intermediate nodes. Sensor node has limited communication range so it takes help from the neighboring nodes. Sensor nodes deployed in a hostile environment so charging a sensor node is a tough task. Limited capacity and defense capability constraints make sensor nodes vulnerable to many attacks. Sensor nodes can easily be targeted by software attacks like biological worm attack. It is a well-known truth that worms spread very fast due to the malicious object and propagate easily from one node to another node via communication in a susceptible network. Control on the worms is necessary for smooth functioning of the network. Mathematical modeling is an important tool to analyze the dynamics of worm propagation.

If a single node influenced with the worm than it may affect the entire network through different broadcast protocol [1, 2]. There is a close similarity between biological worms and the software generated worms. The worm attack is the most dangerous form of cyber attack that propagates in the computer and telecommunication networks. New types of worms have emerged in last few years. These types of worms do not need the internet connectivity for their propagation. They can be spread from device to device through wireless communication technology such as wi-fi or Blue tooth. Cabir is a computer worm that sends itself repeatedly in blue-tooth enabled devices. Mabir, is a variant of Cabir and has the capability of spreading not only via blue tooth but also via MMS. The spreading behavior of the Mabir and Cabir worms are epidemic in nature [13]. There is a basic similarity between worms spread among the population and the transmission of worms from device to device in a computer networks. Thus, security mechanisms that can defend sensor nodes against software attacks is of great interest to the sensor network community. To defend the sensor nodes against these types of malware attacks, we propose a security mechanism using epidemic models. Security and energy efficiency of a sensor network has been a recent research topic. Spread of malicious object through epidemic model based study is widely used in sensor networks . The objective of this paper is to present a strong defense mechanism and analyzing the effect of introducing vaccinated and exposed class in the network. The main contribution of this paper is to assess the feasibility of epidemic models in order to sending an information in WSN. In particular, we first show that epidemic modelling in WSN is meaningful. Later, we introduce two categories in the existing model and show that the proposed model works well. Experiments do support our analytical findings. Finally, we highlight some further research directions. Outline of the proposed paper is as follows: Sect. 2 presents the related work. Section 3 describes notations and terminology for the proposed work. Section 4 presents the dynamics of proposed SEIRV model. Section 5 presents the stability analysis of proposed model. Simulation results and numerical results on worm propagation is given in Sect. 6. Comparison analysis is given in Sect. 7. Section 8 concludes the presented work.

2 Related Work

Kermack and Mckendrick [3] presented a mathematical model for predicting worm spread within a population. Later, such models have been applied to many networks. Reproduction number \(R_0\) is one of the basic element in mathematical biology. Heesterbeek studied about the concept of \(R_0\) from demography to epidemiology and found that \(R_0\) is ‘one of the foremost and most valuable ideas that mathematical thinking has brought to epidemic theory’ [4]. Originally \(R_0\) is developed for the study of demographics, it is now widely used in the study of infectious disease, and more recently, in models of in-host population dynamics. Epidemic models for worm spread over the internet have been widely studied by researchers [5, 6].

Some mathematical model based on epidemic models have been proposed for WSN. Khelil et al. [8] proposed a SI model for a simple information diffusion to analyze worm attacks in mobile ad hoc networks. They derived an expression which shows the dependency of infection rate with node density. Khayam et al. [9] proposed a worm propagation model, the topologically aware worm propagation model (TWPM) for WSN and they consider susceptible and infected two possible states. Akdere et al. [10] has shown the applicability of epidemic theory on WSN and a comparative analysis of epidemic algorithms for data dissemination has been done. Zheng et al. [11] presented an epidemic model for mobile phone and consider the three main characteristics, distribution density, coverage radius, and moving velocity of mobile phone. De et al. [12] presented a model for WSN to analyze the spread of worms and study on random graphs considering the network parameters such as key sharing, distance. Tang et al. [13] proposed an epidemic theory based susceptible-infective-recovered with maintenance (SIR-M) model that captures both the spatial and the temporal dynamics. Tang [14] proposed a modified SI model to improve the anti-worm capability of networks by leveraging sleep mode. Wang and Li [15] proposed an epidemic theory based iSIRS model which define the process of worm propagation and they also considered the energy consumption of sensor nodes. Mishra and Keshri [16] proposed a SEIRS-V model. That model captures temporal and spatial both types of dynamics of worm propagation but communication radius and node density are not considered which is the main characteristic of WSN. A SIR model was proposed by Feng et al. [17] which consider the communication radius and node density both. Zhu et al. [18] developed a delay reaction diffusion model and described the process of male-ware propagation for mobile WSN. We extend the model proposed by Feng et al. [17] by including exposed and vaccination class.

3 Notations and Terminology

In order to develop a model, we first need to define the notations and terminology used in the paper. Notations and terms used in this paper are described below (Table 1).

Table 1 Notations

3.1 The Basic Reproduction Number

The basic reproduction number, \(R_0\), is defined as the expected number of secondary cases produced by a single infection in a completely susceptible population. When

$$\begin{aligned} R_0 < 1 \end{aligned}$$

each infected node will produce less than one new case of the infected node among all susceptible nodes. It means worm will die out and system becomes free from worms. But if,

$$\begin{aligned} R_0 > 1 \end{aligned}$$

each infected node will produce more than one infectious node so that the infection will take hold and becomes an epidemic.

3.2 Equilibrium Points

For the differential equation

$$\begin{aligned} \frac{dx}{dt} = f(x,t), \;\; x\in \mathbb {R}^n \end{aligned}$$

if \(f(x^*,t) = 0\) for all t, \(x^*\) is knows as equilibrium point.

There are two types of equilibrium: stable and unstable. A small disturbances in the system parameters does not affect the system, then the equilibrium is said to be stable. Otherwise, it is considered an unstable equilibrium.

3.3 Stability of the System

The proposed system represent the set of nonlinear ordinary differential equations. The stability at equilibrium point is checked by finding the Jacobian matrix to linearize the system model. The system is stable if all the eigenvalues of the evaluated Jacobian matrix at the equilibrium points are negative.

3.4 Lyapunov Function

A Lyapunov function for the first order autonomous system \(u =F(u)\) is a continuous real-valued function L(u) that is non-increasing on all solutions u(t), meaning that

$$\begin{aligned} L(u(t)) \le L(u(t_0)) \quad \text {for \,all}\;\; t > t_0 \end{aligned}$$

whenever u(t) is a non-equilibrium solution to the system. The Lyapunov function must be constant on an equilibrium solution.

  • L is a positive definite.

  • \({\dot{L}} \le 0\) so that \({\dot{L}} = 0\)

Every trajectory of \({\dot{x}} = f(x)\;\text { converges \;to \;zero \;as }\;t \rightarrow \infty\) (i.e., the system is globally asymptotically stable). Lyapunov functions are scalar functions and used to analyze the global stability of the equilibrium for the system of ordinary differential equations. There are different types of Lyapunov theorems to obtain Lyapunov function. One common approach is to assume the values of parameters so that the required conditions hold.

3.5 Routh–Hurwitz Criteria

It is an important criterion to determine the stability of a linear system without finding all the roots of the characteristic polynomial. It is a mathematical test, which provides necessary and sufficient conditions for stability. The system with characteristic equation \(P(\lambda )=0\) is stable if all the roots of \(P(\lambda ) = 0\) are negative. Stability criteria for the second, third and fourth degree polynomial with characteristic equation \(P(\lambda ) = 0\) is as follows:

  1. 1.

    For a second degree polynomial \(P(\lambda ) = \lambda ^2 + a_1\lambda + a_0\), all the roots are negative if and only if both coefficients \(a_1\) and \(a_0\) satisfy the condition \(a_1 > 0\), \(a_0 > 0\).

  2. 2.

    For a third degree polynomial \(P(\lambda ) = \lambda ^3 + a_2\lambda ^2 + a_1\lambda + a_0\), all the roots are negative if and only if all coefficients \(a_2\), \(a_1\) and \(a_0\) satisfy the condition \(a_2> 0, a_0 > 0\) and \(a_{2} \cdot a_{1} > a_{0}\).

  3. 3.

    For a fourth degree polynomial \(P(\lambda ) = \lambda ^{4} + a_{3}\lambda ^{3} + a_{2}\lambda ^{2}+a_{1}\lambda + a_{0} = 0\), all the coefficients must be positive and \(a_3 \cdot a_2 > a_1\) and \(a_3 \cdot a_2 \cdot a_1 > a_1^2 + a_3^2 \cdot a_0\).

4 Proposed Model (SEIRV Model)

We consider following five states in the proposed model:

  1. 1.

    Susceptible state (S) The nodes, which are not infected but vulnerable to worms called in the susceptible state.

  2. 2.

    Exposed state (E) The nodes, which are infected but not infectious belong to the exposed state. This type of nodes does not infect other nodes.

  3. 3.

    Infectious state (I) The infected nodes, which are capable of infecting other nodes belong to the infected state.

  4. 4.

    Recovered state (R) When an infected node become free from infection then it belongs to the recovered state.

  5. 5.

    Vaccinated state (V) The nodes, which get vaccination belong to the vaccinated state.

Consider the total number of nodes in the network are N(t) at any time t, which are uniformly distributed in the area \(L \times L \,\) (m\(^2\)) with average density \(\rho = \frac{N}{L^2}\) (nodes/m\(^2\)). The communication range of sensor nodes is r. Let S(t), E(t), I(t), R(t) and V(t) are the number of susceptible, exposed, infectious, recovered and vaccinated nodes at any time ‘t’ respectively. A node dies after exhausting its energy, the addition of new nodes is necessary.

New infections arise in the exposed class by contacts between susceptible and infectious individuals at a rate \(\beta S'I\). The transition relationship between the states of the nodes is depicted by the Fig. 1.

Fig. 1
figure 1

The transition relationship between the states of the nodes

Let the communication area of a sensor node is \(\pi r^2\) and the density of susceptible nodes in a unit area is given by \(\rho (t) = \frac{S(t)}{L^2}\). Then, the total number of neighboring nodes in the communication range of a sensor node is given by

$$\begin{aligned} S^{'}(t)=\rho (t) \cdot \pi r^2 = \frac{S(t) \cdot \pi r^2}{L^2} \end{aligned}$$
(1)

According to the Fig. 1, we consider the following mathematical model for the rate of change of different classes.

$$\begin{aligned} \frac{dS}{dt}&= \mu N -\phi S I - \mu S -\sigma S + \epsilon V + \delta R \end{aligned}$$
(2)
$$\begin{aligned} \frac{dE}{dt}&= \phi S I -(\mu + \alpha ) E \end{aligned}$$
(3)
$$\begin{aligned} \frac{dI}{dt}&= \alpha E -(\mu + \gamma ) I \end{aligned}$$
(4)
$$\begin{aligned} \frac{dR}{dt}&= \gamma I -(\mu + \delta ) R \end{aligned}$$
(5)
$$\begin{aligned} \frac{dV}{dt}&= \sigma S -(\mu + \epsilon ) V \end{aligned}$$
(6)

where,

$$\begin{aligned} \phi = \frac{\beta \pi r^2}{L^2} \end{aligned}$$
(7)

Note The basic reproduction number \(R_0\) for the proposed system plays an important role in the study of worm propagation. Therefore, we evaluate it before analyzing the set of differential Eqs. (26).

4.1 Basic Reproduction Number (\(R_0\))

The basic reproduction number (\(R_0\)) is the largest eigenvalue (spectral radius) of the next generation matrix [7]. The F and W matrix are defined as:

$$\begin{aligned} F =\begin{bmatrix} 0&\phi S^*_0\\ 0&0 \end{bmatrix} \quad \text {and} \quad W = \begin{bmatrix} (\mu + \alpha )&0\\ -\alpha&(\mu + \gamma ) \end{bmatrix} \end{aligned}$$

\(R_0\) is the largest eigenvalue of the matrix \([FW^{-1}]\). Hence, the basic reproduction number is given by

$$\begin{aligned} R_0 = \frac{\phi S^*_0 \alpha }{(\mu + \alpha )(\mu + \gamma )}. \end{aligned}$$
(8)

4.2 Equilibrium Points for the Worm Free and the Epidemic States

We solve the system of differential Eqs. (2) to (6) for equilibrium such that

$$\begin{aligned} \frac{dS}{dt} = 0, \frac{dE}{dt} = 0, \frac{dI}{dt} =0, \frac{dR}{dt} = 0, \frac{dV}{dt} = 0. \end{aligned}$$

On solving (2) to (6), for the worm free equilibrium, we get

$$\begin{aligned} P^*_0 = ( S^*_0,E^*_0,I^*_0,R^*_0,V^*_0) = \left\{ \frac{N(\mu + \epsilon )}{\mu + \epsilon + \sigma } ,0,0,0,\frac{N \sigma }{\mu + \epsilon + \sigma }\right\} \end{aligned}$$
(9)

Now, let \((S^*, E^*, I^*, R^*, V^*)\) are the equilibrium points for the epidemic state. To find equilibrium points for epidemic state, again we solve (2) to (6) for epidemic equilibrium.

Then \(P^*\) for epidemic state as follows:

$$\begin{aligned} \begin{aligned} P^*&= ( S^*,E^*,I^*,R^*,V^*) \\&= \left\{ \frac{(\mu + \alpha )(\mu + \gamma )}{\phi \alpha } ,\frac{(\mu + \gamma )I^* }{\alpha }, A (R_0-1),\frac{\gamma I^*}{(\mu + \delta )},\frac{ \sigma (\mu + \alpha )(\mu + \gamma )}{\phi \alpha (\mu + \epsilon )} \right\} \end{aligned} \end{aligned}$$
(10)

where,

$$\begin{aligned} A = \frac{ (\mu +\alpha )(\mu +\gamma )(\mu +\delta )(\mu +\epsilon +\sigma )}{\phi (\mu +\epsilon )\{\mu ^2+\mu (\alpha +\gamma +\delta )+ \alpha \delta +\delta \gamma +\gamma \alpha \}} \end{aligned}$$
(11)

It should be noted that the epidemic equilibrium is meaningful if \(R_0 > 1\). The epidemic equilibrium points \((S^*,E^*,I^*,R^*,V^*)\) will be positive if \(R_0>1\). The stability of the system (for the worm free and the epidemic state both) at equilibrium points is checked in next section.

5 Stability Analysis of Proposed Model

In order to check the stability at point \(P^*_0\) and \(P^*\), the proposed system defined by the Eqs. (26) is linearized by estimating the Jacobian matrix as follows:

$$\begin{aligned} J = \begin{bmatrix} -(\phi I +\mu + \sigma )&0&- \phi S&\delta&\epsilon \\ \phi I&-(\mu + \alpha )&\phi S&0&0\\ 0&\alpha&-(\mu + \gamma )&0&0\\ 0&0&\gamma&-(\mu + \delta )&0\\ \sigma&0&0&0&-(\mu + \epsilon ) \end{bmatrix} \end{aligned}$$
(12)

5.1 Stability Analysis for Worm Free Equilibrium

Stability analysis for the worm free equilibrium at point \(P^*_0\). Since \(I = I^*_0 = 0\) and \(S = S^*_0\), the Eq. (12) implies that

$$\begin{aligned} J_{(P_0^*)} = \begin{bmatrix} -(\mu + \sigma )&0&- \phi S^*_0&\delta&\epsilon \\ 0&-(\mu + \alpha )&\phi S^*_0&0&0\\ 0&\alpha&-(\mu + \gamma )&0&0\\ 0&0&\gamma&-(\mu + \delta )&0\\ \sigma&0&0&0&-(\mu + \epsilon ) \end{bmatrix} \end{aligned}$$
(13)

Theorem 1

The worm free equilibrium is locally asymptotically stable for the proposed model if \(R_0 < 1\).

Proof

In order to check the stability at the point \(P^*_0\), we will find all the eigenvalues (\(\lambda\)) of the matrix (13). Three eigenvalues are given as

$$\begin{aligned} \lambda = -\mu , -(\mu +\delta ), - (\mu + \sigma + \epsilon ) \end{aligned}$$
(14)

and are negative. Remaining two eigenvalues are given by,

$$\begin{aligned} \{ \lambda ^2 + \lambda (2 \mu + \alpha + \gamma ) + (\mu + \alpha )(\mu + \gamma )(1 - R_0) \} = 0 \end{aligned}$$
(15)

Since all the coefficients of the Eq. (15) are positive, the Routh Hurwitz criteria for the second degree polynomial suggests that its eigenvalues (roots) are negative if \(R_0 < 1\). \(\square\)

Theorem 2

The worm free equilibrium is said to be globally in steady state if \(R_0 \le 1\).

Proof

Taking the Lyapunov function as follows:

$$\begin{aligned} {\dot{L}} = \omega _1 {\dot{E}} + \omega _2 {\dot{I}} = \omega _1 \{ \phi S (t) I(t) - (\mu + \alpha ) E(t) + \omega _2 \{\alpha E(t) - (\mu + \gamma ) I(t) \} \end{aligned}$$
(16)

Let \(\omega _1 = (\mu + \alpha )\) and \(\omega _2 = \alpha\) gives \({\dot{L}} = (R_0 - 1) I(t) \le 0\) so that \({\dot{L}} = 0\). From the above results, it is clear that worm free equilibrium is globally asymptotically stable. \(\square\)

5.2 Stability Analysis for Epidemic Equilibrium

In this section, stability analysis for epidemic equilibrium state at point \(P^*\) is given. On putting \(I = I^*\) and \(S = S^*\) in Eq. (12), we get the following matrix:

$$\begin{aligned} \begin{bmatrix} -(\phi I^* + \mu + \sigma )&0&- \phi S^*&\delta&\epsilon \\ \phi I^*&-(\mu + \alpha )&\phi S^*&0&0\\ 0&\alpha&-(\mu + \gamma )&0&0\\ 0&0&\gamma&-(\mu + \delta )&0\\ \sigma&0&0&0&-(\mu + \epsilon ) \end{bmatrix} \end{aligned}$$
(17)

Theorem 3

The epidemic equilibrium is locally asymptotically stable if \(R_0 > 1\).

Proof

In order to check the stability at the point \(P^*\), we will find the eigenvalues (\(\lambda\)) of the matrix (17). One of the eigenvalue is \(\lambda = -\mu\). Remaining eigenvalues are given by the Eq. (18) in \(\lambda\) as:

$$\begin{aligned}&(\lambda + \phi I^* + \mu + \sigma ) (\lambda + \mu + \alpha )(\lambda + \mu + \gamma )(\lambda + \mu + \delta )\nonumber \\&\quad +\,\epsilon (\lambda +\mu )(\lambda + \mu + \alpha + \gamma )(\lambda + \mu + \phi I^* + \delta )\nonumber \\&\quad - \,\phi S^*\alpha (\lambda + \mu + \delta ) (\lambda + \mu + \epsilon ) - \phi S^*\alpha \sigma (\lambda + \mu + \delta ) + \phi I^*\delta \epsilon (\lambda + \mu + \alpha + \gamma ) \nonumber \\&\quad +\, \alpha \gamma \epsilon (\lambda + \mu + \phi I^* + \delta ) - \phi I^*\alpha \gamma \delta = 0. \end{aligned}$$
(18)

Equation (18), is equivalent to the equation

$$\begin{aligned} \left( a_4 \lambda ^4 + a_3 \lambda ^3 + a_2 \lambda ^2 + a_1 \lambda + a_0 \right) = 0. \end{aligned}$$
(19)

where,

$$\begin{aligned} a_4&= 1 \\ a_3&= (4 \mu + \alpha + \delta + \gamma + \sigma + \phi I^* + \epsilon ) \\ a_2&= (\mu + \gamma )(\mu + \phi I^* + \sigma ) + \epsilon (2\mu + \alpha +\gamma +\delta + \phi I^*) \\&\quad + (2\mu + \alpha )(2 \mu + \sigma +\phi I^*) + \delta (2 \mu + \gamma + \sigma +\phi I^*) + \alpha \delta + \delta \mu + \gamma \mu \\ a_1&= (2\mu + \gamma + \phi I^* + \sigma ) (\mu + \alpha ) (\mu + \delta ) + (2 \mu + \alpha + \delta )(\mu + \gamma )(\mu +\phi I^* + \sigma ) + \epsilon \delta \phi I^* \\&\quad + \alpha \gamma \epsilon + \epsilon \mu (2 \mu + \alpha + \gamma +\delta +\phi I^* ) + \epsilon ( \mu + \alpha + \gamma ) (\mu +\delta +\phi I^* ) \\&\quad - (\mu + \alpha )(\mu +\gamma ) (2 \mu + \epsilon + \delta + \sigma )\\ a_0&= (\mu + \alpha ) (\mu + \gamma )(\mu + \delta )(\phi I^* - \epsilon ) + \epsilon \delta \phi I^* (\mu + \alpha + \gamma ) + \alpha \gamma \epsilon (\mu + \delta + \phi I^* ) \\&\quad + \epsilon \mu (\mu + \alpha + \gamma ) (\mu + \delta +\phi I^*) - \alpha \delta \gamma \phi I^*. \end{aligned}$$

The coefficients of the Eq. (19) are satisfied the Routh Hurwitz criteria for the fourth degree polynomial if \(R_0 > 1\). Thus, it suggests that its eigenvalues (roots) are also negative and therefore, the system is stable. This completes the proof. \(\square\)

6 Simulation and Numerical Analysis

It is shown in analysis of SEIRV model that system gets the stability for worm free equilibrium if \(R_0 < 1\) and system become stable for epidemic equilibrium when \(R_0 > 1\). So \(R_0\) is a threshold value. We evaluate radius and density threshold from \(R_0\). To verify the result, we simulate the proposed system on MATLAB. First we consider different communication radius and then different density threshold. Results are discussed below.

6.1 Communication Radius (r)

We can rewrite \(R_0\) as

$$\begin{aligned} \begin{aligned} R_0 = \frac{\beta \pi r^2 N (\mu + \epsilon ) \alpha }{L^2( \mu + \alpha )(\mu + \gamma )(\mu + \epsilon + \sigma )}. \end{aligned} \end{aligned}$$
(20)

If \(R_0 = 1\) then \(r = r_{th}\), where \(r_{th}\) is threshold radius. There are two types of cases.

  1. 1.

    Case 1: Communication radius (r) is less than threshold radius. When \(r \le r_{th}\) then \(R_0 \le 1\). In this case worms will die out and system will stabilize for worm free equilibrium.

  2. 2.

    Case 2: Communication radius (r) is greater than threshold radius. If \(r \ge r_{th}\) then \(R_0 \ge 1\). In this case worms exist in the system consistently and system will stabilize for epidemic state.

We simulate SEIRV model for both cases. For simulation on MATLAB We take following values of parameters.

\(N = 1000, L = 10, \mu = 0.001, \beta = 0.0003 , \alpha = 0.0004, \gamma = 0.0025, \epsilon = 0.001, \sigma = 0.0014, \delta = 0.001\) With using these values, we calculate \(r_{th} = 1.486\) from Eq. 20. Let initially number of susceptible, exposed, infectious and recovered nodes are,

$$\begin{aligned} S(0) = 990 , E(0) = 5, I(0) = 5, R(0) = 0, V(0) = 0. \end{aligned}$$

Simulation results are shown by Figs. 2, 3 and 4. Communication radius (r) takes different values. In Figs. 2 and 3, \(r = 0.1\) and 0.5 respectively. Both the figures represent case 1, as both radius are less than the threshold radius. Simulation result shows that system is stabilized for worm free equilibrium.

Fig. 2
figure 2

Communication radius r \(=\) 0.1

Fig. 3
figure 3

Communication radius r \(=\) 0.5

Fig. 4
figure 4

Communication radius r \(=\) 2.0

In Fig. 4, \(r = 2\). It represents case 2, as communication radius (r) is greater than the threshold radius. Result shows that system is stabilize for epidemic state. Hence simulation result verifies the result shown in Sect. 4.

6.2 Node Density (\(\rho\))

Node density is given by \(\rho = \frac{N}{L^2} (\frac{nodes}{m^2})\). Let threshold node density is \(\rho _{th}\). From Eq. 20, \(R_0\) can be written in terms of \(\rho\) as:

$$\begin{aligned} R_0 = \frac{\beta \pi r^2 \rho (\mu + \epsilon ) \alpha }{( \mu + \alpha )(\mu + \gamma )(\mu + \epsilon + \sigma )} \end{aligned}$$
(21)

When \(R_0 = 1\), then \(\rho = \rho _{th}\). Here two cases arise for node density.

  1. 1.

    Case 1: Node density (\(\rho\)) is less than threshold node density. When \(\rho \le \rho _{th}\) then \(R_0 \le 1\). In this case, worms will die out and system will stabilize for worm free equilibrium.

  2. 2.

    Case 2: Node density (\(\rho\)) is greater than threshold node density. If \(\rho \ge \rho _{th}\) then \(R_0 \ge 1\). In this case, worms exist in the system consistently and system will stabilize for epidemic state.

We simulate SEIRV model for both cases. For simulation on MATLAB, We take following value of parameters.

\(N = 1000, \mu = 0.001, \beta = 0.0003, \alpha = 0.0004, \gamma = 0.0025, \epsilon = 0.001, \sigma = 0.0014, r = 1.5\) and calculate \(\rho _{th} = 9.82\) from Eq. 21. Let initially number of susceptible, exposed, infectious and recovered nodes are,

$$\begin{aligned} S(0) = 990, E(0) = 5, I(0) = 5, R(0) = 0, V(0) = 0 \end{aligned}$$

Simulation results are shown by Figs. 56 and 7 for different values of \(\rho\). In Figs. 5 and 6 we take \(\rho = 2\) and 7 respectively. It represent case 1, as both values of \(\rho\) are less than threshold value (\(\rho _{th}\)). System is stabilized for worm free state as shown by the figures.

Fig. 5
figure 5

Node density \(\rho = 2\)

Fig. 6
figure 6

Node density \(\rho = 7\)

Fig. 7
figure 7

Node density \(\rho = 27\)

In Fig. 7, we take \(\rho = 27\) which is greater than \(\rho _{th}\). For case 2, Fig. 7 shows that system is stabilize for epidemic equilibrium. Hence simulation result verify the result shown in Sect. 4 for worm free and epidemic state.

7 Comparative Analysis

Fig. 8
figure 8

Comparative analysis of schemes (\(r = 1.0\))

In this section, we compare our result with Mishra et. al’s [16] schemes. For comparison we take following value of parameters. \(N = 1000, L = 10, \mu = 0.001, \beta = 0.0003 , \alpha = 0.0.0004,\gamma = 0.0025, \epsilon = 0.001, \sigma = 0.0014, \delta = 0.001\). We plot the graph between infectious number of sensor nodes with respect to time while considering different values of communication radius. We take different values of communication radius as \(r = 1, 1.8, 2.5\) and 4. Figures 8910, and  11 depict the comparative analysis. It is clear from the figures for comparative analysis, that number of infectious sensor nodes is different for different communication radius in proposed scheme. But in existing scheme number of infectious sensor nodes remain same. So existing scheme is not appropriate for the practical approach. It is also notable that for every communication range, proposed scheme has less number of infectious sensor nodes.

Fig. 9
figure 9

Comparative analysis of schemes (\(r = 1.8\))

Fig. 10
figure 10

Comparative analysis of schemes (\(r = 2.5\))

Fig. 11
figure 11

Comparative analysis of schemes (\(r = 4\))

8 Conclusion

A SEIRV model is proposed in this paper, which is an extension of SIR model to control worms spread in WSN. In particular, this paper exhibited that modeling in WSN via the epidemic models is meaningful. We introduced two categories (E and V) in the existing SIR model. A controller parameter \(R_0\) is evaluated. With the help of \(R_0\), the threshold values for the communication radius and the node density have evaluated. Further, we analyzed the stability of the proposed SEIRV model for the worm free and the epidemic states. It has shown that the system is stable in both of the cases. In addition, simulation analysis of proposed model has verified the results. The comparative analysis with the existing model has been done. The comparison shows that existing scheme gives the same result while considering different communication radius and the proposed scheme has a low rate of infectious nodes in every case. Hence, the proposed scheme is efficient than the existing scheme against worms attack as it has minimized the number of infectious sensor nodes. The experiment results have justified our analytical findings. It will provide help to developing an anti-virus mechanism for WSN. Analysis of SEIRV model has shown that it improves the efficiency of the network in terms of the stability and the energy efficiency.