Water-Energy Management for Demand Charges and Energy Cost Optimization of a Pumping Stations System under a Renewable Virtual Power Plant Model

: The e ﬀ ects of climate change seriously a ﬀ ect agriculture at di ﬀ erent latitudes of the planet because periods of drought are intensifying and the availability of water for agricultural irrigation is reducing. In addition, the energy cost associated with pumping water has increased notably in recent years due to, among other reasons, the maximum demand charges that are applied annually according to the contracted demand in each facility. Therefore, very e ﬃ cient management of both water resources and energy resources is required. This article proposes the integration of water-energy management in a virtual power plant (VPP) model for the optimization of energy costs and maximum demand charges. For the development of the model, a problem related to the optimal operation of electricity generation and demand resources arises, which is formulated as a nonlinear mixed-integer programming model (MINLP). The objective is to maximize the annual operating proﬁt of the VPP. It is worth mentioning that the model is applied to a large irrigation system using real data on consumption and power generation, exclusively renewable. In addition, di ﬀ erent scenarios are analyzed to evaluate the variability of the operating proﬁt of the VPP with and without intraday demand management as well as the inﬂuence of the wholesale electricity market price on the model. In view of the results obtained, the model that integrates the management of the water-energy binomial increases the self-consumption of renewable energy and saves electricity supply costs.


Introduction
Since 1998, the Spanish electricity market has been liberalized, which means that both the generation of electricity and the purchase of energy by consumers are open to competition. Liberalization seeks to achieve greater efficiency in investments and operation of electrical systems and thus reduce costs and increase the quality and reliability of electricity supply. In this current legal framework of the electricity sector, all consumers, in addition to paying for the purchase of energy in the hourly production market, are obliged to pay some charges (network access fees) for the use of transportation and distribution, regulated by the Spanish government. This scheme of liberalization of the electricity sector is the same as that followed in all developed countries.
The access charges collect revenue to cover the costs of the regulated activities of transport and distribution of electricity and revenue for other regulated costs of the electricity system. The access tariffs are divided into two terms: an annual charge for the contracted demand (€/kW) and an hourly charge for the energy consumed (€/kWh).

Problem Statement
The high energy cost together with the uncertainty about the availability of water resources to meet the demand creates a risk to the economic viability of the water supply and distribution facilities for irrigation since energy has become the main cost factor of m 3 of water for farmers in many regions. In this context, the efficient joint management of energy and water in agricultural operations is essential to minimize energy costs.
In relation to water management, during the irrigation campaign, the irrigation communities request the necessary flow for each day. The existence of internal regulation ponds is essential to adapt to the availability of the resource and the water demand over time.
Irrigation communities follow different pumping strategies. On the one hand, there are pumping stations that collect water from canals at one or more points, temporarily storing it in reception ponds for gravity irrigation or by direct pumping. Other communities, however, have a water storage pond, which allows for temporarily storing a quantity of water that satisfies the irrigation in the following days. In this case, the water is taken from the regulation canals to a water reception pond, and from there, the water is raised by means of a pumping station to the water storage pond. From the water storage pond, the water is distributed by gravity to the different irrigated areas (see Figure 1). The real study system consists of 27 pumping stations connected to the electricity distribution network, with a high-voltage access tariff of six periods. The hourly demand for electricity is manageable in 10 of the pumping stations, since they have storage for the efficient management of water in a water storage pond, while for the rest of the pumping stations the hourly demand for electricity is known (direct pumping). We refer to the first 10 pumping stations as manageable, since they are able to schedule the water pumping during the hours of a day while satisfying the daily irrigation needs (see Figure 1b), whereas the other 17 pumping stations are considered unmanageable as they must meet the required water demand for irrigation each hour (see Figure 1a). It should be noted that the 27 pumping stations act as a single entity that participates in the OMIE electricity market, allowing the contracting of a single maximum power in each pricing period.
On the other hand, from the point of view of power generation, the study system consists of a wind farm and six hydroelectric plants that evacuate their production to the region's electricity grids and 27 self-consumption photovoltaic plants located next to the pumping stations. First, these self-consumption photovoltaic plants should meet the local demand of each pumping station. Subsequently, in the case of excess generation, PV plants will export the rest of the energy produced to the distribution network. Figure 2 shows the energy flow of the proposed VPP model. Each subsystem (B) consists of a pumping station connected both to the grid and to a self-consumption PV plant. On the other hand, the global system (A) receives the energy flow from the wind farm and hydroelectric plants, and also from the subsystems. The actual data of the study system are shown in Appendix A. As introduced in Section 1, this work aims to develop a mathematical model to maximize the operating profit of a VPP for a whole year by optimizing the annual contracted demand of the hourly management of water consumption and electricity from the pumping stations and from the electricity production resources. The VPP participates in the OMIE wholesale electricity market for the purchase and sale of electricity in real time.

