Optimized Control of Variable Speed Hydropower for Provision of Fast Frequency Reserves

This paper deals with the design of controllers for variable speed hydropower (VSHP) plants with the objective of optimize the plants' performance. The control objectives imply enabling fast responses to frequency deviations while keeping the electric and hydraulic variables within their constraints. A model predictive controller (MPC) was developed to coordinate the turbine controller with the virtual synchronous generator (VSG) control of the power electronics converter. The simulation results show that the VSG is able to deliver fast power responses by utilizing the rotational energy of the turbine and the generator. The MPC controls the guide vane opening of the turbine to regain the nominal turbine rotational speed. If this is not possible due to the constraints of the hydraulic system, the MPC adjusts the power output of the VSHP by changing the VSG power reference. The proposed control system allows the VSHP to provide fast frequency reserves (FFR).


I. INTRODUCTION
Variable speed operation of hydropower plants is currently being investigated, and is motivated by several factors. One key factor is the potential for providing ancillary services, such as fast frequency reserves (FFR). More renewables like wind and solar energy increase the need for flexible production and loads to balance the grid and maintain the power system security. Variable speed hydropower (VSHP) may provide this flexibility with virtual inertia (VI) control by utilizing the rotational energy of the turbine and the generator, both in production and in pumping mode. Challenges and opportunities for VSHP are further explained in [1]. The hypothesis is that the VSHP can offer additional ancillary services, contributing to improving frequency control and maintaining grid stability, thus allowing for higher penetration of variable renewables in the grid. Complete utilization of this potential comprises the development of an advanced control system optimizing the operation of the power plant while considering the constraints in the electric and the hydraulic systems. This can be achieved by combining VI control for improving the power response to frequency deviations with model predictive control (MPC) for handling the internal control of the VSHP.
Research on the use of MPC for control of hydropower plants and frequency control is limited, however, both locally and centralized based MPCs are used for this purpose. In [2], a local MPC controller is used for hydro turbine governor control in a conventional power plant. The Francis turbine is represented by a linearized hygov-model, the guide vane opening speed is limited and generalized predictive control is used to solve the optimization problem. MPC is also used for frequency control as in [3]. A bat-inspired algorithm is utilized to optimize the MPC design for load frequency control of superconducting magnetic storage and capacitive energy storage.
A centralized MPC considering limitations on tie-line power flow, generation capacity, and generation rate of change is studied for load frequency control in [4]- [6], applying both linear and nonlinear MPC. MPC can also be used to damp oscillations in the AC system by minimizing the generators frequency deviation from the average system frequency by a global MPC-based grid control [7]- [10]. This control layout can be modified to also control voltage and ensure voltage stability [11].
A PID controller is utilized to control the guide vane opening of a VSHP in [12] while virtual inertia control methods for VSHP are investigated in [13]. The internal control of the VSHP and the virtual inertia control is not coordinated and a more advanced controls system is needed to ensure that the power response of the virtual control will not cause problems for the internal control of the power plant. In this paper, the VSHP control is improved by proposing a new control scheme: MPC and virtual synchronous generator (VSG) control are combined to optimize the frequency response of the power plant while keeping the electric and hydraulic variables within their limits. While a conventional hydropower plant has a direct relation between guide vane opening reference g * , guide vane opening g, mechanical power P m , electrical power P e , frequency f and turbine rotational speed ω as shown in Figure  1, the VSHP enables one more degree of freedom to control power and speed. The proposed control scheme utilizes the VSHP output power P g to control the frequency f while

Turbine
Reservoir the guide vane opening reference g * and the VSHP output power reference P * g control the turbine rotational speed ω, as indicated in Figure 2. There is still a direct relationship between the power and the frequency, however, the turbine rotational speed and the frequency are disengaged. This allows for quicker changes of the VSHP output power by utilizing the rotational energy of the turbine and generator compared to a conventional power plant where the slow governor will limit the ancillary service capabilities. With that, new possibilities emerges as faster frequency control and other grid ancillary service, but it also necessitates proper co-ordination of the controls -and there will be new constraints that must be taken into account. This paper is organized as follows: The MPC theory and the control objectives for the MPC controller are presented in Section II while the development of the MPC model and Kalman filter are presented in, respectively, Sections III and IV. The results and discussions are given in Section V and the conclusion in Section VI.

