Real-Time Dispatch for Multi-Unit Hydroelectric Plants With AC Optimal Power Flow: The Case of the Santo Antonio System

The growing demand for green energy has driven the development of large-capacity hydroelectric plants away from load centers. In this setting, one key aspect is constructing electrical networks for efficient power transmission to the primary grid, which is sometimes combined with high-voltage direct-current systems. However, on-site applications based on real-time dispatch problems often do not model AC power flow (ACPF) constraints, partly because of a lack of appealing methods to simultaneously include the dispatch and ACPF operating characteristics. Furthermore, a precise hydropower production function, a priority in this type of problem, can introduce additional complexity, and practical applications commonly sacrifice grid-connection modeling. This paper proposes a technique for incorporating ACPF constraints in real-time hydro dispatch, promoting widespread methods and optimization tools. The proposed strategy is based on mixed-integer quadratic programming that yields convergent electrical variables compatible with the exact ACPF to minimize a compromise between transmission losses and turbined outflow. The testbed is the Santo Antônio system, composed of 50 generating units, 13 power transformers, and 41 buses. Simulations based on real-life data demonstrate the impact of ACPF modeling, achieving consistently reduced losses above 5%, at the cost of a higher processing time.

i Index associated with a generating unit. k, m Indexes associated with buses. km Pair of indexes associated with buses at the endpoints of a transmission branch. Parameterized unit i initial state for the real-time dispatch problem (binary).

W in
Parameterized total water inflow (m 3 /s).

G min(max) i
Minimum (maximum) active power of unit i (MW).

W min(max) i
Minimum (maximum) turbined outflow of unit i (m 3 /s).

V min(max) k
Minimum (maximum) voltage magnitude of bus k (pu). E sys , F sys Real/imaginary fixed voltage components (pu) for the slack bus of each section sys. CC xz Coefficients of index x (0 to 1) for segment z of the piecewise linear capability curve.

CL xyz
Coefficients of index x (0 to 1) for segment z of reactive power limiter type y (I or II).

Q min(max) i
Minimum (maximum) reactive power of unit i (pu). D sys Active power (pu) requirement associated to the generating units set of each section sys. Q sys Reactive power (pu) requirement at reference substation of each section sys. I max km Maximum current capacity (pu) of circuit branch km. E0 k/m , F0 k/m Parameterized pivot values for real/imaginary voltage components (pu) at bus k/m. AW vi , AG vi Sampled turbined outflow (m 3 /s) and active power output (MW) of unit i, derived from nonlinear hydropower production functions. U ref i Parameterized unit i auxiliary reference for optimal power flow solution (binary). U max Maximum switching operations relative to an auxiliary reference.