Mathematical Model
The optimization model is a problem with 80 continuous variables and 63 integers in each hour. The optimization model returns, in each hour, the optimal values of the binary integer variables for decision making in the problem: • import/export of energy from the global system (I i imp /I i exp ) • import/export of energy from each pumping station with self-consumption (I i in,k , I i in,v,j /I i out,k , I i out,v,j ) • excess power (I i exc ) The model also returns, in each hour, the optimal hourly values of: • production of electricity from its own sources with renewable energy: hydroelectric, wind, photovoltaic (P i W , P i H , P i PV,k , P i PV,v,j ) • energy imported/exported from the global system (P i imp /P i exp ) and subsystems (P i in,k , P i in,v,j /P i out,k , P i out,v,j ) • hourly electricity demand in each pumping station with water storage (P i D,v,j ) In addition, the annual optimal values of the contracted demand are obtained in each pricing period (P c,p ).
As highlighted in Section 1, an important novelty of this work is the integration of water management with energy, as well as the optimization of the annual contracted demand to minimize energy costs. In this way, a more complete and realistic exploitation model is offered for the study system.
Next, the terms that make up the objective function and the constraints that the variables of the problem must meet are presented.

Objective function
Energies 2020, 13, 2900 6 of 21 The calculation of the optimization of the operating profit of the VPP is performed by formulating an objective function composed of the difference between income and costs of the study system (Equation (6)).
On the one hand, the objective function expresses the costs of producing electricity from renewable sources: In addition, the acquisition of energy is also allowed (P i imp,z ) at the hourly price of the wholesale electricity market (ρ i imp,z ) when there is no energy available in the system to meet the demand or if it is more economically profitable: On the other hand, the objective function also includes the costs of contracted demand in each pricing period, which are obtained as a product of the price of the power term of the access tariff f power,p (Table 1) by the annual contracted demand in each period (P c,p ).
Finally, the charges for excess demand are added, as indicated in Spanish legislation [44].
4· exc i r,p 2 (4) The imputed cost using the formula of Equation (4) occurs only when the net power demand at the evacuation point of the pumping stations (P i in,total ) exceeds the contracted demand in any hourly period. The excess power is calculated monthly and every quarter of an hour. In this case, it has been assumed that the same value is obtained for each quarter of an hour. K p is a dimensionless constant whose value depends on the pricing period, while K ex is a constant whose value is 1.4064 €/kW. Table 1 shows the prices of the annual power term for the high-voltage access tariff of six periods ( f power,p ), as well as the values of the coefficient K p for the calculation of excess demand charges.
On the other hand, the income of the system comes only from selling surplus energy to the electricity market (P i exp,z ) at the hourly market price, resulting in daily auctions organized by the Spanish wholesale market operator OMIE (ρ i exp,z ).
Energies 2020, 13, 2900 7 of 21 In this way, the mathematical optimization problem, whose objective function is formulated in Equation (6), calculates both the optimal hourly dispatch of the virtual power plant over 365 days of the year and the optimal annual contracted demands.
• Constraints Equations (7)-(9) show the energy balances of the global system (A) and of each subsystem (B) (see Figure 2). As regards demand management, Equation (10) indicates the fulfillment of daily demand, while Equation (11) limits the hourly demand in each of the pumping stations with water storage.
The variables of wind and hydroelectric generation can vary between 0 and a maximum value defined according to the availability of renewable resources, as shown by Equations (12) and (13).
The model supports both the purchase and sale of energy to the electricity market according to the optimal economic situation in each hourly period, but both operations can never occur at the same time (Equation (14)). Equations (15)-(18) establish the variation range of the energy import and export variables to the distribution network.
Energies 2020, 13, 2900 8 of 21 Regarding the pumping stations with photovoltaic self-consumption, Equations (19)- (22) show the range of variation of the incoming/outgoing energy in each of them. Equations (23)-(24) prevent the export and acquisition of energy from the pumping stations from occurring simultaneously.
In regard to the optimization of demand charges, Equation (25) limits the maximum demand contracted in each pricing period. In high voltage charges, legislation requires that the demand contracted in a pricing period (P c,(p+1) ) must always be greater than or equal to the demand contracted in the previous pricing period (P c,p ) [44]. Equations (26)-(29) set the restrictions for the billing of excess power. A variable is defined (exc i r,p ) that will only consider the excess power when the power demanded in the system (P i in,total ) in each hour of the period p exceeds the demand contracted in that period. In order to make this decision, a binary variable (I i exc ) will take a value equal to 1 when excess power occurs; otherwise, it will take a value equal to 0. The parameter M represents the positive upper bound of the excess power restriction, exc i p , while parameter m is its negative lower bound.
According to the characteristics of the optimization problem described above, it is of type mixed-integer nonlinear because integer variables and nonlinear constraints are defined in the model.
For the resolution of the proposed problem, LINGO was used, a calculation software suitable for modeling and solving nonlinear mathematical optimization problems efficiently [46]. This software uses the branch-and-bound method [47] to favor obtaining a global optimal solution and, thus, avoid local optimal solutions. This technique allows us to implicitly enumerate all possible combinations of integer variables. Upper and lower bounds of the value of the objective function are generated, which are approximated to each other. This process fundamentally consists of dividing the total set of feasible solutions into smaller subsets of solutions to facilitate the search for a global optimum. The execution of the model ends when it is not possible to make further divisions of the problem, or the difference between the lower and upper bound of the target value is less than a pre-established tolerance. This method allows the optimal selection of the next subset so that valid solutions are found more efficiently.
It is worth mentioning that LINGO allows us to develop a model in a similar way to the standard mathematical notation. In addition, this software can integrate a large amount of data into the model from external spreadsheets to facilitate data management. According to the formulation of the problem, Energies 2020, 13, 2900 9 of 21 LINGO invokes the appropriate internal solver to search for the optimal solution to the proposed model. Once it determines the optimal solution (if any), it provides a solution report with general information about the model and the values for all variables. For our problem, LINGO returned a globally optimal solution. As expected, being a nonlinear model with a large number of variables, this optimization procedure required a long computation time. The calculation time of each case was 630 min, using a computer with an Intel ® Core i7 processor, 3.00 GHz CPU and 16 GB of RAM.