II. MODEL PREDICTIVE CONTROL
MPC controllers offer great advantages compared to transitionally PID controllers, although they are more complex. They are multiple-input, multiple-output (MIMO) controllers, they offer a faster and smoother response and lower rising time, settling time and overshoots compared to PID controllers and they are more robust. While the PID controller is a linear controller, MPC can handle non-linear systems as power electronics. However, a proper system model is needed for the design of the MPC controller.
MPC is a closed-loop optimization problem where a discrete-time model is optimized on a time horizon from t = 0 to t = N . Only the inputs for the first time step are used and the optimization problem is recalculated for the next time step, with the new initial state values.
A linear MPC model with quadratic objective function and linear constraints called an output feedback linear MPC, is used in this paper. The model (1)-(3) includes cost for the error of state/variables values, changes in state values, the error of input values, changes in input values and cost for exceeding the constraints on the states with the use of slack variables.
subjected to where The optimization problem is solved by the quadprog function in MATLAB.

A. Control Objectives for the MPC Controller
The MPC controller solves the optimization problem to find the optimal inputs u; the power reference P * g and the guide vane reference g * , while handling all constraints defined in the MPC model. The main tasks of the MPC in this paper are: • Primary frequency control: -Provide power reference P * g to the VSG. -Minimize deviation in grid frequency ∆f .
-Keep the converter power P g within its limits.
• Hydraulic system control: -Provide guide vane reference g * to the turbine.
-Minimize the operation of guide vane opening g to reduce wear and tear. -Minimize the rate of change of g to reduce water hammering and mass oscillation. -Keep the surge tank level h st within its limit and close to the stationary value. -Keep the water flow q above its minimum level.
-Optimize the rotational speed of the turbine ω.
• Turbine speed control: -Keep the rotational speed of the turbine ω within the limits and close to its optimal speed. -Make sure that ω will recover after a disturbance. Other possible tasks for the MPC, not implemented in this paper, will be: • Power oscillation damper (POD). • Optimize the control of guide vane opening g to minimize water hammering and mass oscillation. • Voltage control. Some of these control objectives are conflicting. For instance, fast regulation of the guide vane opening g reduces the deviation in turbine rotational speed ω, however, this will increase the deviation in the surge tank level h st and increase mass oscillation and water hammering. The cost of changing g * , of deviations in h st and of exceeding the limits of h st will reduce the rate of change of g. Similarly, the cost of deviation in ω will increase the rate of change of g.

III. MPC DYNAMIC MODEL
This section presents the MPC model with its costs and constraints. Finally, linearization and discretization of the model are shown.
The step length of the MPC model is set to ∆t = 0.2s to cover the low frequency (< 0.5Hz) dynamics of the waterway system. An appropriate number of time steps is found to be N = 41, resulting in a prediction horizon of 8.2s. Based on simulation studies, we have found that the prediction horizon is long enough to ensure the performance and stability of the control system. Control input blocking is used to reduce the number of control input decision variables. The block sizes are equal to the step sizes for the first 10 steps, thereafter the sizes of the blocks gradually increase such that the total number of blocks becomes m = 21.
The MPC model is based on the models presented in [14] and [12], and is combined with the VSG presented in [13].
These papers present all parameters and variables that are not explained in this paper. Sections III-A to III-F presents the differential-algebraic equations (DAE) (4)-(9) of the MPC model. These are necessary to construct the matrices A t and B t in the equality constraints in (2) as presented in Section III-J. The inequality constraints of (2) and the cost function (1) are constructed from the information given in respectively Sections III-G and III-H.

A. Governor
The governor can either set the rotational speed reference ω * or the governor control can be performed by the MPC, setting the guide vane opening reference g * . Although the open-loop system without a governor control is unstable, the latter alternative is chosen in this paper since the MPC will manage the governor control. The guide vane opening g is found asġ

B. Waterway
The hydraulic system is modelled by the Euler turbine equation model presented in [14]. To reduce the number of states, the penstock water column is assumed to be inelastic, and the differential equations for the waterway are thereby given as:

C. Turbine
The turbine model is based on the Euler turbine equation, as presented in [14], [15].

D. Synchronous Generator
To save simulation time, a simple first-order synchronous generator model (7) is used in the MPC model. The torque must be used in the swing equation instead of the power since the rotational speed is not constant. Since the converter controller time constants are significantly smaller than the sampling time of the MPC, the electrical power of the synchronous generator is assumed to be equal to the output power of the VSHP P g .

