# Optimal Load Distribution in DG Sources Using Model Predictive Control and the State Feedback Controller for Switching Control

Authors: Iman Sayedi; Mohammad H. Fatehi; Mohsen Simab
Journal: International Transactions on Electrical Energy Systems
 (2022)

---

## Abstract

The distributed energy management of interconnected microgrids, which is based on model predictive control (MPC), relies on the cooperation of all the agents (i.e., microgrids). Model predictive control or MPC is widely used in industrial applications as an effective tool for dealing with multivariable limited control problems. MPC uses an explicit system model to predict the future horizon of the system and its outputs. This predictability allows calculating the optimal order of inputs to minimize output errors over a limited horizon, which is effected by the limitations of the system. This study presents a distributed economic model predictive control method using the new state feedback controller to control the switching of interface converters and compensate for the unbalanced and nonlinear loads. In this model, the islanding mode and the reconnection of the grid are considered to improve the transient behavior of the system to achieve steady-state power distribution. It has been proposed that it could obtain better results in predictive control, utilizing similarity transform in the state matrix and its modification. First, this model is simulated on distributed generation sources with power-sharing and local loads using the state feedback controller in MATLAB Simpower. Then, the performance of the proposed method is evaluated, confirming that it is more reliable than the FS-MPC and DSVM-MPC methods.


---

## Body

## 1. Introduction

A microgrid is a small-scale power grid designed for supplying electricity to end users. Under certain conditions, microgrids have the ability to inject their excess energy into the main grid [1]. The most important challenge when using microgrids involves maintaining the system’s security and stability. Most renewable energy-based distributed generation (DG) plants need voltage source inverters (VSIs) to connect to the microgrid [2]. Nowadays, choosing the appropriate method for controlling industrial processes is highly important. Moreover, control methods in the industry must have several characteristics, such as ease of use by the operator, simple configuration, and cost-effectiveness [3]. Although using proportional-integral-derivative (PID) controllers has become common in the industry, it should be noted that industrial processes involve a wide range of different operations, limiting the use of such controllers. The main reason behind the wide range of different dynamic operations probably relates to various factors, including the existence of zeroes outside the stable region, unstable poles, and long delays with indefinite and variable times.Furthermore, it can overcome the uncertainties of the plant parameters because of load demand fluctuations and the errors of the implementation. The new method has been built based on new simple frequency domain conditions and the whale optimization algorithm (WOA). This method is utilized to design a robust proportional-integral-derivative (PID) controller based on the WOA in order to enhance the damping characteristics of the wind energy conversion system [4]. New two methods of artificial intelligence (AI) techniques are used to design the model predictive controllers (MPCs) with superconducting magnetic energy storage (SMES) and capacitive energy storage (CES) for load frequency control (LFC) [5]. The model predictive control (MPC) algorithm is a method for dealing with such complex industrial processes. Implementing the predictive control method for electric power converters can be difficult due to the large computational load required to instantly solve optimization equations. To mitigate this problem, a number of practical solutions have been considered, such as the out-of-line calculation of optimization equations and solving these equations by evaluating finite state switching. The latter is known as the finite state model predictive control (FS-MPC) since it works using a finite set of possible states for the electric power converter switching. So far, the FS-MPC control method has been used in various applications, e.g., as rectifier, inverter, motor control, and uninterruptible power supply (UPS). Based on the results of the relevant studies, this control method has high performance ability for the optimal operation of the whole system, while there is no need to fine-tune the controller parameters. Despite these capabilities, this method has two major drawbacks that limit its use in industrial systems. The first drawback is that to achieve high performance, and a high sampling frequency is required, leading to costly hardware and the need for high computation power. Moreover, in this method, the switching frequency is variable, which increases the values of the converter’s output filter and the volume, weight, and total cost of the converter. When FS-MPC control designs are implemented in laboratory experiments, a large volume of calculations needs to be performed during each sampling period, which causes a significant delay in the activation of the actuator signal. Therefore, if the delay caused by the measurement, calculations, and the operation of the actuator is not considered in the design of the controller, it can cause poor controller performance. In this regard, [6] describes the reason for this delay and the method for compensating for it, which creates an interval between the moment the current is measured and the moment the new switching state is applied. During this interval, the previous switching state is present at the converter’s output, which causes a difference between the load current and the reference current, increasing the current’s ripple. To solve this problem, [6] uses the prediction of the next two samples instead of the prediction of the next sample. Moreover, [7] proposes a new predictive control method, called fast predictive control. In this method, the volume of the calculations will be significantly reduced, and it can be used in multilevel converters that have a large number of control vectors. Another disadvantage of the FS-MPC method is the variable switching frequency [8]. The variable switching frequency creates a wide range of harmonics at the output of the converter, which can cause resonance and make filter design more difficult. In [9], the average switching frequency is kept constant by adding corrective terms to the cost function. In addition, [9] modifies the current predictive control scheme in such a way that the switching frequency can become somewhat independent of the sampling frequency. Configuring and selecting the weighting coefficients in the FS-MPC method will be a major challenge, which has a significant impact on the system’s performance. Configuring these coefficients is more time-consuming than adjusting the parameters of the PI controller in classical current control and adjusting the hysteresis bandwidth. Furthermore, [10] presents a number of important points for determining the optimal values of the weighting coefficients. In addition, [10] introduces a predictive control method without using weighting coefficients in the induction motor drive. On the other hand, [11] shows that using discrete space vector modulation in the FS-MPC control method enables employing virtual switching states in the control algorithm in addition to the real switching states. This new technique is called the discrete space vector modulation-model predictive control (DSVM-MPC), using which the required sampling frequency is reduced, while the switching frequency of the converter is stabilized [12]. In addition to the advantages of the FS-MPC method, this control method also provides other benefits, including fixed switching frequency and low sampling frequency [13]. However, due to the use of the same algorithm and its discrete nature, it includes a limited and discrete number of converter vector space points. Therefore, to account for a wide and variable range of operating points for the converter, more points are needed, which may lead to slow dynamic performance, low accuracy, and distortion in the output of the converter. The economic costs for the MPC and the heuristic approach in the considered price scenarios are reported in the economic costs of prosumers equipped with production units, energy storage systems, and electric vehicles. To this purpose, the predictive control manages the available energy resources by exploiting future information about energy prices, absorption and production power profiles, and electric vehicle (EV) usage, such as times of departure and arrival and predicted energy consumption [14]. In the model predictive control and state feedback controller, the chosen states of the system are compared with their reference quantities to generate the converter switching. With the method proposed, in addition to the fact that we have maintained system dynamics, this similarity transform should be used to evaluate all systems. Hence, the following state transform matrix is considered for this system, and better results in terms of overshoot, rise time, settling time, and steady state have been obtained with this method, which are shown in the results of this study. This study proposes a state feedback control method and discusses the optimal design using the iteration method to define all possible switching states along the predictor’s horizon for the controller, thus mitigating the drawbacks of the previous methods. Therefore, finding an economically applicable model with the best state-space model is very important. A comprehensive review of DC microgrids can be found in [15, 16].