Data
The model proposed in Section 3 was applied to a real case study, consisting of different energy infrastructures, with both consumption and electricity generation assets. The system consisted of 27 water pumping stations for agricultural irrigation, located in a dispersed manner in a geographical area of 135,000 hectares in Spain, which consumed annual electricity of 39 GWh, according to real data recorded in 2017 (see Figure 3). The system integrated different renewable electricity generation units, both hydroelectric and wind and photovoltaic, with a total installed capacity of 60.2 MW. Table 2 shows the total data of the demand and the generation facilities, as well as the production costs that have been considered in the model. See Appendix A for a more detailed description of the data used here. In the case study, the hourly prices of the Spanish wholesale electricity market in 2017 were published by the market operator OMIE [48].

Results and Discussion
The mathematical problem of nonlinear mixed-integer programming allows us to optimize the cost of the system and to calculate as a result the optimal hourly value of 143 variables of the model during each hour of a year. It should be noted that six variables were of the integer type, associated with the optimal annual contracted demand in each pricing period, and 57 variables are of binary integer type, taking a value of 0 or 1, associated with the decisions to import or export electricity in the different subsystems and in the joint system. These variables allow the decision to obtain the optimal economic exploitation of the system, minimizing the cost in each hourly period. Figure 4 presents the results of the optimal dispatch for a day in June. As can be seen, the VPP purchases the necessary energy in the electricity market when it cannot deliver the requested demand with its own sources of renewable generation. The main parameters for the analysis of the results obtained are the electricity values, such as generation, import and export of the system, and the hourly distribution of the manageable demand of the pumping stations. In addition, the costs of the energy consumed and the demand recorded will be analyzed according to the optimal contracted demand in each pricing period. Pricing periods are distributed across the year as they are established by the regulation of network access tariffs (see Table 3). In order to evaluate the results obtained from the proposed model, the problem was initially solved considering the data of the electrical demand to be satisfied at each hour in each pumping station, without considering the possible intraday management of the demand of some pumping stations. In other words, in this first case study (case 1), the demand is known every hour, and therefore, it is not a variable to be optimized. Table 4 shows the distribution of demand according to the month and pricing period without taking into account the demand management in the model.  Total   P1  13  10  ---316  754  ----30 1124 Total   88  125  74  102  452  601  1239  1617  2834  3945  4459  5910  7372  9849  10,647  10,647  3475  4480  941  1128  145  210  307  391  32,032  39,003 On the other hand, Table 5 shows the results in the case of the system with manageable intraday demand proposed in this article. Comparing both tables and analyzing the results in the months of greatest demand (mainly June and July), it is observed that, in the case of the system with intraday demand management (see Table 5), there is a large increase in consumption in period 1, and lighter, in periods 3 and 4, corresponding to the hours with the highest solar radiation. This is caused by the greater self-consumption of photovoltaic power by the system. By favoring self-consumption, there is more efficient management of demand throughout the hourly periods of access tariffs, decreasing consumption in period 6, which has a lower cost but corresponds mainly to night hours where all available production resources cannot be taken advantage of.  Figure 5 represents the values reflected in the previous tables from a more graphic point of view for the annual demand according to the pricing periods, observing for the case with manageable demand an increase of 65.62% in the demand of period 1 and a decrease of the demand of period 6. Conversely, in the months of lower demand, consumption slightly increases in the cheaper periods, thus minimizing energy costs. In short, intraday demand management adapts the consumption curve of pumping stations to the generation curve of renewable energy sources, since the most efficient VPP is that in which self-consumption is closest to 100%. In this case, it is possible to cover 99.64% of the annual demand through the self-consumption of the electricity generation itself ( Table 6). The remaining 0.36% of annual demand corresponds to hours where the cost of generation is less competitive than the cost of acquiring electricity in the electricity market.  Regarding the production results, it is verified that a higher percentage of energy produced is self-consumed thanks to intraday management. As shown in Table 6, the demand is covered with the same production as in the case without manageable demand, but reducing the imported power (P imp ) considerably and slightly reducing the exported power (P exp ). Therefore, it is shown that it is more efficient to self-consume than to export, whenever possible, achieving in this situation that the VPP is able to cover 99.64% of its demand with its own generation compared to 94.60% without intraday management.
From the analysis of the results obtained associated with the optimal contracted demand in each pricing period (see Tables 3 and 7), it is observed that with the proposed demand management model, it is possible to reduce the peaks of maximum demand and flatten the curve of daily demand. In this way, the maximum contracted demand annually in the most expensive hourly periods is reduced, as well as the excess power, and, consequently, the operating profit of the VPP is increased (see Table 8). It is worth remembering that the contracted demand values in each of the six pricing periods must be maintained by law for one year.
The maximum demand contracted in period 6 is much higher than the rest of the contracted powers since the irrigation communities of the analyzed system concentrate on average 80% of their consumption in this period. Period 6 includes 5048 annual hours, which include, among others, those corresponding to the entire month of August (Table 3). In this month, there is a high demand for energy along with the lower cost of acquiring electricity. For this reason, the intraday demand management strategy allows us to reduce the contracted demand in the most expensive periods while increasing in period 6. In this way, the contracted demand is better adjusted to the demand of the facilities and, as a consequence, excess power is reduced. Table 8 compares the results of the income and costs of the case studies. According to the demand charges, in both cases, the costs for excesses in the contracted demand are higher than the costs per fixed power term. This is because the power needs have a seasonal variation in the farms since a high power is needed to pump the water in the months of the irrigation season (May to September) and a minimum power the rest of the year. However, the obligation to contract electric power throughout the year and the high cost of the fixed term of annual power make it profitable to contract a lower electric power than the maximum demanded annually even at the cost of assuming a cost of the penalty for excess power.
In view of the results of the integration of intraday demand management in the model, there is a reduction in the production cost (−4.72%), the fixed cost of contracted demand (−8.39%) and the cost of power excesses (−2.73%). Income also decreases, but to a much lesser extent (−0.87%), and as a consequence, the operating profit of VPP increases (3.20%). This trend can be seen in a more graphic way in Figure 6. In addition, as seen in Table 6, less energy is exported to the grid (−1.37%), although income is not reduced in the same proportion (−0.87%), which means that a better economic performance is obtained from selling exported power.