I. INTRODUCTION
One of the most crucial tasks for hydroelectric plant operation is real-time dispatch (RTD), which addresses the optimal distribution of power generation among the available generating units (GUs). The solution obtained in this optimization problem is used in real-time operations to assist the production allocation among GUs. Moreover, efficient computation of the RTD is of particular importance because, in generation scheduling models, hydro plants are represented by power production and turbined outflow functions, usually built using the optimal values related to RTD. In addition to computational efficiency, adequate RTD modeling is an important issue [1], and studies have shown that significant gains can be rendered by adequately allocating the power between GUs [2], [3]. The typical RTD formulation consists of maximizing the power generation for a given plant turbined outflow or, equivalently, minimizing the discharge necessary to meet a given target demand, while satisfying constraints on the operation ranges of GUs. The reservoir water balance, limits of net head and power of the GUs, rates of variation of outflow, and operating power reserve requirements are additional typical constraints.
One of the critical challenges in the RTD problem of hydroelectric power plants is to precisely represent the hydro production function (HPF). In general, HPF depends on the product between the net head and turbined outflow in each GU, which is a nonconvex and nonlinear function [4]. The HPF can also be discontinuous owing to the presence of forbidden operating zones. An adequate HPF is important in the RTD context because suboptimal dispatch solutions are related to inefficient and nonsmooth hydroelectric power generation. As damaging consequences, we highlight the waste of water (a scarce resource) associated with the lowefficiency points and the increased wear and tear of the turbine equipment due to excessive switches of the GUs.
Despite the recent advances in mixed-integer nonlinear programming (MINLP), given the complex nature and computational time limit for solving the RTD problem, modeling simplifications are needed to allow for the computational tractability of the resulting optimization model. In this sense, most studies assume that alternating current power flow (ACPF) constraints must be sacrificed, favoring an adequate representation of the HPF, especially for multi-unit hydropower plants. Therefore, when introduced in the RTD problem, the power flow (PF) constraints tend to be simplified, focusing mostly on modeling the active power.
The introduction of PF-related constraints in generation scheduling problems is intricately linked to the development of an optimal power flow (OPF). Since its conception, the OPF has progressed dramatically, starting from fuel cost minimization under only active power constraints to modernday developments with new objective functions, reactive power flow constraints, and the application of more sophisticated mathematical techniques. In some cases, as both ACPF and discrete features of the power system are modeled precisely, OPF problems can already be formulated and solved as fully fledged mixed-integer nonlinear programming (MINLP) optimization problems [5], [6]. However, typical applications of the OPF problem still focus mainly on the network operation in which 0-1 (binary) decisions associated with the GU statuses have been previously determined. Furthermore, despite all advances in nonlinear programming (NLP)-type ACOPF problems, many practical applications still simplify PF equations, mainly because of convergence problems and computational burden. For example, direct current power flow (DCPF) is a traditional modeling strategy, especially for systems with a vast transmission network. In this context, enhanced linearized PF formulations have been proposed, allowing for the approximated modeling of reactive power flow, voltage profile, or transmission losses [7]- [9].
Concerning the RTD and related short-term hydro scheduling (STHS) problems, such as the hydro unit commitment (HUC) [10], given the necessity of accurate HPF representation, transmission network modeling is implicated in complex optimization problems. Works that deal explicitly with RTD problems in hydro plants, similar to [11] and [12], are relatively less common than those focusing on other types of STHS problems, such as the HUC. To the best of our knowledge, no studies have specifically focused on handling the hydro RTD and ACOPF simultaneously. Nonetheless, some recent papers [13]- [15] have proposed sophisticated methods for directly solving ACPF-constrained STHS problems, specifically day-ahead HUC problems. However, these methods have not yet been demonstrated to be sufficiently stable, suitable for on-site applications, or compatible with widely available solution tools. Furthermore, [6] and [16] presented advances in new problem-solving paradigms, such as evolutionary computation and artificial intelligence, with the potential to deal with generation scheduling and OPF problems.
Although dependent on simplifications in PF modeling, practical works have considered commercial solver-based solution strategies that approximate transmission grid operational features. In [17], for example, the HUC of a plant with 18 GUs was studied, and a high-voltage direct current (HDVC) system was considered. The HUC is formulated as a mixed-integer linear programming (MILP) problem, and the transmission load targets of HVDC lines are achieved via specific constraints.
Regardless of modeling complexity or solution strategy, works primarily concerned with OPF problems, especially for large-scale systems, aiming at optimizing transmission operation, target production, or costs, and usually cannot afford to deal with hydraulic optimization with a precision level that is comparable to that obtained with a strict hydro RTD problem. On the other hand, hydro RTD problems are used by plant owner operators, which normally sacrifice transmission system modeling. As mentioned before, literature specifically related to the hydro RTD problem is relatively scarce. However, as examples of low-precision transmission modeling in RTD and hydraulic modeling in OPF, we can cite a few recent papers. In [18] and [19], OPF problems for wind-thermalhydro systems were dealt with, in which HPF modeling was neglected. In turn, [20] applied a hydrothermal dispatch problem with improved formulations for plant productivity, but the electrical network modeling was based on the basic DCPF. All of these studies have been published in the past two years.
An important example of a complex practical case that can benefit from accurately modeling the local transmission network in the RTD problem is the Santo Antônio Hydroelectric Power Plant (SAHP). The SAHP is the fifth largest hydro plant in Brazil, coupled with the Brazilian power system grid via the Madeira River HVDC system. As further detailed in the following sections, the plant comprises 50 GUs and 13 power transformers (TRs) distributed along a 2.6 km wide dam. Four 500 kV AC transmission lines, each approximately 15 km long, connect 44 GUs and the HVDC system. Then, a DC-link drains the power output to the southeastern region of Brazil through two bipoles, each one over 2,000 km long (3,150 MW and ±600 kVdc each). Finally, two 230 kV AC transmission lines, approximately 20 km long each, couple the remaining six GUs and the Brazilian power system grid.
Obtaining an efficient RTD in the SAHP is challenging because of its many GUs and complex hydraulic constraints associated with the run-of-the-river operation. Furthermore, the HVDC operation imposes reactive power requirements for 44 GUs in SAHP (500 kV) and all 50 GUs in the Jirau power plant, located 100 km upstream (the HVDC system and each plant with its local AC transmission correspond to the Madeira River complex). If reactive power requirements are not met, the PF may be interrupted or limited owing to the electronic converters and filter operating constraints. This problem can become noticeable during low inflow periods when fewer GUs are necessary to produce active power.
This paper proposes a strategy for a solution algorithm to incorporate the ACPF constraints in the RTD problem of the SAHP, with the aim of obtaining an integrated optimal operation for the GUs and local transmission system. In-site suitable solutions are intended, taking advantage of wellknown techniques and general-use commercially available tools. The testbed cases take the SAHP as a reference, where the numerical experiments are based on actual data provided by the plant operator. Therefore, this study aims to provide the following contributions, presented in the order of relevance: • A framework to integrate more sophisticated modeling and solution techniques applied to real-time hydrodispatch problems with AC power flow optimization, based on a state-of-the-art MILP linearization technique.
• A strategy for linearized modeling and solving of ACOPF problems, capable of providing high-precision results, even when the operating conditions (e.g., very low power factors) cannot be handled efficiently for most known techniques.
• Study of an important real-life case related to a hydropower plant with unique operating characteristics, highlighting the connection to the grid via a complex HVDC transmission system. The remainder of this paper is structured as follows: Section II contains a more detailed description of the Madeira River complex; Section III reviews some fundamental topics and presents a general description of the RTD problem combined with the ACOPF constraints; Section IV summarizes the basics regarding linearization techniques employed in the solution strategy; Section V describes the developed methodology, presenting a general algorithm and the mathematical formulation of the associated optimization problems, Section VI focuses on the numerical simulations, and Section VII offers conclusions.

