## 2 Multifocused Analysis Methodology
### PV System Configuration and Surplus Energy Estimation  
Presently, customers of electricity that have installed energy sources at their households are transformed into 'prosumers' [51]. As was previously discussed, different countries use diverse schemes of support for 'prosumers' [52]. In fact, diverse mechanisms supporting the self-consumption of electricity in key countries all over the world and to highlight the challenges and opportunities associated with their developments have been recently discussed by the IEA [53]. Under this framework, the present section characterizes the sale of energy from PV installations, which supplies energy for agricultural irrigation by groundwater. This characterization process starts with an initial database, where the energy demanded by the irrigated area and the energy-demanding facilities are estimated. Subsequently, a preliminary configuration of the PV facility is determined by including the type of technology (Mono-Si, Te-Cd...), solar tracking options, connection to the grid, and injection of surplus energy to the grid. Other parameters such as depth of the aquifer, plot grouping, and water needs of crops are also taken into account [9]. It is then possible to estimate the rate power of the PV installation under different groundwater pumping scenarios, which depend on the depth of the aquifer level, the averaged crop water demand, and the hydraulic system pressure. For the purpose of comparing different alternatives, the rate power required by the pump is first estimated (\(P_{p}\)) [54]:  
\[P_{p}=\frac{H_{t}\cdot Q_{mx}\cdot\rho\cdot g}{\
u_{MP}}\ \to P_{d}=\frac{P_{p}\cdot K_{d}}{\
u_{d}}\ \to P_{g}=P_{d}\cdot K_{g} \tag{1}\]  
where \(H_{t}\) is the total dynamic head (m), \(Q_{mx}\) is the maximum flow rate (m\({}^{3}\)/s), \(r\) is the water density (kg/m\({}^{3}\)), \(g\) is the earth's gravitational acceleration (m/s\({}^{2}\)), and \(\
u_{MP}\) is the pump efficiency (%). For PV solar power estimations (\(P_{PV}\)), the following expression is proposed [55]:  
\[P_{PV}=\frac{E_{dem}}{E_{(\alpha,g)}\cdot\overline{PR}} \tag{2}\]where \(E_{dem}\) is the expected averaged energy consumption (kWh/day) by considering the crop water need, \(E_{(\alpha,\beta)}\) is the expected averaged energy production of a PV power plant from an average monthly value of a typical daily irradiation on the horizontal surface (kWh/m\({}^{2}\).day) and \(PR\) is the performance ratio of the PV installation. The surplus energy from the PV pumping system can be then determined from the global PV-generated power and the global crop water need:  
\[Se_{(x,y,z)}=\sum_{k=1}^{k=8760}\frac{E_{gen}(k)-E_{dem}(k)}{1000} \tag{3}\]  
where \(Se_{(x,y,z)}\) is the surplus annual energy (MWh/year), \(x\) is the aggregated areas (ha), \(y\) is the phreatic level of groundwater depth (m), \(z\) the global crop water need (m\({}^{3}\)), \(k\) is hours in a year, \(E_{gen}\) is the energy produced in a specific \(k\)-hour (kWh), and \(E_{dem}\) is the energy demanded in a specific \(k\)-hour (kWh).  
The next step is to apply the rules and requirements to enable pouring surplus energy into the electricity grid, determining the economic values to consider possible economic retribution. At this point, as discussed in the introduction, the net-mtering is differentiated by applying the prices of the electricity market and self-consumption defined and regulated by the corresponding national authorities. The following section describes the case study, which focuses on current Spanish legislation. Nevertheless, the proposed methodology can also be applied to other legislative frameworks under different national authority requirements.