1 Introduction

Coupled with the progress of the digital era and increasing development of various network applications, networks have become more and more popular in our daily life [1,2,3]. Among the popular networks, the wireless sensor network is one of the most vulnerable to attacks of malicious codes due to its special structure, such as limited capacity and defense capability constraints. Wireless sensor networks are usually made up of hundreds, even thousands, of sensor nodes placed in a hostile or dangerous environment and organized in ad hoc paradigm to monitor the environment where they are not physically safe [4, 5]. Hence, for upgrading the security in wireless sensor networks, the test on better investigation of malicious codes spreading dynamics is a very crucial subject. For this reason, one of the imperious topics is to formulate reliable mathematical models that are applicable to effectively provide some insights into the characteristics of malicious codes spreading dynamics [6, 7] due to the compelling analogies between malicious codes and their biological counterparts. In recent years, some scholars at home and abroad formulated and investigated various mathematical models to study the spread of malicious codes in wireless sensor networks.

Tang and Mark [8] proposed a modified Susceptible–Infected–Recovered (SIR) model by introducing a maintenance mechanism in the sleep mode of wireless sensor networks to characterize the dynamics of the virus spreading process from a single node to the entire network. Unfortunately, Tang and Mark [8] assume that the recovered nodes have permanent immunity, which is not consistent with reality in networks. Because that the recovered nodes may be infected again by newly emerging viruses. To overcome this defect of the modified SIR model, Feng et al. [9] formulated an improved Susceptible–Infected–Recovered–Susceptible (SIRS) worm propagation model in a wireless sensor network and considered the model communication radius and distributed density of nodes. Zhu et al. [10] developed a delayed SIRS reaction–diffusion model with a state feedback controller to describe the process of malware propagation in mobile wireless sensor networks and studied the Hopf bifurcation of the model. Considering the latent characteristic of malicious codes, Keshri and Mishra [4] proposed a delayed Susceptible–Exposed–Infectious–Recovered (SEIR) to describe the transmission dynamics of malicious signals in wireless sensor network. Vaccination and quarantine are well-known countermeasures in epidemiology. Thus it is interesting and important to extend epidemic models with quarantine and vaccination to study the malicious codes propagation in wireless sensor networks. Mishra and Keshri et al. [11,12,13,14,15] proposed different epidemic models with vaccination to study the attacking behavior of malicious codes in wireless sensor networks. Ojha et al. [16,17,18] formulated different models with quarantine to depict worm propagation behavior in wireless sensor network. There are also some dynamical models with both vaccination and quarantine [19, 20] and other models [21,22,23,24] to model the dynamics of malicious codes in wireless sensor networks. It should be pointed out that most of the models considering the latent state above assume that all the malicious codes in the wireless sensor network have the same latent period. However, different types of malicious codes are available in the digital environment, and they require no any human intervention or infrastructure network for transmission. Based on this consideration, Ojha et al. [25] proposed the following model for the transmission of worm in wireless sensor with two latent periods:

$$ \textstyle\begin{cases} \frac{dS(t)}{dt} = b-\beta S(t)I(t)-\sigma S(t), \\ \frac{dE_{1}(t)}{dt} = p\beta S(t)I(t)-(\alpha _{1}+\sigma )E_{1}(t), \\ \frac{dE_{2}(t)}{dt} = q\beta S(t)I(t)-(\alpha _{2}+\sigma )E_{2}(t), \\ \frac{dI(t)}{dt} = \alpha _{1}E_{1}(t)+\alpha _{2}E_{2}(t)-(\gamma + \sigma )I(t), \\ \frac{dR(t)}{dt} = \gamma I(t)-\sigma R(t), \end{cases} $$
(1)

where \(S(t)\), \(E_{1}(t)\), \(E_{2}(t)\), and \(I(t)\) denote the numbers of the susceptible infected class of short latent period, the infected class of long latent period, the infectious, and the recovered nodes at time t, respectively. More parameters are listed in Table 1. Ojha et al. [25] studied the stability of system (1).

Table 1 Parameters and their meanings

However, as stated in [26], one of the typical features for the malicious codes in networks is their latency. There is usually a delay from the time the \(E_{1}\) and \(E_{2}\) nodes are infected to the time they become infectious due to the intrinsic latent period of worms. On the other hand, delay differential equations exhibit much more complicated dynamics than ordinary differential equations since a time delay can cause the Hopf bifurcation phenomenon and changes the behavior of a dynamical system from stable focus to limit cycle [27,28,29,30,31,32]. Hence the study of the complex dynamical behaviors of system (2) with time delay, especially the Hopf bifurcation, also is very important for the transmission and controlling of the worms. Thus we incorporate the latent delay of the two categories of worms into system (1) and investigate the following delayed system:

$$ \textstyle\begin{cases} \frac{dS(t)}{dt} = b-\beta S(t)I(t)-\sigma S(t), \\ \frac{dE_{1}(t)}{dt} = p\beta S(t)I(t)-\sigma E_{1}(t)-\alpha _{1}E _{1}(t-\tau _{1}), \\ \frac{dE_{2}(t)}{dt} = q\beta S(t)I(t)-\sigma E_{2}(t)-\alpha _{2}E _{2}(t-\tau _{2}), \\ \frac{dI(t)}{dt} = \alpha _{1}E_{1}(t-\tau _{1})+\alpha _{2}E_{2}(t-\tau _{2})-(\gamma +\sigma )I(t), \\ \frac{dR(t)}{dt} = \gamma I(t)-\sigma R(t), \end{cases} $$
(2)

where \(\tau _{1}\) is the latent period of the first category of worm transmit in the wireless sensor network, and \(\tau _{2}\) is the latent period of the second category of worm transmit in the wireless sensor network. We may see that the first four equations in system (2) are independent of the fifth equation, and therefore the fifth equation can be omitted. So we will discuss the following reduced system:

$$ \textstyle\begin{cases} \frac{dS(t)}{dt} = b-\beta S(t)I(t)-\sigma S(t), \\ \frac{dE_{1}(t)}{dt} = p\beta S(t)I(t)-\sigma E_{1}(t)-\alpha _{1}E _{1}(t-\tau _{1}), \\ \frac{dE_{2}(t)}{dt} = q\beta S(t)I(t)-\sigma E_{2}(t)-\alpha _{2}E _{2}(t-\tau _{2}), \\ \frac{dI(t)}{dt} = \alpha _{1}E_{1}(t-\tau _{1})+\alpha _{2}E_{2}(t-\tau _{2})-(\gamma +\sigma )I(t). \end{cases} $$
(3)

The structure of this paper is as follows. The local stability of the worm induced equilibrium and existence of Hopf bifurcation are discussed by choosing different combination of \(\tau _{1}\) and \(\tau _{2}\) as the bifurcation parameter in Sect. 2. We investigate the direction and stability of the Hopf bifurcation at the worm-induced equilibrium when \(\tau _{2}>0\) and \(\tau _{1}\in (0, \tau _{10})\) by using the normal form theory and center manifold theorem. To verify the obtained results and some important parameter effects, we accomplish some numerical simulations in Sect. 4. We conclude the paper in Sect. 5.

2 Local stability and existence of Hopf bifurcation

According to the analysis in [25], we can conclude that system (3) has a worm-induced equilibrium \(E_{*}(S_{*}, E_{1*}, E_{2*}, I_{*})\), where

$$\begin{aligned}& S_{*} = \frac{b}{\sigma R_{0}}, \quad\quad E_{1*}= \frac{pb}{\alpha _{1}+\sigma } \biggl(\frac{R_{0}-1}{R_{0}} \biggr), \\& E_{2*} = \frac{(1-p)b}{\alpha _{2}+\sigma } \biggl(\frac{R_{0}-1}{R_{0}} \biggr), \quad \quad I_{*}=\frac{\sigma }{\beta }(R_{0}-1), \end{aligned}$$

where

$$ R_{0}=\frac{\beta b}{\sigma (\gamma +\sigma )} \biggl[\frac{p \alpha _{1}}{\alpha _{1}+\sigma }+\frac{q\alpha _{2}}{\alpha _{2}+\sigma } \biggr], \quad p+q=1. $$

The Jacobian matrix of system (3) evaluated at \(E_{*}\) is

$$ J_{E_{*}}= \begin{pmatrix} \alpha _{11} & {0} & {0} & \alpha _{14} \\ \alpha _{21} & \alpha _{22}+\beta _{22}e^{-\tau _{1}} & {0} & \alpha _{24} \\ \alpha _{31} & {0} & \alpha _{33}+\gamma _{33}e^{-\lambda \tau _{2}} & \alpha _{34} \\ {0} & \beta _{42}e^{-\tau _{1}} & \gamma _{43}e^{-\lambda \tau _{2}} & \alpha _{44} \end{pmatrix}, $$

where

$$\begin{aligned}& \alpha _{11} = -(\beta I_{*}+\sigma ), \quad\quad \alpha _{14}=-\beta S_{*}, \\& \alpha _{21} = p\beta I_{*}, \quad\quad \alpha _{22}=-\sigma , \quad\quad \alpha _{24}=p\beta S_{*}, \\& \alpha _{31} = q\beta I_{*}, \quad\quad \alpha _{33}=-\sigma , \quad\quad \alpha _{34}=q\beta S_{*}, \quad\quad \alpha _{44}=-(\gamma +\sigma ), \\& \beta _{22} = -\alpha _{1}, \quad\quad \beta _{42}=\alpha _{1}, \quad\quad \gamma _{33}=-\alpha _{2}, \quad\quad \gamma _{43}=\alpha _{2}. \end{aligned}$$

The characteristic equation associated with system (3) at the worm-induced equilibrium \(E_{*}\) is

$$\begin{aligned}& \begin{aligned}[b] &\lambda ^{4}+m_{3}\lambda ^{3} +m_{2}\lambda ^{2}+m_{1}\lambda +m_{0} \\ &\quad{} +\bigl(n_{3}\lambda ^{3}+n_{2}\lambda ^{2}+n_{1}\lambda +n_{0}\bigr)e^{-\lambda \tau _{1}} \\ &\quad{} +\bigl(p_{3}\lambda ^{3}+p_{2}\lambda ^{2}+p_{1}\lambda +p_{0}\bigr)e^{-\lambda \tau _{2}} \\ &\quad{}+\bigl(q_{2}\lambda ^{2}+q_{1}\lambda +q_{0}\bigr)e^{-\lambda (\tau _{1}+\tau _{2})}=0, \end{aligned} \end{aligned}$$
(4)

