## 3 Topological Modeling and Power Flow Analysis Based on Petri Net
### Graphical Modeling of Petri Net for the Power System of Floating Nuclear Power Plant  
A Petri net model is composed of library, transition, token, input correlation matrix and output correlation matrix. The library represents the node set of the system, which is represented by the circle. An m-dimensional node system is represented by the corresponding library \(\mathbf{P}=\{P_{1},\ P_{2},\ \ldots,\ P_{m}\}\). The loads, power distribution boards and power sources in the system correspond to the library. The token is located in the library and is used to describe the state of the library; it is represented as \(\mathbf{K}_{P}=[k_{P1},\ k_{P2},\ \ldots,\ k_{Pm}]\). The token number is determined by the load power of each component. After transition firing, the token in the library is transferred, which is represented by a vertical line. A set of \(1\times n\)-dimensional transition nodes is expressed as \(\mathbf{R}=\{R_{1},\ R_{2},\ \ldots,\ R_{n}\}\). In the system, except for the contact switch between the main switchboard, other switches correspond to the transitions. Input correlation matrix \(\mathbf{I}\mathbf{:}\mathbf{P}\rightarrow\mathbf{R}\) reflects the library to transitions. If there is an input arc from library \(P_{i}\) to transition \(R_{j}\), \(I_{ij}=1\). Otherwise, \(I_{ij}=0\). Output correlation matrix \(\mathbf{O}\mathbf{:}\mathbf{R}\rightarrow\mathbf{P}\) reflects the transition to the library. If there is an output arc from transition \(R_{i}\) to library \(P_{i}\), \(O_{ij}=1\). Otherwise, \(O_{ij}=0\). The input and output association matrices are determined by the connection between libraries and transitions in a Petri net under the system topology status.  
For a simple power network as shown in Figure 2(a), its equivalent Petri net model is shown in Figure 2(b). Load L corresponds to library p\({}_{1}\), and its load is represented by the token K. When the diagonal elements in the input and output matrices \(I_{\text{p1r1}}\) and \(\mathbf{O}_{\text{r1p2}}\) are all 1, it means that the corresponding switch S\({}_{1}\) is under the closed state. After r\({}_{1}\) is fired with the corresponding change in switch S\({}_{1}\), the token in p\({}_{1}\) is dynamically transmitted to library p\({}_{2}\) corresponding to switchboard B. At the same time, the power load of the switchboard can be calculated. Similarly, when the diagonal elements in the input and output matrices I\({}_{\text{p}222}\) and \(O_{\text{r}223}\) are all 1, the corresponding switch S\({}_{2}\) is under the closed state. After r\({}_{2}\) is fired with the corresponding change of switch S\({}_{2}\), the token in p\({}_{2}\) is transmitted migrated to library p\({}_{3}\) corresponding to generator G, and the load carried by the generator can be calculated. According to this process, power flow analysis for the power system can be realized.  
Based on the topological structure of the power system in the floating nuclear power plant shown in Figure 1, the equivalent model of the topological connection relation for each electrical component in the Petri net is established, as shown in Figure 4. The model is divided into two parts: the distribution network and the generation network. The distribution network includes the part extending down from the main switchboard to the terminal loads of the system, that is, the part outside the dashed box in Figure 4. The generation network extends from the main switchboard up to the generator, within the dashed box in Figure 4.