# Operational Resilience Metrics for Complex Inter-Dependent Electrical Networks
## Appendix A
Let's assume that an MV line is identified by the tuple \(MV_{I}=\left(l_{id},ss_{r},T^{l}_{ss_{r}}\right)\) where \(l_{id}\) is the unique identifier of the line, \(ss_{r}\) is the name of the MV line root secondary station and \(T^{l}_{ss_{r}}\) is the tree (rooted in \(ss_{r}\)) that models the MV line topology. Let us indicate with \(\left(ss_{i},ss_{j}\right)^{p}\) the direct path from node \(ss_{i}\) to node \(ss_{j}\) and with \(ss_{f}\) that the node of \(MV_{I}\) is in failure. Two different cases are possible:  
* the subtree \(T^{l}_{ss_{r}}\) contains automated secondary stations and at least one of these nodes belong to the path \(\left(ss_{r},ss_{f}\right)^{P}\). Formally: \[\exists y:ss_{y}\text{ is automated and }ss_{y}\in\left(ss_{r},ss_{f}\right)^{P}\] If there are more of such automated nodes the _simulateProtections()_ chooses the last automated node in the path (i.e., the nearest automated node to \(ss_{f}\)). The procedure chooses the next node of this node in the path \(\left(ss_{r},ss_{f}\right)^{P}\). Let us indicate this node with \(ss_{k}\). Then, the procedure sets the status of all nodes belonging to the subtree rooted with \(ss_{k}\) (\(\overline{T^{l}_{ss_{k}}}\))as **disconnected**;
* there are no automated nodes in the \(MV_{I}\) line. In this case the _simulateProtections()_ sets the status of all nodes in \(T^{l}_{ss_{r}}\) as **disconnected**. An example of the execution of the _simulateProtections()_ on an MV line is shown in Figure A3. Then, after simulating the protection devices behavior the _simulate_ procedure calls the _setDisconnectionLast_ procedure that sets the disconnection time of each \(ss\in T^{l}_{ss_{r}}\). The rationale of this procedure is explained as follow:  
1. The procedure checks if there exist tele-controlled nodes in the path \((ss_{r},ss_{f})^{P}\). Let us assume that \(ss^{llc}_{y}\) is the last tele-controlled node in this path and that the SCADA system is working properly. Then, the procedure computes the subtree \(\overline{T^{l}_{ss_{r}}}\) obtained removing the outcoming edges from \(ss^{llc}_{y}\). The procedure sets the disconnection time of all the nodes in \(\overline{T^{l}_{ss_{r}}}\) equal to \(llc_{l}\) (the mean time needed to perform a tele-controlled action). If there are no tele-controlled nodes in the path \((ss_{r},ss_{f})^{P}\) or their SCADA system is not working (because of BTS failures) the procedure sets the disconnection time to all nodes \(ss_{f}\in\overline{T^{l}_{ss_{r}}}\) (where \(\overline{T^{l}_{ss_{r}}}\) in this case, is obtained by removing the incoming edge to \(ss_{f}\)) to \(tr_{l}+m_{t}\), that is, the time that the technical crew needs to travel to the failed node and to perform the manual actions to isolate the failure. 2. The procedure sets the disconnection time to all nodes of all subtrees \(\{\overline{T^{l}_{ss_{f}}}\}\) obtained by removing the outcoming edges from \(ss_{f}\). For each \(T^{l}_{ss_{f}}\in\{\overline{T^{l}_{ss_{f}}}\}\) the procedure checks if there are frontier nodes in order to energize \(T^{l}_{ss_{f}}\) or part of it, using another MV line. In general, there are different cases: 1. There exists a frontier node (denoted by \(ss^{fr}_{x}\))that can be connected to another line \(MV_{11}\) and the related frontier node in \(MV_{11}\) has the functioning status (i.e., there are no failures and/or disconnections on \(MV_{11}\)). Moreover, the connection of the two frontier nodes can be performed using the SCADA system. In this case, the procedure checks if there exist tele-controlled nodes in the path \((ss_{f},ss^{fr}_{x})^{P}\). Let us assume that \(ss^{llc}_{y}\) is the first tele-controlled node in this path and that the SCADA system is working properly. Then, the procedure computes the subtree \(\overline{T^{l}_{ss_{f}}}\) obtained, removing the incoming edge to \(ss^{llc}_{y}\). The procedure sets the disconnection time of all the nodes in \(\overline{T^{l}_{ss_{f}}}\) equal to \(llc_{l}\). 2.