## 2 Short-Circuit Calculations
### Short-Circuit Flow Formulation  
Constraints (14) and (15)--introduced in Section 2.1--are applied to the current-voltage formulation of PowerModelsDistribution.jl [59]. The optimization of PMsP is formulated to calculate the voltages for each bus and the three-phase currents for each system component. The formulation used by PMsP for calculating fault currents is presented below. It should be noted that the formulation is based in rectangular coordinates. In order to simplify presentation, the constraints are not explicitly separated into real and imaginary parts. This formulation is expressed a constraint satisfaction problem because all devices are operating under local control. There is no objective function, with the optimizer searching only for a feasible solution that satisfies all of the constraints. The current balancing constraint provides the main source of coupling between multiple nodes in the problem. These constraints can be applied as an additional set of constraints to an optimization problem such as an optimal power flow or optimal switching. Subject to:  
for \(\forall g\in\mathcal{G},\ \forall\phi\in\Phi_{i}:\)  
\[V^{\phi}_{g\
u f}=V^{\phi}_{g0} \tag{16}\]  
\[V^{\phi}_{g\bar{f}}=V^{\phi}_{g0f}-Z^{\phi}_{g\bar{f}}I^{\phi}_{g\bar{f}} \tag{17}\]  
for \(\forall g\in\mathcal{G},\ \forall f\in\mathcal{F},\ \forall i\in\mathcal{N} \setminus i_{f},\ \forall\phi\in\Phi_{i}:\)  
\[\sum_{(i,j,k)\in\mathcal{E}^{+}_{i}}I^{\phi}_{ijkf}-\sum_{(j,i,k)\in \mathcal{E}^{-}_{i_{j}}}I^{\phi}_{ijkf}=\sum_{g\in\mathcal{G}_{i}}I^{\phi}_{ g\bar{f}}-I^{\phi}_{ijf} \tag{18}\]  
\[\sum_{(i,j,k)\in\mathcal{E}^{+}_{i_{f}}}I^{\phi}_{ijkf}-\sum_{(j,i,k)\in \mathcal{E}^{-}_{i_{j}}}I^{\phi}_{ijkf}=\sum_{g\in\mathcal{G}_{i_{j}}}I^{\phi }_{g\bar{f}}-I^{\phi}_{ii_{j}f}-I^{\phi}_{ijf} \tag{19}\]  
for \(\forall g\in\mathcal{G},\ \forall i\in\mathcal{N},\ \forall\phi\in\Phi_{i},\ \forall(i,j,k)\in \mathcal{E}_{i}:\)  
\[I^{\phi}_{if}=I^{\phi}_{ijkf}+(g^{\phi}_{ijkf}+jh^{\phi}_{ijkf})V^{\phi}_{if} \tag{20}\]  
for \(\forall g\in\mathcal{G},\ \forall i\in\mathcal{N},\ \forall\phi\in\Phi_{i},\ \forall(j,i,k)\in \mathcal{E}_{i}:\)  
\[I^{\phi}_{if}=I^{\phi}_{ijkf}+(g^{\phi}_{ijkf}+jh^{\phi}_{ijkf})V^{\phi}_{j\bar {f}} \tag{21}\]  
\[V^{\phi}_{j\bar{f}}=V^{\phi}_{i\bar{f}}+(r^{\phi}_{ijkf}+jx^{\phi}_{ijkf})I^{ \phi}_{ijkf} \tag{22}\]  
for \(\forall f\in\mathcal{F},\ \forall i\in\mathcal{N}:\)  
\[I^{\phi}_{slf}=G_{if}V^{\phi}_{i\bar{f}} \tag{23}\]  
for \(\forall i,j\in\mathcal{N},\ \forall(i,j,k)\in\mathcal{X}:\)  
\[W_{ijk}V_{i\bar{f}}=\eta_{ijk}V_{j\bar{f}} \tag{24}\]  
\[W_{ijk}{}^{\prime}I_{j\bar{f}}=\eta_{ijk}I_{if}. \tag{25}\]  
Constraint (16) sets the magnitude and angle of the generator connected to the reference bus. As with other fault formulations, a generator is defined as a voltage source behind an impedance, which is shown in constraint (17), the voltage \(V_{g_{0}}\) is the pre-fault voltage of the generator. In the case of inverter-interfaced generation, constraint (16) is replaced with an additional set of constraints governing \(I^{\phi}_{g\bar{f}}\). These constraints are de pendent on whether the inverter is operating in grid-following or grid-forming mode (presented in Sections 2.3 and 2.4). Constraints (18) and (19) are the current balancing constraints discussed in Section 2.1. Constraint (20) and (21) define the current injected into a bus from a line, while constraint (22) defines the voltage drop across the line. Figure 4 illustrates the interactions between two adjacent buses in a three-phase model (sub-figures are corresponding to phase voltages). Constraint (23) defines the fault current. The last set of constraints, constraints (24) and (25), define the voltages and currents for transformers, where \(\eta_{ijk}\) represents the scaling of voltages and currents due to the winding ratios and the matrix \(W_{ijk}\) defines the connections of transformers.