## 3 Topological Modeling and Power Flow Analysis Based on Petri Net
### Power Flow Analysis and Calculation Method Based on Petri Net
#### 3.2.2 Power Calculation Method for Generators  
For the internal power system, when there is a generator out of operation, first of all, in the process of distribution network reconfiguration, the system shifts to emergency power supply mode. However, the power supply time is limited for emergency power sources, the tie line between the medium- and low-voltage systems should be closed and the power source should be turned to the main generator. In this case, the topology of the whole network needs to be reconstructed and the output of each generator in the generation network needs to be reallocated. In the generation network, the initial token vector is \(K_{\text{PNet2}}^{0}\), which is taken as the load of each switchboard. According to the connection mode of the tie lines between the main switchboards, the token is concentrated in one or more switchboards. Then, it is distributed according to the rated capacity of each generator. First, the depth order search method is used to adjust the weight states of the correlation matrix of the generator network. For example, when the main switchboard B1 is used as the virtual centralized library, that is, if S4 and S5 are closed, B1 and B2 run in parallel. For the input correlation matrix \(I_{\text{Net2}}\), the column elements associated with B1 are superimposed on the original ones with the column elements associated with B2, and the column elements associated with B2 are set to zero. That is, the elements corresponding to B2 \(\rightarrow\) S6 in the input correlation matrix are placed on B2 \(\rightarrow\) S1, as shown in Figure 5a. Then, look for the other directly connected main switchboards and adjust the elements of the input correlation matrix in the same way to concentrate the load on the corresponding changes of the virtual centralized library. Figure 4: Petri net model for the floating nuclear power plant system. For output correlation matrix \(\mathbf{O}_{\text{Net2}}\), the row associated with \(\text{S}_{1}\) is superimposed with the row elements associated with \(\text{S}_{6}\) on the original basis, and the row elements associated with \(\text{S}_{6}\) are set to zero. That is, the elements corresponding to \(\text{S}_{6}\rightarrow\text{G}_{2}\) in the output correlation matrix are placed on \(\text{S}_{1}\rightarrow\text{G}_{2}\), as shown in Figure 5b. If there are other directly connected main switchboards, adjust the elements in the output correlation matrix in the same way. The complete process of this search method is shown in Figure 6. On this basis, the updated input and output correlation matrices \(\mathbf{I}_{\text{Net2}}\) and \(\mathbf{O}_{\text{Net2}}\) of the generation network can be obtained after adjustment based on the connection state of the tie lines. Here, only \(\text{B}_{1}\) is taken as an example. If other main switchboards are used as virtual centralized libraries, the power analysis process can be analogous to the above method. Based on the above adjustment, considering that the output load power of the generator in the power system is evenly divided according to the rated capacity, the weight of each non-zero element in the output correlation matrix is determined according to the operating state and rated capacity of each generator. The formula for calculating the weight is:  
\[\tau_{jk}=s_{jk}\times\frac{G_{k}}{\sum G} \tag{8}\]  
where \(\tau_{jk}\) is the weight of the elements corresponding to the switchboard \(j\) to the generator \(k\) in \(\mathbf{O}_{\text{Net2}}\) after adjusting the output matrix. \(s_{jk}\) is the connection state between \(j\) and \(k\) in \(\mathbf{O}_{\text{Net2}}\), and its value is 0 or 1. \(G_{k}\) is the rated power of generator \(k\), and \(\sum G\) is the sum of the rated power of the generator connected to the switchboard \(j\), for which the element  
Figure 5: Correlation matrix adjustment process. (**a**) Input correlation matrix adjustment process. (**b**) Output correlation matrix adjustment process. Figure 6: Correlation matrix adjustment process based on the tie line condition.