II. DESCRIPTION OF THE SYSTEM
The Madeira River hydroelectric complex consists of Jirau (50 GUs and 3,750 MW) and Santo Antônio (50 GUs and 3,568 MW) hydroelectric power plants built between 2008 and 2016 in the northern region of Brazil. Fig. 1 presents a simplified diagram of the transmission system of the Madeira River complex [21]. Notice that 94 GUs are connected to the HVDC system at the same 500 kV AC bus, whereas the remaining six GUs (in SAHP) are connected to the Brazilian power system grid via a 230 kV AC system.  The maximum turbined outflow in the SAHP was approximately 30,000 m 3 /s, and the nominal head was 13.9 m. In the dry season, usually from June to October, the inflow can reach values below 5,000 m 3 /s. In turn, the inflow exceeds the plant capacity in the wet season, and therefore, spillage is quite common, as shown in Fig. 2.
The plant can maintain a daily average output that ranges from approximately 500 MW to 3,500 MW. However, the maximum generation does not necessarily occur at peak inflow because they produce excessively high tailrace levels. Furthermore, inflow is roughly equal to the outflow due to run-of-the-river operation, except for some special conditions, such as during transition periods, when the forebay level changes from 70.5m to 71.3m, and vice-versa. As a result, the heads present a wide range, and the differences between the powerhouses can be observed in Fig. 2.   During the low-generation periods, the net reactive power resulting from the primary grid and the voltage at the 500 kV substation, tends to be elevated. As a result, the system can reach power factors lower than 0.8. There are two types of GU in SAHP: type A (5-blades bulb turbines) and type B (4-blades bulb turbines), each with its own specific hill diagram. However, all GUs have the same generator type with 13.8 a nominal voltage and 82.25MVA maximum capacity. Fig. 4 illustrates a piecewise linear concave approximation for the generator feasible operation region extracted from the capability curve. Each GU has an under-excitation limiter (UEL), defined as UEL I and UEL II. Representations of the settings associated with each UEL are shown over the capability curve. The UEL is highlighted because the GUs often operate at limited capacity owing to the reactive power profile. Finally, Fig. 5 shows the equivalent circuit considered for the SAHP system operation simulations. The elements are displayed according to the river margins. All 500 kV grid TRs are three-windings, and their representation introduces fictitious buses. Fig. 5 indicates the GU distribution along with the powerhouses, type of turbine in each GU (indicated by arrows), and the type of UEL in each generator (indicated by X or O).

III. MATHEMATICAL MODELS AND FORMULATIONS
As previously cited, precise HPF representation is of utmost importance in the RTD problem. Thus, this section initially presents a nonlinear nonconvex HPF model, which is well suited for representing the operating features of the GUs in the SAHP. Next, we introduce the ACPF equations, focusing on the rectangular form. Finally, this section concludes with a description of the resulting MINLP optimization model related to the RTD problem of the SAHP.

A. HYDRO PRODUCTION FUNCTION
The following nonlinear and nonconvex function represents the HPF of the i-th GU [22]: The net head of each gu is written as follows The turbine efficiency of each GU is written as follows: For real-time operation, the gross head is obtained by measurements via forebay-and tailrace-level sensors. In addition, the plant has pressure sensors that acquire the trash hack hydraulic losses in real time for each GU. For the sake of notation, we include losses in GH i . Therefore, the net head in each GU is a univariate function, and consequently, the efficiency is also a univariate function. As a result, the HPF of the i-th GU is given by The rectangular form of the ACPF equations related to the active and reactive power balances for the kth bus are presented in (5) and (6), respectively.
The rectangular form is more convenient for model linearization, as discussed in the next section. Additionally, the transmission losses in the objective function can be inserted by directly applying the residual sum of (5), which yields a quadratic formulation. Moreover, (7) and (8) calculate the squares of a given bus voltage and circuit branch current magnitudes, respectively, as functions of the rectangular voltage components.

