A discrete optimal control model for the distributed energy system considering multiple disturbance inputs

Distributed energy systems with the characteristics of ﬂexible scheduling, high reliability, and high efﬁciency have been widely studied because it can absorb abundant renewable energy and solve long-distance energy transmission loss. Wind power, photovoltaic power, and user load power have obvious intermittently and volatility, which brings difﬁculties to the dispatching and control of distributed energy systems. This work focuses on the optimal control problem of a distributed energy system considering multiple disturbance inputs. A discrete system model suitable for developing optimal control is established and solved by minimizing performance function in the process of iterating disturbance inputs and its function vector. Based on the optimal control results, a method for stabilizing the output power is designed to consider operating cost and loss. The effectiveness of the proposed method is veriﬁed by different disturbance inputs and compared with the classical optimization algorithm. The results indicate that the optimal control model can effectively suppress disturbance inﬂuences and obtain a fast and satisfactory control effect. The output stabilization method can save operating costs and reduce equipment loss. Compared with the optimization algorithm, the proposed method is more stable and reliable. This work provides a new insight into multi-disturbance suppression of the distributed energy systems.


INTRODUCTION
The distributed energy systems are composed of distributed generation, energy storage, energy conversion, and local loads [1]. Compared with the centralized energy systems, the distributed energy systems overcome the difficulties of renewable energy consumption, long-distance transmission, and higher loss [2,3], which are beneficial supplement of the centralized energy systems. As one of the effective ways to absorb renewable energy, distributed energy systems can alleviate energy crises and protect environment [4]. It can operate independently or interact with a main power grid [5]. Because of its safety, This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited. © 2021 The Authors. IET Generation, Transmission & Distribution published by John Wiley & Sons Ltd on behalf of The Institution of Engineering and Technology reliability, higher energy utilization rate, and environmental friendliness, the distributed energy systems have become a hot topic in the energy field. The introduction of micro power generation equipment, renewable energy, and energy storage devices in a distributed energy system increases the flexibility of energy allocation, meanwhile, it also increases the difficulty of energy management and power control. Therefore, the realization of the optimal power distribution among various distributed energy sources has a pivotal role in the development process of the distributed energy systems.
In recent years, the distributed energy systems have received considerable critical attention because of their remarkable advantages. A distributed energy system involves a variety of energy types, operating modes, control strategies, and controllable variables. Appropriate and effective multi-source coordinated control is the key to achieve stable, reliable, and efficient operation [6,7]. The control types of distributed energy systems include the island control [8] and the interactive control with a main power grid [9], usually including centralized control, decentralized control, distributed control, hardware in the loop test etc. The centralized control usually optimizes the exchange power between the locally distributed generators and the main power grid to realize the optimal control [10,11]. It is an early control mode suitable for traditional energy systems, such as a main power grid. However, in a distributed energy system, traditional centralized control is difficult to achieve the optimal operating states for different energy equipment at the same time [12,13]. However, the strong coordination mechanism between the distributed energy sources causes that the simple decentralized control methods cannot meet the actual demands [14]. Distributed control means that each energy equipment is controlled independently according to its local information [15], it mainly includes hierarchical control and distributed cooperative control. Hierarchical control includes primary control layer realizing distributed energy self-control, secondary control layer focusing on distributed system dynamic operation control, and optimization management layer realizing energy management control [16,17]. Distributed cooperative control takes into account the advantages of traditional centralized control and decentralized control. Based on the local interaction information, it promotes global information sharing and realizes global optimization of control decision-making [18]. It has been widely concerned and deeply studied due to good real-time, flexibility, and reliability. Xu et al. proposed a distributed consistent information exchange method to obtain the global system information and to achieve reasonable load distribution [19]. Zhang et al. built an energy management strategy based on the marginal cost distributed consistency to realize the economic operation [20].
At present, the distributed control is widely used in the distributed energy systems. The distributed control is reliable, but it is complex and costly, so it is difficult to build an accurate control model for a complex system [21,22]. In particular, the main obstacle is to establish an accurate control model for the distributed energy systems with intermittent and fluctuating inputs, such as wind power and photovoltaic power. Therefore, it is difficult to obtain a better control effect on the distributed energy systems with multi disturbance inputs. There are usually two categories of disturbances in the distributed energy systems, namely the renewable energy fluctuations and user load uncertainty. There is too little work devoting to consider these two categories of disturbance inputs in the existing control methods. This work focuses on the optimization control of a distributed energy system containing multiple disturbance inputs.
Optimal control is a commonly used method to achieve the optimal operating state for a target system [23]. It is essential to seek an optimal control law based on the model or state equations by transferring from the initial state to the terminal state and minimizing the performance index [24]. Based on the operation mechanism of a target system, the system model or state equations can be established, in which the disturbance variables can be regarded as the disturbance inputs. It can solve the disturbance problem of the target system to a certain extent. Moreover, for larger disturbance contained in the target system, the optimal control model with error tracking feedback can also suppress disturbance effectively [25]. Therefore, the optimal control may be a solution to the operation control of a distributed energy system with multiple disturbance inputs. In recent years, the energy allocation based on the optimal control theory has also been studied, the most typical technique is the realization of optimal control based on the dynamic programming method [26,27], but it needs to deal with complex numerical operations, which easily leads to the difficulty of solving the optimization problems. In order to realize the optimal control, it needs to establish the system model or state equations, performance function, and solution method.
There are mainly two methods establishing the distributed energy system model. One is mechanism modelling with continuous time according to the energy conservation equation and the characteristics of energy equipment. For the complex distributed energy systems, the mechanism model with continuous time has higher nonlinearity and is difficult to be transformed into a state-space model to develop the optimal control [28]. Saha et al. analysed the load tracking behaviour of distributed micro gas turbine and simulated different load conditions under the islanding mode and grid-connected mode [29]. Huang et al. adopted the stepwise decomposition modelling method, combined with different energy conversion technologies, and established a distributed energy system model with multi-energy complementary [30]. The other is data-driven modelling based on the historical data. It can effectively reflect the operation states of distributed energy systems, but it requires a lot of highquality operation data [31]. Zou et al. proposed a data-driven modelling method combining the current and prediction performance to improve energy efficiency [32]. Han et al. proposed an energy management model of a power grid-connected microenergy system based on the data-driven method to achieve optimal scheduling and minimum system management cost [33]. The data-driven model is difficult to deal with the simulation and prediction of distributed energy systems with variable conditions, which may lead to larger errors. For distributed energy systems containing renewable energy, the data-driven model is more difficult to obtain a better application effect. Therefore, a discrete state-space model is established based on the system mechanism and the output power relationship in adjacent scheduling periods. The model is simple in form, but it can directly reflect the output power changes between distributed energy sources, which helps develop the optimal control. Moreover, the linearized model only needs to collect the system information at the discrete time, it reduces the computational burden and is suitable for online optimal control under different operation conditions.
The variational method, minimum principle, and dynamic programming are usually used to solve a continuous optimal control model without the disturbance inputs [34,35], while the iterative method is usually used for a discrete optimal control system. In most optimal control studies, the control systems usually subject to a large number of deterministic or stochastic disturbances. For the control system with disturbance inputs, it is usually necessary to pre-process disturbance, such as using the Kalman filter to estimate disturbance [36,37]. In this paper, multiple disturbance inputs of the distributed energy system, such as wind power, photovoltaic power, and random fluctuation of user load power, are considered, which greatly increases the difficulty of solving the optimal control model. If each disturbance is estimated in advance, on the one hand, it will increase the calculation complexity of the optimal control model, reduce the model efficiency and control accuracy. On the other hand, it is difficult to support online optimal control for distributed energy systems. Therefore, this paper proposes a solution method for the optimal control model of a distributed energy system with multiple disturbance inputs based on the state-space model and optimal control theory. The optimal control law is constructed by minimizing the performance function to complete the optimal control. The day-ahead scheduling planning power is selected as a reference input of the optimal control model.
The main contributions of this work are as follows: A discrete state-space model suitable for developing optimal control of distributed energy systems with multiple disturbance inputs is established. The accurate and fast iterative solution algorithm for the optimal control model is deduced, and the optimal control method of distributed energy systems is proposed, which solves the optimal power planning and allocation problem of distributed energy systems with multiple disturbance inputs. A method to stabilize the output power of distributed energy equipment is designed based on the optimal control results. The superiority of the proposed method is verified by using different disturbance inputs.
The paper is arranged as follows. The linearized state-space model with disturbance inputs is established, and system constraints are described in Section 2. In Section 3, the optimal control algorithm for the above model and output stabilization method are designed in detail. The correctness and effectiveness of the proposed method are verified by three kinds of disturbance inputs in Section 4. The main conclusions are summarized in Section 5.