where

$$\begin{aligned}& m_{0} = \alpha _{11}\alpha _{22}\alpha _{33}\alpha _{44}, \\& m_{1} = -\bigl[\alpha _{11}\alpha _{22}(\alpha _{33}+\alpha _{44})+\alpha _{33} \alpha _{44}(\alpha _{11}+\alpha _{22})\bigr], \\& m_{2} = \alpha _{11}\alpha _{22}+\alpha _{33}\alpha _{44}+(\alpha _{11}+ \alpha _{22}) (\alpha _{33}+\alpha _{44}), \\& m_{3} = -(\alpha _{11}+\alpha _{22}+\alpha _{33}+\alpha _{44}), \\& n_{0} = \alpha _{11}\alpha _{33}(\alpha _{44}\beta _{22}-\alpha _{24}\beta _{42})+\alpha _{14}\alpha _{21}\alpha _{33}\beta _{42}, \\& \begin{aligned} n_{1} &= \alpha _{24}\beta _{42}( \alpha _{11}+\alpha _{33})-\alpha _{14} \alpha _{21}\beta _{42} \\ &\quad{} -\beta _{22}(\alpha _{11}\alpha _{33}+ \alpha _{11}\alpha _{44}+\alpha _{33}\alpha _{44}), \end{aligned} \\& n_{2} = \beta _{22}(\alpha _{11}+\alpha _{33}+\alpha _{44})-\alpha _{24} \beta _{42},\quad\quad n_{3}=-\beta _{22}, \\& p_{0} =\alpha _{22}\gamma _{43}(\alpha _{14}\alpha _{31}-\alpha _{11} \alpha _{34})+\alpha _{11}\alpha _{22}\alpha _{44}\gamma _{33}, \\& \begin{aligned} p_{1} &=\alpha _{34}\gamma _{43}( \alpha _{11}+\alpha _{22})-\alpha _{14} \alpha _{31}\gamma _{43} \\ &\quad{} -\gamma _{33}(\alpha _{11}\alpha _{22}+ \alpha _{11}\alpha _{44}+\alpha _{22}\alpha _{44}), \end{aligned} \\& p_{2} =\gamma _{33}(\alpha _{11}+\alpha _{22}+\alpha _{44})-\alpha _{34} \gamma _{43}, \quad\quad p_{3}=-\gamma _{33}, \\& \begin{aligned} q_{0} &=\beta _{22}\gamma _{43}( \alpha _{14}\alpha _{31}-\alpha _{11} \alpha _{34})+\beta _{42}\gamma _{33}(\alpha _{14}\alpha _{21}-\alpha _{11} \alpha _{24}) \\ &\quad{}+\alpha _{11}\alpha _{44}\beta _{22}\gamma _{33}, \end{aligned} \\& q_{1} =\alpha _{24}\beta _{42}\gamma _{33}+\alpha _{34}\beta _{22}\gamma _{43}-\beta _{22}\gamma _{33}(\alpha _{11}+\alpha _{44}), \quad\quad q_{2}=\beta _{22} \gamma _{33}. \end{aligned}$$

Case 1 \(\tau =0\). Equation (4) becomes

$$ \lambda ^{4}+m_{13}\lambda ^{3}+m_{12}\lambda ^{2}+m_{11}\lambda +m_{10}=0, $$
(5)

where

$$\begin{aligned}& m_{10} = m_{0}+n_{0}+p_{0}+q_{0},\quad\quad m_{11}=m_{1}+n_{1}+p_{1}+q_{1}, \\& m_{12} = m_{2}+n_{2}+p_{2}+q_{2},\quad\quad m_{13}=m_{3}+n_{3}+p_{3}. \end{aligned}$$

Obviously, \(m_{13}=\alpha _{1}+\alpha _{2}+\beta I_{*}+\gamma +4\sigma >0\). Based on the Hurwitz criterion, we have the following results.

Lemma 1

If condition \((H_{1})\) holds, that is, \(m_{10}>0\), \(m_{12}m_{13}>m_{11}\), and \(m_{11}m_{12}m_{13}>m_{12}^{2}+m_{10}m_{13} ^{2}\), then system (3) is locally asymptotically stable when \(\tau =0\).

Case 2 \(\tau _{1}>0\), \(\tau _{2}=0\). Equation (4) reduces to

$$ \lambda ^{4}+m_{23}\lambda ^{3}+m_{22}\lambda ^{2}+m_{21}\lambda +m_{20}+\bigl(n _{23}\lambda ^{3}+n_{22} \lambda ^{2}+n_{21}\lambda +n_{20} \bigr)e^{-\lambda \tau _{1}}=0 $$
(6)

with

$$\begin{aligned}& m_{20} = m_{0}+p_{0}, \quad\quad m_{21}=m_{1}+p_{1},\quad\quad m_{22}=m_{2}+p_{2}, \quad\quad m_{23}=m _{3}+p_{3}, \\& n_{20} = n_{0}+q_{0},\quad\quad n_{21}=n_{1}+q_{1},\quad\quad n_{22}=n_{2}+q_{2},\quad\quad n_{23}=n _{3}. \end{aligned}$$

Let \(\lambda =i\omega _{1}\) (\(\omega _{1}>0\)) be a root of Eq. (6). Substituting it into Eq. (6) and separating the real and imaginary parts, we get

$$ \textstyle\begin{cases} (n_{21}\omega _{1}-n_{23}\omega _{1}^{3})\sin \tau _{1}\omega _{1}+(n_{20}-n _{22}\omega _{1}^{2})\cos \tau _{1}\omega _{1}=m_{22}\omega _{1}^{2}- \omega _{1}^{4}-m_{20}, \\ (n_{21}\omega _{1}-n_{23}\omega _{1}^{3})\cos \tau _{1}\omega _{1}-(n_{20}-n _{22}\omega _{1}^{2})\sin \tau _{1}\omega _{1}=m_{23}\omega _{1}^{3}-m _{21}\omega _{1}, \end{cases} $$

which implies

$$ \omega _{1}^{8}+h_{23}\omega _{1}^{6}+h_{22}\omega _{1}^{4}+h_{21} \omega _{1}^{2}+h_{20}=0, $$
(7)

where

$$\begin{aligned}& h_{20} = m_{20}^{2}-n_{20}^{2}, \\& h_{21} = m_{21}^{2}-2m_{20}m_{22}-n_{21}^{2}+2n_{20}n_{22}, \\& h_{22} = m_{22}^{2}+2m_{20}-2m_{21}m_{23}+2n_{21}n_{23}-n_{22}^{2}, \\ & h_{23} = m_{23}^{2}-2m_{22}-n_{23}^{2}. \end{aligned}$$

Let \(\omega _{1}^{2}=v_{1}\). Then Eq. (7) becomes

$$ v_{1}^{4}+h_{23}v_{1}^{3}+h_{22}v_{1}^{2}+h_{21}v_{1}+h_{20}=0. $$
(8)

Define

$$\begin{aligned} \begin{gathered} g_{21}(v_{1})=v_{1}^{4}+h_{23}v_{1}^{3}+h_{22}v_{1}^{2}+h_{21}v_{1}+h _{20}, \\ \zeta _{20} = \frac{1}{2}h_{22}-\frac{3}{16}h_{23}^{2},\quad\quad \eta _{20}= \frac{1}{32}h_{23}^{2}- \frac{1}{8}h_{22}h_{23}+h_{21}, \\ \alpha _{20} = \biggl(\frac{\eta _{20}}{2} \biggr)^{2}+ \biggl(\frac{\zeta _{20}}{3} \biggr), \quad\quad \beta _{20}=-\frac{1}{2}+ \frac{\sqrt{3}}{2}i, \\ x_{21} = \sqrt{-\frac{\eta _{20}}{2}+\sqrt[3]{\alpha _{20}}}+ \sqrt[3]{-\frac{ \eta _{20}}{2}-\sqrt{\alpha _{20}}}, \\ x_{22} = \beta _{20} \sqrt{-\frac{\eta _{20}}{2}+\sqrt[3]{ \alpha _{20}}}+\beta _{20}^{2}\sqrt[3]{- \frac{ \eta _{20}}{2}-\sqrt{\alpha _{20}}}, \\ x_{23} = \beta _{20}^{2}\sqrt{-\frac{\eta _{20}}{2}+ \sqrt[3]{\alpha _{20}}}+\beta _{20}\sqrt[3]{- \frac{\eta _{20}}{2}-\sqrt{\alpha _{20}}}, \\ v_{1i} = y_{2i}-\frac{3h_{23}}{4},\quad i=1,2,3. \end{gathered} \end{aligned}$$
(9)

Based on the distribution of the roots of Eq. (8) in [33], we have the following results.

Lemma 2

For Eq. (8), we have:

  1. (i)

    if \(h_{20}<0\), then Eq. (8) has at least one positive root;

  2. (ii)

    if \(h_{20}\geq 0\) and \(\alpha _{20}\geq 0\), then Eq. (8) has positive roots if only if \(v_{11}>0\) and \(g_{21}(v_{11})<0\);

  3. (iii)

    if \(h_{20}\geq 0\) and \(\alpha _{20}<0\), then Eq. (8) has positive roots if only if there exists at least one \(v_{1*}\in \{v _{11}, v_{12}, v_{13}\}\) such that \(v_{1*}>0\) and \(g_{21}(v_{1*})>0\).

We further suppose that

\((H_{21})\)::

the coefficients \(h_{20}\), \(h_{21}\), \(h_{22}\), and \(h_{23}\) in \(g_{21}(v_{1})\) satisfy one of the conditions

  1. (a)

    \(h_{20}<0\),

  2. (b)

    \(h_{20}\geq 0\), \(\alpha _{20}\geq 0\), \(v_{11}>0\), and \(g_{1}(v_{11})<0\),

  3. (c)

    \(h_{20}\geq 0\), and there exists at least one \(v_{1*}\in \{v_{11}, v_{12}, v_{13}\}\) such that \(v_{1*}>0\) and \(g_{21}(v_{1*})>0\), \(\alpha _{20}<0\).