C. THE NONLINEAR OPTIMIZATION PROBLEM
In the context of RTD problems with ACPF constraints, the overall problem consists of determining i) GUs on-off statuses, ii) active power level in each GU, and iii) active and reactive power flow through TRs and transmission lines. However, in classical hydro-RTD problems presented in the literature, local AC transmission constraints are typically not described accurately. In contrast, in the proposed RTD problem, commitment decisions account for the PF among the transmission devices. Therefore, GUs connected to lines and TRs with low (high) loading are preferably turned on (turn-off). This principle is also observed for the dispatch distribution among the active GUs, where an unbalanced amount of power is dispatched in GUs connected to lowload transmission devices. Then, the optimization problem accounts simultaneously for the transmission losses (for better grid operation), efficient use of the water (minimizing turbined outflow), and smooth commitment (decreasing the number of on-off operations). Thus, the MINLP optimization problem related to the RTD with ACPF constraints in the SAHP is presented in the sequence.
, k ∈ gen (21) In the MINLP problem, the sum of the three terms gives the objective function (9): plant turbined outflow, start-up, and shutdown of the GUs, and transmission active power losses. We use the constants O W , O R , and O L to control the weight of each term in the objective function. Constraint (10) avoids the fact that a GU is turned on and turned off simultaneously. In turn, (11) is a three-binary constraint used to represent the relationship among the 0-1 statuses of a GU. (12) models the integrality constraints associated with the 0-1 decisions. Constraint (13) corresponds to HPF in each GU. Equation (14) is the reservoir water balance, where, due to run-of-the-river operation, the inflow is equal to the sum of the plant turbined outflow and spillage. In turn, (15)-(16) represent the operating zones of the GUs, given by limits on power generation and turbined outflow. Constraints (17)-(18) include the active and reactive power balance equations in all non-slack buses, where no voltage-controlled buses or internal consumption at generation buses is considered. In other words, demands are assumed to be zero (except for the slack buses), and injections are equal to generation. Constraint (19) models the required operative limits for the voltage magnitude at each bus. Constraint (20) sets the fixed voltage values at the slack buses for each section (230 kV and 500 kV). Constraints (21)- (22) associate active/reactive power injections at generation buses with the respective GUs' dispatch in each bus, as shown in Fig. 5. Constraint (23) ensures that the active/reactive power injection balances at transference buses are zero. Constraints (24)-(25) represent a function that correlates the maximum reactive power with the active power in each GU, so the pair (g i , q i ) is feasible for the generator operation. As shown in Fig. 4, this feasibility is given by the intersection between the linear capability range (24) and the UEL limit (25). Constraint (26) ensures that q i = 0 for the offline GUs. Constraint (27) represents the active power targets, modeled as power injections at the delivery buses. Constraint (28) characterizes the reactive power injection targets associated with the HVDC system operation. Finally, (29) represents the maximum capacity of the circuit branches.

IV. OVERVIEW OF THE LINEARIZATION TECHNIQUES
As discussed, this work aims to employ solution strategies suitable for on-site applications. These strategies must be based on using robust and well-established commercial solvers to be embedded in the supervisory control system in the SAHP. A particular concern is that MINLP problems are usually difficult to solve, even for small instances. Furthermore, there are few robust commercial MINLP software that can efficiently handle this type of optimization model. However, current state-of-the-art software can efficiently tackle large-scale MILP and mixed-integer quadratic programming (MIQP) problems. Thus, owing to recent advances, the strategy to deal with nonlinear functions via MILP (MIQP) solvers is drawing attention. This strategy is generally employed (but not restricted) to univariate and bivariate functions because of the number of variables and constraints used in each piecewise linear approximation. Although not all nonlinear functions can be rewritten as piecewise linear functions, this reformulation is valid for the HPF. In contrast, we propose a different linearization-based approach for the ACPF constraints owing to accentuated nonlinearity, as detailed below.

A. HYDRO PRODUCTION FUNCTION VIA PIECEWISE LINEAR MODEL
Developments in RTD and generation scheduling-related problems have popularized strategies based on the formulation and solution of MILP models [10], [23]. This study replaces the nonlinear and nonconvex HPF (13) with mixed-integer constraints, representing this function using a piecewise linear (PWL) approximation. Given the formulation used in (4), the linearization methods studied in [23] can be applied. To achieve better computational performance, we adopted the one-dimensional logarithmic aggregated convex combination (LACC) model. The LACC-based PWL model approximates the nonlinear HPF according to

B. AC POWER FLOW EQUATIONS VIA TAYLOR SERIES EXPANSION
Owing to the substantial flow of reactive power, the ACPF equations (5)- (6) are not convenient for the MILP linearization in the SAHP problem because it requires an excessive number of mixed-integer constraints to represent the nonlinearity with adequate precision. However, a first-order Taylor series-based approximation can be as precise as desired if the estimated calculations are performed for points sufficiently close to a solution. Thus, replacing (17)- (19) and (29) with its Taylor series equivalents yields a linearly approximated ACOPF problem. Nevertheless, this direct approach is susceptible to error when expansion is employed in a lowquality pivot or when the reactive power flow of the system is prevalent. However, this disadvantage can be overcome by applying multiple Taylor series linearization. This principle takes advantage of the proposed solution, as shown in the next section.

