Analysis of PV Self-Consumption in Educational and Ofﬁce Buildings in Spain

: As grid parity is reached in many countries, photovoltaic self-consumption is raising great interest. Currently, there is a big number of new projects being developed in Spain thanks to the new regulation. From the experience of the monitoring of one full year of operation of a self-consumption PV plant in a university building, a regulatory, energy, and economic analysis is made for this type of building. It has been carried out by simulating the behavior of the building with installations within the range of PV powers allowed in the Spanish regulation. The analysis shows the good ﬁtting between the new Royal Decree of Self-Consumption and the new Building Code. The economic analysis proves that the new simpliﬁed compensation method gives the best economic return for this use of the buildings when the PV production is matched with the consumption. The time of return of investment is between 8 and 9 years, and the levelized cost of electricity (LCOE) is into the range of the pool market price of electricity. These results show the proﬁtability of PV self-consumption for this type of building.


Introduction
Nowadays, energy conservation is an important concern, leading to initiatives in both efficiency and use of renewable energy sources. One of the biggest energy consumers is the building sector, residential and commercial, accounting for about 40% of energy consumption and 36% of CO 2 emissions in EU with a potential reduction of 27% in emissions [1] and 28% of total energy in the United States [2]. The EU Directive on the energy performance of buildings stipulates that by 31 December 2020, all new buildings must be nearly zero energy buildings (NZEB). It is important to note that NZEB definition has to take into account the climate, building geometry, and patterns of use [3,4]. In line with the definition of NZEB, it is necessary to define a maximum level of energy demand and a minimum percentage of renewable energy. The EU Directive states that "the nearly zero or very low amount of energy required should be covered to a very significant extent by energy from renewable sources, including energy from renewable sources produced on-site or nearby" and that "the definition of nearly zero-energy buildings, reflecting their national, regional, or local conditions, and including a numerical indicator of primary energy use expressed in kWh/m 2 per year". Regarding their use, in Europe, the residential sector accounts for a 75% of the total stock in m 2 , and the remaining 25% is a more heterogeneous sector, being educational and office buildings a 40% of this sector [5].
Transposition of this EU Directive to the Spanish legislation is done by means of the renovation of the Spanish Building Code, more precisely in the Basic Document of Energy Saving and Efficiency [6]. This document states a limitation on the building electrical consumption based on climatic zones, use, and the extent of interventions, in case of renovation. It clearly points out that the electrical consumption must be supported by using renewable energy sources. Chapter 5 "Exigencia básica HE5: Generación minima de energía eléctrica" states the obligation to integrate systems of electric generation from costs passed to the prosumer (the infamous "tax on the Sun") and the threat of very high economic fines that discouraged commercial and industrial consumers from installing PV. This legislation is analyzed in more detail in [23][24][25]. Fortunately, a new regulation was approved in 2018 [26], and technical details were developed in 2019 [27], so it has become a driver of great interest in self-consumption on residential, commercial, and industrial consumers. This regulation marks the end of the "tax on the Sun", with exemptions of charges and tolls on self-consumed electricity, clearly defines collective self-consumption, introduces surplus simplified compensation (a sort of net billing), eases administrative procedures, and allows to install more PV power than the contracted access power. That results in a surge of interest on PV installations.
This work is based on the experience acquired from a full year monitoring of the self-consumption PV installation available in "E.U. Educación y Turismo" of University of Salamanca in the city of Ávila, Spain. It is intended to shed some light on the benefits of PV in buildings with similar use (educational, office, commercial). Detailed PV generation and grid exchange allows one to simulate the behavior of installations of different PV power and calculate the economic returns in accordance with the new Spanish regulation of electricity self-consumption considering and comparing the different compensation models in the case of discharge of surpluses. The results allow us to determine a fair time of return of investment, making PV attractive to users so the success of the new regulation and the Spanish Building Code can be expected.

