## 2 Materials and Methods
### Simulation, Optimization, and Sensitivity Analysis
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Winery** & **Irrigation** & **Pip Farm** & **Single-Family** & **Second Home** \\  & & **Pumping** & **Pig Farm** & **Home** & **Second Home** \\ \hline Mounting & On the roof & On the ground & On the roof & On the roof & On the roof \\ Orientation & Coplanar & Optimal & Coplanar & Coplanar & Coplanar \\ Azimuth & \(-45^{\circ}\) and \(135^{\circ}\) & \(0^{\circ}\) & \(-5^{\circ}\) & \(5^{\circ}\) & \(-90^{\circ}\) and \(90^{\circ}\) \\ Tilt & \(20^{\circ}\) & \(25^{\circ}\) & \(20^{\circ}\) & \(20^{\circ}\) & \(20^{\circ}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Orientation of the PV panels. Regarding batteries, the operating parameters are indicated in Table 4, according to their data sheets and the assigned design criteria. For the simulations of PV systems, it was imposed that 100% of the demand must be satisfied and that the autonomy of the system must be at least one day. This limited autonomy was chosen to intraday storage will be the main function of the battery in the system, leaving aside in this study medium- and long-term storage. In simulations of hybrid systems, the minimum autonomy condition was not necessary, due to the presence of a diesel genset. The economic parameters, based on the European Monetary Policy [44], for the simulation are shown in Table 5.  
All the loads are single-phase AC in the homes and three-phase AC in the winery, pumping, and pig farm. In all cases, the architecture of the energy systems corresponds to an AC bus, to which all the elements are directly or indirectly connected. Thus, the PV panels are connected through a solar inverter and the battery through a battery bi-directional inverter. In the simulations of hybrid systems, the diesel generator is connected directly to the AC bus. Figure 4 shows the block diagram of PV systems and hybrid systems. The battery inverters are responsible for maintaining the parameters of the AC bus, i.e., 230 V 50 Hz in single-phase or 400 V 50 Hz in three-phase. For three-phase, a cluster formed by three synchronized inverters with 120\({}^{\circ}\) phase shifts between them is used. They also manage the flow of power from the 48 V DC battery, charging or discharging it. The PV modules are PERC (passivated emitter and rear cell) technology [45] and polycrystalline silicon cells. The output of the PV strings, of DC with variable voltage and current, is connected to the AC bus through a single-phase or three-phase solar inverter, which incorporates a maximum power point tracker (MPPT). For lead-acid batteries, individual 2 V cells of the OPzS type (vented tubular plate flooded cells) were used. Each battery consists of 24 identical cells connected in series. The simulation software chooses cells of higher or lower capacity. For Li-ion batteries (LiFePO4), 48 V modules were used that can be connected in parallel. Regarding battery degradation, the model described by [PERSON] et al. [12] was used for lead-acid batteries, because it was identified as the most accurate in a study [11] prior to this one. For Li-ion batteries, the models of [PERSON] et al. for cycle aging [24] and [PERSON] et al. for calendar aging [25] were used. \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Lead-Acid** & **Li-Ion** \\ \hline Maximum DOD allowed & 80\% & 90\% \\ Cycling efficiency & 85\% & 95\% \\ Design life & 20 year & 15 year \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Operating parameters of the batteries. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **PV Panels** & **Lead-Acid Batteries** & **Li-ion Batteries** \\ \hline Acquisition cost \({}^{1}\) & 900 \(\upbar\)/kWp \({}^{2}\) & 189–297 \(\upbar\)\(\upbar\)\(\upbar\)\(\upbar\)\(\upbar\)/kWh \({}^{3}\) & 483–500 \(\upbar\)\(\up  
Finally, for each one of the five cases, the simulation processes were carried out and the optimal configuration was found for the two modalities, PV and hybrid systems.