Thus we can conclude that there exists a positive root \(\omega _{10}\) of Eq. (7) such that Eq. (6) has a pair of purely imaginary roots \(\pm i\omega _{10}\). For \(\omega _{10}\), we have

$$ \tau _{10}=\frac{1}{\omega _{10}}\times \arccos \biggl\{ \frac{P_{21}( \omega _{10})}{Q_{21}(\omega _{10})} \biggr\} , $$
(10)

where

$$\begin{aligned}& \begin{aligned} P_{21}(\omega _{10}) &=(n_{22}-m_{23}n_{23}) \omega _{10}^{6}+(m_{23}n _{21}+m_{21}n_{23}-n_{20}-m_{22}n_{22}) \omega _{10}^{4} \\ &\quad{} +(m_{22}n_{20}+m_{20}n_{22}-m_{21}n_{21}) \omega _{10}^{2}-m_{20}n _{20}, \end{aligned} \\ & Q_{21}(\omega _{10}) =n_{23}^{2}\omega _{10}^{6}+\bigl(n_{22}^{2}-2n_{21}n _{23}\bigr)\omega _{10}^{4}+\bigl(n_{21}^{2}-2n_{20}n_{22} \bigr)\omega _{10}^{2}+n_{20} ^{2}. \end{aligned}$$

Differentiating both sides of Eq. (4) with respect to \(\tau _{1}\) yields

$$ \biggl[\frac{d\lambda }{d\tau _{1}} \biggr]^{-1}=-\frac{4\lambda ^{3}+3m _{23}\lambda ^{2}+2m_{22}\lambda +m_{21}}{\lambda (\lambda ^{4}+m_{23} \lambda ^{3}+m_{22}\lambda ^{2}+m_{21}\lambda +m_{20})}+ \frac{3n_{23} \lambda ^{2}+2n_{22}\lambda +n_{21}}{\lambda (n_{23}\lambda ^{3}+n_{22} \lambda ^{2}+n_{21}\lambda +n_{20})}-\frac{\tau }{\lambda }. $$

Hence we obtain

$$ \operatorname{Re} \biggl[\frac{d\lambda }{d\tau _{1}} \biggr]^{-1}_{\tau _{1}=\tau _{10}}= \frac{g_{21}^{\prime }(v_{10})}{Q_{21}(\omega _{10})}, $$

where \(g_{21}(v_{1})=v_{1}^{4}+h_{23}v_{1}^{3}+h_{22}v_{1}^{2}+h_{21}v _{1}+h_{20}\).

Clearly, if condition

\((H_{22})\)::

\(g_{21}^{\prime }(v_{10})\neq 0\)

is satisfied, then \(\operatorname{Re}[\frac{d\lambda }{d\tau _{1}}]^{-1}_{\tau _{1}=\tau _{10}}\neq 0\). Based on the previous discussion and the Hopf bifurcation theorem in [34], we can obtain the following results.

Theorem 1

For system (3), if conditions \((H_{1})\), \((H_{21})\), and \((H_{22})\) hold, then system (3) is locally asymptotically stable when \(\tau _{1}\in [0, \tau _{10})\); system (3) undergoes a Hopf bifurcation at the worm-induced equilibrium \(E_{*}\) when \(\tau _{1}=\tau _{10}\), and a family of periodic solutions bifurcate from the worm-induced equilibrium \(E_{*}\); \(\tau _{10}\) is defined as in Eq. (10).

Case 3 \(\tau _{1}=0\), \(\tau _{2}>0\). Equation (4) becomes

$$ \lambda ^{4}+m_{33}\lambda ^{3}+m_{32}\lambda ^{2}+m_{31}\lambda +m_{30}+\bigl(p _{33}\lambda ^{3}+p_{32} \lambda ^{2}+p_{31}\lambda +p_{30} \bigr)e^{-\lambda \tau _{2}}=0 $$
(11)

with

$$\begin{aligned}& m_{30} = m_{0}+n_{0},\quad\quad m_{31}=m_{1}+n_{1},\quad\quad m_{32}=m_{2}+n_{2}, \quad\quad m_{33}=m _{3}+n_{3}, \\& p_{30} = p_{0}+q_{0}, \quad\quad p_{31}=p_{1}+q_{1},\quad\quad p_{32}=p_{2}+q_{2}, \quad\quad p_{33}=p _{3}. \end{aligned}$$

Let \(\lambda =i\omega _{2}\) (\(\omega _{2}>0\)) be a root of Eq. (11). Substituting it into Eq. (11) and separating the real and imaginary parts, we get

$$ \textstyle\begin{cases} (p_{31}\omega _{2}-p_{33}\omega _{2}^{3})\sin \tau _{2}\omega _{2}+(p_{30}-p _{32}\omega _{2}^{2})\cos \tau _{2}\omega _{2}=m_{32}\omega _{2}^{2}- \omega _{2}^{4}-m_{30}, \\ (p_{31}\omega _{2}-p_{33}\omega _{2}^{3})\cos \tau _{2}\omega _{2}-(p_{30}-p _{32}\omega _{2}^{2})\sin \tau _{2}\omega _{2}=m_{33}\omega _{2}^{3}-m _{31}\omega _{2}, \end{cases} $$

which leads to

$$ \omega _{2}^{8}+h_{33}\omega _{2}^{6}+h_{32}\omega _{2}^{4}+h_{31} \omega _{2}^{2}+h_{20}=0, $$
(12)

where

$$\begin{aligned}& h_{30} = m_{30}^{2}-p_{30}^{2}, \\& h_{31} = m_{31}^{2}-2m_{30}m_{32}-p_{31}^{2}+2p_{30}p_{32}, \\& h_{32} = m_{32}^{2}+2m_{30}-2m_{31}m_{33}+2p_{31}p_{33}-p_{32}^{2}, \\& h_{33} = m_{33}^{2}-2m_{32}-p_{33}^{2}. \end{aligned}$$

Let \(\omega _{2}^{2}=v_{1}\). Then Eq. (12) becomes

$$ v_{2}^{4}+h_{33}v_{2}^{3}+h_{32}v_{2}^{2}+h_{31}v_{2}+h_{30}=0. $$
(13)

Define

$$\begin{aligned} \begin{gathered} g_{31}(v_{2})=v_{2}^{4}+h_{33}v_{2}^{3}+h_{32}v_{2}^{2}+h_{31}v_{2}+h _{30}, \\ \zeta _{30} = \frac{1}{2}h_{32}-\frac{3}{16}h_{33}^{2},\quad\quad \eta _{30}= \frac{1}{32}h_{33}^{2}- \frac{1}{8}h_{32}h_{33}+h_{31}, \\ \alpha _{30} = \biggl(\frac{\eta _{30}}{2} \biggr)^{2}+ \biggl(\frac{\zeta _{30}}{3} \biggr), \quad\quad \beta _{30}=-\frac{1}{2}+ \frac{\sqrt{3}}{2}i, \\ x_{31} = \sqrt{-\frac{\eta _{30}}{2}+\sqrt[3]{\alpha _{30}}}+ \sqrt[3]{-\frac{ \eta _{30}}{2}-\sqrt{\alpha _{30}}}, \\ x_{32} = \beta _{30} \sqrt{-\frac{\eta _{30}}{2}+\sqrt[3]{ \alpha _{30}}}+\beta _{30}^{2}\sqrt[3]{- \frac{ \eta _{30}}{2}-\sqrt{\alpha _{30}}}, \\ x_{33} = \beta _{30}^{2}\sqrt{-\frac{\eta _{30}}{2}+ \sqrt[3]{\alpha _{30}}}+\beta _{30}\sqrt[3]{- \frac{\eta _{30}}{2}-\sqrt{\alpha _{30}}}, \\ v_{2i} = x_{3i}-\frac{3h_{33}}{4},\quad i=1,2,3. \end{gathered} \end{aligned}$$
(14)

Based on the distribution of the roots of Eq. (13), we have the following results.

Lemma 3

For Eq. (13), we have:

  1. (i)

    if \(h_{30}<0\), then Eq. (13) has at least one positive root;

  2. (ii)

    if \(h_{30}\geq 0\) and \(\alpha _{30}\geq 0\), then Eq. (13) has positive roots if only if \(v_{21}>0\) and \(g_{22}(v_{21})<0\);

  3. (iii)

    if \(h_{30}\geq 0\) and \(\alpha _{30}<0\), then Eq. (13) has positive roots if only if there exists at least one \(v_{2*}\in \{v _{21}, v_{22}, v_{23}\}\) such that \(v_{2*}>0\) and \(g_{22}(v_{2*})>0\).

We further suppose that

\((H_{31})\)::

the coefficients \(h_{30}\), \(h_{31}\), \(h_{32}\), and \(h_{33}\) in \(g_{22}(v_{2})\) satisfy one of the conditions

\((a^{\prime })\) :

\(h_{30}<0\),

\((b^{\prime })\) :

\(h_{30}\geq 0\), \(\alpha _{30}\geq 0\), \(v_{21}>0\), and \(g_{22}(v_{21})<0\),

\((c^{\prime })\) :

\(h_{30}\geq 0\),

and there exists at least one \(v_{2*}\in \{v_{21}, v_{22}, v_{23}\}\) such that \(v_{2*}>0\) and \(g_{22}(v_{2*})>0\), \(\alpha _{30}<0\).

Then we know that there exists a positive root \(\omega _{20}\) of Eq. (12) such that Eq. (11) has a pair of purely imaginary roots \(\pm i\omega _{20}\). For \(\omega _{20}\), we have

$$ \tau _{20}=\frac{1}{\omega _{20}}\times \arccos \biggl\{ \frac{P_{31}( \omega _{20})}{Q_{31}(\omega _{20})} \biggr\} , $$
(15)

where