E. Grid Converter
To simplify the model, only the outer d-axis loop control of the grid converter, the active power control, is considered. This simplification is satisfactory since the inner controller is faster than the step length of the MPC and since the voltage control is not considered. The active power is controlled by a VSG, which is found to be more suitable for the purpose than the virtual synchronous machine (VSM) [13].
It is assumed that the converter output power P g equals the d-axis current i g,d such that

F. Grid Model
The grid frequency is derived from the swing equation [16].
where P pb is the power balance of the grid without the VSHP; P pb = P generation − P loads − P losses . The values of the mean grid inertia H g = 25.35p.u., the total rated power of all connected power producers S n = 1p.u. and the damping of the grid D m = 0 are assumed supplied from the TSO and are updated continuously.
The electrical power in the grid is estimated from the measured grid frequency f and rate-of-change-of-frequency (ROCOF)ḟ by the PLL.
f andḟ are filtered by first order filters with filter constants at respectively ω f = 0.625rad/s and ωḟ = 0.25rad/s. The total grid inertia H g and damping D m is

G. Constraints and Slack Variables
The constraints on the inputs and variables u are given in Table I. The guide vane opening reference g * is limited by the minimum and maximum values during normal operation and the converter power P g is limited by its maximal nominal power. Power transfer from the grid to the generator is blocked by setting the lower constraint of P g to zero. In addition, the change in g * from one step to the next is limited to ∆g * max = 0.2∆t = 0.04, which correspond to the maximum operational speed of the guide vane.   To avoid non-convergence, slack variables are used instead of constraints on the state variables, as given in Table II. The turbine needs a minimum and maximum water flow q to function properly, and a slack variable is used to add costs to the cost function if q is outside its constraints. The next slack variable ensures that the surge tank level h st will be limited to the maximum pressure over the turbine, normally 1.1-1.15 p.u., or the maximum head of the surge tank. Exceeding these values may cause damage to the turbine blades or water to blow out of the surge shaft. This slack variable also avoids the surge tank level from becoming too low. Normally a sand trap is located between the surge shaft and pressure shaft. Too low surge tank level will cause sand to raise here and to be sent through the turbine, causing increased wear and tear and reduced lifetime of the turbine.
The third slack variable is related to the turbine rotational speed ω, which is limited by the maximal rated speed of the generator. If this speed is exceeded, there is a high consequence risk of the poles to falling off.
When ω is reduced and the converter output power P g is kept constant, the electrical torque will increase. The increase in mechanical torque will be less, and the MPC controller has to increase the guide vane opening g to regain the reference turbine speed ω * . If ω decreases too much, the MPC controller will not be able to regain the reference turbine speed without reducing the converter output power P g . A lower limit slack variable is therefore used on ω to prevent this situation.

H. Costs in MPC Cost Function
The cost function includes costs for deviation in the grid frequency ∆f , turbine rotational speed ω and the VSHP power reference P * g from their reference value, as given in Table III. The costs for exceeding the constraints of the slack variables, given in Table II, are also included in the cost function.
The relative values of the costs determine how the MPC priorities between its objectives given in Section II-A. A high cost related to an objective causes the MPC controller to prioritize this objective to reduce the cost function. The objectives are prioritized as follows: 1) Keep the surge tank level h st within its constraints to avoid damage of the hydraulic system. 2) Keep the turbine rotational speed ω within its constraints to avoid undesired operation conditions of the hydraulic system and damage of the generator. 3) Minimize the deviation in the VSHP power reference P * g to assure that the VSHP is contributing to the frequency regulation as intended by the VSG. 4) Minimize the deviation of the turbine rotational speed ω from the best efficiency operating point to increase the efficiency of the system. 5) Keep the water flow q within its constraints to avoid undesired operation conditions of the hydraulic system. 6) Minimize the deviation in grid frequency ∆f . The cost of deviation in ∆f is low and the cost of deviation in P * g is high since the grid frequency control should primarily be performed by the VSG. The VSHP power reference P * g is not supposed to compensate for deviations in the turbine rotational speed ω unless ω is predicted to go outside its constraints. The cost of deviations in P * g is, therefore, higher than the cost of deviation in ω. The deviations in ω will, when possible, be compensated only by adjusting the guide vane opening reference g * and thereby the mechanical power. However, if constraints on the surge tank level h st , the water flow q or the rate of change of the guide vane opening reference ∆g * block the turbine rotational speed ω from being recovered within its limit, the VSHP power reference P * g will be adjusted. In this way, situations, where the turbine rotational speed is reduced too much to be able to produce enough torque to increase again will be avoided.

