## 4 Multi-Time Scale Dispatching Model of Active Power and Reactive Power Based on MPC
### Intra-Day Rolling Optimal Dispatching Model  
In the day-ahead optimization stage, the optimal dispatch of the distribution network is based on the day-ahead forecast data of wind and solar loads. Due to the long time scale, the forecast error is large in the day-ahead stage, leading to deviations in the optimization results. This paper employs the MPC optimization method to perform rolling optimization of controllable resources in the distribution network every 15 min, enabling intra-day rolling optimal dispatch. The framework for intra-day rolling optimal dispatch is illustrated in Figure 2.  
In the intra-day rolling optimization stage, the control variables include the reactive power of wind and PV, the reactive power of SVG, and the active and reactive power of GT, VPSPH and BES. Based on MPC in the intra-day rolling stage, a predictive model is established at time \(t\), the optimization results of OLTC and CBs action states, VPSPH and BES charging/discharging states obtained in the day-ahead stage, as well as the latest ultra-short-term forecast data of wind, PV, and load, and system constraints are input into the model to predict the future outputs in the M\(\Delta t\) period. By minimizing the objective function, the control commands at time \(t+\Delta t,\ t+2\Delta t,\ \cdots t+M\Delta t\) are obtained, but only the first control command value is applied to the distribution network. The above process is repeated at the next time \(t+\Delta t\), continuously rolling for optimization. 1. Predictive model of MPC  
The control variables are obtained by solving the rolling optimization model, and then the active and reactive power outputs of each distributed power source and energy storage in the finite time domain are predicted. The predictive model is as follows:  
\[ \begin{split}\mathbf{P}(k+i|k)&=\mathbf{P}_{0}(k)+\sum \limits_{t=1}^{i}\Delta\mathbf{u}_{1}(k+t|k)\\ \mathbf{Q}(k+i|k)&=\mathbf{Q}_{0}(k)+\sum\limits_{t=1}^{i} \Delta\mathbf{u}_{2}(k+t|k)\\ \end{split}  \tag{23}\]  
\[ \begin{split}\mathbf{P}=[P^{\text{GT}}\ p^{\text{VPSSH}}\ p^{\text{ BES}}]^{T}\\ \mathbf{Q}=[Q^{\text{WT}}\ Q^{\text{PV}}\ Q^{\text{GT}}\ Q^{\text{ VPSSH}}\ Q^{\text{BES}}\ Q^{\text{SVG}}]^{T}\\ \Delta\mathbf{u}_{1}=[\Delta P^{\text{GT}}\ \Delta P^{\text{VPSSH}}\ \Delta P^{\text{BES}}]^{T}\\ \Delta\mathbf{u}_{2}=[\Delta Q^{\text{WT}}\ \Delta Q^{\text{PV}}\ \Delta Q ^{\text{GT}}\ \Delta Q^{\text{VPSSH}}\ \Delta Q^{\text{BES}}\ \Delta Q^{\text{SVG}}]^{T}\end{split}  \tag{24}\]  
where \(i=1,2\cdots M\), The initial value of the controlled resource at time \(k\) is obtained from the feedback actual measurement. \(\mathbf{P}(k+i|k)\) is the active output of GT, VPSSH, and BES at \(k+i\) time predicted at \(k\) time; \(\mathbf{Q}(k+i|k)\) is the reactive output of WT, PV, GT, VPSSH, BES, and SVG at \(k+i\) time predicted at \(k\) time; \(\mathbf{P}_{0}(k),\ \mathbf{Q}_{0}(k)\) are the initial values of the controllable resource at the time \(k\), which are obtained from the actual measurement of the feedback; \(\Delta\mathbf{u}_{1},\ \Delta\mathbf{u}_{2}\) are the control variables, that is, the increment of active and reactive power output of the controllable resources. 2. Objective function  
To ensure consistency between the day-ahead and intra-day objective functions, the intra-day rolling optimization objective function still includes minimizing the distribution network operation cost and node voltage deviation. Additionally, to maintain the daily operating capacity balance of VPSPS and BES as much as possible, the objective function of intra-day incorporates a capacity imbalance penalty. The closer the end of the day is, the greater the penalty for unbalance is, so that the VPSSH and BES capacity can recover to the initial value as much as possible at the end of the day. Therefore, the intra-day rolling optimization objective function is:  
\[