$$\begin{aligned}& \begin{gathered} \begin{aligned} P_{31}(\omega _{10}) &=(p_{32}-m_{33}p_{33}) \omega _{20}^{6}+(m_{33}p _{31}+m_{31}p_{33}-p_{30}-m_{32}p_{32}) \omega _{20}^{4} \\ &\quad{} +(m_{32}p_{30}+m_{30}p_{32}-m_{31}p_{31}) \omega _{20}^{2}-m_{30}p _{30}, \end{aligned} \\ Q_{31}(\omega _{10}) =p_{33}^{2}\omega _{20}^{6}+\bigl(p_{32}^{2}-2p_{31}p _{33}\bigr)\omega _{20}^{4}+\bigl(p_{31}^{2}-2p_{30}p_{32} \bigr)\omega _{20}^{2}+p_{30} ^{2}. \end{gathered} \end{aligned}$$

Similarly as in Case 2, we can obtain

$$ \operatorname{Re} \biggl[\frac{d\lambda }{d\tau _{2}} \biggr]^{-1}_{\tau _{2}=\tau _{20}}= \frac{g_{22}^{\prime }(v_{20})}{Q_{31}(\omega _{20})}, $$

where \(g_{22}(v_{2})=v_{2}^{4}+h_{33}v_{2}^{3}+h_{32}v_{2}^{2}+h_{31}v _{2}+h_{30}\).

Thus, if condition

\((H_{32})\)::

\(g_{22}^{\prime }(v_{20})\neq 0\)

holds, then \(\operatorname{Re}[\frac{d\lambda }{d\tau _{2}}]^{-1}_{\tau _{1}= \tau _{20}}\neq 0\). In conclusion, we have the following results.

Theorem 2

For system (3), if conditions \((H_{1})\), \((H_{31})\), and \((H_{32})\) hold, then system (3) is locally asymptotically stable when \(\tau _{2}\in [0, \tau _{20})\); system (3) undergoes a Hopf bifurcation at the worm-induced equilibrium \(E_{*}\) when \(\tau _{2}=\tau _{20}\), and a family of periodic solutions bifurcate from the worm-induced equilibrium \(E_{*}\); \(\tau _{20}\) is defined as in Eq. (15).

Case 4 \(\tau _{1}>0\), \(\tau _{2}\in (0, \tau _{20})\). Let \(\lambda =i\omega _{11}\) (\(\omega _{11}>0\)) be the root of Eq. (4). Then \(\omega _{11}\) must satisfy the following form:

$$ \textstyle\begin{cases} M_{41}(\omega _{11})\sin \tau _{1}\omega _{11}+M_{42}(\omega _{11})\cos \tau _{1}\omega _{11}=M_{43}(\omega _{11}), \\ M_{41}(\omega _{11})\cos \tau _{1}\omega _{11}-M_{42}(\omega _{11})\sin \tau _{1}\omega _{11}=M_{44}(\omega _{11}), \end{cases} $$

where

$$\begin{aligned}& M_{41}(\omega _{11}) = n_{1}\omega _{11}-n_{3}\omega _{11}^{3}+q_{1} \omega _{11}\cos \tau _{2}\omega _{11}- \bigl(q_{0}-q_{2}\omega _{11}^{2}\bigr) \sin \tau _{2}\omega _{11}, \\& M_{42}(\omega _{11}) = n_{0}-n_{2} \omega _{11}^{2}+q_{1}\omega _{11} \sin \tau _{2}\omega _{11}+\bigl(q_{0}-q_{2} \omega _{11}^{2}\bigr)\cos \tau _{2} \omega _{11}, \\& \begin{aligned} M_{43}(\omega _{11}) &= m_{2} \omega _{11}^{2}-\omega _{11}^{4}-m_{0}- \bigl(p _{1}\omega _{11}-p_{3}\omega _{11}^{3}\bigr)\sin \tau _{2}\omega _{11} \\ &\quad{} -\bigl(p_{0}-p_{2}\omega _{11}^{2} \bigr)\cos \tau _{2}\omega _{11}, \end{aligned} \\& \begin{aligned} M_{44}(\omega _{11}) &= m_{3} \omega _{11}^{3}-m_{1}\omega _{11}- \bigl(p_{1} \omega _{11}-p_{3}\omega _{11}^{3}\bigr)\cos \tau _{2}\omega _{11} \\ &\quad{} +\bigl(p_{0}-p_{2}\omega _{11}^{2} \bigr)\sin \tau _{2}\omega _{11}. \end{aligned} \end{aligned}$$

Thus we obtain the following equation with respect to \(\omega _{11}\):

$$ M_{43}^{2}(\omega _{11})+M_{44}^{2}( \omega _{11})-M_{41}^{2}(\omega _{11})-M _{42}^{2}(\omega _{11})=0. $$
(16)

Next, we suppose that condition \((H_{41})\) holds, that is, Eq. (16) has at least one positive root \(\omega _{1}^{*}\). Thus Eq. (4) has a pair of purely imaginary roots \(\pm i\omega _{1}^{*}\). For \(\omega _{1}^{*}\), we have:

$$ \tau _{1}^{*}=\frac{1}{\omega _{1}^{*}}\times \arccos \biggl\{ \frac{M _{41}(\omega _{1}^{*})\times M_{44}(\omega _{1}^{*})+M_{42}(\omega _{1} ^{*})\times M_{43}(\omega _{1}^{*})}{M_{41}^{2}(\omega _{1}^{*})+M_{42} ^{2}(\omega _{1}^{*})} \biggr\} . $$
(17)

Differentiating both sides of Eq. (4) with respect to \(\tau _{1}\), we obtain

$$ \biggl[\frac{d\lambda }{d\tau _{1}} \biggr]^{-1}=\frac{P_{41}(\lambda )}{Q _{41}(\lambda )}- \frac{\tau _{1}}{\lambda } $$

with

$$\begin{aligned}& \begin{aligned} P_{41}(\lambda ) &=4\lambda ^{3}+3m_{3} \lambda ^{2}+2m_{2}\lambda +m _{1}+ \bigl(3n_{3}\lambda ^{2}+2n_{2}\lambda +n_{1}\bigr)e^{-\lambda \tau _{1}} \\ &\quad{} -\bigl[\tau _{2}p_{3}\lambda ^{3}-(3p_{3}- \tau _{2}p_{2})\lambda ^{2}-(2p _{2}-\tau _{2}p_{1})\lambda -p_{1}+\tau _{2}p_{0}\bigr]e^{-\lambda \tau _{2}} \\ &\quad{} -\bigl[\tau _{2}q_{2}\lambda ^{2}-(2q_{2}- \tau _{2}q_{1})\lambda -q_{1}+\tau _{2}q_{0}\bigr]e^{-\lambda (\tau _{1}+\tau _{2})}, \end{aligned} \\& Q_{41}(\lambda ) =\lambda \bigl(n_{3}\lambda ^{3}+n_{2}\lambda ^{2}+n_{1} \lambda +n_{0}\bigr)e^{-\lambda \tau _{1}}+\lambda \bigl(q_{2}\lambda ^{2}+q_{1} \lambda +q_{0}\bigr)e^{-\lambda (\tau _{1}+\tau _{2})}. \end{aligned}$$

Further, we have

$$ \operatorname{Re} \biggl[\frac{d\lambda }{d\tau _{1}} \biggr]^{-1}_{\tau _{1}=\tau _{1}^{*}}= \frac{U_{41}V_{41}+U_{42}V_{42}}{V_{41}^{2}+V_{42}^{2}}, $$

where