## 2. Study of a Microgrid Containing a DG Source

Figure1 depicts the single-line diagram of a power system containing two DG sources. The microgrid is connected to the main grid at the PCC point. Two sources, i.e., DG1 and DG2, are directly connected to the microgrid using the CB-3 and CB-4 circuit breakers, respectively. Both DGs have local loads, which may be nonlinear and unbalanced. In addition, the microgrid may have a joint load as well, which is assumed to be balanced and located at a long distance from the DGs. One of the tasks of the DGs is to correct the imbalance and the nonlinearity of the local load. Several control schemes have been introduced in order to ensure the proper operation of the microgrid in the grid connection mode or the islanding mode [17]. Moreover, several control schemes have been introduced in order to ensure the proper operation of the microgrid in the grid connection mode or the stand-alone mode [18]. A comprehensive review of dc microgrids can be found in [19–21].Figure 1
The single-line diagram for the microgrid and the electricity grid, including two sources of distributed generation [31].In the DG grid connection mode, the microgrid shares a percentage of its local load with the main power grid, while the joint load is fully supplied by the main grid. During the process of islanding, each DG source supplies its own local load, while the joint load is shared between the DG sources.The mix powers drawn by the local loads includePL1+jQL1 and PL2+jQL2. Moreover, the joint load draws the iLC current from the grid and it consumes the mix power PLC+jQLC.Local loads at points PCC1 and PCC2 are connected to the DG sources with voltages ofvp1 and vp2, respectively.The real and reactive powers supplied by the DGs are denoted by P1, Q1, P2, and Q2, respectively. It is assumed that the microgrid is mainly resistive, and at the distribution level, the impedances of the lines are denoted byRD1 and RD2.The main power supply is shown byVs, while the feeder inductance resistors are denoted by RS and LS, respectively.The main power grid injects PG and QG powers into the microgrid, and PS-PG and QS-QG powers supply the main load of the power grid.CB1 can disconnect the microgrid from the main power grid.In the next sections, we will examine the performance of the system and the compensator in both grid connection and islanding modes. In all the modes mentioned in this section for the grid, a state feedback controller is used with a quadratic linear regulator to control the grid and correct the unbalanced loads. The general diagram block of this controller is shown in Figure2. Here, in order to achieve the desired solutions, the value of h is set to 0.001. It should be noted that i1, icf, and vcf signals are measurable.Figure 2
The diagram of the finite state model predictive control for three-phase inverters [8].In [22], the authors present an adaptive optimization method for NMPC, where an extended Kalman filter (EKF) is used for estimating the state variables. In [2], a system is investigated where the superheated steam temperature (SST) is the main variable that must be controlled. To do so, several categories of cascading PIDs have been used to control this variable. In [3], to adapt the model, neural networks are presented for controlling the model predictive control. In [23], a fuzzy method based on Lyapunov fragment functions is used in the model predictive control. In [24], in order to make the system smart, generalized predictive control (GPC) and a neural network model are used. In this method, a nonlinear neural network is used to extract the linear model of the system. In [25], horizon optimization is utilized for predictive control using a genetic algorithm. In [26], the prediction of the next two samples is used instead of predicting the next sample. Moreover, [27] proposes a new predictive control method, called fast predictive control. In this method, the volume of calculations will be significantly reduced, and it can be used in multilevel converters that have a large number of control vectors. In addition, [28] modifies the current predictive control scheme in such a way that the switching frequency can become somewhat independent from the sampling frequency. Increasing the sampling frequency improves the performance of FS-MPC, while reducing the ripple of the output current. However, increasing the sampling frequency also increases the switching frequency, which ultimately leads to increased losses [29]. This study presents a predictive control method using the state feedback controller to control the switching interface converters and compensate for the unbalanced and nonlinear loads.


## 3. The Model Predictive Control (MPC) Method

The MPC method is an optimization problem where the cost function is minimized. Using the system model and the values of the variables until time K, the state values are predicted until time horizonK + N. Moreover, through the optimization of the cost function, the first component of the command sequence is applied at moment K+1. These steps are repeated for the next time steps. The cost function includes the control objectives of the system, and its common terms include variables that need to follow a reference value [11].According to equation (1), controlling these variables will be a function of the error between the predicted value and its reference value.As can be seen in equation (1), this function can be the size, the square, or the integral over a sampling time interval.(1)g=∫kk+1x∗t−xptdt.


### 3.1. The Finite State Model Predictive Control (FS-MPC)

