Comprehensive analysis of a stochastic wireless sensor network motivated by Black-Karasinski process

Wireless sensor networks (WSNs) encounter a significant challenge in ensuring network security due to their operational constraints. This challenge stems from the potential infiltration of malware into WSNs, where a single infected node can rapidly propagate worms to neighboring nodes. To address this issue, this research introduces a stochastic \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf{S}\textsf{E}\textsf{I}\textsf{R}\textsf{S}$$\end{document}SEIRS model to characterize worm spread in WSNs. Initially, we established that our model possesses a globally positive solution. Subsequently, we determine a threshold value for our stochastic system and derive a set of sufficient conditions that dictate the persistence or extinction of worm spread in WSNs based on the mean behavior. Our study reveals that environmental randomness can impede the spread of malware in WSNs. Moreover, by utilizing various parameter sets, we obtain approximate solutions that showcase these precise findings and validate the effectiveness of the proposed \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf{S}\textsf{E}\textsf{I}\textsf{R}\textsf{S}$$\end{document}SEIRS model, which surpasses existing models in mitigating worm transmission in WSNs.


Proposed model
Recently Ojha et al. 29 constructed a problem using the approach of a deterministic version of the wireless sensor networks epidemic model.Worms spreading across a wireless sensor network could be illustrated through a hypothetical situation involving a network of interconnected sensors deployed for monitoring and collecting data in a critical infrastructure setting, such as a smart city, industrial plant, or environmental monitoring system.A network is formulated consisting of N nodes at any time t and these nodes are distributed uniformly across the specified area.All of these nodes are uniformly scattered in the area L 2 with average density ( ρ ) and r and hence the covering region for sensing is πr 2 .To establish communication, it is required that one node should exist in this covering area.Once a node gathers some information, the same must be circulated in the neighboring nodes or it should be directly sent to the sink.It will be assumed that all of the network nodes are vulnerable to the virus assaults and can catch the worm.The dynamics of the nodes from one stage into another based on the worm is shown in Fig. 1.The second main assumption is that all of the nodes can mix homogeneously, that is, information may be circulated by a node to any other node that lies within the sensing area.
To formulate the model, we shall divide the entire nodes of the network into four compartments based on their worm status.These classes are: 1.The vulnerable nodes S(t) which are exposed to the worm assaults and are currently safe.2. The latent/exposed nodes E(t) , nodes which encountered by the worms but not infectious.3. The infectious nodes I(t) the nodes that are infected by the worm and can spread the worm to other nodes.4. The recovered nodes R(t) , that have been equipped with a detection tool capable of identifying and removing worm infection.nodes.
Every node will be able to spread the malware within the region πr 2 for a given sensing area of radius r.The notion ρ(t) = S(t) L×L stands for the density of per unit areal susceptibility of the nodes inside the networks.The size of nodes in the vicinity of the sensing node is designated and defined as S ′ (t) = S(t)πr 2 L 2 .For convenience, let ζ = πr 2 L 2 β represent a parameter.The model is as follows: A detailed interpretation of the model parameters is presented in Table 1.
( www.nature.com/scientificreports/By using the techniques of differential equations, one can obtain the worm-free equilibrium (WFE): Following the well-known procedure for calculating the threshold quantity for an ODE system, one can obtain the value of R 0 as Status of the phenomenon where worms are present in the WSN is called the endemic equilibrium (EE) or the worm-present equilibrium and is described as ¶ * = S * , E * , I * , R * where System (1) has always the worm-free equilibrium point given by (2) and has a unique endemic equilibrium (3) whenever R 0 > 1.
(2)  Next, we have to prove the local analysis of these equilibria, that is, we will check the behavior of the solution in the long run when the initial data is sufficiently close to the equilibrium points.First of all, we will show the local analysis of the WFE.

Theorem 1
The worm-free equilibrium point given by (2) is locally asymptotically stable for R 0 < 1 and unstable otherwise.

Proof
The variational matrix at the WFE is given by The variational matrix (4) has the eigenvalues: t 1 = −(µ + ω) , t 2 = −(µ + ε) where the remaining two eigen- values are the roots of the quadratic equation If R 0 < 1 , then by Descartes's rule of sign, relation (5) has no real positive or complex solution with positive real parts.Further, the rule ensures that both the roots are less than zero or complex with negative real parts.Thus, all of the eigenvalues of the variational matrix are complex with negative real parts or negative and thus the WFE is LAS under R 0 < 1 .
Next, we will present the local asymptotic stability of the worm present a fixed point.

Theorem 2
The worm endemic equilibrium point given by (3) is locally asymptotically stable for R 0 > 1 and otherwise unstable.

Proof
The variational matrix at the worm's present equilibrium is given by The characteristic equation of matrix (6) is given by where and For R 0 > 1 , all of the coefficients χ i for i = 1, 2, 3, 4 of (7) are positive.Further, by calculating 1 > 0 under the same condition of R 0 > 1 .Hence, by using the Routh Hurwitz criterion, all of the roots of (7) are negative or complex with negative real parts and hence the worm's present fixed point is LAS.www.nature.com/scientificreports/While dealing with real-world scenarios, outbreaks (whether infectious diseases or others) are subject to complex and random variations.Utilizing stochastic models for modeling epidemics may be a more suitable approach, considering the inherent unpredictability of such scenarios.The key purpose of the current work is to introduce the white noise of the model (1).Then the deterministic system (1) may written in the stochastically perturbed format as follows: Where Z i (t) for i = 1, • • • , 4 are for the fluctuating dynamics and α 1 , α 2 , α 3 and α 4 are for the noise intensities.definitely it contains the outcomes of Z i (0) = 0 for i = 1, 2, • • • , 4 .Figure 2 represents the diagram of a system (8).

Qualitative analysis of positive solution
To investigate the dynamic behavior of the system (8), we aim to address the positivity aspects concerning the solution of the proposed system (8) and to prove that the solution of the considered model is unique.The investigation of positive and non-local solutions requires further analysis using Lyapunov function techniques 30,31 .
Theorem 3 Subject to a non-negative initial state of the variabels, almost surely the global solution (S, E, I, R)(t) ∈ R 4 + for model (8) exist whenever t ≥ 0.
Proof The coefficient(s) involved in the model ( 8) are continuous and Lipschitz locally, considering the initial values (S 0 , E 0 , I 0 , R 0 ) from the space R 4 + .Consequently, one and only one solution (S(t), E(t), I(t), R(t)) (in local sense) exists for t belong to the interval [0, τ e ) , here τ e represents the explosion-time.To establish the solution behaves like the global, it is necessary to demonstrate that τ e = ∞ almost surely.Choose a very large number K 0 ≥ 0 in such a way that (S(0), E(0), I(0), R(0)) lies in the strip 1 K 0 , K 0 .For every integer K 0 ≤ K , the stop- ping-time is defined by the following expression: Let us define ∞ = inf ∅ , one can notice that τ e ≥ τ + , which suggests that τ + = ∞ almost surely, demonstrating that τ e = +∞ a.s.Assume that τ + is ∞ , then there must be a T > 0 (real) in such a way that 0 < P T > τ + and As a result, there exists a real number K 0 ≤ K 1 for which To proceed further, let us introduce a function (a C 2 -function) V : R 4 where {x : x is non-negative real number} = R + , by By employing the Itô formula, we derive where We know that I(0) ≥ 0 , then Since M is real positive and not dependent on the state and independent variables, we have By taking integral of relation (10) within the interval [0, T ∧ τ k ] and taking expectations, then we can get Setting � K = {τ K ≤ T} for K ≥ K 1 and by Eq. ( 3), P(� K ) ≥ ǫ .It can be easily judged that for every ω in K , there exist one solution at the point Utilizing relations ( 12) and ( 13), we can write In the above 1 �(ω) stand for represent the -indicator function.By letting K → ∞ , we arrived at

Extinction analysis of the worm-free equilibrium
This part of the manuscript deals with the investigate of the extinction of system (8) and establish a threshold to determine whether the disease will die out or persist.We will introduce two auxiliary lemmas that plays an important role in the proof of the key assertion of the current section.
Lemma 1 Let for t ≥ 0 , the notion M = {M t } denotes the real-valued function and it signifies the local martingale that vanishes at t = 0 .Then Vol.:(0123456789) Lemma 2 ( 31 ) Assume a solution (S, E, I, R) of model (8) subject to an initial data (S 0 , E 0 , , then Define the parameter as follows: Theorem 4 If the threshold number R s 0 < 1 , as defined by Eq. ( 15), the exposed and infected worms ( E(t) and I(t) functions) in the system (8) will almost surely tend to zero following an exponential function.
Proof Regarding model (8), one can notice that Integrating the above expression within the range 0 and t, we get where Now using the concept of Lemma 2, we get Assume that (S, E, I, R) ∈ R 4 + be a solution of equations ( 8) with positive initial values (S 0 , E 0 , I 0 , R 0 ) ∈ R 4 + .Define Differentiating Eq. (20)   This demonstrates the stochastic asymptotic behavior of the system and hence, the key aim of the theorem holds valid.

Ergodic stationary distribution
Ergodic stationary distribution of nodes is rooted in the study of stochastic processes, where nodes within a network undergo random transitions between different states.The ergodic stationary distribution provides insights into the long-term behavior of the network, emphasizing the idea that, over time, the system explores and represents all possible states with sufficient probability.Ergodicity ensures that, given enough time, the network dynamics explore all possible configurations of node states.In the case of the model (8), the system has an endemic steady state.Thus, in this part of the paper, we utilize the techniques proposed by Khasminskii 32 to explore that the proposed system has a stationary distribution.Let define The diffusion matrix is (aE 1.In the neighborhood of U and within its domain, the smallest eigenvalue of the matrix A(t) remains bounded away from zero. 2. If x belongs to the space R d \U , the average time τ required to cover the path from x to U is not infinite.Moreo- ver, for every compact subset K ⊂ R n , the quantity sup x∈K E x τ is finite.Additionally, if f (•) is a function integrable with respect to the measure " • ", then Then the Markov process X(t) admits a unique ergodic stationary distribution π(•) and where f (•) is an integrable function with respect to the measure π.
The threshold parameter in the case of the stochastic model is calculated as > 0, then for (S 0 , E 0 , I 0 , R 0 ) ∈ R 4 + , system (8) has a unique ergodic stationary distribution π.
Proof To establish the conditions (1) and ( 2) of Lemma 3, we need to validate them.In order to derive condition (1), we consider the diffusion matrix as follows: Irrespective of a compact subset of R 4 + , it is to be noted that ϒ is positive definite matrix, thus confirming condi- tion (1) of Lemma 3.
Next, we derive condition (2).Consider the C 2 -operator V : R 4 + → R given by: where It is prominent to mention that V is a function of the state variables which is defined for all possible values of the state variables.Further, this function has the property that it approaches +∞ as the state variables go to their limits and ||(S, E, I, R)|| → ∞.
Let us consider the initial data (S 0 , E 0 , I 0 , R 0 ) from the space R 4 + , and subject this data, the function V (being a function of the state variables) will take the form: and n > 1 is a so larger integer, 2 ) > 0 .Thus and Using the well-known formula due to Itô to the function V 1 , we obtained Let Similarly, we can get ( 29) B is given in Eq. ( 31).From Eqs. ( 32)-(37), we follows Let 0 < ξ , and consider a closed bounded set in the form of Over the complement of this set, that is R 4 + \D , we have the following inequalities: (36) 2 .
(37) If we use inequality (39), we can reach to the conclusion that −1 ≥ L V for all Q ∈ D 1 .Further, with the help of inequalities (40), ( 41) and (42), and following a similar approach as that of Case 1, one can easily prove that −1 ≥ V for all Q ∈ D 2 , D 3 and D 4 .
In the conclusion, we have which are sufficient in proving the condition (2) in Lemma 3 and thus, system (8) has the property of ergodicity and hence the theorem.

Numerical simulations
In the previous section, we obtained some important theoretical results based on the dynamic perspectives of the deterministic and stochastic models.In this part, we intend to verify these results through simulations.We will employ the standard higher ordered Milstein's method 33 to discretized system (8), Milstein's method is an extension of the method, aiming to improve the accuracy of numerical solutions for SDEs.The associated discretization equations are given by: where the term t represents a positive uniform time-step and ξ i , such that i = 1, • • • , 4 are the independent Gaussian random variables that follow the Gaussian distribution N(0, 1) for i = 1, 2, 3, 4 .The set for the time is tested [0, 5000], and = 0.5.

Simulations based on sensing radius of nodes
We have seen in the analysis part of the study that the condition R s acts as a threshold parameter for the model, that is, the dynamics of the solution to the model can be completely specified in terms of that parameter.Under the conditions of R s < 1 , the infected nodes will approach 0 in the long run.The integral curves of the deter- ministic system will reach WFE and the curves of the stochastic model will oscillate around the stated equilibrium point.Simulations further confirm that the virus will eventually leave the WSN when we keep R s < 1 and analytically, it is proved in Theorem 4. Graphically, these conclusions could be confirmed from Fig. 3a-d which are the results of the simulations.The values of the parameters as well as the initial size of the nodes are shown in Table 2.The simulation was carried out by implementing the scheme (obtained by following the method presented in the previous section) within MATLAB (R2017a).Figure 3 shows that by using these values of the parameters, no matter what the value of S 0 , the susceptible nodes will reach the component S 0 of susceptibles in the WFE.Similarly, in the initial course of worm spread, the size of the exposed and virus-infected nodes will tend to grow.After achieving the respective maximum values, the size of these nodes will exhibit a decline and finally reach zero as t → ∞ .This behavior could be easily noticed from Fig. 3b,c where we plotted sample solution curves of the virus-infected compartment utilizing both (50) the stochastic and deterministic models.Finally 3d reflects the behavior of the recovered nodes which initially showed an increase in the size and finally reached the respective fixed point.
The figures further elaborate that under the condition of R s < 1 , the curves reaching non-trivial components of the WFE fluctuate more compared to those approaching the trivial components.The figures also suggest that the method converges fast to the desired equilibrium for any discretization.

Simulations regarding nodes distribution
We stated and proved Theorem 5 which ensures the existence of a worm within the network at any time t.To simulate both the deterministic and stochastic model for this scenario, we shall assume values of the parameters as well as the initial value from Table 3.By using these values the parameters, we calculated R s which was noticed greater than one.When we simulated the models several times, we observed that the curves of the deterministic system approach the worm-present equilibrium.Likewise, the stochastic curves approach the EE but not actually as in the case of deterministic.Such curves will fluctuate in the vicinity of the deterministic curves.Taking into consideration both the temporal and spatial values of the variables and parameters, the dynamics of the curves suggest the presence of the worm in the networks, and hence a control strategy should be followed to reduce the spread.
Figure 4 show a drastic decrease in the size of the susceptible nodes and then reach a steady state as time evolves.Figure 4b,c show the dynamics of the exposed and infected nodes under the condition of R s > 1 .The plots indicate that the worms initially spread almost at an exponential rate and finally approached the respective fixed points.Finally, we presented the dynamics of the removed nodes in Fig. 4d where the curves almost show a constant behavior.All of these figures show that the worms will remain in the network, resulting in a stable EE.Furthermore, it has been discovered that increasing the connectedness of sensor nodes leads to enhanced network connectivity.
Here again, the convergence of the curves is independent of the discretization and this shows the beauty of the proposed scheme.All of the deterministic curves reach the desired equilibria and the associated stochastic curves fluctuate around the deterministic curves.Due to the high intensity of the noises, the amplitude of the oscillation of the stochastic curves is observed large compared to curves with small values of the noises.

Histogram of the node distribution
Next, to specifically describe the effects of each noise term on the dynamic behavior of the system (8), we assume that the system is influenced by only one random noise.Figure 5a-d illustrate the impact of noise strength on the fluctuations of each population.It can be observed that low-strength noise results in minimal population fluctuations, while high-strength noise causes significant oscillations and maintains populations at certain levels.Additionally, the histograms of the solutions and the corresponding marginal function curves for each population are presented.The associated values of the parameters and initial conditions of the state variables about the model ( 8) are provided in Table 4.

The impact of noise on system (8)
This section provides the effect of intensities on the dynamics of the worm-infected nodes in connection with system (8).The impact of noise intensities was plotted in Fig. 6a-d where it can be deduced that if one increases α i , resultantly the worm-infected nodes will tend to extinct out of the network.We conducted observations on the impact of the radius of nodes on the dynamic behavior of the model.It was noticed that the optimization of the threshold value (flexibility shifts) has a significant influence on various aspects, including the enhancement of the lifetime of networks, elimination of the malware from the networks, and controlling the spread of the malware.The remaining parameters and initial values of the system (8) were obtained from Table 3 and changed initial values to (S, E, I, R) = (600, 500, 500, 200).

Conclusion
In this study, we have examined a stochastic SEIRS model to control worm spread in WSNs.The model incor- porates stochastic components arising from environmental variability, which are represented as Gaussian white noise.We derived a set of sufficient conditions that determine the persistence or extinction of worm spread in WSNs in terms of the mean behavior.These conditions offer valuable insights into the long-term dynamics of the system and contribute to enhancing our understanding of worm propagation dynamics and control strategies in WSNs.At first, we mentioned that our model is globalized, positive, and feasible root by applying the the technique of Lyapunov function.After that, we have computed a threshold value of our stochastic system (8) and basic reproductive value R 0 of the defined deterministic system (1) without oscillation of noises.We also concluded, if R s < 1 , the infection will die with sure probability, otherwise if R s 0 > 1 , the infection lies in the mean of the WSNs.In the last, we have compared our obtained scheme results through simulations.
The extensive results obtained from this study provide evidence that the proposed model contributes to increased network lifetime and improved data efficiency in Wireless Sensor Networks.These findings have practical implications for software organizations, as they can utilize this knowledge to develop more effective antivirus software that can effectively restrict malware attacks in WSNs.Moreover, the investigation will assist end-users in recovering infected nodes and implementing antivirus software on sensor nodes with careful consideration, thereby strengthening the overall security framework to mitigate attacks.
Furthermore, future research directions can include the analysis of additional factors such as vaccinated and quarantined classes, as well as the inclusion of heterogeneous and mobile nodes.These considerations can enhance the model's applicability and provide further insights into the dynamics of worm spread and mitigation strategies in WSNs.

Figure 2 .
Figure 2. The chart shows the flow of nodes in various states of the system (8).

Figure 3 .
Figure 3.The corresponding simulations of the system (8) and the deterministic system (1).

Figure 4 .
Figure 4.The corresponding simulations of the system (8) and the deterministic system (1).

Figure 5 .
Figure 5.The histogram of the solution and the corresponding marginal density function curve for each sensor node.

Table 4 .
Values of the parametric for simulating systems (1), and (8) to explain the behavior of the persistence of the worms within the networks.

Table 1 .
Parameters of the model and their interpretation.
µRepresent the rate at which nodes lose their energy and hence assumed deadβThe rate of transmitting the worm-present information by infected nodes to susceptible nodes which develop infection therein a Stand for the rate at which exposed nodes go to the infected class γ The rate of removal/recovery ω The rate at which vulnerable nodes get recovery following It ô formula, one can get lim t→∞ �M, M� t = ∞, a.s.⇒ lim Here again, if we use inequality (43), we can reach to the conclusion that Vol.:(0123456789) Scientific Reports | (2024) 14:8799 | https://doi.org/10.1038/s41598-024-59203-3www.nature.com/scientificreports/

Table 2 .
Values of the parametric for simulating models (1) and (8) to explain the behavior of extinction of the worms within the networks.