Description of the Building and PV Installation
The study is carried out in the building of the University School of Education and Tourism of the University of Salamanca in Ávila (40 • 39 N, 4 • 41 W, altitude 1110 m). The building has 5660 m 2 built, and it is located on a plot of 13,042 m 2 . It currently has 750 students enrolled and 65 workers, including teachers, administration, and services staff. According to the technical building code, if the indicated building were to be built today, it would have to be equipped with a renewable energy installation with a nominal power of between 56.6 kW and 88 kW since the roof area is 1765 m 2 . With actual PV modules of efficiency around 19%, it is possible to install more than 70 kW on the roof.
The existing self-consumption photovoltaic installation is ground-mounted next to the building, it is located at the bottom right in Figure 1, and it is connected to the internal electrical grid. So, this photovoltaic system is in an urban environment, and local climatic conditions are of high irradiance and large daily temperature variations due to the altitude and the dry climate. The modules are in a fixed structure with a 45 • inclination and south orientation. This is a research installation for a long-term study of polycrystalline technologies and is made up of three photovoltaic fields of 3.3 kW peak, connected respectively to three Zigor Sunzet SP 3.3 kW inverters with two PV strings each. For the full year 2019 one string was disconnected, so the data corresponds to a peak power of 8.33 kW.

Description of the Electricity Retail Tariff
The electrical supply point of the building is a low voltage one, with a contracted power of 66 kW and at retail ATR 3.0 tariff, which is the low voltage rate with three time periods for maximum power above 15 kW. This rate is common in administrative, educational, and commercial buildings (when they do not have their own transformer). Accord-

Description of the Electricity Retail Tariff
The electrical supply point of the building is a low voltage one, with a contracted power of 66 kW and at retail ATR 3.0 tariff, which is the low voltage rate with three time periods for maximum power above 15 kW. This rate is common in administrative, educational, and commercial buildings (when they do not have their own transformer). According to the latest report from the National Markets and Competition Commission in 2019 there are 779,914 supply points in this rate, with a contracted power of 20,642 MW for period 2, and a total annual consumption of 37,081 GWh [28]. This rate does not make the difference between working days, holidays, and the month of August, unlike other rates which during holidays and in August establish the costs of the "valley" period. Table 1 shows the hourly distribution of the three periods for the winter and summer rates, together with the reference of hourly radiation for the solstices and equinoxes. In wintertime the "peak" period is in the afternoon, just after sunset, so solar production corresponds to the intermediate rate (flat). During summer hours, the "peak" rate coincides with noon, and those 4 h correspond to hours of high solar production, resulting in greater financial savings for self-consumption systems. The electricity bill in Spain for ATR 3.0 tariff is composed of four parts: a charge based on nominal contracted power (named access charge), a variable charge for energy consumed, a penalty for reactive power consumed and taxes. The taxes are a 5.11269632% electricity tax and 21% of VAT, resulting in total taxes of 27.50265248%. The variable charge for energy consumed is composed of two parts: tolls reflecting part of the costs of distribution services (at a price fixed by the Ministry of Ecologic Transition [29]) and the cost of energy. So, the cost of distribution services is charged through the access charge (fixed) and the cost of tolls included in the retail price of energy. The price of electricity as a commodity is the main part of the retail price of energy and includes the production costs and energy losses. The price of energy for the consumer depends on the electricity marketer company, and the consumer can choose among a variety of commercial offers that can be at a fixed or variable (indexed to the electricity pool market) price. Table 2 shows the access charge, tolls, and energy and retail prices (fixed) of two electricity marketers for the year 2019.