This method uses the discrete nature of electronic power converters in such a way that all converter voltage vectors are tested in the cost function, and the vector that minimizes the cost function is selected [20].Figure2 shows the finite state model predictive control (FS-MPC). The algorithm for solving this method includes the following steps [26]:A : Load current measurement;B : Prediction of the load current in the next samples for all possible switching states according to the following equation:(2)ipk+1=1−rL×TSLik+TSLvSk−vsi.This equation is obtained by discretizing the voltage equation.C: The cost function is evaluated for each prediction.In this method, the cost function is expressed as the error between the reference current and the predicted current for each of the possible switching states ((3)).(3)gn=iαref−iαpSi+iβref−iβpSi.D: The switching state that minimizes the cost function is selected.When FS-MPC control schemes are implemented in laboratory experiments, a large volume of calculations is performed in each sampling period, which causes a significant delay in the activation of the actuator signal. Therefore, if the delay caused by the measurement, the calculations, and the activation of the actuator is not considered in the controller design, it can cause poor controller performance. In this regard, [26] describes the reason for this delay and how to compensate for it.


### 3.2. The DSVM-MPC Controller

The main idea behind the DSVM-MPC control method involves using other points in the vector space. In the SVM modulation method, in addition to the eight main switching states for the three-phase converter, other states can also be applied in the form of a linear combination of these base states. These new states are called virtual states. However, because the cost function is calculated per each vector, it will only be possible to use a limited number of points in the vector space. In Figure 3, the real points (circles) and virtual points (squares) are shown for the switching of a three-phase converter [21] (Figure 3).Figure 3
The vector space for switching of a power converter [21].This control method also offers benefits such as a fixed switching frequency and a low sampling frequency. However, due to using a similar algorithm and its discrete nature, it covers a limited and discrete number of points in the converter’s vector space [19].


### 3.3. The Proposed DE-MPC Controller

The microgrid shown in Figure1 is considered. It can be observed that when entering the is landing mode and reconnecting the grid, the system’s response is not highly satisfactory since it takes a long time for the power distribution to reach a steady state. To solve this problem, we first used a PSO algorithm and PID control, and the issue was largely mitigated. In this section, we try to design a distributed economic model predictive controller (DEMPC) to improve the transient state of the system.The model predictive controller method is designed and implemented based on the following three steps:(1)
A model is used to predict the behavior of the control variables for the next time step.(2)
A cost function is determined, including control objectives and the expected behavior of the system.(3)
The appropriate command is extracted by minimizing the value of the cost function.The model used for the prediction is a discrete-time model that can be represented in the form of state equations according to equations (4) and (5):(4)xk+1=Axk+Buk,(5)yk=Cxk+Duk.In these equations, the vectorx(k) denotes the current values of the state variables, x(k + 1) is the future prediction value for the state variables, u(k) denotes the current values of the input variables, and y(k) is the vector of the current output values. In the next step, the cost function must be determined. According to equation (6), in this function, the reference values, values of the future states, and the future control commands are considered.(6)J=fxk,uk,.....,uk+N.It is noted that the constraints of the state equations are considered as follows.S.t:umin ≤  u(k + i)  ≤  umax; i = 0,…, Nu-1.∆umin  ≤  ∆u(k + i)  ≤  ∆umax; i = 0,…, Nu-1.Ymin(k + i)  ≤  y(k + i)  ≤  ymax(k + i); i = 1,…, NpThe quantities of the prediction horizon are usually considered to be twofold the control horizon. That is in the simulation,Np = 10 and Nu = 5 should be considered in this regard.The DE-MPC control method is an optimization problem in which the cost function is minimized. In this optimization, the system model and control objectives are considered forK+1 to K + N time steps. The result of this optimization is N consecutive commands. The first component of this command sequence is applied at moment K + 1. Similarly, during this time, using the new measurement values, the optimization is performed for the next moment, and the appropriate command is selected for the moment K + 2. These types of calculations are called receding horizon strategies. Figure 4 shows the performance of the DE-MPC method. Using the system model and the values of the variables until time K, the state values until time horizon K + N are predicted. In addition, by optimizing the cost function, the first component of the command sequence is applied at moment K + 1. These steps are repeated for the next time steps.Figure 4
Principles of the operation of the predictive method.In this method, the number of switching states is defined to control the microgrid, and based on this number and the proposed cost function, the switching operation is performed. Furthermore, Figure5 shows the state feedback controller diagram. Moreover, the proposed controller equations are explained in Section 3.4.Figure 5
The state feedback controller diagram block.Among constraints that exist in this system, we could mention constraints in switching control S, which is considered in the equation below. The control signal, which is defined by predictive control, is continuous. The variable S is denoted that tou signal. As it is mentioned, this signal takes one of values +1 or −1. The principle of switching is presented below:(7)Ifuck>hthenu=+1,elseIfuck<−hthenu=−1,in which h is a very small number. Choosing the h value determines switching frequency, in a way that reference values are tracked. After several sequences, when we achieved a more accurate model, we could choose this h value even smaller.The single-phase equivalent circuit of converted is shown in Figure6. Using this figure and in the presence of the LCL filter, the state vector in conventional methods is considered as below:(8)x1T=ifi1vcf.Figure 6
Single-phase equivalent circuit VSC (LCL filter) [32].Figure6 shows the block diagram of the implemented control method. Using Figure 6 and considering selected state variables, it will be obtained the following descriptions for system state space:(9)x1•=if.i1.vcf.=−RfLf0−1Lf001L11Cf−1Cf0ifi1vcf+VdcLf00u+0−1L10vPCC.Hence, the following state vectors are given that by equation (13).(10)B1=VdcLf00,B2=0−1L10,A=−RfLf0−1Lf001L11Cf−1Cf0.In the following, it has been proposed that it could be obtained better results in predictive control, utilizing similarity transform in the state matrix and its modification. With this method, in addition to the fact that it has maintained system dynamics, we can use this similarity transform to evaluate all systems.


### 3.4. The Proposed Method