System modelling
Distributed energy systems containing renewable energy sources have been widely concerned in recent years due to the accessing and scheduling flexibility. The typical distributed energy system including micro gas turbine (MGT), fuel cell (FC), battery, wind power, photovoltaic (PV) power and user loads is shown in Figure 1.
In Figure 1, P MGT represents the output power of micro gas turbine, P FC represents the output power of fuel cell, and The layout of the distributed energy system P bat represents the charging or discharging power of battery. The negative P bat indicates that the distributed energy system is charging the battery, and the positive P bat indicates that the battery is discharging to the system. The remaining capacity of battery is S B , the output power of wind turbine is P wind , the output power of photovoltaic generator is P PV , and the power demand of users is P load . The distributed energy system is interconnected with the main power grid through the point of common coupling (PCC) to purchase or sell electricity. The interactive power is P PCC . The distributed energy system should maintain a power balance in each scheduling period, and the corresponding balance equation can be expressed as P MGT + P FC + P wind + P PV + P bat + P PCC = P load (1) In the process of optimization and scheduling, the system state in the next scheduling period is closely related to that in the previous scheduling period, which is essentially an iterative process in accordance with the time flow direction. Therefore, this paper intends to establish a discrete state-space model that is more in line with the actual operating and scheduling of a distributed energy system.
The micro gas turbine power, fuel cell power, battery power, battery capacity, and interaction power are selected as the state variables of the distributed energy system, then the state variable x(k) at kth scheduling period is expressed as In the distributed energy system shown in Figure 1, the distributed generation units are mainly adopted to meet the power demands of users, and the output power of the current scheduling period should be planned according to the output power of the previous scheduling period. Hence, the increments of micro gas turbine power, fuel cell power, and battery charging or discharging power are selected as the control variables to adjust the system state. The control variable u(k) at the kth scheduling period can be expressed as Generally, the user load power, wind power, and photovoltaic power are greatly affected by user behaviours or external environment, leading to larger uncertainties for the distributed energy system. If they are considered as the state variables, it is difficult to realize the optimal operation and scheduling. The increments of these variables with larger uncertainties are taken as the disturbance inputs of the distributed energy system. The disturbance input w(k) is written as The optimal state of a distributed energy system subjected to multiple disturbance inputs can be obtained by controlling the micro gas turbine power, fuel cell power, and battery power at the kth scheduling period. Thereafter, the optimal output y(k) is determined, as shown in Equation (5).
According to Equations (2)-(5), the discrete state-space model of a distributed energy system with multiple disturbance inputs can be established, as shown in Equation (6).
where A is a coefficient matrix, B is an input matrix, B W is a disturbance matrix, and C is an output matrix. Equation (6) describes the relationship between the system inputs, operating states, and system outputs. According to the power conservation, the specific form of each matrix can be obtained as follows, In the coefficient matrix A, the E bat denotes the battery total capacity, and σ denotes the battery self-discharge rate. Δt denotes the time interval between kth and (k+1)th scheduling period, namely, scheduling period.
The optimal control of distributed energy systems based on the discrete state-space model shown in Equation (6) is essentially the optimal output power planning and allocation for each energy equipment in the scheduling period Δt , which belongs to the category of coordinated control of multiple energy equipment. System dynamics should be reflected by the system operating characteristics after the optimal output power is configured for each energy equipment. For the control of voltage deviation, voltage flicker, and active power curtailments of renewables [38], it is necessary to design a local control strategy separately for each energy equipment or use the control system of energy equipment itself.
Based on the above analyses, the actual outputs y(k), such as interactive power P PCC and battery power P bat , can be obtained by iterating Equation (6) using wind power, photovoltaic power, and user load power as the disturbance inputs. To make the fluctuations of wind power, photovoltaic power, and user load power have little influence on the system state, it is necessary to force the actual output to track the expected outputȳ(k). Hence, the objective function of the optimal control model is established as Equation (7), it is designed according to the actual operation optimization requirements of the distributed energy system.
where Q N denotes the terminal error weighting matrix, it is a positive semidefinite constant matrix. Q denotes the error variable weighting matrix, it is an asymmetric positive semidefinite matrix. R denotes the control variable weighting matrix, it is an asymmetric positive definite matrix. The objective function J is used to evaluate the solution process of discrete state-space model of the distributed energy system, and the optimal output power of micro gas turbine, fuel cell, and battery can be obtained by minimizing it. Based on the results of the optimal control model, the output stability method is used to evaluate the system operating cost to further attain the most economical output power of distributed generation units. Since the operating cost of a distributed energy system is related to the operating losses of the energy equipment, which cannot be quantified in real-time, moreover, the operating cost is related to the piecewise electricity purchase price. If the operating cost is considered in the objective function of the optimal control model, the complexity of objective function will be greatly increased, resulting in the difficulty in solving the optimal control model. Therefore, the operating cost is not considered in Equation (7).