$$\begin{aligned}& \begin{aligned} U_{41} &=\bigl[2n_{2}\omega _{1}^{*}+(2q_{2}-\tau _{2}q_{1}) \omega _{1}^{*} \cos \tau _{2}\omega _{1}^{*} \\ &\quad{} -\bigl(\tau _{2}q_{2}\bigl(\omega _{1}^{*}\bigr)^{2}+q_{1}-\tau _{2}q_{0}\bigr)\sin \tau _{2}\omega _{1}^{*}\bigr]\sin \tau _{1}^{*} \omega _{1}^{*} \\ &\quad{} +\bigl[n_{1}-3n_{3}\bigl(\omega _{1}^{*}\bigr)^{2}+(2q_{2}-\tau _{2}q_{1})\omega _{1} ^{*}\sin \tau _{2}\omega _{1}^{*} \\ &\quad{}+\bigl(\tau _{2}q_{2}\bigl(\omega _{1}^{*}\bigr)^{2}+q_{1}-\tau _{2}q_{0}\bigr)\cos \tau _{2}\omega _{1}^{*}\bigr]\cos \tau _{1}^{*} \omega _{1}^{*} \\ &\quad{}+\bigl[(2p_{2}-\tau _{2}p_{1})\omega _{1}^{*}+\tau _{2}p_{3}\bigl(\omega _{1}^{*}\bigr)^{3}\bigr] \sin \tau _{2} \omega _{1}^{*} \\ &\quad{}+\bigl[p_{1}-\tau _{2}p_{0}-(3p_{3}- \tau _{2}p_{2}) \bigl(\omega _{1}^{*} \bigr)^{2}\bigr] \cos \tau _{2}\omega _{1}^{*} \\ &\quad{}+m_{1}-3m_{3}\bigl(\omega _{1}^{*} \bigr)^{2}, \end{aligned} \\ & \begin{aligned} U_{42} &=\bigl[2n_{2}\omega _{1}^{*}+(2q_{2}-\tau _{2}q_{1}) \omega _{1}^{*} \cos \tau _{2}\omega _{1}^{*} \\ &\quad{}-\bigl(\tau _{2}q_{2}\bigl(\omega _{1}^{*}\bigr)^{2}+q_{1}-\tau _{2}q_{0}\bigr)\sin \tau _{2}\omega _{1}^{*}\bigr]\cos \tau _{1}^{*} \omega _{1}^{*} \\ &\quad{}-\bigl[n_{1}-3n_{3}\bigl(\omega _{1}^{*}\bigr)^{2}+(2q_{2}-\tau _{2}q_{1})\omega _{1} ^{*}\sin \tau _{2}\omega _{1}^{*} \\ &\quad{}+\bigl(\tau _{2}q_{2}\bigl(\omega _{1}^{*}\bigr)^{2}+q_{1}-\tau _{2}q_{0}\bigr)\cos \tau _{2}\omega _{1}^{*}\bigr]\sin \tau _{1}^{*} \omega _{1}^{*} \\ &\quad{}+\bigl[(2p_{2}-\tau _{2}p_{1})\omega _{1}^{*}+\tau _{2}p_{3}\bigl(\omega _{1}^{*}\bigr)^{3}\bigr] \cos \tau _{2} \omega _{1}^{*} \\ &\quad{}-\bigl[p_{1}-\tau _{2}p_{0}-(3p_{3}- \tau _{2}p_{2}) \bigl(\omega _{1}^{*} \bigr)^{2}\bigr] \sin \tau _{2}\omega _{1}^{*} \\ &\quad{}+2m_{2}\omega _{1}^{*}-4\bigl(\omega _{1}^{*}\bigr)^{3}, \end{aligned} \\ & \begin{aligned} V_{41} &=\bigl[n_{0}\omega _{1}^{*}-n_{2}\bigl(\omega _{1}^{*} \bigr)^{3}+\bigl(q_{0}\omega _{1}^{*}-q_{2} \bigl(\omega _{1}^{*}\bigr)^{3}\bigr)\cos \tau _{2}\omega _{1}^{*} \\ &\quad{}+q_{1}\bigl(\omega _{1}^{*} \bigr)^{2}\sin \tau _{2}\omega _{1}^{*} \bigr]\sin \tau _{1} ^{*}\omega _{1}^{*} \\ &\quad{}+\bigl[n_{3}\bigl(\omega _{1}^{*} \bigr)^{4}-n_{1}\bigl(\omega _{1}^{*} \bigr)^{2}+\bigl(q_{0}\omega _{1}^{*}-q_{2} \bigl(\omega _{1}^{*}\bigr)^{3}\bigr)\sin \tau _{2}\omega _{1}^{*} \\ &\quad{}-q_{1}\bigl(\omega _{1}^{*} \bigr)^{2}\cos \tau _{2}\omega _{1}^{*} \bigr]\cos \tau _{1} ^{*}\omega _{1}^{*}, \end{aligned} \\ & \begin{aligned} V_{42} &=\bigl[n_{0}\omega _{1}^{*}-n_{2}\bigl(\omega _{1}^{*} \bigr)^{3}+\bigl(q_{0}\omega _{1}^{*}-q_{2} \bigl(\omega _{1}^{*}\bigr)^{3}\bigr)\cos \tau _{2}\omega _{1}^{*} \\ &\quad{}+q_{1}\bigl(\omega _{1}^{*} \bigr)^{2}\sin \tau _{2}\omega _{1}^{*} \bigr]\cos \tau _{1} ^{*}\omega _{1}^{*} \\ &\quad{}-\bigl[n_{3}\bigl(\omega _{1}^{*} \bigr)^{4}-n_{1}\bigl(\omega _{1}^{*} \bigr)^{2}+\bigl(q_{0}\omega _{1}^{*}-q_{2} \bigl(\omega _{1}^{*}\bigr)^{3}\bigr)\sin \tau _{2}\omega _{1}^{*} \\ &\quad{}-q_{1}\bigl(\omega _{1}^{*} \bigr)^{2}\cos \tau _{2}\omega _{1}^{*} \bigr]\sin \tau _{1} ^{*}\omega _{1}^{*}. \end{aligned} \end{aligned}$$

Thus, if condition \((H_{42})\): \(U_{41}V_{41}+U_{42}V_{42}\neq 0\) holds, then \(\operatorname{Re}[\frac{d\lambda }{d\tau _{1}}]^{-1}_{\tau _{1}=\tau _{1} ^{*}}\neq 0\). In conclusion, we have the following results.

Theorem 3

For system (3), suppose that conditions \((H_{1})\), \((H_{41})\), and \((H_{42})\) hold and \(\tau _{2}\in (0, \tau _{20})\). Then system (3) is locally asymptotically stable when \(\tau _{1}\in [0,\tau _{1}^{*})\); system (3) undergoes a Hopf bifurcation at the worm-induced equilibrium \(E_{*}\) when \(\tau _{1}=\tau _{1}^{*}\), and a family of periodic solutions bifurcate from the worm-induced equilibrium \(E_{*}\); \(\tau _{1}^{*}\) is defined as in Eq. (17).

Case 5 \(\tau _{2}>0\), \(\tau _{1}\in (0, \tau _{10})\). Let \(\lambda =i\omega _{22}\) (\(\omega _{22}>0\)) be the root of Eq. (4). Then we can obtain

$$ \textstyle\begin{cases} M_{51}(\omega _{22})\sin \tau _{2}\omega _{22}+M_{52}(\omega _{22})\cos \tau _{2}\omega _{22}=M_{53}(\omega _{22}), \\ M_{51}(\omega _{22})\cos \tau _{2}\omega _{22}-M_{52}(\omega _{22})\sin \tau _{2}\omega _{22}=M_{54}(\omega _{22}), \end{cases} $$

where

$$\begin{aligned}& M_{51}(\omega _{22}) = p_{1}\omega _{22}-p_{3}\omega _{22}^{3}+q_{1} \omega _{22}\cos \tau _{1}\omega _{22}- \bigl(q_{0}-q_{2}\omega _{22}^{2}\bigr) \sin \tau _{1}\omega _{22}, \\& M_{52}(\omega _{22}) = p_{0}-p_{2} \omega _{22}^{2}+q_{1}\omega _{22} \sin \tau _{1}\omega _{22}+\bigl(q_{0}-q_{2} \omega _{22}^{2}\bigr)\cos \tau _{1} \omega _{22}, \\& \begin{aligned} M_{53}(\omega _{22}) &= m_{2} \omega _{11}^{2}-\omega _{11}^{4}-m_{0}- \bigl(n _{1}\omega _{22}-n_{3}\omega _{22}^{3}\bigr)\sin \tau _{1}\omega _{22} \\ &\quad{} -\bigl(p_{0}-p_{2}\omega _{11}^{2} \bigr)\cos \tau _{2}\omega _{11}, \end{aligned} \\& \begin{aligned} M_{54}(\omega _{11}) &= m_{3} \omega _{22}^{3}-m_{1}\omega _{22}- \bigl(n_{1} \omega _{22}-n_{3}\omega _{22}^{3}\bigr)\cos \tau _{1}\omega _{22} \\ &\quad{} +\bigl(n_{0}-n_{2}\omega _{22}^{2} \bigr)\sin \tau _{1}\omega _{22}. \end{aligned} \end{aligned}$$

Thus we obtain the following equation with respect to \(\omega _{22}\):

$$ M_{53}^{2}(\omega _{22})+M_{54}^{2}( \omega _{22})-M_{51}^{2}(\omega _{22})-M _{52}^{2}(\omega _{22})=0. $$
(18)

Next, we assume that \((H_{51})\) holds, that is, Eq. (18) has at least one positive root \(\omega _{2}^{*}\). Thus Eq. (4) has a pair of purely imaginary roots \(\pm i \omega _{2}^{*}\). For \(\omega _{2}^{*}\), we have:

$$ \tau _{2}^{*}=\frac{1}{\omega _{2}^{*}}\times \arccos \biggl\{ \frac{M _{51}(\omega _{1}^{*})\times M_{54}(\omega _{1}^{*})+M_{52}(\omega _{1} ^{*})\times M_{53}(\omega _{1}^{*})}{M_{51}^{2}(\omega _{1}^{*})+M_{52} ^{2}(\omega _{1}^{*})} \biggr\} . $$
(19)

Similarly as in Case 4, we have

$$ \biggl[\frac{d\lambda }{d\tau _{2}} \biggr]^{-1}=\frac{P_{51}(\lambda )}{Q _{51}(\lambda )}- \frac{\tau _{2}}{\lambda } $$

with

$$\begin{aligned}& \begin{aligned} P_{51}(\lambda ) &=4\lambda ^{3}+3m_{3} \lambda ^{2}+2m_{2}\lambda +m _{1}+ \bigl(3p_{3}\lambda ^{2}+2p_{2}\lambda +p_{1}\bigr)e^{-\lambda \tau _{2}} \\ &\quad{} -\bigl[\tau _{1}n_{3}\lambda ^{3}-(3n_{3}- \tau _{1}n_{2})\lambda ^{2}-(2n _{2}-\tau _{1}n_{1})\lambda -n_{1}+\tau _{1}n_{0}\bigr]e^{-\lambda \tau _{1}} \\ &\quad{} -\bigl[\tau _{1}q_{2}\lambda ^{2}-(2q_{2}- \tau _{1}q_{1})\lambda -q_{1}+\tau _{1}q_{0}\bigr]e^{-\lambda (\tau _{1}+\tau _{2})}, \end{aligned} \\& Q_{51}(\lambda ) =\lambda \bigl(p_{3}\lambda ^{3}+p_{2}\lambda ^{2}+p_{1} \lambda +p_{0}\bigr)e^{-\lambda \tau _{2}}+\lambda \bigl(q_{2}\lambda ^{2}+q_{1} \lambda +q_{0}\bigr)e^{-\lambda (\tau _{1}+\tau _{2})}. \end{aligned}$$

Similarly as in Case 4, we can obtain

$$ \operatorname{Re} \biggl[\frac{d\lambda }{d\tau _{2}} \biggr]^{-1}_{\tau _{2}=\tau _{2}^{*}}= \frac{U_{51}V_{51}+U_{52}V_{52}}{V_{51}^{2}+V_{52}^{2}}, $$

where