Analysis of the Influence of the Electricity Market Price
In addition to solving the models with and without intraday demand management, other scenarios were studied to evaluate the influence of the Spanish wholesale electricity market OMIE on the proposed model. As a reference, the prices of the wholesale electricity market of 2017 have been taken, while in order to determine the variations that are applied to these prices, a historical study of the evolution of the average price of electricity in the last ten years was carried out. For this analysis, the most extreme cases were considered, obtaining a percentage difference of +10% and −30% with respect to the average price of the year 2017.
Regarding the results of power generation, export and import (see Table 9), for case studies 1.3 and 2.3 with a lower price in the electricity market, the production of available power decreases, since it is more profitable to stop producing to export, to continue generating to sell energy at a price lower than the cost of generation. The opposite occurs when the price of the electricity market increases. The main differences are observed in the amount of power imported from the grid since for cases of unmanageable demand (cases 1.1, 1.2, 1.3), it remains constant in the face of possible changes in the price of the electricity market. Generation costs remain more competitive than the energy purchase price set by the electricity market even when the market price is reduced by 30%. In addition, in these cases, energy balances must be satisfied, and demand must be met at all times. , it is observed that, for the situation of a low market price (case 2.3), the system tends to self-consume as much as possible and avoid exporting power to the distribution network. It should be remembered that the model always seeks to maximize the percentage of self-consumed power and import the least amount of power possible from the grid, so for a reduction of 30% of the market price, the power imported from the grid decreases by 12.85%. Flexibility in demand allows for more efficient management of renewable resources and reduces energy dependence. Despite the intraday demand management, in all the cases studied, the VPP is not able to completely cover its demand with renewable energy sources, since in some hours of analysis, the energy balance cannot be met by any technology generation due to technical production constraints, or it is more economical to purchase power from the electricity market.
On the other hand, Table 10 shows the results of the optimal contracted demand in the face of variations in the electricity market price. As expected, when the demand is known (cases 1.1, 1.2, 1.3), the values do not vary, since it must be remembered that in this case, the demand is a condition to be satisfied in each hour and, therefore, is not a variable to be optimized. However, intraday demand management (cases 2.1, 2.2, 2.3) optimizes contracting for each market situation. As shown in Table 9, at a lower OMIE market price (case 2.3), demand and available production resources are managed more efficiently, increasing self-consumption as much as possible, which causes period 6 to be slightly reduced, and as a consequence, the maximum demand contracted in this period is also reduced. As will be seen later in the economic results shown in Table 11, this situation causes a decrease of 0.72% in the costs of the power term, although an increase of 2.31% in the power excesses. However, due to the seasonality of demand in irrigation and high power costs, it is necessary to find the economic balance between both terms, and it is generally more profitable to minimize the contracted demands and incur costs due to excess power.
Regarding the income of the system, it is observed that by increasing the price of the OMIE electricity market, the general trend is to increase the income of the system due to the increase in energy production for its subsequent export to the grid at a higher selling price, see Table 11 and Figure 7. On the other hand, regarding the costs of the system, the influence of intraday demand management is fundamentally appreciated in the production costs with a variation of 0.18%, −0.99% with respect to the cases +10% OMIE and −30% OMIE, respectively, percentages lower than those obtained for cases of unmanageable demand (0.38%, −1.45%, respectively), since the model always tends to seek the optimal value of energy self-consumed, by virtue of which it manages the demand and consequently the optimal profit.