I. Reference Turbine Rotational Speed
The optimal turbine rotational speed ω depends on the flow q and thereby by the produced power. This is implemented in the MPC by letting the turbine rotational speed reference ω * be a function of the VSHP output power P g , as given in (11). The curve is based on the measured optimal speed of a reversible pump-turbine presented in [17]. 0.85 < P g ω * = 1 + 0.6(P g − 0.85) 0.73 < P g < 0.85 ω * = 1 + 0.3(P g − 0.85) P g < 0.73 ω * = 0.964 + 0.15(P g − 0.73)

J. Linearization and Discretization of the Model
The system DAEs are given from (4), (5), (7), (8) and (9) The stationary operation point x s is found from the previous estimation of the grid power balance P pb and the previous value of the VSHP power reference P * g by solving the equatioṅ x s = 0 for g * = g. The system is linearized around this point as given by (13).
where ∆x = x − x s and ∆u = u − u s are the errors from the linearization point. Next, the model is discretized as shown in (14), where ∆t is the step time length.
For each time step, a new stationary operation point based on the previous inputs and a new linearized function are found, and the equality constraints are updated with the new state system matrices. Cost matrices and inequality constraints must also be updated according to the new linearization point.
The steps of the MPC are explained in Figure 4. The VSHP inputs g * and P * g from the previous solution of the optimization problem are applied to the power system. At the next time step, the grid power balance P pb is estimated to calculate the stationary state values by settingẋ s = 0. In parallel, the Kalman filter, explained in the next section, estimates the state values and the deviations from the stationary values are found. The system DAEs are then linearized based on the stationary values and cost matrices, and the inequality constraints are updated. Finally, the optimization problem is solved and the first inputs to the power system are found and applied.

IV. KALMAN FILTER
A Continuous-Time Kalman filter is used to estimate the unmeasured variables in the hydraulic system. The guide vane opening g, the surge tank height h st , the height over the turbine h and the mechanical power P m are measured. The Kalman filter is designed to filter g and h st and estimate values of the pressure tunnel flow q and the headrace tunnel flow q hr .
The estimated values will be used as input to the MPC. The dynamical system model is: where Estimate P pb (10) Calculate stationary valueṡ x s = 0 g * = g u s = [P * g P pb g * ] T P pb Linearize (13) Update inequality constraints x s , u s Solve optimization problem (1) Kalman filter (15) - (17) x kf Power system [12]- [14] y kf , ω ∆f, ∆ω g x 0 x s g * , P * g g * ,P * g g * P * g Fig. 4: Float diagram for MPC controller The matrices A kf , B kf , C kf and D kf are found by linearizing the hydraulic system model (4) -(6) at the initial stationary operation point. w and v are, respectively, white process noise and measurement noise.
The Kalman filter equations are given as: where the filter gain L kf is solved by an algebraic Riccati equation in MatLab [18], [19].