C. RE-FRAMING OF THE NEWTON-RAPHSON METHOD
The Newton-Raphson is a numerical technique that supports a wide range of strategies commonly used to tackle conventional ACPF analysis [5]. The application of Newton-Raphson for static ACPF problems can be summarized as follows: • Step 1 (formulation): From (5)- (6), select a subset that defines a nonlinear system. This selection depends on the suitable choice of which variables have previously fixed values in problem formulation (i.e., buses real/imaginary voltage components and active/reactive power injections).
• Step 2 (Jacobian matrix): Choose the initial values for all real/imaginary voltage components at each bus and calculate partial derivatives for the nonlinear system. This procedure defines the Jacobian matrix Jac. • Step 3 (iteration): Solve the linear system Jac· Vc = Ij, where Ij is a vector with the deviations between power injections calculated by (5)-(6) (using initial voltage components) and the fixed values of the power injections (as set at formulation). Only equations associated with the fixed injections were used. The solution Vc updated the initial voltage values.
• Step 4 (convergence): Convergence occurs when the Ij elements are sufficiently small. While convergence is not achieved, the updated values Vc are the new initial voltage components for the next iteration. Then, the process returns to ''step 2''. The updated voltage obtained after the solution of the linear system in ''Step 3'' can also be obtained from the resolution of a suitable linear programming (LP) problem. It can be shown that the expressions derived from Jac · Vc = Ij, at a given iteration, are equivalent to the Taylor series expansions of equations (5)-(6) used in the ACPF problem if the expansion pivot is the same as the initially estimated voltage components used for partial derivative calculation in ''Step 2.'' Equations (36)-(37) present the equations for the k-th bus and initial voltage components [E0 k , F0 k ]. Moreover, (38) presents a similar expression for (7) if the explicit voltage magnitude calculation is relevant in the ACPF problem (i.e., when voltage-controlled buses are declared). For an LP problem where e k and f k are variables, if (36)-(38) linearization for all equations of an ACPF problem are added as equality constraints, where pgt k and qgt k are set to be equal to the fixed power injection values, the LP solution will have e k and f k values that are equal to the updated [E0 k , F0 k ] obtained from a Newton-Rahpson iteration. If these results are applied to formulate an updated LP problem, the succession of [E0 k , F0 k ] will be the same as in the Newton-Raphson method. Therefore, a series of LP problems can be used to achieve an implicit solution of an associated ACPF problem if multiple sequential executions are applied until the PF convergence criterion is met (as in ''Step 4''). The algorithm can also be stopped when consecutive [E0 k , F0 k ] values become stable. The diagram in Figure 6 represents this procedure.
As an extension of this approach, if pgt k and qgt k from (36)-(37) are introduced as variables, the resulting formulation will be a linearly approximated ACOPF, where power generation and demand at each bus are defined with respect to a specific goal. However, if multiple solutions are applied, analogous to Fig. 6, convergent results are made compatible with the exact nonlinear ACPF; note that for a linearized ACOPF tackled through this framework, specific constraints may be necessary to guarantee that the sequence of solutions converges and yields effective results.

V. PROPOSED APPROACH A. SOLUTION STRATEGY
When problems (9)-(29) are linearized, one complicating factor is the binary variables applied in the PWL HPF model because of the computational burden. Moreover, the commercial solver can present difficulties in terminating the convergence gaps due to numerical proprieties in some specific cases, becoming susceptible to an unpredicted rise in processing time. Therefore, to circumvent these difficulties, we add constraints limiting state switching concerning a parameterized reference, which reduces the number of 0-1 states to be evaluated in the solution procedure. Furthermore, as multiple solutions are usually required to achieve ACPF convergence, different problem formulations that prioritize specific optimization goals separately can be applied at each iteration. The proposed approach is based on the sequential execution of three phases, where each phase is related to a different optimization problem.
In the first phase, the RTD problem was solved without ACPF constraints. Thus, we obtain an initial estimate for the 0-1 states and active power injections of the GUs. The latter is used in a static ACPF-based estimation of the initial voltage components. Subsequently, these voltages are set as a reference to achieve a first-order Taylor expansion of the ACPF constraints. Then, an RTD problem with incorporated ACPF constraints is solved in the second phase, yielding the final committed GUs. Finally, in the last phase, with fixed GUs 0-1 states, a series of ACOPF problems are solved until the ACPF convergence criteria are met. Note that in this last phase, the active power injections in the buses are still explicitly constrained by the HPF, and binary variables are used because of the LACC model. Therefore, as transmission losses (5) are included in the objective function, the second and third phases are modeled as MIQP problems. Fig. 7 illustrates the general algorithm framework employed in this study. In the following sections, we present the optimization problems associated with each phase, as shown in Fig. 7.
Moreover, the stopping criteria based on PF convergence imply that new re-parameterized Phase 3 problems are formulated sequentially. Then, these problems are solved until a full set of power injections and complex voltage components satisfy, within a tolerance criterion, the relations established by the rectangular ACPF equations for all buses. In other words, convergent results are as accurate as can be obtained from a static ACPF analysis that takes active/reactive dispatch information from optimization results as load/generation (freevoltage) bus input parameters. The following MILP problem corresponds to ''Basic RTD, '' as shown in Fig. 7.
The objective function (39) minimizes the weighted sum of the turbined outflow and start-up/shutdown of the GUs. The start-up/shutdown term is not necessarily applied in all simulations, and its effect can be eliminated simply by setting O R = 0. The relative magnitude of O R concerning O W can alter GU commitment and overall dispatch efficiency; these settings' effects will also be further discussed in the numerical results section. Regarding the feasible set, the nonlinear and nonconvex HPF (13) is replaced by equations (41)-(43), which correspond to the PWL LACC approach. Furthermore, constraint (44) ensures that the active power targets equal the sum of all the GUs' power output for each system section.