$$\begin{aligned}& \begin{aligned} U_{51} &=\bigl[2p_{2}\omega _{2}^{*}+(2q_{2}-\tau _{1}q_{1}) \omega _{2}^{*} \cos \tau _{1}\omega _{2}^{*}-\bigl(\tau _{1}q_{2}\bigl( \omega _{2}^{*}\bigr)^{2}+q_{1}- \tau _{1}q_{0}\bigr)\sin \tau _{1}\omega _{2}^{*}\bigr]\sin \tau _{2}^{*}\omega _{2} ^{*} \\ &\quad{} +\bigl[p_{1}-3p_{3}\bigl(\omega _{2}^{*}\bigr)^{2}+(2q_{2}-\tau _{1}q_{1})\omega _{2} ^{*}\sin \tau _{1}\omega _{2}^{*} \\ &\quad{}+\bigl(\tau _{1}q_{2}\bigl(\omega _{2}^{*} \bigr)^{2}+q _{1}-\tau _{2}q_{0}\bigr) \cos \tau _{1}\omega _{2}^{*}\bigr]\cos \tau _{2}^{*}\omega _{2}^{*} \\ &\quad{}+\bigl[(2n_{2}-\tau _{1}n_{1})\omega _{2}^{*}+\tau _{1}n_{3}\bigl(\omega _{2}^{*}\bigr)^{3}\bigr] \sin \tau _{1} \omega _{2}^{*} \\ &\quad{}+\bigl[n_{1}-\tau _{1}n_{0}-(3n_{3}-\tau _{1}n _{2}) \bigl(\omega _{2}^{*}\bigr)^{2} \bigr]\cos \tau _{2}\omega _{2}^{*}, \end{aligned} \\& \begin{aligned} U_{52} &=\bigl[2p_{2}\omega _{2}^{*}+(2q_{2}-\tau _{1}q_{1}) \omega _{2}^{*} \cos \tau _{1}\omega _{2}^{*}-\bigl(\tau _{1}q_{2}\bigl( \omega _{2}^{*}\bigr)^{2}+q_{1}- \tau _{1}q_{0}\bigr)\sin \tau _{1}\omega _{2}^{*}\bigr]\cos \tau _{2}^{*}\omega _{2} ^{*} \\ &\quad{}-\bigl[p_{1}-3p_{3}\bigl(\omega _{2}^{*}\bigr)^{2}+(2q_{2}-\tau _{1}q_{1})\omega _{2} ^{*}\sin \tau _{1}\omega _{2}^{*} \\ &\quad{}+\bigl(\tau _{1}q_{2}\bigl(\omega _{2}^{*} \bigr)^{2}+q _{1}-\tau _{1}q_{0}\bigr) \cos \tau _{1}\omega _{2}^{*}\bigr]\sin \tau _{2}^{*}\omega _{2}^{*} \\ &\quad{}+\bigl[(2n_{2}-\tau _{1}n_{1})\omega _{2}^{*}+\tau _{1}n_{3}\bigl(\omega _{2}^{*}\bigr)^{3}\bigr] \cos \tau _{1} \omega _{2}^{*} \\ &\quad{}-\bigl[n_{1}-\tau _{1}n_{0}-(3n_{3}-\tau _{1}n _{2}) \bigl(\omega _{2}^{*}\bigr)^{2} \bigr]\sin \tau _{1}\omega _{2}^{*}, \end{aligned} \\& \begin{aligned} V_{51} &=\bigl[p_{0}\omega _{2}^{*}-p_{2}\bigl(\omega _{2}^{*} \bigr)^{3}+\bigl(q_{0}\omega _{2}^{*}-q_{2} \bigl(\omega _{2}^{*}\bigr)^{3}\bigr)\cos \tau _{1}\omega _{2}^{*}+q_{1}\bigl( \omega _{2}^{*}\bigr)^{2}\sin \tau _{1}\omega _{2}^{*}\bigr]\sin \tau _{2}^{*}\omega _{2}^{*} \\ &\quad{}+\bigl[p_{3}\bigl(\omega _{2}^{*} \bigr)^{4}-p_{1}\bigl(\omega _{2}^{*} \bigr)^{2}+\bigl(q_{0}\omega _{2}^{*}-q_{2} \bigl(\omega _{2}^{*}\bigr)^{3}\bigr)\sin \tau _{1}\omega _{2}^{*}-q_{1}\bigl( \omega _{2}^{*}\bigr)^{2}\cos \tau _{1}\omega _{2}^{*}\bigr]\cos \tau _{2}^{*}\omega _{2}^{*}, \end{aligned} \\& \begin{aligned} V_{52} &=\bigl[p_{0}\omega _{2}^{*}-p_{2}\bigl(\omega _{2}^{*} \bigr)^{3}+\bigl(q_{0}\omega _{2}^{*}-q_{2} \bigl(\omega _{2}^{*}\bigr)^{3}\bigr)\cos \tau _{1}\omega _{2}^{*}+q_{1}\bigl( \omega _{2}^{*}\bigr)^{2}\sin \tau _{1}\omega _{2}^{*}\bigr]\cos \tau _{2}^{*}\omega _{2}^{*} \\ &\quad{}-\bigl[p_{3}\bigl(\omega _{2}^{*} \bigr)^{4}-p_{1}\bigl(\omega _{2}^{*} \bigr)^{2}+\bigl(q_{0}\omega _{2}^{*}-q_{2} \bigl(\omega _{2}^{*}\bigr)^{3}\bigr)\sin \tau _{1}\omega _{2}^{*}-q_{1}\bigl( \omega _{2}^{*}\bigr)^{2}\cos \tau _{1}\omega _{2}^{*}\bigr]\sin \tau _{2}^{*}\omega _{2}^{*}. \end{aligned} \end{aligned}$$

Thus, if condition

\((H_{52})\)::

\(U_{51}V_{51}+U_{52}V_{52}\neq 0\)

holds, then \(\operatorname{Re}[\frac{d\lambda }{d\tau _{2}}]^{-1}_{\tau _{2}= \tau _{2}^{*}}\neq 0\). In conclusion, we have the following results.

Theorem 4

For system (3), suppose that conditions \((H_{1})\), \((H_{51})\), and \((H_{52})\) hold and \(\tau _{1}\in (0, \tau _{10})\). Then system (3) is locally asymptotically stable when \(\tau _{2}\in [0,\tau _{2}^{*})\); system (3) undergoes a Hopf bifurcation at the worm-induced equilibrium \(E_{*}\) when \(\tau _{2}=\tau _{2}^{*}\), and a family of periodic solutions bifurcate from the worm-induced equilibrium \(E_{*}\); \(\tau _{2}^{*}\) is defined as in Eq. (19).

3 Direction and stability of Hopf bifurcation

Following the idea of Hassard [34], in this section, we investigate the direction and stability of the Hopf bifurcation at the critical value \(\tau _{2}^{*}\) by using the normal form theory and the center manifold theorem. Throughout this section, we assume that \(\tau _{1*}<\tau _{1} ^{*}\), where \(\tau _{1*}\in (0, \tau _{10})\). Let \(\tau _{2}=\tau _{2} ^{*}+\mu\) (\(\mu \in \mathrm{R}\)), \(u_{1}=S(\tau _{2} t)\), \(u_{2}=E_{1}(\tau _{2} t)\), \(u_{3}=E_{2}(\tau _{2} t)\), and \(u_{4}=I(\tau _{2} t)\). System (3) becomes

$$ \dot{u}(t)=L_{\mu }(u_{t})+F(\mu , u_{t}), $$
(20)

where \(u(t)=(u_{1}, u_{2}, u_{3}, u_{4})^{T} \in C=C([-1, 0], \mathrm{R}^{4})\), and \(L_{\mu }\): \(C\rightarrow \mathrm{R}^{4}\) and F: \(\mathrm{R}\times C\rightarrow \mathrm{R}^{4}\) are defined as

$$ L_{\mu }\phi =\bigl(\tau _{2}^{*}+\mu \bigr) \biggl(A_{\max }\phi (0)+B_{\max } \phi \biggl(-\frac{\tau _{1*}}{\tau _{2}^{*}} \biggr)+C_{\max }\phi (-1) \biggr) $$

and

$$ F(\mu , \phi )=\bigl(\tau _{2}^{*}+\mu \bigr) \begin{bmatrix} -\beta \phi _{1}(0)\phi _{4}(0) \\ p\beta \phi _{1}(0)\phi _{4}(0) \\ q\beta \phi _{1}(0)\phi _{4}(0) \\ {0} \end{bmatrix} $$

with

$$\begin{aligned}& A_{\max }= \begin{pmatrix} \alpha _{11} & {0} & {0} & \alpha _{14} \\ \alpha _{21} & \alpha _{22} & {0} & \alpha _{24} \\ \alpha _{31} & {0} & \alpha _{33} & \alpha _{34} \\ {0} & {0} & {0} & \alpha _{44} \end{pmatrix} , \quad\quad B_{\max }= \begin{pmatrix} {0} & {0} & {0} & {0} \\ {0} & \beta _{22} & {0} & {0} \\ {0} & {0} & {0} & {0} \\ {0} & \beta _{42} & {0} & {0} \end{pmatrix} , \\& C_{\max }= \begin{pmatrix} {0} & {0} & {0} & {0} \\ {0} & {0} & {0} & {0} \\ {0} & {0} & \gamma _{33} & {0} \\ {0} & {0} & \gamma _{43} & {0} \end{pmatrix} . \end{aligned}$$

Thus by the Reisz representation theorem there exists \(\eta (\theta , \mu )\) such that

$$ L_{\mu }\phi = \int _{-1}^{0}\,d\eta (\theta , \mu )\phi (\theta ), \quad \text{for } \phi \in C. $$
(21)

In fact, we can choose

$$ \eta (\theta ,\mu )= \textstyle\begin{cases} (\tau _{2}^{*}+\mu )(A_{\max }+B_{\max }+C_{\max }), & \theta =0, \\ (\tau _{2}^{*}+\mu )(B_{\max }+C_{\max }), & \theta \in [-\frac{\tau _{1*}}{\tau _{2}^{*}}, 0), \\ (\tau _{2}^{*}+\mu )C_{\max }, & \theta \in (-1, -\frac{\tau _{1*}}{\tau _{2}^{*}}), \\ 0, & \theta =-1, \end{cases} $$
(22)

where \(\delta (\theta )\) is the Dirac delta function.

For \(\phi \in C([-1,0], \mathrm{R}^{4})\), define

$$ A(\mu )\phi = \textstyle\begin{cases} \frac{d\phi (\theta )}{d\theta }, & -1\leq \theta < 0, \\ \int _{-1}^{0}\,d\eta (\theta ,\mu )\phi (\theta ), & \theta =0, \end{cases} $$

and

$$ R(\mu )\phi = \textstyle\begin{cases} 0, & -1\leq \theta < 0, \\ F(\mu ,\phi ), & \theta =0. \end{cases} $$

Then system (20) is equivalent to

$$ \dot{u}(t)=A(\mu )u_{t}+R(\mu )u_{t}. $$
(23)

