## 3 Optimal Load Shedding Model for the IEWS
### Water System Constraints  
The WS constraints contain conventional constraints such as piping equations, pump equations, nodal flow balance equations, and upper and lower water flow limit constraints, in addition to the constraints of the desalination plant (1) to (9), which are modeled as follows:  
\[H_{W_{m,t}}=\frac{P_{W_{m,t}}}{\rho g}+h_{W_{m}},\forall W_{m}\in\Lambda^{\rm {W}} \tag{17}\]\[H_{{\rm W}_{m,t}}-H_{{\rm W}_{m,t}}=r_{{\rm W}_{n}}{\rm sgn}(q_{{\rm W}_{m,t}}) \big{(}q_{{\rm W}_{m,t}})^{2} \tag{18}\]  
\[q_{{\rm W}_{mm}}^{\rm min}\leq q_{{\rm W}_{mm,t}}\leq q_{{\rm W}_{mm,t}}^{\rm max }\,\forall({\rm W}_{m},{\rm W}_{n})\in\Delta^{\rm W} \tag{19}\]  
\[H_{{\rm P}_{m,t}}=a_{{\rm P}_{m}}(q_{{\rm P}_{m,t}})^{2}+b_{{\rm P}_{m}}q_{{\rm P }_{m,t}}+c_{{\rm P}_{m}} \tag{20}\]  
\[q_{{\rm P}_{m}}^{\rm min}\phi_{{\rm P}_{m,t}}\leq q_{{\rm P}_{m,t}}\leq q_{{ \rm P}_{m}}^{\rm max}\phi_{{\rm P}_{m,t}},\forall{\rm P}_{m}\in\Delta_{\rm P}^ {\rm W} \tag{21}\]  
\[(H_{{\rm W}_{m,t+1}}-H_{{\rm W}_{m,t}})A_{{\rm W}_{m}}^{\rm Tank}=W_{{\rm W}_{ m,t+1}}-(1-\mu_{\rm W})W_{{\rm W}_{m,t}} \tag{22}\]  
\[W_{{\rm W}_{m,t}}=(1-\mu_{\rm W})W_{{\rm W}_{m,t-1}}+(q_{{\rm W}_{m,t}}^{\rm in }-q_{{\rm W}_{m,t}}^{\rm out})\Delta t \tag{23}\]  
\[W_{{\rm W}_{m}}^{\rm min}\phi_{{\rm T}_{m,t}}\leq W_{{\rm W}_{m,t}}\leq W_{{ \rm W}_{m}}^{\rm max}\phi_{{\rm T}_{m,t}},\forall{\rm W}_{m}\in\Lambda_{\rm T} ^{\rm W} \tag{24}\]  
\[-M(1-\phi_{{\rm V}_{m,t}})\leq H_{{\rm W}_{m,t}}-H_{{\rm W}_{m,t}}\leq M(1+\phi _{{\rm V}_{m,t}}) \tag{25}\]  
\[q_{{\rm W}_{mm}}^{\rm min}\phi_{{\rm V}_{m,t}}\leq q_{{\rm W}_{m,t}}\leq q_{{ \rm W}_{mm}}^{\rm max}\phi_{{\rm V}_{m,t}},\forall({\rm W}_{m},{\rm W}_{n}) \in\Delta_{\rm V}^{\rm W} \tag{26}\]  
\[H_{{\rm W}_{m,t}}-H_{{\rm W}_{m,t}}=r_{{\rm W}_{n}}{\rm sgn}(q_{{\rm W}_{m,t}}) \big{(}q_{{\rm W}_{m,t}})^{2} \tag{18}\]0  
\[H_{{\rm W}_{m,t}}-H_{{\rm W}_{m,t}}=r_{{\rm W}_{n}}{\rm sgn}(q_{{\rm W}_{m,t}}) \big{(}q_{{\rm W}_{m,t}})^{2} \tag{18}\]1  
\[H_{{\rm W}_{m,t}}-H_{{\rm W}_{m,t}}=r_{{\rm W}_{n}}{\rm sgn}(q_{{\rm W}_{m,t}}) \big{(}q_{{\rm W}_{m,t}})^{2} \tag{18}\]2  
where \(H_{{\rm W}_{m,t}}\), \(P_{{\rm W}_{m,t}}\), and \(h_{{\rm W}_{m}}\) represent the total hydrostatic head, stream pressure, and positional head at node \({\rm W}_{m}\) of the WS, respectively. \(\rho\) and \(g\) represent the density of water and gravitational acceleration, respectively. \(q_{{\rm W}_{m,t}}\) indicates the volume of water flowing through the pipe, \(r_{{\rm W}_{n}}\) denotes the pipe head loss coefficient. \(H_{{\rm P}_{m,t}}\), and \(q_{{\rm P}_{m,t}}\) denote the head gain of pump \({\rm P}_{m}\) and the flow rate through the pump; \(a_{{\rm P}_{m}}\), \(b_{{\rm P}_{m}}\), and \(c_{{\rm P}_{m}}\) represent the head coefficient of the pump, respectively. \(q_{{\rm W}_{m,t}}^{\rm in}\), \(q_{{\rm W}_{m,t}}^{\rm out}\), and \(W_{{\rm W}_{m,t}}\) denote the inflow and outflow flow rates and the storage capacity of the cistern W\({}_{m}\), respectively; \(A_{{\rm W}_{m}}^{\rm Tank}\) and \(\mu_{\rm W}\) denote the cross-sectional area of the reservoir and the rate of water loss in the impoundment, respectively. M is a very large constant. \(D_{{\rm W}_{k,t}}\), \(q_{{\rm W}_{m,t}}\), and \(q_{{\rm W}_{k,t}}\) are the water loads, inflow flows, and outflow flows at node \(W_{\rm k}\) of the distribution network at the time; \(q_{{\rm L}W_{m,t}}\) is the leakage from the pipe if there is a fault in the pipe \(m-n\). \(P_{{\rm P}_{m,t}}^{\rm Wp}\) is the power consumed by the pump \({\rm P}_{m}\) and \(\eta\) is the pump efficiency. \(\Lambda^{\rm W}\) represents the collection of water system nodes, \(\Delta^{\rm W}\) represents the collection of water system pipes, \(\Delta^{\rm W}_{\rm P}\) is the collection of water pumps, \(\Lambda^{\rm W}_{\rm T}\) represents the collection of reservoirs, and \(\Delta^{\rm W}_{\rm V}\) is the collection of valves.