# Research on Plant Disease and Pest Diagnosis Model Based on Generalized Stochastic Petri Net
## 3 Generalized Random Petri Net Model for Plant Pest and Disease Spread Diagnosis
### Pest and Disease Spread Evolution Modeling Methods  
Based on the structural description of the plant pest and disease spread evolution process mentioned earlier, the pest and disease spread evolution model using the GSPN is established. The specific steps are as follows:  
Step 1: Construct the GSPN model. Build the GSPN model based on the characteristics and requirements of pest and disease spread. This includes defining the places in the system (representing the states of pest and disease), transitions (representing the changes between states), and their relationships (directed arcs). Additionally, associate time delays with the corresponding transitions.  
Step 2: Generate the reachability graph and construct the isomorphic Markov chain. The distribution and movement of tokens represent changes in the system's state. Based on the calculation results of \(\mathrm{D_{ij}}\) (whether the conditions are met), tokens can move from one place to another, simulating the results of the \(\mathrm{D_{ij}}\) conditions through transitions. This generates the reachability graph \(\mathrm{R(m)}\), where each state or marking is denoted as \(\mathrm{M_{1}},\mathrm{M_{2}},\ldots,\mathrm{M_{n}}\) (n being the total number of states), representing a specific configuration in the Petri net. Then, assign the corresponding firing rate to each arc and construct the isomorphic Markov chain [24], followed by an analysis of the model's validity.  
Step 3: Analyze the Markov chain. Convert the obtained reachability graph into a Markov model to calculate the steady-state probabilities. The steady-state probability \(\mathrm{P[M_{i}]}\) can be solved using the relevant theorems of the stationary distribution of the Markov chain and the Chapman-Kolmogorov equation:  
\[\mathrm{P}=\left(\mathrm{P[M_{0}]},\mathrm{P[M_{1}]},\ldots,\mathrm{P[M_{n-1}]}\right) \tag{15}\]  
\[\begin{cases}\mathrm{P}Q=0\\ \sum\limits_{\mathrm{i=0}}^{\mathrm{n-1}}\mathrm{P[M_{i}]}=1\end{cases} \tag{16}\]  
where \(\mathrm{n}\) is the number of states in the model, \(\mathrm{i}=\{0,1,\ldots,\mathrm{n-1}\}\), \(\mathrm{P}\) is the state probability vector, and \(\mathrm{Q}=\left[\mathrm{q_{ij}}\right]\), where \(\mathrm{i}=\{0,1,\ldots,\mathrm{n-1}\}\) and \(\mathrm{j}=\{0,1,\ldots,\mathrm{n-1}\}\). For the elements off the main diagonal \(\mathrm{q_{ij}}\), if there is an arc from state \(\mathrm{M_{i}}\) to state \(\mathrm{M_{j}}\), the value is the firing rate \(\lambda_{\mathrm{k}}\) associated with the exponential distribution of the transition \(\mathrm{T_{k}}\) from \(\mathrm{M_{i}}\) to \(\mathrm{M_{i}}\); if no arc connects the two states, this element is 0. The elements on the main diagonal \(\mathrm{q_{ij}}\) follow the equation \(-\left(\sum_{\mathrm{i}\
eq\mathrm{j}}\mathrm{q_{ij}}\right)\), ensuring that the sum of each row equals zero [19].  
Step 4: Performance evaluation and optimization. After calculating the steady-state probabilities, evaluate and optimize the performance of the pest and disease spread system constructed by the generalized stochastic Petri net model. The busy probability of places can be calculated using Formula (17). The idle probability of places can be calculated usingFormula (18). Additionally, the utilization rate of system transitions can be calculated using Formula (19) [25].  
\[\mathrm{P}[\mathrm{M}(\mathrm{p}_{\mathrm{i}})=1]=\sum\limits_{\mathrm{j}}\mathrm{ P}\left[\mathrm{M}_{\mathrm{j}}\right],\mathrm{M}_{\mathrm{j}}\in[\mathrm{M}_{0}> \mathrm{M}_{\mathrm{j}}(\mathrm{p})=\mathrm{i} \tag{17}\]  
\[\mathrm{P}[\mathrm{M}(\mathrm{p}_{\mathrm{i}})=0]=1-\mathrm{P}[\mathrm{M}( \mathrm{p}_{\mathrm{i}})=1] \tag{18}\]  
\[\mathrm{U}(\mathrm{t})=\sum\limits_{\mathrm{M}\in\mathrm{E}}\mathrm{P}[ \mathrm{M}] \tag{19}\]