For \(\varphi \in C^{1}([0, 1], (\mathrm{R}^{4})^{*})\), define

$$ A^{*}(\varphi )= \textstyle\begin{cases} -\frac{d\varphi (s)}{ds}, & 0< s\leq 1, \\ \int _{-1}^{0}\,d{\eta }^{T}(s,0)\varphi (-s), & s=0, \end{cases} $$

and the bilinear inner form for A and \(A^{*}\)

$$ \bigl\langle \varphi (s),\phi (\theta )\bigr\rangle =\bar{\varphi }(0)\phi (0)- \int _{\theta =-1}^{0} \int _{\xi =0}^{\theta }\bar{\varphi }(\xi - \theta )\,d\eta ( \theta )\phi (\xi )\,d\xi , $$
(24)

where \(\eta (\theta )=\eta (\theta , 0)\).

Let \(\rho (\theta )=(1, \rho _{2}, \rho _{3}, \rho _{4})^{T}e^{i\tau _{2} ^{*}\omega _{2}^{*}\theta }\) be the eigenvector of \(A(0)\) corresponding to \(+i\tau _{2}^{*}\omega _{2}^{*}\), and let \(\rho ^{*}(s)=D(1, \rho _{2} ^{*}, \rho _{3}^{*}, \rho _{4}^{*})^{T}e^{i\tau _{2}^{*}\omega _{2}^{*}s}\) be the eigenvector of \(A^{*}(0)\) corresponding to \(-i\tau _{2}^{*} \omega _{2}^{*}\). By the definition of \(A(0)\) and \(A^{*}\) we get

$$\begin{aligned}& \rho _{2} = \frac{\alpha _{21}+\alpha _{24}\rho _{4}}{i\omega _{2}^{*}- \alpha _{22}-\beta _{22}e^{-i\tau _{1*}\omega _{2}^{*}}}, \\& \rho _{3} = \frac{(i\omega _{2}^{*}-\alpha _{44})\rho _{4}-\beta _{42}e ^{-i\tau _{1*}\omega _{2}^{*}}\rho _{2}}{\gamma _{43}e^{-i\tau _{2}^{*} \omega _{2}^{*}}}, \\& \rho _{4} = \frac{i\omega _{2}^{*}-\alpha _{11}}{\alpha _{14}}, \\& \rho _{2}^{*} = \rho _{41}^{*}\rho _{4}^{*}, \quad\quad \rho _{3}^{*}=\rho _{42}^{*} \rho _{4}^{*}, \\& \rho _{4}^{*} = \frac{\alpha _{14}}{\rho _{41}^{*}+\rho _{42}^{*}-i\omega _{2}^{*}}, \\& \rho _{41}^{*} = -\frac{\beta _{42}e^{i\tau _{1*}\omega _{2}^{*}}}{i\omega _{2}^{*}+\alpha _{22}+\beta _{22}e^{i\tau _{1*}\omega _{2}^{*}}}, \\& \rho _{42}^{*} = -\frac{\gamma _{43}e^{i\tau _{2}^{*}\omega _{2}^{*}}}{i \omega _{2}^{*}+\alpha _{33}+\gamma _{33}e^{i\tau _{2}^{*}\omega _{2}^{*}}}. \end{aligned}$$

From Eq. (24) the expression of Q can be obtained as follows:

$$ \begin{aligned} \bar{D}={}&\bigl[1+\rho _{2}\bar{\rho }_{2}^{*}+\rho _{3}\bar{\rho }_{3}^{*}+ \rho _{4}\bar{ \rho }_{4}^{*}+\tau _{1*}e^{-i\tau _{1*}\omega _{2}^{*}}\rho _{2}\bigl(\beta _{22}\bar{\rho }_{2}^{*}+ \beta _{42}\bar{\rho }_{4}^{*}\bigr)\\&{}+\tau _{2}^{*}e^{-i\tau _{2}^{*}\omega _{2}^{*}}\rho _{3}\bigl(\gamma _{33}\bar{ \rho }_{3}^{*}+\gamma _{43} \bar{\rho }_{4}^{*}\bigr)\bigr]^{-1}, \end{aligned} $$

where \(\langle \rho ^{*}, \rho \rangle =1\) and \(\langle \rho ^{*}, \bar{ \rho }\rangle =0\).

In what follows, we can obtain \(g_{20}\), \(g_{11}\), \(g_{02}\), and \(g_{21}\) by using the algorithms in [34] and a similar computation process as that in [29, 35, 36]:

$$\begin{aligned}& g_{20} = 2\tau _{2}^{*}\bar{D}\beta \rho _{4}\bigl(p\bar{\rho }_{2}^{*}+q\bar{ \rho }_{3}^{*}-1\bigr), \\& g_{11} = \tau _{2}^{*}\bar{D}\beta \operatorname{Re}\{ \rho _{4}\}\bigl(p\bar{\rho } _{2}^{*}+q\bar{\rho }_{3}^{*}-1\bigr), \\& g_{02} = 2\tau _{2}^{*}\bar{D}\beta \bar{\rho }_{4}\bigl(p\bar{\rho }_{2} ^{*}+q\bar{\rho }_{3}^{*}-1\bigr), \\& \begin{aligned} g_{21} &= 2\tau _{2}^{*}\bar{D} \beta \bigl(p\bar{\rho }_{2}^{*}+q\bar{\rho } _{3}^{*}-1\bigr) \biggl(W_{11}^{(1)}(0) \rho _{4} \\ &\quad{} +\frac{1}{2}W_{20}^{(1)}(0)\bar{\rho }_{4}+W_{11}^{(4)}(0)+ \frac{1}{2}W_{20}^{(4)}(0) \biggr), \end{aligned} \end{aligned}$$

with

$$\begin{aligned}& W_{20}(\theta ) =\frac{ig_{20}\rho (0)}{\tau _{2}^{*}\omega _{2}^{*}}e ^{i\tau _{2}^{*}\omega _{2}^{*}\theta }+ \frac{i\bar{g}_{02}\bar{\rho }(0)}{3 \tau _{2}^{*}\omega _{2}^{*}}e^{-i\tau _{2}^{*}\omega _{2}^{*}\theta }+E _{1}e^{2i\tau _{2}^{*}\omega _{2}^{*}\theta }, \\& W_{11}(\theta ) =-\frac{ig_{11}\rho (0)}{\tau _{2}^{*}\omega _{2}^{*}}e ^{i\tau _{2}^{*}\omega _{2}^{*}\theta }+ \frac{i\bar{g}_{11}\bar{\rho }(0)}{ \tau _{2}^{*}\omega _{2}^{*}}e^{-i\tau _{2}^{*}\omega _{2}^{*}\theta }+E _{2}. \end{aligned}$$

\(E_{1}\) and \(E_{2}\) can be obtained by the following two equations:

$$\begin{aligned}& \begin{aligned} E_{1}&=2 \begin{pmatrix} 2i\omega _{2}^{*}-\alpha _{11} &{0} &{0} &-\alpha _{14} \\ -\alpha _{21} & 2i\omega _{0}-\alpha _{22}-\beta _{22}e^{-2i\tau _{1*} \omega _{2}^{*}} &{0} &-\alpha _{24} \\ -\alpha _{31} &{0} & 2i\omega _{2}^{*}-\alpha _{33}-\gamma _{33}e^{-2i\tau _{2}^{*}\omega _{2}^{*}} &-\alpha _{34} \\ {0} &-\beta _{42}e^{-2i\tau _{1*}\omega _{2}^{*}} &-\gamma _{43}e^{-2i\tau _{2}^{*}\omega _{2}^{*}} &2i\omega _{2}^{*}-\alpha _{44} \end{pmatrix}^{-1} \\ &\quad{} \times \begin{pmatrix} -\beta \rho _{4} \\ p\beta \rho _{4} \\ q\beta \rho _{4} \\ {0} \end{pmatrix}, \end{aligned} \\& E_{2}=- \begin{pmatrix} \alpha _{11} &{0} &{0} &-\alpha _{14} \\ \alpha _{21} &\alpha _{22}+\beta _{22}& {0} &\alpha _{24} \\ \alpha _{31} &{0} &\alpha _{33}+\gamma _{33} &\alpha _{34} \\ {0} &\beta _{42} &\gamma _{43} &\alpha _{44} \end{pmatrix}^{-1}\times \begin{pmatrix} -\beta \operatorname{Re}\{\rho _{4}\} \\ p\beta \operatorname{Re}\{\rho _{4}\} \\ q\beta \operatorname{Re}\{\rho _{4}\} \\ {0} \end{pmatrix}. \end{aligned}$$

Then we can obtain

$$ \begin{gathered} C_{1}(0)= \frac{i}{2\tau _{2}^{*}\omega _{2}^{*}} \biggl(g_{11}g_{20}-2 \vert g _{11} \vert ^{2}-\frac{ \vert g_{02} \vert ^{2}}{3} \biggr)+ \frac{g_{21}}{2} \\ \mu _{2} =-\frac{\operatorname{Re}\{C_{1}(0)\}}{\operatorname{Re}\{\lambda '(\tau _{2} ^{*})\}}, \\ \beta _{2}=2{\operatorname{Re}\bigl\{ C_{1}(0)\bigr\} }, \\ T_{2}=-\frac{\operatorname{Im}\{C_{1}(0)\}+\mu _{2}\operatorname{Im}\{\lambda '(\tau _{2}^{*})\}}{\tau _{2}^{*}\omega _{2}^{*}}. \end{gathered} $$
(25)

In conclusion, we have the following results.

Theorem 5

For system (2), if \(\mu _{2}>0\) (\(\mu _{2}<0\)), then the Hopf bifurcation is supercritical (subcritical); if \(\beta _{2}<0\) (\(\beta _{2}>0\)), then the bifurcating periodic solutions are stable (unstable); if \(T_{2}>0\) (\(T_{2}<0\)), then the period of the bifurcating periodic solutions increase (decrease).

4 Numerical simulations

For verifying accuracy and correctness of the obtained theoretical results, in this section, we execute some numerical simulations. For simulation, we choose the following set of parameters: \(b=0.32\), \(\beta =0.1\), \(\sigma =0.004\), \(p=0.4\), \(q=0.6\), \(\alpha _{1}=0.36\), \(\alpha _{2}=0.26\), \(\gamma =0.1\). Then we obtain the following specific case of system (3):