Figure6 depicts a block diagram of the implemented control method. In the model predictive control and state feedback controller, the chosen states of the system are compared with their reference quantities to generate the converter switching. It is easy to generate a reference for the output voltage vcf and current ic from power flow conditions. However, the same cannot be said about the reference for the if. To facilitate this, we define the new state vectors as follows:(11)xT=icfilvcf.Therefore, we will have the following conversion matrix:(12)x=1−10010001x1=Cpx1.The transformed state equations are obtained by combining equations (11) and (12) as follows:(13)x˙=CpACp−1x+CpBuc+CpCvpcc=Λx+Γ1uc+Γ2vPCC.The control rule is defined as follows:(14)uck=−Kx1k−xrefk.In the above equation,K is a gain matrix, and xref is the reference vector. The gain matrix can be obtained using the DE-MPC control method and the proposed switching method.The control rule of equation (13) includes switching control, which is discussed in detail below.Assuming complete control overu, a quadratic optimal linear steady state can be designed for this problem. As noted earlier, the control rule is as follows:(15)u=−Kx1k−xrefk.The control law discussed so far is for the system in which the DGs have an output inductor. Alternatively, when the DGs do not have an output inductance, the inductance L1 is removed and the output filter is a simple LC filter. The system state is then modified follows:(16)x2T=icf⋅vcf.With respect to Figure6, the reference for vcfv∗and given V∗ and Ø∗, the current phasor through the capacitor Cf is given by equation (14).(17)Icf∗=wCfV∗∠δ1∗+90.The referenceicf∗ is obtained from the instantaneous value of Icf∗. As we have seen, it is much easier to predict the reference values from the capacitor voltage (vcf) and then to predict its current (ic) than to predict the current if and δ1∗ is angle of V∗, respectively. It is evident in equation (11) that reference for all elements of the states is required for state feedback. Since V and δ are obtained from the droop equation, the references for the capacitor voltage and current are given by vcref=Vsinwt+δ and icref = V ѡ Cfsin(ѡt +δ +90).In the above equation,xrefk denotes reference vectors. The DE-MPC controller minimizes the following performance index:(18)j=∫0∞x−xrefTQx−xref+ρuTRudt.The index given in equation (18) must be minimized to obtain the optimal control rule, u, by solving the steady-state equation.In equation (18), the weighting matrix, Q, is a definite or semidefinite positive matrix, which is real and symmetric, while the penalty control matrix, R, is a definite positive matrix, which is real and symmetric. Moreover, ρ is a constant positive number. According to Bryson’s rule, the initial choice for R and Q matrices is possible in the form of diagonal matrices as follows:(19)Qii=1maximumacceptablevalueforzi2,i∈1,2,…,l,Rjj=1maximumacceptablevalueforuj2,j∈1,2,…,m.In the above equation,l is the number of control outputs and m is the number of inputs. Moreover, zi is called the controlled output, which is related to the signal we want to minimize in the shortest possible time. In this method, the output voltage is indirectly regulated by controlling the inductor’s current. The reason behind selecting the current instead of the voltage involves the presence of more ripples in the current, which increases the predictions in the proposed controller. In this way, more accurate data about the future can be predicted, increasing the robustness of the proposed controller.To do so, an optimal objective function is specified that determines the order of switching. The order of switching along the prediction horizon will be according to equation (20):(20)Uk=ukuk+1…uk+N−1T.In this equation, U is the optimal switching state whose first element, i.e.,u(k), which is applied to the circuit, while its other elements are applied in subsequent time steps.In this method, one of the control goals of the objective function involves reducing the difference between the current and its reference value according to equation (21):(21)iLerrk=iLrefk−iLK+1.In this way, the cost function can be expressed as equation (22):(22)jk=∑j=kk+N−1iLerrj|k.The optimal switching state is achieved by minimizing the cost function as follows:(23)U∗k=argminJk.The reason for using these arguments in the proposed equation is that it can better minimize the cost function. Optimal switching in equation (23) is performed using the iteration method. All possible switching states are defined for the controller along the N horizon, which is shown by Uk.Therefore, there will be 2N switching states. Matrices (20) and (21) are calculated for all the switching states, while the cost function equation (22) is also calculated.Finally, the switching state with the lowestj value is selected and applied to the switch.The existing differential approximation, i.e.,di/dt, can be considered as follows as a simple step-forward Euler equation:(24)diα,βdt≈iα,βk+1−iα,βkTs.In addition, by substituting equation (24) into (21), the future value of the load current vector is obtained as follows:(25)ik+1α,β=TsLvα,βk−iα,βkR−LTs.Equation (25) is used in the controller block for predicting the future current values based on the measured voltage vector. To select the voltage vector and control the current, the predicted current is evaluated using the following cost function:(26)gk+1=iα∗k+1−iαk+1+iβ∗k+1−iβk+1.In this equation,i ∗ α, β[k+1] is the estimate of the reference current vector in the next horizon. For grids with a sufficiently small sampling time, it can be assumed that this current is equal to its previous value, i.e., i ∗ α, β[k+1] i ∗ α, β[k]. However, for large sampling times, the future value of the reference current needs to be extrapolated. To make the values of the three-phase current vectors independent from each other, the voltage vectors can be first obtained from the values of the switching signals and the voltage of the DC link capacitors.(27)vaN=vc1S1a+vc2S2a+vc3S3a,vbN=vc1S1b+vc2S2b+vc3S3b,vcN=vc1S1c+vc2S2c+vc3S3c.The shared-mode voltage is obtained as follows:(28)vNO=vcm=vaN+vbN+vcN3.The cost function in the proposed algorithm is to minimize the voltage drop.The objective function that should be minimized is defined as follows:(29)F=∫0tsimt.∑Pi−Piss+Qi−Qissdt,i=L1,G1,1,L2,G2,2.In the above equation, P1ss, PL1ss, PG1ss, P2ss, Pl2ss, and PG2ss are the final (stable) values obtained for the active powers in Table 1. Moreover, Q1ss, QL1ss, QG1ss, Q2ss, QL2ss, and QG2ss are the final (stable) values of the reactive powers.Table 1
The numerical results of the joint load sharing by the distributed generation source by selecting optimal parameters using the LQR controller (employing the PSO method).
Active powerInitialIntermediate amount, MW(in the islanding mode)Final amountRecovery time (second)Amount (MW)(MW)(After reconnecting the grid)Figure7PL11.111.10.01PG10.88−0.150.880.02P10.221.150.220.02PL21.10.971.10.01PG20.55−0.30.550.02P20.551.270.550.02Figure8Voltage dropIn PCC2% in PCC1%2.7% 3.1%In fact, this objective function is defined in such a way that the values of the powers have the least deviation from the final values or the values of their steady states, while reaching this steady state in the shortest possible time. The model-based predictive control process algorithm for controlling the current in the selected system is as follows:(i)
Applying V[k];(ii)
V[k-1] =v[k];(iii)
Measuring currents ic, ia, and ib;(iv)
Calculating the current vector;Predicting the next horizon’s currenti[k + 1];Calculating the cost function gi;Is gi < gopt?Yes: gopt = gj, Iopt = Ij.No: Restart.


