# Stochastic Predictive Energy Management of Multi-Microgrid Systems
## 2 Problem Formulation  
Adopting the dynamical system approach, each subsystem \(i\) can be represented as a stack variable with associated inflows and outflows. The inflow is related to the net MG production including the aggregated power generation of WTs (\(P_{WT,r}^{i}(t)\)) and PV units (\(P_{PV,r}^{i}(t)\)) as well as the power consumption (\(L_{i}(t)\)) as represented below. \[IF_{i}(t)=\sum_{r=1}^{N_{WT}^{i}}P_{WT,r}^{i}(t)+\sum_{r=1}^{N_{PV,r}^{i}}P_{PV,r}^{i}(t)-L_{i}(t), \tag{1}\]  
In (1), \(P_{WT,r}^{i}(t)\) and \(P_{PV,r}^{i}(t)\) represent the output power of the \(r\)th renewable unit in the \(i\)th MG at hour \(t\). Besides, \(N_{WT}^{i}\) and \(N_{PV}^{i}\), are related to the number of WTs and PVs in the \(i\)th MG, respectively. On the other hand, according to the following equation, the outflow of the \(i\)th MG is the total power that is transferred from it to the neighboring MGs and the main grid where \(N_{i}\) is the set of the \(i\)th MG neighbors including the main grid. \[OF_{i}(t)=\sum_{j\in N_{i}}P_{ij}(t). \tag{2}\]  
Assume that \(IF_{i}(t)\) represents the net power balance of the \(i\)th subsystem which could be forecasted based on the historical data during the scheduling horizon \(T\). MGs provide the CEMS with the day-ahead predicted values of \(IF_{i}(t)\) with 1-hour time resolutions. Utilizing this abstracted form of information, each MG is modeled through its net power balance from the CEMS point of view, disregarding further details and complexities. Afterward, system-wide power flow analyses are conducted by CEMS to specify the amount of power to be transferred through power lines considering voltage and frequency constraints as well as system losses. Thus, the system is expected to be in balance based on the day-ahead predicted values, which means \(IF_{i}(t)=OF_{i}(t),\ i=1,...,M-1,\ t=1,...,T\). Here, \(M\) is the total number of subsystems including the main grid with the assumption that the highest index is assigned to the upstream network. After deciding day-ahead scheduling, the entire MMG system will be represented to the main grid as an aggregated load or generation unit through its net energy content (see (3)). \[I_{M}(t)=\sum_{i=1}^{M-1}OF_{i}(t). \tag{3}\]  
Considering day-ahead power scheduling, IMGs are required to exchange power with the main grid according to the pre-specified trajectory of \(I_{M}(t)\). However, the intrinsic uncertainty of RESs production and the variability of loads as well as the forecasting errors will result in uncertain behavior of MGs' real-time power balance quantities. It is assumed that any real-time power deviation will be technically compensated by the main grid to guarantee the stability of the system. However, a large penalty cost will be imposed on the MGs. Consequently, MGs are required to devise operation strategies to compensate for the uncertainty locally at the MGs level. In this paper, to reduce the computational complexity, it is proposed that a local variable named power mismatch can be defined for the individual MGs as follows, for which the desired value is zero. \[\delta_{mis,i}(t)=\hat{OF}_{i}(t)-OF_{i}(t). \tag{4}\]  
In other words, it is desired that the realized outflow of each MG (\(\hat{OF}_{i}(t)\)) follows the estimated trajectory for the outflow of the MG (\(OF_{i}(t)\)). However, accounting for the inherent uncertainty of the MGs, this constraint cannot be fully guaranteed before the realization of the uncertain parameters. Thus, it is assumed that each MG is equipped with an energy storage system (ESS), which can be used as an appropriate tool to mitigate the uncertainty. The cost function of each MG is to minimize the operation cost of ESS unit as represented in the following. \[min\quad c_{i}|P_{b,i}(t)|. \tag{5}\]  
In (5), \(c_{i}(\frac{\$}{KW})\) represents operational cost of the ESS in the \(i\)th MG and \(P_{b,i}(t)\) is the amount of charging/discharging power, which is assumed to be positive/negative during charging/discharging intervals.