2) PROBLEM FORMULATION OF PHASE 2
The following problem corresponds to the optimization model used in Phase 2.
, k ∈ gen (54) , k ∈ gen (55) Fundamentally, the goal of Phase 2 is to introduce transmission modeling in the previous problem, so the unit commitment is adjusted by grid operation. As PF convergence is only achieved in the next phase, this adjustment is based on a single approximated ACOPF. As shown, the term associated with transmission losses is included in the objective function (45). Furthermore, to reduce the computational burden, (47)-(50) limit the switching of GUs concerning a reference, which is taken as the commitment of the first phase. Note that this switching limit for each i-th GU is determined by a new set of binary variables xr i and yr i . Constraints (51)-(52) are the Taylor expansions of the PF equations, whereas (53) imposes limits similar to (19), except that the voltage magnitudes are calculated by the Taylor expansion in (38). Constraints (54)-(56) and (57)-(58) are analogous to (21)-(23) and (27)-(28), respectively; however, the power injection variables refer to the linearized PF equations. Note that (57) is converted into an inequality constraint to ensure feasibility, while PF convergence is not achieved. In addition, because (57) is added in Phase 2, constraint (44) is no longer considered. Finally, constraint (59) corresponds to (24)-(26), as presented previously.

3) PROBLEM FORMULATION OF PHASE 3
The following problem corresponds to the optimization model used in Phase 3.
Phase 3 is similar to the previous one, except for u i variables being replaced by parameters representing the final GUs committed established by the previous phase (61). Furthermore, the constraints indicated by (62) are maintained as before, whereas constraints previously associated with state variable modulation are not applied. Moreover, the VOLUME 9, 2021 terms in the objective function are the same, except that the start-up/shutdown costs are no longer applicable in (60). Finally, the circuit branches' maximum transmission capacity is added with (63), which is equivalent to (29), when that expression is linearized by the application of a Taylor series expansion, similar to (51)-(53). This constraint could have been included in the last formulation; however, as this approximation precision has considerable sensitivity for the voltage pivots, it is preferable to apply it after setting the GU status.

VI. NUMERICAL RESULTS OF CASE STUDIES
Owing to the significant yearly hydrological variation in the SAHP, several scenarios are necessary to encapsulate all possible conditions observed historically. However, to evaluate the performance of the proposed algorithm concisely, the results focus on a few selected scenarios that allow comprehensive insights and demonstrate the effects of a detailed introduction of grid-connection modeling in the problem. Thus, we initially present some RTD dispatch problems to illustrate the impact of ACPF inclusion in the modeling; stepby-step results detailing each solution phase are presented to help clarify the application of the algorithm. Afterward, we present a rolling-horizon analysis on a full day to show the effects of the ACPF constraints on the daily switching operations of the GUs. All simulations were performed with a 16.0GB RAM Intel Core i7-5500U CPU@2.40GHz desktop computer, with GUROBI Optimizer 8.1.1. The convergence MILP gap was 0.5·10 −4 . Furthermore, we used 65 equidistant points of the turbined outflow to represent the PWL HPF via the LACC.