## 3.1. The Finite State Model Predictive Control (FS-MPC)

This method uses the discrete nature of electronic power converters in such a way that all converter voltage vectors are tested in the cost function, and the vector that minimizes the cost function is selected [20].Figure2 shows the finite state model predictive control (FS-MPC). The algorithm for solving this method includes the following steps [26]:A : Load current measurement;B : Prediction of the load current in the next samples for all possible switching states according to the following equation:(2)ipk+1=1−rL×TSLik+TSLvSk−vsi.This equation is obtained by discretizing the voltage equation.C: The cost function is evaluated for each prediction.In this method, the cost function is expressed as the error between the reference current and the predicted current for each of the possible switching states ((3)).(3)gn=iαref−iαpSi+iβref−iβpSi.D: The switching state that minimizes the cost function is selected.When FS-MPC control schemes are implemented in laboratory experiments, a large volume of calculations is performed in each sampling period, which causes a significant delay in the activation of the actuator signal. Therefore, if the delay caused by the measurement, the calculations, and the activation of the actuator is not considered in the controller design, it can cause poor controller performance. In this regard, [26] describes the reason for this delay and how to compensate for it.


## 3.2. The DSVM-MPC Controller

The main idea behind the DSVM-MPC control method involves using other points in the vector space. In the SVM modulation method, in addition to the eight main switching states for the three-phase converter, other states can also be applied in the form of a linear combination of these base states. These new states are called virtual states. However, because the cost function is calculated per each vector, it will only be possible to use a limited number of points in the vector space. In Figure 3, the real points (circles) and virtual points (squares) are shown for the switching of a three-phase converter [21] (Figure 3).Figure 3
The vector space for switching of a power converter [21].This control method also offers benefits such as a fixed switching frequency and a low sampling frequency. However, due to using a similar algorithm and its discrete nature, it covers a limited and discrete number of points in the converter’s vector space [19].


## 3.3. The Proposed DE-MPC Controller

The microgrid shown in Figure1 is considered. It can be observed that when entering the is landing mode and reconnecting the grid, the system’s response is not highly satisfactory since it takes a long time for the power distribution to reach a steady state. To solve this problem, we first used a PSO algorithm and PID control, and the issue was largely mitigated. In this section, we try to design a distributed economic model predictive controller (DEMPC) to improve the transient state of the system.The model predictive controller method is designed and implemented based on the following three steps:(1)
A model is used to predict the behavior of the control variables for the next time step.(2)
A cost function is determined, including control objectives and the expected behavior of the system.(3)
The appropriate command is extracted by minimizing the value of the cost function.The model used for the prediction is a discrete-time model that can be represented in the form of state equations according to equations (4) and (5):(4)xk+1=Axk+Buk,(5)yk=Cxk+Duk.In these equations, the vectorx(k) denotes the current values of the state variables, x(k + 1) is the future prediction value for the state variables, u(k) denotes the current values of the input variables, and y(k) is the vector of the current output values. In the next step, the cost function must be determined. According to equation (6), in this function, the reference values, values of the future states, and the future control commands are considered.(6)J=fxk,uk,.....,uk+N.It is noted that the constraints of the state equations are considered as follows.S.t:umin ≤  u(k + i)  ≤  umax; i = 0,…, Nu-1.∆umin  ≤  ∆u(k + i)  ≤  ∆umax; i = 0,…, Nu-1.Ymin(k + i)  ≤  y(k + i)  ≤  ymax(k + i); i = 1,…, NpThe quantities of the prediction horizon are usually considered to be twofold the control horizon. That is in the simulation,Np = 10 and Nu = 5 should be considered in this regard.The DE-MPC control method is an optimization problem in which the cost function is minimized. In this optimization, the system model and control objectives are considered forK+1 to K + N time steps. The result of this optimization is N consecutive commands. The first component of this command sequence is applied at moment K + 1. Similarly, during this time, using the new measurement values, the optimization is performed for the next moment, and the appropriate command is selected for the moment K + 2. These types of calculations are called receding horizon strategies. Figure 4 shows the performance of the DE-MPC method. Using the system model and the values of the variables until time K, the state values until time horizon K + N are predicted. In addition, by optimizing the cost function, the first component of the command sequence is applied at moment K + 1. These steps are repeated for the next time steps.Figure 4
Principles of the operation of the predictive method.In this method, the number of switching states is defined to control the microgrid, and based on this number and the proposed cost function, the switching operation is performed. Furthermore, Figure5 shows the state feedback controller diagram. Moreover, the proposed controller equations are explained in Section 3.4.Figure 5
The state feedback controller diagram block.Among constraints that exist in this system, we could mention constraints in switching control S, which is considered in the equation below. The control signal, which is defined by predictive control, is continuous. The variable S is denoted that tou signal. As it is mentioned, this signal takes one of values +1 or −1. The principle of switching is presented below:(7)Ifuck>hthenu=+1,elseIfuck<−hthenu=−1,in which h is a very small number. Choosing the h value determines switching frequency, in a way that reference values are tracked. After several sequences, when we achieved a more accurate model, we could choose this h value even smaller.The single-phase equivalent circuit of converted is shown in Figure6. Using this figure and in the presence of the LCL filter, the state vector in conventional methods is considered as below:(8)x1T=ifi1vcf.Figure 6
Single-phase equivalent circuit VSC (LCL filter) [32].Figure6 shows the block diagram of the implemented control method. Using Figure 6 and considering selected state variables, it will be obtained the following descriptions for system state space:(9)x1•=if.i1.vcf.=−RfLf0−1Lf001L11Cf−1Cf0ifi1vcf+VdcLf00u+0−1L10vPCC.Hence, the following state vectors are given that by equation (13).(10)B1=VdcLf00,B2=0−1L10,A=−RfLf0−1Lf001L11Cf−1Cf0.In the following, it has been proposed that it could be obtained better results in predictive control, utilizing similarity transform in the state matrix and its modification. With this method, in addition to the fact that it has maintained system dynamics, we can use this similarity transform to evaluate all systems.