Conclusions
Improving the competitiveness of farms requires the development of new innovative strategies for water and energy management. The availability of natural resources to produce sustainable electricity is being used in irrigation communities to promote new investments that make the supply of electricity to water pumping stations more economically and environmentally sustainable. The model proposed in this study of the virtual power plant (VPP), with the integration of the joint management of water and energy, covers up to 99.64% of the electricity demand with its own renewable energy sources.
The analysis of the results shows that it is more economically efficient to self-consume as much electricity as possible and avoid exporting energy to the grid. As a consequence, the consumption curve of the pumping stations adapts to the curve of electricity generation with renewables, provided that the generation costs are more competitive against the purchase price of energy in the electricity market. In addition, it is possible to increase the use of electricity production with renewable energy and reduce the peaks of maximum demand, thus increasing the operating profit of the VPP by reducing the maximum demand contracted annually in the hourly periods with higher energy costs.
This approach may be useful not only for the case presented in this research, but also for other cases of distributed power generation sources, which are not necessarily connected on-site to the load but belong to the same owner or a joint venture that would benefit from working together as a single operator in the electricity market. In particular, the proposed model could be applied to a group of industrial companies where electricity and other supplies (water, heat) must be managed together with their own power generation resources, even if those electricity production facilities are spread over a large geographical area. Further research should also address the new paradigms of demand response aggregation and energy communities that can be modeled under a virtual power plant scheme.    binary variable equal to 1 if power is exported from the global system; otherwise, it will be equal to 0 I i imp binary variable equal to 1 if power is imported to the global system and, otherwise, it will be equal to 0