A. CASE 1
This case focuses on a single stage on a typical operating day, as observed during the transition periods between the dry and wet seasons. Although most GUs are available during these inflow periods, some, or even many, are not dispatched because production targets can be met more efficiently with few GUs. The simulations considered that all GUs were available. Data regarding turbine hydraulic efficiency and circuit parameters are not presented because of manufacturer confidentiality. As shown in Fig. 5, the connection grid has two sections (230 kV and 500 kV), where the substation bus at each one of them is considered to be both the slack bus in the PF model and the delivery bus for meeting production targets.
In this case, the real-time inflow at the plant is 15,178 m 3 /s. On the other hand, Table 1 presents the gross head acquired via level sensors in each powerhouse. Furthermore, the production targets are 2,073 MW and 355 MW for the 500 kV and 230 kV substations, respectively.
The first solution involves solving the MILP proposed in (39)-(44), equivalent to Phase 1 in Fig. 7. The initial GU status is U ini i (i = 1, . . . , N ) = O R = 0, whereas O W = 1. In addition, as the transmission system modeling is disregarded, production target fulfillment is considered the sum of all generations in each dispatched GU (44). Consequently, owing to transmission losses, effectively delivered power in substations tends to be slightly smaller than production targets. This issue could be enhanced by applying an estimated increase in production targets to adjust for these losses. However, nowadays, the SAHP operator ignores this issue because grid-connection losses account for only approximately 0.5% of the total production, on average. Therefore, based on the discussed data, the GUROBI optimizer solves the MILP problem in 1.92s. The optimal objective function value is equal to 13,993.1 m 3 /s. Note that the generation in both 500 kV and 230 kV sections meets the demands, while the delivered power at substations cannot be obtained directly from this solution because the transmission model is disregarded. Moreover, because not all inflows are necessary to supply the power targets, and due to run-of-theriver operation, 1,184.9 m 3 /s of spillage is observed.
Owing to the differences in gross heads, trash hack losses, and hydraulic efficiency in each turbine, the optimal dispatch levels are fairly different for each GU (up to 10%). Table 2 illustrates some results obtained from the solution of Phase 1, such as the number of GUs dispatched by type (A or B) and section (500 kV or 230 kV), along with the minimum and maximum generation levels observed in one GU. The plant productivity, that is, the ratio between power and turbined outflow, in the solution is 0.1736 MW/(m 3 /s).   Because a linearized ACOPF is considered in Phase 2, production targets are now met as the power is effectively delivered at reference buses, even though the injections calculated for the substations are still approximated in this phase. Consequently, Phase 1 GU active power dispatches and turbined outflows are also adjusted to accommodate the slightly higher production, compensate for transmission losses, and achieve a balance between loss minimization and turbined outflow efficiency. The optimal reactive power dispatch was also introduced, and the relevant parameters are summarized in Table 3. All the results in Phase 2 are provisional (except for the GU commitment) because they will still be finely tuned in the next phase concerning power flow convergence. Hence, these results were not further detailed. The approximated voltage components and final commitment values obtained from the solution of this MIQP problem are then introduced as parameters for the problem in the next phase.
Finally, the last step involves solving the MIQP problem proposed in (60)-(63), equivalent to Phase 3. All parameters necessary for the solution of this problem are as indicated for the previous phases, whereas the second Phase 0-1 status of each GU is taken as a constant. In addition, PF convergence criteria must be introduced. In this sense, as a stopping criterion, we adopted a 10 −4 upper limit for the quadratic sum of the differences between the current [E0 k , F0 k ] and the values of voltage component variables in the solution of a given iteration.
Therefore, GUROBI is applied to solve a series of MIQP problems based on the discussed data and parameters, returning a solution in five iterations (in phase 3). The processing time (i.e., all phases) was 29.87s, and the optimized transmission loss was 12.17 MW. For comparison, another simulation was performed, with all data and parameters maintained, except for the setting of U max = 4. In this case, a solution is obtained in four iterations (in Phase 3), with a processing time of 16.12s and 12.51 MW in transmission losses. These results indicate that parameter setting can reduce the computational cost, possibly in exchange for a smaller potential for loss reduction. The turbined outflow, losses, generation, and deliver power for the original U max = 8 reference simulation are summarized in Table 4. For this reference case, active and reactive power injections and voltage magnitudes in the generation buses are shown in Fig. 9. The optimizer sets the reactive power magnitudes smaller in buses with a higher active power, aiming at a smoother loading distribution.  To further evaluate the results, two other simulations were performed. In the first one, committed GUs and active power dispatch results of Phase 1 are fixed (i.e., (57) is not considered), which allows for a better comparison of transmission losses due to fulfillment of reactive power requirements. Table 5 presents the results of the simulation. From the comparison of the data in Tables 4 and 5, it can be observed that the adjustment of GU commitment and dispatch produced a reduction of over 10% in total transmission losses. Moreover, because more power is generated and the compromise between hydraulic efficiency and transmission losses, the plant productivity decreases to 0.1733 MW/(m 3 /s).
Naturally, the degree to which the hydraulic efficiency deteriorates owing to the transmission inclusion depends on the relative magnitudes of the O L and O W parameters. Hence, in the second simulation, the parameters and data are the same as in the reference case, except for O L = 2, 000. These results are presented in Table 6 (processing time of 67.41s). Notice how transmission losses are further reduced in the reference case, while the hydraulic efficiency further deteriorates. In all simulations, the number of GUs remained, as presented in Table 2.

B. CASE 2
This case focuses on a single stage observed during lowinflow periods. The gross head tends to be elevated, and only type A turbine GUs can be dispatched owing to the head limits of type B turbines. The simulations considered that all type-A turbine GUs were available. Furthermore, HVDC operation constraints have a significant impact in these periods owing to the capability limits of the generators. This simulation shows the impact of ACPF introduction on the RTD of the SAHP under these circumstances. Therefore, only the 500 kV section of the connection-grid is evaluated.
The data necessary for the simulation of Case 2 are analogous to those presented in the last case and are listed in Table 7. ''Test 1'' and ''Test 2'' values for HVDC reactive power are observed in the operative record for similar inflow periods. The remaining parameters applied were the same as those in the reference simulation for Case 1. After applying the proposed algorithm, the solution obtained for Case 2 yielded 12 GUs committed (in 500 kV) for the reactive power requirement indicated as ''Test 1'' in Table 7. Fig. 10 depicts [g i , q i ] representing the operation points of each active GU over the generator capability curve approximation, along with the UEL settings. Note that most GUs operate at a limited capacity for reactive power absorption owing to the reactive power requirement. Under these circumstances, a problem that does not model the transmission system would have dispatched a different set of 12 GUs, analogous to the one presented for Phase 1 of Case 1. However, for reactive power requirements such as the indicated as ''Test 2'' in Table 7, the proposed algorithm can identify that it is impossible to supply the necessary reactive power with only 12 GUs, dispatching an extra unit (highlighted in Fig. 10), and simultaneously re-allocating active and reactive power distribution in an optimized fashion. Under this ''Test 2'' condition, an RTD problem without reactive power sensibility would still have dispatched 12 GUs (in fact, 12 GUs are dispatched in the solution of Phase 1), incurring in a transmission unfeasibility and leading to a suboptimal emergency dispatch of the 13th GU during operation.