## 3.4. The Proposed Method

Figure6 depicts a block diagram of the implemented control method. In the model predictive control and state feedback controller, the chosen states of the system are compared with their reference quantities to generate the converter switching. It is easy to generate a reference for the output voltage vcf and current ic from power flow conditions. However, the same cannot be said about the reference for the if. To facilitate this, we define the new state vectors as follows:(11)xT=icfilvcf.Therefore, we will have the following conversion matrix:(12)x=1−10010001x1=Cpx1.The transformed state equations are obtained by combining equations (11) and (12) as follows:(13)x˙=CpACp−1x+CpBuc+CpCvpcc=Λx+Γ1uc+Γ2vPCC.The control rule is defined as follows:(14)uck=−Kx1k−xrefk.In the above equation,K is a gain matrix, and xref is the reference vector. The gain matrix can be obtained using the DE-MPC control method and the proposed switching method.The control rule of equation (13) includes switching control, which is discussed in detail below.Assuming complete control overu, a quadratic optimal linear steady state can be designed for this problem. As noted earlier, the control rule is as follows:(15)u=−Kx1k−xrefk.The control law discussed so far is for the system in which the DGs have an output inductor. Alternatively, when the DGs do not have an output inductance, the inductance L1 is removed and the output filter is a simple LC filter. The system state is then modified follows:(16)x2T=icf⋅vcf.With respect to Figure6, the reference for vcfv∗and given V∗ and Ø∗, the current phasor through the capacitor Cf is given by equation (14).(17)Icf∗=wCfV∗∠δ1∗+90.The referenceicf∗ is obtained from the instantaneous value of Icf∗. As we have seen, it is much easier to predict the reference values from the capacitor voltage (vcf) and then to predict its current (ic) than to predict the current if and δ1∗ is angle of V∗, respectively. It is evident in equation (11) that reference for all elements of the states is required for state feedback. Since V and δ are obtained from the droop equation, the references for the capacitor voltage and current are given by vcref=Vsinwt+δ and icref = V ѡ Cfsin(ѡt +δ +90).In the above equation,xrefk denotes reference vectors. The DE-MPC controller minimizes the following performance index:(18)j=∫0∞x−xrefTQx−xref+ρuTRudt.The index given in equation (18) must be minimized to obtain the optimal control rule, u, by solving the steady-state equation.In equation (18), the weighting matrix, Q, is a definite or semidefinite positive matrix, which is real and symmetric, while the penalty control matrix, R, is a definite positive matrix, which is real and symmetric. Moreover, ρ is a constant positive number. According to Bryson’s rule, the initial choice for R and Q matrices is possible in the form of diagonal matrices as follows:(19)Qii=1maximumacceptablevalueforzi2,i∈1,2,…,l,Rjj=1maximumacceptablevalueforuj2,j∈1,2,…,m.In the above equation,l is the number of control outputs and m is the number of inputs. Moreover, zi is called the controlled output, which is related to the signal we want to minimize in the shortest possible time. In this method, the output voltage is indirectly regulated by controlling the inductor’s current. The reason behind selecting the current instead of the voltage involves the presence of more ripples in the current, which increases the predictions in the proposed controller. In this way, more accurate data about the future can be predicted, increasing the robustness of the proposed controller.To do so, an optimal objective function is specified that determines the order of switching. The order of switching along the prediction horizon will be according to equation (20):(20)Uk=ukuk+1…uk+N−1T.In this equation, U is the optimal switching state whose first element, i.e.,u(k), which is applied to the circuit, while its other elements are applied in subsequent time steps.In this method, one of the control goals of the objective function involves reducing the difference between the current and its reference value according to equation (21):(21)iLerrk=iLrefk−iLK+1.In this way, the cost function can be expressed as equation (22):(22)jk=∑j=kk+N−1iLerrj|k.The optimal switching state is achieved by minimizing the cost function as follows:(23)U∗k=argminJk.The reason for using these arguments in the proposed equation is that it can better minimize the cost function. Optimal switching in equation (23) is performed using the iteration method. All possible switching states are defined for the controller along the N horizon, which is shown by Uk.Therefore, there will be 2N switching states. Matrices (20) and (21) are calculated for all the switching states, while the cost function equation (22) is also calculated.Finally, the switching state with the lowestj value is selected and applied to the switch.The existing differential approximation, i.e.,di/dt, can be considered as follows as a simple step-forward Euler equation:(24)diα,βdt≈iα,βk+1−iα,βkTs.In addition, by substituting equation (24) into (21), the future value of the load current vector is obtained as follows:(25)ik+1α,β=TsLvα,βk−iα,βkR−LTs.Equation (25) is used in the controller block for predicting the future current values based on the measured voltage vector. To select the voltage vector and control the current, the predicted current is evaluated using the following cost function:(26)gk+1=iα∗k+1−iαk+1+iβ∗k+1−iβk+1.In this equation,i ∗ α, β[k+1] is the estimate of the reference current vector in the next horizon. For grids with a sufficiently small sampling time, it can be assumed that this current is equal to its previous value, i.e., i ∗ α, β[k+1] i ∗ α, β[k]. However, for large sampling times, the future value of the reference current needs to be extrapolated. To make the values of the three-phase current vectors independent from each other, the voltage vectors can be first obtained from the values of the switching signals and the voltage of the DC link capacitors.(27)vaN=vc1S1a+vc2S2a+vc3S3a,vbN=vc1S1b+vc2S2b+vc3S3b,vcN=vc1S1c+vc2S2c+vc3S3c.The shared-mode voltage is obtained as follows:(28)vNO=vcm=vaN+vbN+vcN3.The cost function in the proposed algorithm is to minimize the voltage drop.The objective function that should be minimized is defined as follows:(29)F=∫0tsimt.∑Pi−Piss+Qi−Qissdt,i=L1,G1,1,L2,G2,2.In the above equation, P1ss, PL1ss, PG1ss, P2ss, Pl2ss, and PG2ss are the final (stable) values obtained for the active powers in Table 1. Moreover, Q1ss, QL1ss, QG1ss, Q2ss, QL2ss, and QG2ss are the final (stable) values of the reactive powers.Table 1
The numerical results of the joint load sharing by the distributed generation source by selecting optimal parameters using the LQR controller (employing the PSO method).
Active powerInitialIntermediate amount, MW(in the islanding mode)Final amountRecovery time (second)Amount (MW)(MW)(After reconnecting the grid)Figure7PL11.111.10.01PG10.88−0.150.880.02P10.221.150.220.02PL21.10.971.10.01PG20.55−0.30.550.02P20.551.270.550.02Figure8Voltage dropIn PCC2% in PCC1%2.7% 3.1%In fact, this objective function is defined in such a way that the values of the powers have the least deviation from the final values or the values of their steady states, while reaching this steady state in the shortest possible time. The model-based predictive control process algorithm for controlling the current in the selected system is as follows:(i)
Applying V[k];(ii)
V[k-1] =v[k];(iii)
Measuring currents ic, ia, and ib;(iv)
Calculating the current vector;Predicting the next horizon’s currenti[k + 1];Calculating the cost function gi;Is gi < gopt?Yes: gopt = gj, Iopt = Ij.No: Restart.