System constraints
For the distributed energy system shown in Figure 1, the power balance is the most basic energy constraint, such as Equation (1). The interactive power with the main power grid is regarded as the tracking power, therefore, the power constraint of P PCC is not considered in the control process. The power constraints of other energy equipment satisfy Equation (8), including the micro gas turbine, fuel cell, battery, wind power, and photovoltaic power.
where, P i denotes the output power of equipment i, P min,i, and P max,i denote the upper and lower limits of power, respectively. When the battery is charged or discharged, the remaining capacity S B in the kth scheduling period satisfies Equations (9)-(11) [39].
where, P bat,c,k is the charging power, and P bat,d,k is the discharging power at the kth scheduling period. η 1 is the charging efficiency, η 2 is the discharging efficiency, P max,c is the maximum charging power, and P max,d is the maximum discharging power.

Optimal control method
For the discrete state-space model with multiple inputs and outputs given in Equation (6), it is difficult to obtain an exact analytical solution by using the optimal control theory. To realize the optimal control of a distributed energy system with multiple disturbance inputs, an iterative solution method is derived in this section. For Equation (6), the input w(k) composed of user load power, wind power, and photovoltaic power can be regarded as the system disturbances. Supposing that the reference input of a distributed energy system isȳ(k), which can be described as: where, z ∈ R n ,ȳ ∈ R m . F and H are constant matrices. The tracking error e(k) of the optimal control can be defined by the reference inputȳ(k) and actual output y(k), as shown in Equation (7). The purpose of optimal control is to find the optimal control law u * (k) to minimize performance index J (Equation (7)). By substituting Equation (6) and Equation (12) into Equation (7), we can get the following equation.
According to the optimal control theory of the discrete system and performance index (Equation (13)), the optimal control law can be expressed as where λ(k+1) is a solution to the two-point boundary value problem, which satisfies Equation (15).
where a 0 is the initial state. Equation (15) still contains the leading term λ(k+1), which is difficult to know in advance in the practical applications, so it is also difficult to obtain the exact analytical solution of Equation (15). We will use the successive iteration method to solve the two-point boundary value problem in Equation (15) to obtain the optimal control law.
The λ(k) is related to the state variable x(k), reference input z(k) and disturbance input w(k), it can be expressed as The g(k) is a function of w(k). Comparing Equation (16) (15), we can get Equation (17), which provides the terminal values of iterative solution process.
P 1 (k) is the unique positive semidefinite solution to the discrete Riccati equation.
Because of P 1 (k) and P 2 (k) are the unique solution of Equations (20) and (21). Therefore, the discrete optimal control of the distributed energy system determined by Equations (6) and (7) has a unique optimal control law u * (k). Substituting λ(k+1) determined by Equation (18) into Equation (14), the optimal control law is obtained as follows, By substituting Equation (23) into Equation (15), we can get the following results, According to Equation (24), the difference equation of state variable x(k) is constructed, as shown in Equation (25).
According to Equation (22), the difference equation of function g(k) is constructed, which is as follows, Through the derivation of the iterative solution process of a discrete optimal control model with multiple disturbance inputs, it can be found that the optimal control law u [j] (k) calculated in the j-th iteration is jointly determined by x [j] (k), z(k), w [j-1] (k) and g [j-1] (k+1).