V. RESULTS AND DISCUSSION
The dynamic performance of the MPC controller is tested on the grid presented in [12]. Cases with both overproduction and underproduction are investigated by first reducing the load by 160 MVA at Bus 7 at time t = 0s and thereby increasing the load back to the initial value at t = 60s. Figure 5 compares the real values of four states with the values estimated by the Kalman filter. The estimation of the guide vane opening g is almost perfect since the reference value (g * ) is known. A small delay is observed for the other states; the turbine flow q, the headrace tunnel flow q hr and the surge tank head h st .  Figure 6 shows the reference and the measured VSHP power P * g , P g , the grid frequency f , the turbine rotational speed ω, the guide vane opening reference g * , the turbine mechanical power P m and the surge tank head h st . When the grid load is reduced at t = 0s, the grid frequency f immediately starts increasing because of overproduction in the system. The VSG reduces the VSHP output power P g depending on the droop; if the droop is low (1%), P g is reduced by approximately 0.4 p.u. within 2 sec, and the peak frequency is limited to 0.4%. In this case, most of the loss reduction is actually compensated by the VSHP. With 4% droop, the decrease in P g is less, causing a three times higher frequency deviation.
The MPC minimizes its cost given in Section III-H while fulfilling the constraints in Section III-G. To reduce the cost of deviation in turbine rotational speed ω, the MPC reduces the guide vane opening reference g * immediately to regain ω as fast as possible. However, the maximal g * step size is limited to the maximal operational speed of the governor. This constraint is active for the first time steps after the load reduction. The fast reduction in guide vane opening g causes the surge tank head h st to increase close to its maximal value. To avoid h st from exceeding its maximal value, the MPC reduces the rate of change of g * and g after 0.6 sec.
The guide vane opening g is reduced as fast as possible until the turbine rotational speed ω is almost regained to its optimal value. Subsequently, g increases. Since there is a larger deviation between the stationary value and the lower constraint of h st than of the stationary value and the higher constraint of h st , g * and g are allowed to increase faster than it decreases. After 60 sec, the grid load increases by 160 MW, back to its initial value. This causes the grid frequency f to drop. The guide vane opening reference g * increases with its maximal rate of change until it almost reaches its maximum value. The maximal deviation in turbine rotational speed ω is less for the case of load increase compared to the case of load decrease. The rate of change of the guide vane is faster since the lower constraint of the surge tank head h st is not active for most of the time. Thereby, the turbine mechanical power P m changes faster to recover ω. This is a very important quality of the proposed MPC control since too low rotational speed must be avoided. In cases with high VSHP output power P g and low turbine rotational speed ω, the turbine might not be able to deliver enough power to regain ω without reducing P g . If P g is not reduced in this case, the turbine stops. While a conventional governor control increases and decreases the guide vane opening g at the same speed, the MPC controller makes it possible to increase the opening speed of g. This reduces the minimum rotational speed, and thereby avoid situations where P g has to be reduced to regain ω.
The third case in Figure 6 shows how the MPC handles situations where both surge tank height h st and the turbine rotational speed ω exceed its constraints. In this case, the constraints of ω are reduced to 0.85−1.10p.u.. At t = 10s, h st has reached its maximal value and limits the rate of change of guide vane reference g * . It is therefore not possible to close g faster to reduce ω, which is simultaneously getting close to its maximal value. Since the cost of the h st and ω slack variables are higher than the cost of deviations in VSHP output power reference P * g , the MPC increases P * g to avoid h st and ω from exceeding its constraints. This causes a temporary increase in VSHP output power P g and grid frequency ∆f .
The performance of the controller system after disconnection of half of the generators at G2 at t = 0 is shown in Figure  7. To illustrate its benefits, the MPC controller is compared to the governor control presented in [12], however, the VSG with 1 % droop controls the grid converter output power. Since the MPC considers the limitations in surge tank level h st , the guide vane opening g can be increased faster until its maximum value is reached or the minimum value of h st is reached. This results in higher turbine mechanical power P m and thereby less deviation in turbine rotational speed ω and higher efficiency of the turbine. The more aggressive control of the guide vane opening g causes higher deviation and more oscillations in the surge thank level h st , however, this can be tolerated since the MPC controller handles the system constraints. Due to the increased performance of the turbine control and lower deviation in turbine rotational speed ω, it is possible to increase the FFR delivery.
The step responses in Figures 5, 6 and 7 show that the linearized MPC model is not a perfect model of the system. For instance, the surge tank head h st should be closer to its maximum constraint between 0 − 30s and the overshoots in turbine rotational speed ω and guide vane opening g should be less. The use of a nonlinear MPC will improve the calculation of the turbine torque and thereby increase the precision of the control and reduce or eliminate these problems.

VI. CONCLUSION
As the share of wind and solar energy production increases, more flexible production and loads are required to control the balance of the grid in order to maintain the power system security. By utilizing the rotational energy of the turbine and the generator, VSHPs are able to deliver both VI and FFR. However, an advanced MIMO control system is needed to optimize the control and to ensure that the hydraulic and Fig. 7: Dynamic performance after generator loss; with MPC (blue) and PID governor from [12] (red). VSG with 1% droop is utilized in both cases. electric variables are within their constraints. A control system with an overall MPC and VSG control of the grid-connected converter is developed to fulfil the control objectives. When a grid frequency deviation occurs, the VSG controls the output power of the converter to reduce the frequency deviation. Thereby, the MPC will primarily control the turbine guide vane opening to regain the nominal turbine rotational speed. The speed of the control will be faster than for a conventional governor control since the MPC maximizes the rate of change of the guide vane opening while considering the surge tank head guide vane speed constraints. In cases where the turbine rotational speed could not be kept within its limits due to these constraints, the MPC will adjust the VSG power reference and thereby change the VSHP output power to regain the turbine rotational speed. The linearization of the MPC model causes inaccurate prediction and overshoots that may be improved by the use of nonlinear MPC.