## 4. The Simulation Results

This section presents the optimal distribution of the joint load using the distributed generation source, which is separately simulated using the LQR and PID methods. This simulation was performed in MATLAB Simpower environment in the presence of two distributed generation sources. In addition, by optimally adjusting the parameters of each controller using the PSO algorithm, the reliability of the microgrid substation has increased. In the following, the proposed predictive control method, i.e., DE-MPC, is compared with PID controllers using PSO. Moreover, FS-MPC and DSVM-MPC are simulated using a single distributed generation source, and the results are compared with each other.Figure7 shows the simulated model of the system in MATLAB Simpower. Suppose that at time t = 0.5s, the impedance of the joint load is reduced by half of the initial value.Figure 7
The simulated model of the system in MATLABSimpower. Suppose that at timet = 0.5 (s), the impedance of the joint load is reduced by half of the initial value.In this section, the active power and voltage DGs are obtained in Figures8(a) and 8(b). In Figure 9 as can be seen from these figures and Table 1, in this case, after reconnecting the microgrid to the main grid, the power values rapidly reach their steady state; according to Figure 9, the fluctuation of power in PCC1 and PCC2 point voltage is reduced. In addition, to compare the performance of two methods, in Table 2, the numerical results of the PID controller using the PSO algorithm for two DGs are obtained, and in Figures 10 and 11 it that the active power dedication in DG-1 and DG-2.Table 2
The numerical results of joint power allocation by the distributed generation sources in the presence of a PID controller (using the PSO method).
Active powerInitialIntermediate amount, MW (in the islanding mode)Final amountRecovery time (second)Amount (MW)(MW)(After reconnecting the grid)Figure9PL11.111.10.01PG10.88−0.160.880.03P10.221.160.220.03PL21.10.981.10.01PG20.55−0.30.550.02P20.551.270.550.02Figure10Voltage dropIn PCC1%in PCC2%2.7%3.1%Figure 8
Dedication of active power in (a) DG-1 and (b) DG-2.
(a)(b)Figure 9
(a) PCC1 and (b) PCC2 point voltages (KV) (by selecting optimal values for R and Q parameters).
(a)(b)Figure 10
Dedication of active power in DG-1 and DG-2.
(a)(b)Figure 11
PCC1 and PCC2 (KV) point voltages (including the PID controller).
(a)(b)It can be illustrated the active power distribution with the PID controller and three-phase voltage waveform at the PCC1 point by PSO algorithm for one DG in Figures12 and 13 respectively. Furthermore, Table 3 presents the PID controller simulation results for one DG. In order to better compare the proposed method (DEMPC) by PID controller using PSO algorithm, the numerical results for one DG are evaluated.Figure 12
DG-1 active power distribution with the PID controller.Figure 13
Three-phase voltage at the PCC1 point.Table 3
The numerical results of the islanding mode in the presence of a PID controller (using the PSO method) and a distributed generation source.
Active powerInitial amount (MW)Intermediate amount (in the islanding mode) (MW)Final amount (MW)Recovery time (second) after reconnecting the grid (CB-1)Figure11PL10.70.640.70.03PG10.63−0.140.630.03P10.070.760.070.04Figure12Voltage dropVoltage range, KV(%) PPC1Initial amountIntermediate amount (in the islanding mode)2.5%54.89Figure14 shows the convergence diagram of the objective function. In this case, in order to compare the proposed method with DSVM-MPC, the convergence diagram of DE-MPC is first simulated using 100 iterations. It shows the convergence diagram of the objective function. According to the convergence diagram, it can be concluded that the diagram of the proposed controller cost function is lower than the DSVM method. In terms of economy, the better performance can be seen than the other controllers studied. The reasons for choosing PSO include simplicity in implementation and a successful track record in these works. It should be noted that the effectiveness of an algorithm largely depends on the type and structure of the problem, but the fact that PSO has been successfully used in a wide range of scientific fields shows its good potential for solving optimization problems. Hence, one of the main weaknesses of previous methods is convergence to local optimums and the lack of a robust global search. As the formulations of classic PSO indicate, the best approach to increase the efficiency of this algorithm is to adjust the coefficients so as to improve its local and global searches. In the improved algorithm, the inertia weight (wmin = 0.4, wmax = 0.9) and the acceleration coefficients and population number (c1 = 0.2 and c2 = 2.3, population = 50) are obtained by the parameters mentioned [16, 30].Figure 14
The convergence diagrams of DE-MPC and DSVM-MPC.The simulations results demonstrated the good performance of best so far quantities’ optimization with the proposed algorithm in solving the model predictive control cost function. The notable features of the developed algorithm include fast convergence and the progress of search based on the rotational motion of the system during optimization.In Figure15, the active power distribution is calculated for one DG in the presence of the proposed controller. Furthermore, this method can be a suitable alternative for the mentioned controllers. Figure 15 shows the actual power allocation, and Figure 16 shows the PCCI voltage point with the DE-MPC controller. Table 3 presents the numerical results obtained from these diagrams.Figure 15
The active power distribution of DG-1 using the DE-MPC controller with state feedback.Figure 16
The three-phase voltage at the PCCI point using the DE-MPC controller with state feedback.According to Figures15 and 16, the information presented in Table 3, it can be observed that in the presence of the DE-MPC controller, the transient response of the system is significantly improved, and after connecting the grid, the power distribution returns to its original state even in less time compared to PID and PSO. In addition, for noncomplex model predictive control to define optimization functions and solve them, the constrained linear functions such as fminprog and nonlinear constrained functions such as fmincon can be used in the MATLAB software. Also, if the problem is unconstrained by linear functions, the fminsearch function is used.Comparing the results in Table3 and Table 4 with the results of the power allocation in the islanding mode using the proposed DE-MPC controller, it can be seen that when using the DE-MPC controller, the transient response of the system is greatly improved, and after reconnecting the microgrid to the main power grid (in less than 1 second), the power distribution rapidly reaches its steady state, and there will be no power fluctuations.Table 4
The numerical results for the islanding mode in the presence of the proposed DE-MPC controller.
Active powerInitial amount (MW)Intermediate amount (in the islanding mode) (MW)Final amount (MW)Recovery time (second) after reconnecting the grid (CB-1)Figure14PL10.70.680.70.02PG10.63−0.120.630.02P10.070.710.070.03Voltage dropVoltage range, KV(%) PPC1Initial amountIntermediate amount (in the islanding mode)Proposed DE-MPC Figure152.1%54.89FS-MPC2.7%54.85DSVM-MPC2.5%54.87PL1 curveOV%Rise timeSettling timePID3%0.08s0.25sProposed DE-MPC00.05s0.1 s