$$ \textstyle\begin{cases} \frac{dS(t)}{dt} = 0.32-0.1 S(t)I(t)-0.004 S(t), \\ \frac{dE_{1}(t)}{dt} = 0.04 S(t)I(t)-0.004 E_{1}(t)-0.36E_{1}(t- \tau _{1}), \\ \frac{dE_{2}(t)}{dt} = 0.06 S(t)I(t)-0.004 E_{2}(t)-0.26E_{2}(t- \tau _{2}), \\ \frac{dI(t)}{dt} = 0.36E_{1}(t-\tau _{1})+0.26E_{2}(t-\tau _{2})-0.104I(t). \end{cases} $$
(26)

With the help of Matlab package software we obtain \(R_{0}=76.7543\). Further, we obtain the unique worm-induced equilibrium \(E_{*}(1.0542, 0.3470, 0.7177, 2.9954)\). Now we can validate for the worm-induced equilibrium that \(m_{10}=0.003>0\), \(m_{12}m_{13}=0.3785>m_{11}=0.0377\), and \(m_{11}m_{12}m_{13}=0.1368>m_{12}^{2}+m_{10}m_{13}^{2}=0.0143\) by means of Matlab software package. So system (26) is locally asymptotically stable in absence of delay.

Further, by some complex computations we can obtain \(\omega _{10}=0.2907\) and \(\tau _{10}=4.7657\) when \(\tau _{2}=0\); \(\omega _{20}=0.7062\) and \(\tau _{20}=7.2185\) when \(\tau _{1}=0\); \(\omega _{1}^{*}=1.4981\) and \(\tau _{1}^{*}=4.5750\) when \(\tau _{2}=4.25\in (0, \tau _{20})\); and \(\omega _{2}^{*}=0.0067\) and \(\tau _{2}^{*}=7.0505\) when \(\tau _{1}=2.25 \in (0, \tau _{10})\). It follows from Theorems 14 that the worm-induced equilibrium \(E_{*}(1.0542, 0.3470, 0.7177, 2.9954)\) is locally asymptotically stable when the value of the time delay is under the critical value, and in this case the propagation of the worms can be controlled. However, the worm-induced equilibrium \(E_{*}(1.0542, 0.3470, 0.7177, 2.9954)\) will lose its stability, and a Hopf bifurcation will occur once the delay passes through the critical value, and in this case the propagation of the worms will be out of control. This property can be illustrated by the bifurcation diagrams shown in Figs. 14.

Figure 1
figure 1

The bifurcation diagram with respect to \(\tau _{1}\) when \(\tau _{2}= 0\)

Figure 2
figure 2

The bifurcation diagram with respect to \(\tau _{2}\) when \(\tau _{1}= 0\)

Figure 3
figure 3

The bifurcation diagram with respect to \(\tau _{1}\) when \(\tau _{2}= 4.25 \in (0,\tau _{20})\)

Figure 4
figure 4

The bifurcation diagram with respect to \(\tau _{2}\) when \(\tau _{1}= 2.25 \in (0,\tau _{10})\)

Figure 5(a–d) demonstrate the effect of the constant recruitment to susceptible nodes b on system dynamics and show that the infected class of short latent period, the infected class of long latent period, and the infectious class increases, whereas the susceptible class keeps static along with the increment of b when \(\tau _{1}>0\) and \(\tau _{2}=0\). We can also observe that oscillations and delay can be reduced and removed by decreasing the value of b, which is illustrated by Fig. 6. Figure 7(a–d) describe the effect of the recovery rate of the infectious nodes γ on system dynamics and show that the susceptible class increases, whereas the infected class of short latent period, the infected class of long latent period, and the infectious class decreases when \(\tau _{1}>0\) and \(\tau _{2}=0\). Also, oscillations and delay can be reduced and removed by increasing the value of γ, which is illustrated by Fig. 8. The effects of b and γ on system dynamics when \(\tau _{1}=0\) and \(\tau _{2}>0\), \(\tau _{1}>0\) and \(\tau _{2}\in (0, \tau _{20})\), and \(\tau _{2}>0\) and \(\tau _{1}\in (0, \tau _{10})\) are the same as those in the case where \(\tau _{1}>0\) and \(\tau _{2}=0\). The simulations are shown in Figs. 920. Thus we can conclude that the constant recruitment to susceptible nodes b and the recovery rate of the infectious nodes γ have a tremendous effect on the system dynamics.

Figure 5
figure 5

Time plots of S, \(E_{1}\) \(E_{2}\) and I for different b at \(\tau _{1} =4.25<\tau _{10}\) when \(\tau _{2} = 0\). Rest of the parameters are taken as given in the text

Figure 6
figure 6

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{1} = 4.75 < \tau _{10}\) when \({\tau _{2}= 0}\) for different b. Rest of the parameters are taken as given in the text

Figure 7
figure 7

Time plots of S, \(E_{1}\) \(E_{2}\) and I for different γ at \(\tau _{1}= 4.25\) when \(\tau _{2}= 0\). Rest of the parameters are taken as given in the text

Figure 8
figure 8

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{1} = 4.95 > \tau _{10}\) when \({\tau _{2}= 0}\) for different γ. Rest of the parameters are taken as given in the text

Figure 9
figure 9

Time plots of S, \(E_{1}\), \(E_{2}\) and I for different b at \(\tau _{2}= 6.25 < \tau _{20}\) when \(\tau _{1}= 0\). Rest of the parameters are taken as given in the text

Figure 10
figure 10

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{2} = 6.25 < \tau _{20}\) when \({\tau _{1}= 0}\) for different b. Rest of the parameters are taken as given in the text

Figure 11
figure 11

Time plots of S, \(E_{1}\), \(E_{2}\) and I for different γ at \(\tau _{2}=6.25\) when \({\tau _{1}=0}\). Rest of the parameters are taken as given in the text

Figure 12
figure 12

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{2} = 7.55 > \tau _{20}\) when \({\tau _{1} = 0}\) for different γ. Rest of the parameters are taken as given in the text

Figure 13
figure 13

Time plots of S, \(E_{1}\), \(E_{2}\) and I for different b at \(\tau _{1}=4.05\) when \(\tau _{2} = 4.25 \in (0,\tau _{20})\). Rest of the parameters are taken as given in the text

Figure 14
figure 14

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{1} = 4.75 > \tau _{1}^{*}\) when \({\tau _{2}= 4.25 \in (0,\tau _{20})}\) for different b. Rest of the parameters are taken as given in the text

Figure 15
figure 15

Time plots of S, \(E_{1}\), \(E_{2}\) and I for different γ at \(\tau _{1}= 4.05\) when \(\tau _{2} = 4.25 \in (0,\tau _{20} )\). Rest of the parameters are taken as given in the text

Figure 16
figure 16

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{1}= 4.75 > \tau _{1}^{*}\) when \({\tau _{2}= 4.25 \in (0,\tau _{20})}\) for different γ. Rest of the parameters are taken as given in the text

Figure 17
figure 17

Time plots of S, \(E_{1}\), \(E_{2}\) and I for different b at \(\tau _{2}=6.25\) when \(\tau _{1}= 2.25 \in (0,\tau _{10})\). Rest of the parameters are taken as given in the text

Figure 18
figure 18

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{2}= 6.95 > \tau _{2}^{*}\) when \({\tau _{1}= 2.25 \in (0,\tau _{10})}\) for different b. Rest of the parameters are taken as given in the text

Figure 19
figure 19

Time plots of S, \(E_{1}\), \(E_{2}\) and I for different γ at \(\tau _{2}=6.25\) when \(\tau _{1}= 2.25 \in (0,\tau _{10})\). Rest of the parameters are taken as given in the text

Figure 20
figure 20

Dynamic behavior of system (26): projection on S\(E_{1}\)I with \(\tau _{2} = 7.55 > \tau _{2}^{*}\) when \({\tau _{1}= 2.25 \in (0,\tau _{10})}\) for different γ. Rest of the parameters are taken as given in the text

5 Conclusions

In the present paper, we investigated a delayed epidemic model for the propagation of worm in wireless sensor network with two latent periods by incorporating the latent delays into the formulated model in the literature [25] considering the typical latent feature of the malicious codes in networks. We mainly consider the effect of the latent delay on the proposed model. In comparison with the other worm propagation models with time delay, in the proposed model, we considered different types of worms in the wireless sensor network. Thus we can conclude that the model investigated is more general and overcomes the insufficiency of the existing worm models to a certain extent.

The local stability and existence of Hopf bifurcation at the worm-induced equilibrium are investigated, and the threshold values of Hopf bifurcation are obtained by satisfying transversality conditions for showing the delay dynamics of the work in [25]. We numerically demonstrated that the propagation of the worms in the wireless sensor network can be controlled when the values of the latent delays are below the threshold value. However, the propagation of the worms is out of control when the values of the latent delays pass through the threshold value. We can conclude that the time delay should be controlled below the threshold value, particularly, the direction and stability of the Hopf bifurcation when \(\tau _{2}>0\) and \(\tau _{1}\in (0, \tau _{10})\). By numerical simulations we have \(C_{1}(0)=-0.003182-i0.000519\), \(\mu _{2}=43.589041>0\), \(\beta _{2}=-0.006364<0\), and \(T_{2}=-0.034226<0\) when \(\tau _{2}>0\) and \(\tau _{1*}=2.25\in (0, \tau _{10})\). Therefore by Theorem 5 we can deduce that the Hopf bifurcation is supercritical and the bifurcating periodic solutions are stable with decreasing period. Since the bifurcating periodic solutions are stable, the numbers of every class of sensor nodes in system (26) may coexist in an oscillatory mode. This phenomenon is not welcome in the wireless sensor networks. According to the numerical simulations, we can see that the onset of the Hopf bifurcation and the oscillation can be delayed if the values of the constant recruitment to susceptible nodes b and the recovery rate of the infectious nodes γ change properly. Thus we strongly recommend that the managers of the wireless sensor network should properly control the constant recruitment to susceptible nodes and update the antivirus software timely to control the propagation of worms in the wireless sensor network easily.