Conflicts of Interest: The authors declare no conflict of interest
binary variable equal to 1 if power is imported to the pumping stations k/j and, otherwise, it will be equal to 0 binary variable equal to 1 if power is exported from pumping stations k/j and, otherwise, it will be equal to 0 P c,p demand contracted in each pricing period p (p = 1.6) (kW) exc i r,p positive excess power in each pricing period p (p = 1.6) (kW) exc i p excess power in each pricing period p (p = 1.6) (kW) I i exc binary variable equal to 1 if excess power is produced; otherwise, it will be equal to 0 P i in,total total hourly incoming power from the general bus to pumping stations (kWh)  binary variable equal to 1 if power is exported from the global system; otherwise, it will be equal to 0 I i imp binary variable equal to 1 if power is imported to the global system and, otherwise, it will be equal to 0

Appendix A
binary variable equal to 1 if power is imported to the pumping stations k/j and, otherwise, it will be equal to 0 binary variable equal to 1 if power is exported from pumping stations k/j and, otherwise, it will be equal to 0 P c,p demand contracted in each pricing period p (p = 1.6) (kW) exc i r,p positive excess power in each pricing period p (p = 1.6) (kW) exc i p excess power in each pricing period p (p = 1.6) (kW) I i exc binary variable equal to 1 if excess power is produced; otherwise, it will be equal to 0 P i in,total total hourly incoming power from the general bus to pumping stations (kWh)  binary variable equal to 1 if excess power is produced; otherwise, it will be equal to P i in,total total hourly incoming power from the general bus to pumping stations (kWh)   binary variable equal to 1 if power is exported from pumping stations k/j and will be equal to 0 P c,p demand contracted in each pricing period p (p = 1.6) (kW) exc i r,p positive excess power in each pricing period p (p = 1.6) (kW) exc i p excess power in each pricing period p (p = 1.6) (kW) I i exc binary variable equal to 1 if excess power is produced; otherwise, it will be P i in,total total hourly incoming power from the general bus to pumping stations (kW    binary variable equal to 1 if power is exported from the global system; otherwise, it will be equal to 0 I i imp binary variable equal to 1 if power is imported to the global system and, otherwise, it will be equal to 0

Appendix A
binary variable equal to 1 if power is imported to the pumping stations k/j and, otherwise, it will be equal to 0 I i out,k /I i out,v, j binary variable equal to 1 if power is exported from pumping stations k/j and, otherwise, it will be equal to 0 P c,p demand contracted in each pricing period p (p = 1.6) (kW) exc i r,p positive excess power in each pricing period p (p = 1.6) (kW) exc i p excess power in each pricing period p (p = 1.6) (kW) I i exc binary variable equal to 1 if excess power is produced; otherwise, it will be equal to 0 P i in,total total hourly incoming power from the general bus to pumping stations (kWh) Energies 2020, 13, 2900 18 of 21 Table A1 shows the electricity consumption during 2017 of the 27 pumping stations that make up the study system.  Table A2 shows the installed power of the hydroelectric plants that make up the study system.  Table A3 shows the power of the self-consumption photovoltaic installation in each of the pumping stations.  Table A4 shows the most detailed data of the renewable generation facilities according to the hourly periods of the contracted access charge. Table A4. Annual generation data according to hourly periods (MWh).