3.1.1
The discrete optimal control algorithm for a distributed energy system with multiple disturbance inputs I. The reference inputȳ(k) is obtained from Equation (12), and P 1 (k) and P 2 (k) are calculated according to Equations (20) and (21). Letting the initial value j = 1, and giving the convergence error σ > 0 of the performance index J (Equation (7)). II. x [ j ] (k) is calculated according to Equation (25 (6) to obtain the closed-loop control system: (k) and J [ j ] according to Equation (7).
If so, outputting the optimal control law u [ j ] (k), otherwise continue to the next step. VI. VI. w [ j ] (k) is the disturbance inputs, it is updated according to Equation (28) in the iterative process.
The block diagram of optimal control for the distributed energy system considering multiple disturbance inputs VII. Substituting w [ j ] (k) into Equation (27) to calculate g [ j ] (k), and letting j = j+1, return to step (II) to continue the next iteration calculation.
The corresponding discrete optimal control algorithm flow of a distributed energy system with multiple disturbance inputs is shown in Figure 2. In the process of iterative solution, the constraint conditions (Equations (8)- (11)) are considered to ensure that the distributed energy equipment operates within the normal power range.

Output stabilization method
The optimized results obtained by the optimal control method still have large fluctuations, which means that the operating conditions of energy equipment change frequently, it will greatly increase the operating loss and reduce the service life. Therefore, a method of stabilizing output power is designed based on the optimized results to make the distributed energy equipment operate smoothly for a long time and improve the service life.
For an optimized output power sequence β(k), assuming that the sequence β(k) can be divided into M segments, the mean value of each segment can be calculated as Mean(α). To obtain a reasonable smoothing result, the threshold value δ is set to determine the smoothing method adopted to process each segment. If the difference between the maximum value and mean value in each segment is less than the threshold value δ, all data points in the segment are replaced by the mean value, otherwise, the data in the segment is replaced by the slash of the first and last data points. The pseudo-code of the output stabilization method is as follows.

3.2.1
Output stabilization method of the distributed generation a. Calculating the mean value for each segment: Obtaining new output power sequence β*(k). d. Obtaining new output power of the energy storage equipment according to the power balance constraint of a distributed energy system.
Where L denotes the length of each segment, M is the total number of segments that need to be smoothed. Length(⋅) denotes the length of sequence β(k), Round(⋅) denotes rounding down.
Step (a) shows that not all data points can be smoothed. For data points that cannot be smoothed, the original data is still retained. According to the power balance constraint of a distributed energy system, the energy storage equipment is used to balance the increase or decrease of power in each scheduling period caused by the output stabilization method. The parameters L and δ determine the above output stabilization process. The cost function of the distributed energy system is introduced to evaluate the performance of the output stabilization process. The cost function is defined as follows [40], where, C MGT and C FC represent the burnup costs of the micro gas turbine and fuel cell, C M,i denotes the maintenance cost, where i denotes the i-th energy equipment, and D is the total number of distributed energy equipment. C PCC represents the cost of purchasing electricity from the main power grid. T represents the total scheduling period. When the operating cost of the distributed energy system after output stabilization is less than that before output stabilization operation, the output stabilization method is feasible.

CASE STUDY
To verify the discrete state-space model established in Section 2, the proposed iterative solution algorithm for the optimal The effect of tracking PCC power by the proposed optimal control method under different iterations control model, and the designed output stabilization method, this work takes a distributed energy system shown in Figure 1 as an object, which has three disturbance inputs, including user load power, wind power, and photovoltaic power, and three controllable power generation devices, liking micro gas turbine, fuel cell, and battery. The distributed energy system interacts with the main power grid to purchase or sell electricity. The power range of the micro gas turbine is [0-85 kW] and that of the fuel cell is [0-50 kW]. The battery has charging and discharging functions, its power range is [−30-30 kW]. The total capacity of battery is 240 kW⋅h, and the initial state of charge is 0.5, which is sufficient to meet the subsequent charging and discharging requirements. In this section, we select the interactive power P PCC and battery power P bat as the reference inputs of the optimal control model. Through the iterative solution and reference tracking, we can obtain the optimal outputs of the micro gas turbine, fuel cell, and battery in different scheduling periods within 24 h. The scheduling period Δt is 30 minutes, it is determined by the actual scheduling time interval of energy equipment in the distributed energy system. It can also be set to a smaller time interval, at least at the minute level, but requires frequent regulation of operating conditions. During the implementation of the optimal control model, the relevant parameters are set as follows: the self-discharge rate of battery is set to 0.05, the convergence error σ of performance index J is set to

Verification of the optimal control model
The proposed optimal control algorithm is an iterative solution process. The day-ahead dispatching plans of the interactive power P PCC and battery power P bat are used as the reference inputs. In Figure 3, the actual output and the reference input are compared under different iterations for the interactive power P PCC . For the initial iteration (j = 1), the actual output deviates  completely from the reference input, and the tracking effect is not achieved. With the increase of iterations, the optimal control model output can quickly track the reference input. When j = 4, the actual output coincides with the reference input, which shows that the better tracking effect is reached. The relative error of performance index J is 2.83×10 -6 , which satisfies the convergence error σ. Furthermore, the simulation experiments carried out on the personal computer with i5 processor, 8 GB RAM, and 2.81 GHz show that the time taken to complete the optimal control is 0.052 s when the initial states and disturbance inputs are given, which fully meets the control requirements of distributed energy systems. Table 1 shows the computation time of the discrete optimal control model and the number of iterations. When the number of iterations increases exponentially, the computation time increases correspondingly, but the increased degree is small. In addition, the discrete optimal control model mainly realizes the solution of the optimal output states of distributed energy equipment in the scheduling period ∆t. When the optimal output states are allocated to each energy equipment, the controller equipped with itself performs the corresponding control operation. Therefore, the time delay caused by the iterative calculation will not affect the control effect of the system. The computation time is far less than the scheduling period (Δt = 30 min), which will not lead to system control maloperation. The convergence errors under different iterations are given in Table 2. The optimal control model can achieve fast convergence and has a good tracking effect. Generally, the user load power, wind power, and photovoltaic power exist great volatility due to the changing external environment. To prove that the optimal control method can achieve good control performance under different disturbance inputs, and guide the micro gas turbine, fuel cell, and battery to reach the optimal states, three disturbance inputs are simulated to verify the proposed method, as shown in Figure 4. Original measured data of the user load power, wind power, and photovoltaic power is marked as Condition 1, which are relatively smooth disturbance inputs. The random values with 3 amplitudes, 0 mean, and 1 variance are added to the original measured data to formed Condition 2. Compared with Condition 1, Condition 2 has obvious volatility. Condition 3 is constructed by added random values with 5 amplitudes, 0 mean, and 1 variance to original measured data. Compared with Condition 1 and Condition 2, Condition 3 has greater volatility. The stochastic process with larger amplitude is considered to simulate the fluctuations of renewable energy sources in the scheduling period Δt to  verify the control performance of the proposed optimal control method under the changing wind speed and light field. The performance analyses and verification of the optimal control model will be performed under the three disturbance inputs shown in Figure 4.
The iterative process of the optimal control model is determined according to the error between actual output and reference input. Figure 5 shows the tracking effect of the optimal control model under three kinds of disturbance inputs. Herein, the reference inputs refer to the day-ahead dispatching planning curves. Condition 1 represents the measured disturbance inputs in a typical day. The actual outputs of the optimal control model almost completely coincide with the reference inputs, which indicates that the optimal control model has a good tracking effect under Condition 1. Because Conditions 2 and 3 have certain random fluctuations, the actual outputs fluctuate slightly in some scheduling periods. The proposed optimal control method can track the reference inputs well under larger disturbance inputs indicating that it has good robustness. Figures 6-8 show the optimal output power of each energy equipment in different scheduling periods based on the proposed optimal control model, in which wind power, photovoltaic power, and user load power are disturbance inputs, micro gas turbine, fuel cell, and battery are controllable generation equipment, and the interactive power is obtained by referring day-ahead planning power. Compared with Figure 6, the disturbance inputs in Figures 7 and 8 have obvious fluctuations, but the output power of the micro gas turbine, fuel cell, and battery obtained by the optimal control model is the same, which shows that the proposed method can still reach the optimal operating state under the existences of external interference factors such as user behaviour, weather, and measurement uncertainty. Taking the output power of the micro gas turbine as an example, the average relative errors of the optimal control results under Condition 2 and Condition 3 are 3.06% and 3.83% compared with the optimal control result under Condition 1.

Applications of output stabilization method
Although the optimal control model and iterative optimization algorithm can obtain the optimal outputs of distributed generation equipment in different scheduling periods, there are still Comparisons of output stabilization effects of MGT output power obtained by the optimal control model differences between adjacent optimal outputs, and the optimal output power curve within 24-h has the large fluctuation. For the micro gas turbine, fuel cell and battery, the fluctuation of output power leads to the frequent adjustment of operating conditions, which has a great impact on the operating loss and service life of the distributed generation equipment.
In Section 3.2, we designed an output stabilization method considering the operating cost to ensure the stable operation of distributed energy equipment for a long time. Figure 9 analyses the smoothing results of the optimal control output power for different L. When L = 1, the smoothing result coincides with the original optimal control result. With the increase of L, the time for energy equipment to maintain stable operation increases, and the effect of the proposed method is gradually obvious. When L is large enough, such as L = 12, the smoothing result will deviate from the changing trend of the optimal control output results. For this case, the charging and discharging burden of battery will be increased significantly. Therefore, it is necessary to decide a suitable L for smoothing the optimal control outputs by using the designed output stabilization method.
The parameters L and δ are the key elements of the designed output stabilization method, which determine the time and smoothing effect of the stable outputs. The operating cost function expressed by Equation (29) is used to select appropriate parameters L and δ. Table 3 lists the burnup and maintenance costs, and Table 4 lists the electricity prices during peak, valley, and general times.
Tables 5 and 6 compare the operating costs under different parameters L and δ when Condition 1 is taken as the disturbance inputs. The results show that L and δ have little influence on the operating costs of the distributed energy system because the output stabilization method is equivalent to shifting peak and filling valley for the original optimal control results. The battery is used to compensate for the increase or decrease of the output power of micro gas turbine and fuel cell. Although the  output stabilization method saves a small amount of operating cost in 24-h scheduling time, it will be considerable benefits for the long-term running of the distributed energy system. It is important that after the output stabilization treatment, the distributed energy equipment can maintain a stable output power for a long time, which greatly avoids frequent changes of the operating state, reduces the equipment operating loss in the long-term operation process, reduces the maintenance cost, and extends the service life. From this point of view, the output stabilization method improves the operation economy of a distributed energy system. Figures 10-12 display the output power of the micro gas turbine, fuel cell, and battery obtained by the optimal control method and the designed output stabilization method under three kinds of disturbance inputs. For the three disturbance inputs, the L is 10, 9, and 10, respectively, and the threshold δ is 10. The original optimization results of the micro gas turbine and fuel cell have obvious fluctuation characteristics. After processing by the output stabilization method, the micro gas turbine and fuel cell can maintain stable operation for a long time. The increased or decreased output power of the micro gas turbine and fuel cell is compensated by the battery through charging or discharging to maintain user load demands. The proposed output stabilization method can improve the economy of a distributed energy system in long-term operation.

Comparison with APSO algorithm
To illustrate the advantages of the proposed optimal control method in the optimal output power planning of distributed energy systems, the adaptive particle swarm optimization (APSO) algorithm [41] is used to optimize the outputs of the micro gas turbine, fuel cell, and battery. Equations (1) and (8)- (11) are considered as the optimization constraints. The cost function described in Equation (29) is taken as the objective function. In the APSO, the learning factors are 2, the maximum and minimum inertia weights are 0.8 and 0.5, the maximum iterations are 100 and the population number is 40. Figure 13 shows the optimal results obtained by the optimal control (OC) and APSO under three disturbance inputs. The proposed optimal control method has good stability and robustness for larger disturbance inputs. However, the results optimized by the APSO algorithm have larger oscillations, which are not suitable for the operating control of distributed energy systems. The fluctuations for Condition 1 are smaller, and for Condition 3 are larger. The standard deviations of the optimized results are listed in Table 7. Fewer constraints for the optimization variables and the random initial values for the population in each iteration of the APSO algorithm result in larger fluctuations of optimization results. Moreover, the larger the input disturbance, the greater the difference between the standard deviation of optimal control and that of APSO algorithm. The optimal control method has a better control effect under larger input disturbance. Compared with APSO, the standard deviation of optimal control results can be reduced by 29.9%.

CONCLUSION
Distributed energy systems with the characteristics of safety, reliability, efficiency, and environmental friendliness are a useful supplement to traditional energy systems. It is one of the effective ways to absorb abundant renewable energy such as wind power and photovoltaic power. However, wind power, photovoltaic power, and user load power are greatly affected by the external factors to form the outputs with intermittence and randomness, which further increase the difficulty of scheduling and control of distributed energy systems. To solve the control problem of a distributed energy system with multiple disturbance inputs, this paper developed a multiple disturbance suppression method based on the optimal control theory. The main conclusions are summarized as follows: 1. Based on the operating mechanism and scheduling mode of distributed energy systems, a discrete system model containing multiple disturbance inputs and multiple outputs is established for the optimal control of a distributed energy system, and an accurate and fast optimal control algorithm is designed to plan and allocate the optimal operating power of the distributed energy equipment. 2. For different disturbance inputs, the proposed optimal control method can deal with the input interferences well and obtain the optimal power. Compared with the optimal control results obtained under Condition 1, the relative errors of optimal control results are only 3.06% and 3.83% for Condition 2 and Condition 3. The effect of suppressing multiple disturbance inputs is satisfactory. 3. The optimal control method based on the discrete model can achieve disturbance suppression and coordinated control of multiple energy equipment, increase the renewable energy consumption rate, reduce the operating loss of energy equipment, and improve the system economy. Excellent robustness and fast computing speed can support the optimal operation state planning and power allocation of distributed energy systems.