Data Collection
Data collection has been carried out through reading of bidirectional electricity meter, which stores incoming and exported electricity, and reactive power every 15 min. Moni-torization data for the PV installation includes inverter parameters (voltage, current, and power) and environmental parameters (irradiance, ambient and modules temperatures, wind speed, and direction). All PV data are acquired every second with a National Instruments Compact RIO system. From these values, it is easy to generate this data in a 15-min resolution. With data for imported, exported, and PV generated energy is possible to reconstruct the load profile of the building. The retail prices for the electricity (if they are not fixed) and the price for exported electricity are given hourly, so all data is converted to hourly resolution. In Figure 2, data of electricity consumption and PV generation are presented for the full year. The vertical axis corresponds to the number of the day and the horizontal to the ordinal number of the hour, ranging from 1 to 24 according to the Spanish electrical sector convention. From the load profile, the working schedule can be seen in Figure 2a (from 8 A.M. to 10 P.M.) as vertical bands, and weekends and holidays as horizontal bands. The highest consumptions are in the morning in autumn, winter, and spring. In summer, the building is closed for the first three weeks of August and in the afternoons during the month of July and the first half of September. The maximum hourly consumption is 45 kW. For the PV generation, it must be noted that in Spain the daylight-saving time (DST) is one hour in winter and two hours in summer, as can be seen in Figure 2b as a shift to the right in the center of the graphic. The maximum PV production is for the 14th hour in winter DST and for the 15th hour in summer DST, just in the lunchtime (in this college, classes in the morning ends at 2 P.M. and afternoon classes start at 4 P.M. Even when the PV peak power is small in comparison with the maximum demanded energy (7 kW vs. 45 kW), there is energy fed into the grid in some periods. The PV production and the energy interchange with the grid are plotted in Figure 3 for a typical week during the school year in late winter. The consumption pattern for the weekends is almost flat, with a minimum of about 4 kW during night and even less during the daytime. During working days, the minimal consumption is around 15-20 kW at lunchtime, just when PV production is peaking. Even when the PV peak power is small in comparison with the maximum demanded energy (7 kW vs. 45 kW), there is energy fed into the grid in some periods. The PV production and the energy interchange with the grid are plotted in Figure 3 for a typical week during the school year in late winter. The consumption pattern for the weekends is almost flat, with a minimum of about 4 kW during night and even less during the daytime. During working days, the minimal consumption is around 15-20 kW at lunchtime, just when PV production is peaking.
Even when the PV peak power is small in comparison with the maximum demanded energy (7 kW vs. 45 kW), there is energy fed into the grid in some periods. The PV production and the energy interchange with the grid are plotted in Figure 3 for a typical week during the school year in late winter. The consumption pattern for the weekends is almost flat, with a minimum of about 4 kW during night and even less during the daytime. During working days, the minimal consumption is around 15-20 kW at lunchtime, just when PV production is peaking.

Data Processing
From previous data, it is clear that even a small PV plant is capable of feeding energy to the grid. For plants under 100 kW, in Spain there is a net billing model. With this model, energy consumed from the grid is valuated at retail prices, but energy fed to the grid is valuated slightly under the electricity pool market price (about 1/2 or 1/3 of retail rate). For each month, the value of exported energy is subtracted from the cost of consumed energy, so there is an economic saving that adds to the saving of self-consumed electricity

Data Processing
From previous data, it is clear that even a small PV plant is capable of feeding energy to the grid. For plants under 100 kW, in Spain there is a net billing model. With this model, energy consumed from the grid is valuated at retail prices, but energy fed to the grid is valuated slightly under the electricity pool market price (about 1/2 or 1/3 of retail rate). For each month, the value of exported energy is subtracted from the cost of consumed energy, so there is an economic saving that adds to the saving of self-consumed electricity that is not purchased at retail price. The Spanish model does not allow a negative balance, so if this situation occurs, then the energy term will be zero in the monthly bill.
Bearing in mind the installed power mandatory with the new Spanish Building Code (56.6 to 88 kW in our case), the self-consumed fraction will be low. A good calculation of hourly produced and/or exported energy is of great importance for studying the economic return of the investment.
The data processing will be as follows: from the hourly data shown in Figure 2, the hourly load profile of the building will be calculated as being E i cons consumed energy E i in energy taken from the grid, E i PV PV generated energy and E srpl the surplus energy fed to the grid on the i th hour.
Electricity prices can be fixed, as shown in Table 1, or indexed to the electrical pool price. The pool price and the price for energy fed into the grid and the price for selfconsumption surplus fed into the grid are published by the Spanish grid operator "Red Eléctrica de España" in the web Esios [30,31]. With the hourly PV produced energy and energy fed into the grid, the hourly savings will be calculated as being Pr i ret the retail price of electricity, and Pr i srpl the price of surplus electricity on the i th hour.
In this building, the electricity contract is under the simplified compensation mechanism defined in the new self-consumption regulation [27]. The energy part of the electric bill follows the net billing scheme and will be computed according to Equation (3) Sustainability 2021, 13, 1662 The energy and economic balances for year 2019 are shown in Figure 4. The total PV production is 11,382 kWh, that means a productivity of 1371 kWh/kWp. This figure is representative of PV self-consumption installations in Spain, that are placed in urban environments, with shadings and non-optimal orientations. The economic balance includes a 5.11269632% electricity tax, and a 21% VAT. Yearly this amounts to 10,640 € of energy consumed from the grid, 1320 € of savings of self-consumed PV electricity and 118 € of PV surplus electricity fed into the grid. It is important to note the small amount obtained from surplus electricity, because it is 17% of PV produced electricity, it is only 8% of economic savings. This is because of the price of fed electricity is lower than retail price for the electricity consumed from the grid.  This data will be the starting point for a more general analysis, that can be useful in the process of sizing PV installations in this sector of edifications, both educational and commercial. Starting from the load profile and the PV production profile, the PV production profile and energy balance with the grid will be calculated for different nominal PV powers, ranging from 10 to 95 kW.
Using current prices for PV installations of these sizes in Spain, the time of return of investment and the Levelized Cost Of Electricity (LCOE) will be calculated. For the calculation of LCOE we will follow the procedure as exposed in [32] where are the costs, the energy produces and the discount rate. In this study, we will assume a lifetime of 25 years. The discount rate is chosen as 3%, in line with historical data for the Euro Area [33]. The installation costs include equipment, labor, local taxes and connection fees. Total costs include a replacement of the inverter at the 12th year. Due to the sizes of these installations, the operation costs will be zero and there will be a maintenance cost of 1% of the value of the installation paid on a yearly basis. This maintenance cost is between 7 and 9 €/kW yearly and fits well with published results [34]. Regarding the degradation of PV modules, it is considered a 0.8% based on the usual warranties given by PV modules manufacturers, the average climate in Spain and taking into account the extensive research on this topic [35]. This data will be the starting point for a more general analysis, that can be useful in the process of sizing PV installations in this sector of edifications, both educational and commercial. Starting from the load profile and the PV production profile, the PV production profile and energy balance with the grid will be calculated for different nominal PV powers, ranging from 10 to 95 kW.

Energy Balance
Using current prices for PV installations of these sizes in Spain, the time of return of investment and the Levelized Cost Of Electricity (LCOE) will be calculated. For the calculation of LCOE we will follow the procedure as exposed in [32] where C t are the costs, E t the energy produces and r the discount rate.
In this study, we will assume a lifetime of 25 years. The discount rate is chosen as 3%, in line with historical data for the Euro Area [33]. The installation costs include equipment, labor, local taxes and connection fees. Total costs include a replacement of the inverter at the 12th year. Due to the sizes of these installations, the operation costs will be zero and there will be a maintenance cost of 1% of the value of the installation paid on a yearly basis. This maintenance cost is between 7 and 9 €/kW yearly and fits well with published results [34]. Regarding the degradation of PV modules, it is considered a 0.8% based on the usual warranties given by PV modules manufacturers, the average climate in Spain and taking into account the extensive research on this topic [35].

Energy Balance
From the data and methodology presented in the former section, the energy balance is simulated for PV powers ranging from 10 kW to 95 kW with a productivity of 1371 kWh/kWp per year. With the reconstructed load profile, for each power, the PV production profile is supposed to be proportional to the hourly profile of the collected data. The energy balance with the grid is calculated accordingly to Section 2.4. To summarize these extensive results, energy balance, self-consumption, and self-sufficiency parameters will be plotted for the PV power range under study. In Figure 5a, the energy purchased from the grid, PV produced energy, and surplus energy are shown relative to the total consumption. For a PV power of 68 kW, the building produces the same amount of electricity that it consumes. Unfortunately, it does not mean that the electricity purchased is zero, in fact, it is more than half of the electricity consumed. As was presented in Section 2.3, there are periods of time when the consumption is low. So, the surplus energy will be very high with the increased PV powers. In order to characterize the degree of self-consumption, Figure 5b plots the self-consumption and the self-sufficiency parameters as defined in Equations (5) and (6) following [18]. Self-consumption is a metric that informs the fraction of PV energy that is self-consumed in the building, and self-sufficiency informs about the degree of dependence on the distribution grid.
Sustainability 2021, 13, x FOR PEER REVIEW 9 of 17 are periods of time when the consumption is low. So, the surplus energy will be very high with the increased PV powers. In order to characterize the degree of self-consumption, Figure 5b plots the self-consumption and the self-sufficiency parameters as defined in Equations (5) and (6) following [18]. Self-consumption is a metric that informs the fraction of PV energy that is self-consumed in the building, and self-sufficiency informs about the degree of dependence on the distribution grid.
(a) (b) Figure 5. Energy balance results for different PV installed powers (a) Energy purchased from the grid, PV produced and surplus fed into the grid (b) Self-consumption and self-sufficiency.
From Figure 5, it is clear that in spite of producing more electricity than the consumption, it is not possible to disconnect the building from the grid. As the PV production rises, the self-consumption degree decreases because of the higher surplus energy, and the selfsufficiency degree rises slowly over 40%. The maximum self-sufficiency degree depends on the consumer load profile and the solar resource (latitude, PV orientation, and local climate). This parameter is a good indicator of the potential savings in each case. In addition to these results in the energy balance, there are important implications in the economic balance, as will be seen shortly. From Figure 5, it is clear that in spite of producing more electricity than the consumption, it is not possible to disconnect the building from the grid. As the PV production rises, the self-consumption degree decreases because of the higher surplus energy, and the self-sufficiency degree rises slowly over 40%. The maximum self-sufficiency degree depends on the consumer load profile and the solar resource (latitude, PV orientation, and local climate). This parameter is a good indicator of the potential savings in each case. In addition to these results in the energy balance, there are important implications in the economic balance, as will be seen shortly.

Economic Balance
The economic balance is calculated using the Spanish net-billing scheme defined in Equation (3) for the simplified compensation procedure and using a simple purchase and sale mechanism (without taxes and including the 7% tax on electricity generation). The differences are that while in the simplified procedure, a negative energy term is not allowed, in the purchase and sale mechanism a negative balance is allowed, but surplus energy earnings are taxed with a 7% rate. In Figure 6, the economic balances for the three options (net purchase and sale, net purchase and sale with sale taxed at 7%, and simplified compensation) are shown for comparison. In this case under study, for PV powers under 50 kW, there is little difference between options. This is because the surplus is relatively small, and its price very low compared to the retail price. The differences are noticeable for powers over 70 kW, but the advantages of simplified compensation can outweigh this small profit in many cases. Anyway, this fact depends on other seasonal factors as holidays and other periods without electrical consumption and must be analyzed prior to sizing the PV installation.  For a deeper insight into this topic, in Figure 7, the raw monthly economic balances with the grid for the full year and all the simulated powers are presented. There are negative economic balances with the grid for powers from above 40 kW. Up to 80 kW, these balances are restricted to the months of July and August, but for higher powers, there are also negative balances in June and even May. It is important to note that in July the College is open only in the morning and in August it is fully closed for the first three weeks of the month. It is also relevant that the climate in the city of Á vila is relatively mild in summer, so HVAC systems are not used. In other cities located near Á vila, like Madrid, HVAC use will make all these balances positive. For a deeper insight into this topic, in Figure 7, the raw monthly economic balances with the grid for the full year and all the simulated powers are presented. There are negative economic balances with the grid for powers from above 40 kW. Up to 80 kW, these balances are restricted to the months of July and August, but for higher powers, there are also negative balances in June and even May. It is important to note that in July the College is open only in the morning and in August it is fully closed for the first three weeks of the month. It is also relevant that the climate in the city of Ávila is relatively mild in summer, so HVAC systems are not used. In other cities located near Ávila, like Madrid, HVAC use will make all these balances positive.
For the time of return of investment (TROI) and LCOE calculations, reference costs of roof-mounted PV installations in Spain are shown in Table 3. It is important to note that these prices can be higher because of particularities in the roof materials, labor costs, safety and protection measures, local taxes, etc. In Spain companies can deduct VAT for this investment, so it is an important saving. On the other side, electricity VAT is compensated in quarterly tax returns for companies. For these reasons, VAT is excluded in the calculation of TROI.
balances are restricted to the months of July and August, but for higher powers, there are also negative balances in June and even May. It is important to note that in July the College is open only in the morning and in August it is fully closed for the first three weeks of the month. It is also relevant that the climate in the city of Á vila is relatively mild in summer, so HVAC systems are not used. In other cities located near Á vila, like Madrid, HVAC use will make all these balances positive.   The TROI is shown in Figure 8. For PV powers under 50 kW, there are no noticeable difference between the simplified compensation procedure and the surplus sale to the marketer company. For PV powers over 50 kW, there is an advantage for the surplus sale procedure due to the negative monthly balances shown in Figure 7. In our case of study, the TROI is below 9 years for powers ranging from 35 kW to 80 kW, being near 8.5 years in the 40-70 kW range as it is shown in Figure 8a. In Figure 8b the TROI is shown vs. self-sufficiency degree, and it is found that the TROI is under 9 years for self-sufficiency degrees between 30% and 40%. For the time of return of investment (TROI) and LCOE calculations, reference costs of roof-mounted PV installations in Spain are shown in Table 3. It is important to note that these prices can be higher because of particularities in the roof materials, labor costs, safety and protection measures, local taxes, etc. In Spain companies can deduct VAT for this investment, so it is an important saving. On the other side, electricity VAT is compensated in quarterly tax returns for companies. For these reasons, VAT is excluded in the calculation of TROI. The TROI is shown in Figure 8. For PV powers under 50 kW, there are no noticeable difference between the simplified compensation procedure and the surplus sale to the marketer company. For PV powers over 50 kW, there is an advantage for the surplus sale procedure due to the negative monthly balances shown in Figure 7. In our case of study, the TROI is below 9 years for powers ranging from 35 kW to 80 kW, being near 8.5 years in the 40-70 kW range as it is shown in Figure 8a. In Figure 8b the TROI is shown vs. selfsufficiency degree, and it is found that the TROI is under 9 years for self-sufficiency degrees between 30% and 40%. Economic evaluation of net billing schemes is often more complicated due to the different prices for the energy purchased and exported to the grid. In addition, these prices can be indexed to the electrical pool market price, so they can vary hourly. For a proper com- Economic evaluation of net billing schemes is often more complicated due to the different prices for the energy purchased and exported to the grid. In addition, these prices can be indexed to the electrical pool market price, so they can vary hourly. For a proper comparison, the levelized cost of PV produced electricity is calculated based on Equation (4) and is shown in Figure 9 related to the price range for the surplus electricity published in [31]. The band limits in the figure are calculated as follows: for the retail prices, they are between the minimum of "flat" price and the maximum of "peak" price as shown in Table 2; for the surplus, all values are calculated as the mean of hourly values where there is significant PV production (hours 9 to 20). The lower value is computed as the mean value of the minimum value for each hour, the median value is the mean of median values, and the upper value is the mean of maximum hourly surplus prices. The LCOE value is within the range of values for surplus energy and below its median value, so the surplus energy can be exported to the grid with a small profit for PV powers above 30 kW. This result allows these PV installations to be profitable, and an extensive roll-out is possible without further regulation or promotion measures. allows these PV installations to be profitable, and an extensive roll-out is possible without further regulation or promotion measures.

Discussion
Grid parity has been reached in many countries [36,37]. This fact means that the levelized cost of electricity (LCOE) generated by PV self-consumption installations is lower than the retail prices for customers. It makes PV an option as a clean, renewable source of energy that can be integrated in buildings, but it does not mean that PV self-consumption is profitable as an investment in all cases. The actual situation in Spain is favorable under the new regulation, but PV self-consumption is profitable only when the self-consumption ratio is above a threshold for each PV market segment, as is shown in [38]. This ratio is key to maximize the economic yield. As can be seen in Figure 8, the best time of return for the investment is for intermediate PV powers because for higher powers there is a big proportion of surplus electricity that is valued at a lower price than the retail price. On the other side, for small sizes, a good self-consumption ratio is reached, meaning that the PV produced electricity is valuated at retail rate, but the installation costs are higher. So, there is a trade-off between maximizing both self-sufficiency and self-consumption ratios. The key factor for optimizing the profitability is the installation cost that allows one to get the best self-sufficiency index and TROI. As the installation costs decrease for higher PV powers, once a particular level (30 kW in our case) is reached, the installation is profitable even for the highest powers. In order to get the best economic value for PV, a proper sizing of installations is required. New methods such as the one proposed in [39] have to be developed. From Figure 8b, the economically optimum range of self-sufficiency is found between 30% and 40%. That self-sufficiency range inversely corresponds to a self-consumption range of 34-58% (not shown). The plot in Figure 8b can be very useful for finding if the desired self-sufficiency level is economically optimal. PV sizing might be addressed not only from the monthly consumption data, but hourly load profiles are also important

Discussion
Grid parity has been reached in many countries [36,37]. This fact means that the levelized cost of electricity (LCOE) generated by PV self-consumption installations is lower than the retail prices for customers. It makes PV an option as a clean, renewable source of energy that can be integrated in buildings, but it does not mean that PV self-consumption is profitable as an investment in all cases. The actual situation in Spain is favorable under the new regulation, but PV self-consumption is profitable only when the self-consumption ratio is above a threshold for each PV market segment, as is shown in [38]. This ratio is key to maximize the economic yield. As can be seen in Figure 8, the best time of return for the investment is for intermediate PV powers because for higher powers there is a big proportion of surplus electricity that is valued at a lower price than the retail price. On the other side, for small sizes, a good self-consumption ratio is reached, meaning that the PV produced electricity is valuated at retail rate, but the installation costs are higher. So, there is a trade-off between maximizing both self-sufficiency and self-consumption ratios. The key factor for optimizing the profitability is the installation cost that allows one to get the best self-sufficiency index and TROI. As the installation costs decrease for higher PV powers, once a particular level (30 kW in our case) is reached, the installation is profitable even for the highest powers. In order to get the best economic value for PV, a proper sizing of installations is required. New methods such as the one proposed in [39] have to be developed. From Figure 8b, the economically optimum range of self-sufficiency is found between 30% and 40%. That self-sufficiency range inversely corresponds to a self-consumption range of 34-58% (not shown). The plot in Figure 8b can be very useful for finding if the desired self-sufficiency level is economically optimal. PV sizing might be addressed not only from the monthly consumption data, but hourly load profiles are also important to reach a good matching between PV generation and consumption. Load matching of PV generation is key to achieve a good self-consumption rate, so strategies such as demand-side management (DSM), storage, and use of different orientations [40][41][42][43] can play an important role in future PV developments.
The time resolution of available data is relevant for accurate characterization of PV self-consumption. The usual 1-h period is known as a possible source of error in the energy data of buildings because of averaging of loads with relatively short peaks [44]. For the smallest PV installations, the relative error in calculation of self-consumption can be as big as 32% when considering hourly versus 1 min intervals [45]. In the building under study in this research, the effect is considered negligible because of averaging of loads and their nature, mainly lighting, computers, and office equipment that run continuously.
Another difficulty for economic evaluation is the selection of electricity prices. While statistical data such as that available in Eurostat [46] is very useful for many purposes, it is not the best option for financial evaluation of PV self-consumption. This is because in many countries, the electrical bill is composed of two main charges: a fixed one related to the maximum available power for the customer, and a variable charge for energy consumed. While the energy charge is reduced by the self-consumed PV energy, it is not clear that the maximum power can be reduced, especially for small and medium contracted powers, as in our case.
Regarding the costs of building new PV installations, the prices referenced in the literature don't correspond well with the real ones, as it is pointed in [47]. Besides the price reduction of photovoltaic technology, there is a lack of transparency of prices for PV components (modules, inverters, and balance of system). The prices in our research are obtained directly from PV promotors, installers, and customers in our zone.
Profitability is characterized in this work by calculation of time of return of investment and levelized cost of electricity. Regarding the prices for new PV installations, residential ones in the range of 3-10 kW are more expensive, reaching >1.5 €/W, while industrial ones can be as cheap as 0.6 €/W for the range 500 kW-1 MW. Final prices of PV in the range under study are between 1.4 €/W for 10 kW and 0.7 €/W for installations over 70 kW. As was mentioned, prices of PV self-consumption can be very different depending on specific particularities with an impact on the economic yield. The calculated time of return of investment is between 8 and 9 years, which can be acceptable for many companies. The LCOE calculation gives a price below 5.0 c€/kWh for sizes over 30 kW. This price is below the most frequent value (5.19 c€/kWh) for surplus energy in the simplified compensation procedure during daytime for the year 2019. This fact implies that even in oversized installations, it is possible to have a small profit because the surplus energy is paid at a value over the LCOE. Also, it is important to note that the yearly production of our installation (1374 kWh/kW) is acceptable but a bit low. In Spain, usual values for PV self-consumption are in the range 1500-1600 kWh/kW. Higher yearly values imply lower values of LCOE, as can be seen in Equation (4). These LCOE values are consistent with recent values published by the International Energy Agency for some countries [48]. In Table 4 we present the LCOE for some commercial installations in France and Italy, calculated with a 3% discount rate and converted to Euro currency, alongside the results in our research. These results present favorable prospects for PV self-consumption in Spain. There is a large number of new PV self-consumption installations in Spain but there is a lack of data about this. The exception is the Government of Catalonia, that provides detailed data about PV from the Institut Català d'Energia [49]. Catalonia figures are representative for all Spain and show a growth in the number of installations of 242% in 2019 and of 247% in 2020. The number of new installations in 2019 was 1679 with a new power of 21,927 kW and it was of 5869 in 2020 with 49,467 kW. From the total number of installations 5.91% of them were of power between 35 kW and 100 kW with 36.87% of total power installed. Data from regional government of Castilla y León shows a new installed power of 65,000 kW for self-consumption in the first 11 months of 2020, an increase of 800% over 2019 [50]. For the whole of Spain it is expected a total of 720 MW of new solar rooftop capacity for 2020 [51].
Whilst the Clean Energy Package [52] states that E.U. Member States must enable self-consumption and guarantee access to the grid, the situation of self-consumption across EU is very varied and will be briefly exposed for the European top PV markets. Countries like Germany and France have a mixed model with coexisting Feed in Tariff that is evolving into auctions for mid-sized and large rooftops, and self-consumption is expected to have a high growth in small systems. Netherlands enjoys an unlimited net-metering scheme for residential PV, but according to a new law proposal, from 2023, it would decrease to 9% per year, ending in 2031. For SMEs and real estate owners, there are fiscal incentives. Poland has a favorable self-consumption scheme, which balances out for a full year and has an interesting discount mechanism to exchange the surplus with the grid: there is a coefficient that states the fraction of surplus energy that can be recovered from the grid, for systems lesser than 10 kW it is as high as 0.8 and 0.6 for systems higher than 50 kW [51]. The present framework in Spain, without charges for self-consumed electricity and with the option to sell or compensate the surplus at prices slightly lower than the pool market price is well balanced and favorable for prosumers.

Conclusions
Solar PV self-consumption in a University building has been analyzed for a full year, extending the results for a wider range of educational and office buildings, corresponding to the range defined in the new Spanish Building Code as mandatory to use renewable energy sources.
The new regulation of electricity self-consumption in Spain has been evaluated and the two methods for valuing surplus electricity, simplified compensation, and sell, have been compared. It is found that for PV powers under 50 kW the economic profit is very similar for both methods but above this power, selling surplus electricity to the grid is more profitable. Anyway, the simplified mechanism benefits from an easier management, especially because of tax exemptions.
The limitation of simplified compensation method to positive monthly balances encourages proper PV sizing and load matching, reducing negative effects of PV on the distribution grid and thus allowing a higher penetration of PV.
Self-consumption and self-sufficiency are very useful parameters for installation sizing, giving a good indication about the optimal performance of the installation, in both energy and economic senses. For these consumers, educational and office buildings, it is found that in Spain, the optimum range for self-sufficiency is between 30% and 40%, and inversely, the self-consumption optimum range is between 34% and 58%.
Regarding the levelized cost of electricity, it is found to be within the lower range of electricity pool market price due to lower costs of installation than in the residential sector. For PV sizes starting from 30 kW, the LCOE is lower than the commodity price of electricity in Spain. This makes profitable even the surplus electricity, and it allows one to oversize installations in an economical way. In addition, this fact allows new business models for PV self-consumption installations and opportunities for third-party companies.
The obligation of installing renewable energy sources in commercial buildings is well fitted with the new regulation of self-consumption thanks to the net billing scheme. The time of return of investment of PV in these conditions is between 8 and 9 years, making the adoption of these installations easier.
Finally, it can be stated that the new Spanish regulation provides a good framework for PV self-consumption, and it is expected a successful and sustainable development of this sector, as it is shown in available data of new installations for the year 2020.
More extensive research is in progress considering the effect of different yearly irradiation together with self-consumption and self-sufficiency parameters and using additional economic indicators as an internal rate of return and present net value. Further research directions of this work will address the situation and performance of self-consumption by industrial consumers in Spain and comparative studies of the self-consumption legal framework, evolution, and performance of installations in Europe and Latin America.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data from University consumption and production are not publicly available due to restrictions. The energy pricing data is publicly available in the web of Spanish grid operator REE [30].