## 5. Conclusions

In this study, a distributed model predictive controller was proposed. A comparison of the results obtained in Tables3 and 4 revealed that the proposed distributed economic model predictive controller significantly improves the transient response of the system and the power quality of the grid compared to the LQR, PID, FS-MPC, and DVSM-MPC methods. It is noteworthy that the proposed DE-MPC controller has a better performance than other controllers in terms of balancing and stabilizing the microgrid when it is connected to the main grid. By changing the predictive control rule and replacing the current with the voltage, more data are provided than in the previous case. Therefore, in this way, a large volume of data becomes available for the proposed predictive horizon. In addition, this study proposes a novel PCC voltage compensation method for islanded microgrids by improving the power-sharing control schemes among the DGs to compensate for the PCC voltage deviation caused by the droop control and the state feedback controller. A smooth transfer between the islanding mode and grid connection mode assure a stable operation of the system. The model predictive control efficacy is checked in the case of the LCL filter. The application is mainly aimed at the rural area where the unbalanced load is common and wireless communication is always desirable due to large network size. However, load sharing can be made more accurate by incorporating the line impedance values in the power reference calculation. By switching the control action of the DGs from state feedback control in grid connection mode to voltage control in islanding modes, a seamless transfer is achieved. A step-by-step matrix transformation control method is proposed for a smooth transition during islanding and resynchronization. It must be mentioned that the proposed distributed economic model predictive controller has more successfully performed in creating balance and stability in the microgrid in the grid connection mode. In addition, this study proposes a novel PCC voltage compensation method for islanded microgrids by improving the power-sharing control schemes among the DGs to compensate for the PCC voltage deviation caused by the state feedback controller. It has changed the inductor and capacitor in Figure 6 section for 2%, its results are evaluated, and it is noticed that this system has good robustness against potential changes. Hence, the following state transform matrix is considered for this system, and better results in terms of overshoot, rise time, settling time, and steady state have been obtained with this method. As a result, the recovery time for reswitching from the island mode to the connection mode of the distributed generation sources is reduced. Some areas for future work are the state feedback control strategy scheme that can be modified to share power in microgrid with inertial and noninertial DG. Improvement in supplementary droop control for enhanced system damping under weak operating conditions and protection of back-to-back converters in case of a fault in utility or microgrid faults can be investigated.



---

*Source: 5423532-2022-03-18.xml*