# Predictive Control for Current Distortion Mitigation in Mining Power Grids
## 2 Preliminaries
### Synthesis of Model Constraints  
Equalities and Inequalities (13) to (20) state the model constraints used to build the optimization problem, considering \(N\) steps ahead, since instant \(k\). Since current controllers at the primary level should be tuned to respond against millisecond-order disturbances, it is possible to assume the steady state of these loops from the MPC point of view. Hence, the discrete-time incremental model, based on the forward Euler method, (13), are defined to predict power magnitudes of fundamental and harmonics frequencies. In this case, \(\Delta U_{h}\) represents the change in the control action required to compensate for harmonics disturbances; therefore, an additional integrator should be placed at the controller output to compute \(U_{h}\). Note that the integral action mitigates the steady state error; therefore \(\Delta U_{h}=0\) is hold, and, thus, the integrator output is the magnitude of the h-th harmonic component. The Inequality (14) is derived from Inequality (12), and bounds the harmonics injected by the compensator to the power grid. The upper bound, \(P_{h,max}\), is constant along the whole prediction horizon and stated according to (15) and (16), where \(K_{h}\) is the ratio between \(I_{1}\) and \(I_{h}\). In addition, the slack variable \(P_{h,s}\) is defined to avoid numerical infeasibilities by expanding, temporarily, the allowed range. Note that the lower bound of (14) is settled in zero because \(P_{h}^{\text{PCC}}\) refers to power component magnitudes.  
\[\begin{split} P_{0}^{\text{DG}}(k+m)-P_{0}^{\text{DG}}(k+m-1)& =\Delta U_{0}(k+m-1)\quad\quad[W]\\ P_{h}^{\text{PCC}}(k+m)-P_{h}^{\text{PCC}}(k+m-1)& =\Delta U_{h}(k+m-1)\ \forall_{1\leq h\leq H}\quad\quad[W]\end{split} \tag{13}\]  
\[0\leq P_{h}^{\text{PCC}}(k+m)\leq P_{h,max}+P_{h,s}(k+m) \tag{14}\] \[P_{0}^{\text{PCC}}(k)=I_{1}(k)V_{1}\quad\quad[W]\] (15) \[P_{h,max}=\left(K_{h+1}^{2}+K_{h-1}^{2}\right)^{\frac{1}{2}}P_{ 0}^{\text{PCC}}(k)\quad\quad[W] \tag{16}\]  
The IEEE std 1547 [12] states the TRD, defined by (17), as a power quality index that relates the sum of all current harmonics, except the fundamental component \(I_{1}\), with the rated current value, \(I_{rated}\). However, when distributed generation is considered and \(I_{rated}\) changes, power quality requirements are relaxed. In this regard, a constraint related to the traditional current THD, that weights higher the variations of the fundamental current than the TRD [34], is preferred for control purposes. Therefore, the terminal THD Constraint (18) is defined as a function of the active power component, \(P_{0}^{\text{PCC}}\), measured at instant \(k\), and the predicted harmonic magnitudes \(P_{h}\), at the end of the prediction horizon, both referred to the PCC, as shown (19). In the same way as (14), the slack variable \(THD_{s}\) is defined to avoid numerical infeasibilities by expanding, temporarily, the allowed range, and the lower bound of (18) is zero because \(THD\) is a function of power magnitudes.  
\[TRD=\frac{\sqrt{I_{rms}-I_{1}^{2}}}{I_{rated}}\times 100\% \tag{17}\]  
\[0\leq THD(k+N) \leq THD_{max}+THD_{s}(k+1) \tag{18}\] \[THD(k+N) =\frac{\sum_{h=1}^{H}P_{h}^{\text{PCC}}(k+N)}{P_{0}^{\text{PCC}}(k)} \tag{19}\]The last constraint considers the limitation due to the generation capacity of the DG. Inequality (20) computes the power balance through the prediction horizon, using, as the initial condition, the sum of power components delivered by the DG. This power balance considers the energy changes of each harmonic component \(\Delta U_{h}\). Considering that bidirectional power flows, caused by energy storage systems and interlinking converters in hybrid microgrids are not usual in mining facilities, the lower bound of power balance (20) is settled to zero.  
\[0\leq\sum_{h=0}^{H}P_{h}^{DC}(k)+\sum_{m=1}^{N}\sum_{h=0}^{H}\Delta U_{h}(k+m-1 )\leq P_{cap}+P_{c,s}(k+1)\hskip 14.226378 pt[W] \tag{20}\]