C. ROLLING HORIZON CASE
We also consider a 24h horizon, where RTD problems are executed every 30 min. The dataset associated with each stage is analogous to that in Case 1, and the most important parameters for the simulations are highlighted in Fig. 11. Note that every stage has different input data because some parameters are obtained from real-time measurements.
The parameters applied are the same as in the reference simulation for Case 1, except that the initial states are now considered to limit the amount of inter-stage GU switching. For this, we adopt O R = 2.5 in all stages, where the initial reference states, that is, U ini i (i = 1, . . . , N ), are taken as the GUs committing in the solution of the last stage (except for the first). Analogous to the comparisons made for the simulations presented in Tables 4 and 5, we also compare the results obtained from the application of the proposed algorithm with another simulation in which committed GUs and active power dispatch results of Phase 1 are fixed through the execution of the algorithm. Fig. 12. compares the turbined outflow obtained for applying the proposed algorithm (denoted as REF) and for simulations that take Phase 1 GU commitment and active power dispatch as constants (shown as PH1). Based on these results, observations similar to those made for Case 1 can be derived.  In the REF case, the total turn-on/off for the whole period was 20, while for the PH1 case, the total was 12. Thus, such a reduction is expected because the transmission optimization does not interfere with the commitment of the GUs, so minimizing switching operations is a priority over transmission losses. Furthermore, as O R = 0, the optimal solution aims to balance the transmission losses, hydraulic efficiency, and the number of switching operations. Consequently, the relative magnitudes of the O R , O W , and O L parameters influence the results.  results obtained with the parameterized Phase 1 dispatch (PH1). Thus, this would be equivalent to comparing results obtained from the presented method with results obtained from a conventional hydro RTD (i.e., without transmission system modeling). In contrast, in this case, AC power flow features are subsequently addressed through a conventional reactive OPF that takes hydroRTD dispatch data as parameters. Note that, in this last case, the grid operation can have no direct impact on hydraulic efficiency. Naturally, although not often, conventional hydro RTD problems can include some transmission system models, whereas the DCPF is a widely applied strategy. Therefore, some simulations that consider the introduction of basic DCPF modeling in the Phase 1 subproblem were performed to further evaluate the impact of high-precision AC grid-connection modeling on hydro RTD. Thus, the proposed strategy is compared to the equivalent of an RTD with DCPF modeling (transmission loss minimization is also considered), followed by a conventional reactive OPF. Data from the rolling horizon case were employed again. Table 8 summarizes the overall results obtained for the three cases: REF, PH1, and DC. The DC case considers fixed data provided by a new phase 1 sub-problem, in which a DCPF model is introduced in the formulation.
The application of a basic DC model requires less computational effort. In addition, as observed from the table above, the DC model makes the problem sensitive to transmission operation, which compromises power generation efficiency, grid operation, and GUs start-ups/shutdowns. However, because of the quality of the approximations, the solution strategy proposed in this work can provide better loss reductions, ensuring that power targets are met at delivery buses more accurately and, most importantly, evaluate the feasibility guarantee of the dispatch regarding the profile of reactive power flow, which is crucial in this system.

E. QUALITY OF THE ACPF APPROXIMATION
Additionally, to demonstrate the quality of ACPF linearizations, in this section, we compare the convergent and equivalent static ACPFs. Given an OPF solution, the active/reactive power dispatch derived from the optimization problem is used as a free-voltage input parameter in a static ACPF analysis. Once again, the data from the rolling horizon simulations are applied, where three metrics are evaluated, concerning the results observed for each of the stages analyzed, for all buses in the system: • Maximum/mean deviations between active/reactive dispatch in the OPF solution and active/reactive injection obtained from the application of the voltage components derived from ACPF analyses in (5) and (6).
• Maximum/mean deviations between voltage components derived from ACPF analyses and the voltage component values at the OPF solution; • Maximum/mean (among all stages) deviations between total transmission losses estimated in the objective function of the OPF and the losses computed with ACPF analysis. The results are listed in Table 9. Note that all deviations are within the margins of tolerance that can be applied for classical static ACPF analysis.

VII. CONCLUSION
Accurate transmission system modeling is crucial for the optimal real-time operation of hydroelectric power plants. This paper presented a three-step strategy to extend the conventional hydro RTD problem by introducing the ACPF equations, which allow for the combined optimization of hydraulic efficiency, GU commitment, and transmission losses. The formulations are based on well-known techniques, and widespread general-use tools can be conveniently applied, making the methodology proposed seamlessly compatible for within-site applications. The case of SAHP is analyzed in detail, given its many peculiarities, making realtime operation challenging. The computational burden of the ACPF equations is exemplified by numerical simulations, indicating that a ten-fold increase in processing time is possible, depending on the formulation and parameters. The grid operational profile in the SAHP case can have relevant impacts on the hydro unit commitment, transmission losses, and even in guaranteeing transmission feasibility. With this work, the authors sought to demonstrate that the integration of precise ACOPF assessment, within the context of hydro RTD optimization problems, can be conveniently achieved with the application of proper adaptations based on popular and well-established techniques. As further developments, the approach presented here could be explored in the context of other short-term dispatch problems where hydraulic efficiency is distinctly relevant, most noticeably the day-ahead HUC.