University Campus and Surrounding Residential Complexes as Energy-Hub: A MILP Optimization Approach for a Smart Exchange of Solar Energy

: An e ﬀ ective way to enlarge the utilization of renewable energy consists in creating a correct interface between producers, consumers, and storage devices, i.e., a so-called “energy hub”. This opens a di ﬃ cult challenge, especially in the urban areas where the availability of room for the installation of renewable plants is limited. This paper considers a university campus in the center of Lisbon that requires a signiﬁcant amount of electricity and natural gas to support the internal activities. The idea is to fulﬁl part of the energy consumption of the campus with the excess of energy supplied by solar systems installed in the surrounding residential buildings. The goal is to ﬁnd the number and type of solar equipment that maximize the reduction of annual energy costs of both residents and campus, where the campus is seen as a virtual storage. Results of the optimization show that, considering the best-exposed 100 buildings in a radius of 500 m around the campus, the campus can reduce the annual energy expenses up to 8.61%, whereas the money-saving for the residents is of the order of 24% to 29%, depending on solar exposure. A sensitivity analysis shows also the higher beneﬁts for both the campus and users deriving from expected decreasing costs of photo-voltaic (PV) panels.


Introduction
The Instituto Superior Técnico (IST) is one of the most prominent academic institutions in Portugal and boasts several partnerships with renowned universities all over the world, together with a prolific academic research activity. It has three campuses, the main one being the Alameda campus, situated in the center of Lisbon.
The Alameda Campus was situated in the outskirts of Lisbon, but with the city's expansion in the first half of the twentieth century, it quickly became surrounded by multiapartment buildings. The IST works all year long, except for two weeks of August, and requires a high amount of energy for didactic, administrative, and research activities. An internal energy audit revealed that the energy mix is composed for 81% of electrical energy (EE), while 19% is natural gas (NG). The energy consumption represents a relevant share of the yearly budget, and to this date, it only relies on the connection to the electric grid and NG distribution network. The campus does not perform any self-generation.
A way to reduce the energy-related costs and decrease the respective carbon footprint would be the integration of renewable energy source (RES) generators.
The investment and operation and management (O&M) costs are accounted as part of the IST yearly energy expenses, because the project is supposed to be fully financed by IST.
Four multifamily residential complexes, each representing a category of buildings, are selected for the energy exchange with the campus. The results obtained for a single building are then scaled for the estimated number of edifices having similar characteristics (i.e., belonging to that category of buildings), so assessing the global-saving potential.
If the conditions are favorable, IST and the owners of the apartments to which the rooftops belong will form a synergistic cooperative: the former will get electricity or thermal energy that is not self-consumed, while the latter receive free renewable energy by making available the unused roof surface.
The reason for considering the ST technology is that, in Portugal, it is common to use EE for heating purposes: a ST system would reduce the renewable PV energy self-consumption, allowing more EE to feed IST.
As stated above, the following aspects will be considered: • The amount and type of the energy conversion devices to be installed: IST can achieve a cheaper price per device than single families, given the higher amount of electricity it takes from the grid compared to a regular household, and • the buildings to be selected for the partnership. Each building is characterized by several parameters defining the surface availability and its quality (a north-facing rooftop is less valuable than a nonshaded south-facing roof), as well as a number of apartments that have an energy consumption profile, the economic conditions to which IST receives the EE from the buildings (name in the following "users", USRs) and vice-versa.

Methods
In this section, the main procedures for the characterization of the system are presented. In Section 2.1, the system is described: the main hypotheses are shown, as well as the procedures to model IST and the USR energy consumption profiles. In Section 2.2, the generation of solar energy is described. Eventually, in Section 2.3, the construction of the model is presented in detail.

System Description
The system is modeled as a central consumption node (the campus, IST) surrounded by residential complexes (USRs) that can become generation nodes and that, if so, will connect to it radially. Figure 1 shows the possible interactions between IST, a generic USR, and the electric grid. As shown, there can be an energy flow between IST and a USR. The arrows represent the possible directions of the energy flows (defined as P). Superscripts and subscripts are to be read as "from-to", respectively.
The IST campus has a peak of EE consumption of 1 to 2 orders of magnitude greater than that of a single-family household. IST can be considered as a fictitious electricity storage system: with the exceeding EE produced by the oversized PV modules, the USRs "charge" the campus, which-when there is not solar energy production-can return the charged energy back to the respective USR. This is because IST generally pays a lower price per kWh than a common household.
The analysis is performed on a yearly basis, with 1h resolution. With 8760 times the steps to simulate a year, the computational effort (the solving time) would be too high. This is why it has been chosen to reduce the year to 4 representative "design" days, one for each season. This choice reduces greatly the complexity of the model. The IST campus has a peak of EE consumption of 1 to 2 orders of magnitude greater than that of a single-family household. IST can be considered as a fictitious electricity storage system: with the exceeding EE produced by the oversized PV modules, the USRs "charge" the campus, which-when there is not solar energy production-can return the charged energy back to the respective USR. This is because IST generally pays a lower price per kWh than a common household.
The analysis is performed on a yearly basis, with 1h resolution. With 8760 times the steps to simulate a year, the computational effort (the solving time) would be too high. This is why it has been chosen to reduce the year to 4 representative "design" days, one for each season. This choice reduces greatly the complexity of the model.

IST Energy Characterization
IST Campus is situated on the top of a hill and is composed of a total of 26 buildings [22], in which didactic, research, or administrative activities take place.
IST is characterized by an hourly electric energy demand. The "Campus Sustentável" project of IST [23] provided a file of hourly records of the campus electric demand. The measurements cover a time range from December 2015 to November 2017.
The raw data has been treated by removing the not-a-number (NaN) records. All the values that fall outside a 3σ (99.7% confidence) interval are removed, because they are considered outliers, which are unusual values whose existence is led back to random malfunctions of the measurement instruments and are not related to the phenomena of interest.
The records are grouped into seasons: winter ranges from 21/12 to 20/03, spring from 21/03 to 20/06, and so on for summer (the records of the month of August have been excluded; the two-week closure and the absence of didactic activities make the month not representative of IST normal functioning) and autumn. This division of the year into seasons is consistent with the environmental records, as explained later on in this section.
For each season, the records are grouped again by the hour of the day in which they were taken. For each of the 24 sets of each season, the median value is extracted; this value will be the value of the respective hour of the design day. The median has been preferred to the mean value due to its higher robustness and lower sensitivity on the extremes.
The obtained curves ( Figure 2) show that the daily EE consumption of the campus is rather constant along the year. This is consistent with the behavior of the campus, since it works during 11 months per year (in August, the main activities are suspended). The base load is 800 kW, while the peak load is approximately 2.2 kW.

IST Energy Characterization
IST Campus is situated on the top of a hill and is composed of a total of 26 buildings [22], in which didactic, research, or administrative activities take place.
IST is characterized by an hourly electric energy demand. The "Campus Sustentável" project of IST [23] provided a file of hourly records of the campus electric demand. The measurements cover a time range from December 2015 to November 2017.
The raw data has been treated by removing the not-a-number (NaN) records. All the values that fall outside a 3σ (99.7% confidence) interval are removed, because they are considered outliers, which are unusual values whose existence is led back to random malfunctions of the measurement instruments and are not related to the phenomena of interest.
The records are grouped into seasons: winter ranges from 21/12 to 20/03, spring from 21/03 to 20/06, and so on for summer (the records of the month of August have been excluded; the two-week closure and the absence of didactic activities make the month not representative of IST normal functioning) and autumn. This division of the year into seasons is consistent with the environmental records, as explained later on in this section.
For each season, the records are grouped again by the hour of the day in which they were taken. For each of the 24 sets of each season, the median value is extracted; this value will be the value of the respective hour of the design day. The median has been preferred to the mean value due to its higher robustness and lower sensitivity on the extremes.
The obtained curves ( Figure 2) show that the daily EE consumption of the campus is rather constant along the year. This is consistent with the behavior of the campus, since it works during 11 months per year (in August, the main activities are suspended). The base load is 800 kW, while the peak load is approximately 2.2 kW.

USRs Characterization
The city of Lisbon is made of thousands of buildings; their individual assessment (single and multifamily residential, nonresidential, etc.) would require an in-depth analysis that is outside the scope of this work. It has been chosen to limit the number of buildings (USRs) to four.
The four USRs have been chosen following these criteria: 1. vicinity to IST: lower distances mean lower losses; therefore, the search for rooftops shall be focused on the surroundings of the campus, 2.
incident solar radiation: surfaces that receive large amounts of solar radiation over the year are more attractive than the others, and

USRs Characterization
The city of Lisbon is made of thousands of buildings; their individual assessment (single and multifamily residential, nonresidential, etc.) would require an in-depth analysis that is outside the scope of this work. It has been chosen to limit the number of buildings (USRs) to four.
The four USRs have been chosen following these criteria: 1. vicinity to IST: lower distances mean lower losses; therefore, the search for rooftops shall be focused on the surroundings of the campus, 2. incident solar radiation: surfaces that receive large amounts of solar radiation over the year are more attractive than the others, and 3. representativity: the four buildings should not be unique, as the results from assessing a place belonging to a family of constructions can be expected to be similar for the whole family; this allows for the extension of the results for a single complex to several buildings.
They were all built between 1919 and 1945 and are referred as "Gaioleiro" buildings [24]; thus, similar energetic performances can be expected. From observation, the number of floors and apartments has been derived.
Information regarding the amount of incident solar radiation on their respective roofs, as well as their surface extensions, were retrieved from the solar energy potential map in Figure 3 [25]. This resource provides data regarding the characteristics of the roofs of the city of Lisbon. They were all built between 1919 and 1945 and are referred as "Gaioleiro" buildings [24]; thus, similar energetic performances can be expected. From observation, the number of floors and apartments has been derived.
Information regarding the amount of incident solar radiation on their respective roofs, as well as their surface extensions, were retrieved from the solar energy potential map in Figure 3 [25]. This resource provides data regarding the characteristics of the roofs of the city of Lisbon.

Electric Load
Likewise, for IST, the hourly electric energy demand for each USR was obtained from different sets of measurements. This data was provided by the Center for Innovation, Technology and Policy Research (IN+) of IST, who performed a range of measurements promoted by ERSE (Entidade Reguladora dos Serviços Energéticos -Portuguese Energy Services Regulatory Authority) [26]. The  Likewise, for IST, the hourly electric energy demand for each USR was obtained from different sets of measurements. This data was provided by the Center for Innovation, Technology and Policy Research (IN+) of IST, who performed a range of measurements promoted by ERSE (Entidade Reguladora dos Serviços Energéticos-Portuguese Energy Services Regulatory Authority) [26]. The project monitored the energy consumption of the nationwide participants to improve the efficiency in the residential sector. These data include the electricity consumption for lighting, household appliances, and space cooling, while the consumption for space heating (when provided by electric heaters) is considered separately.
Among all the records, those considered appropriate for the analysis are presented in Table 1. The same process shown in Section 2.1.2 to obtain seasonal design days has been adopted. Table 1. Electric and thermal consumption profile association for each building (USR): Ppl/flat is the number of people living in the respective flat, N flats is the amount of individual flats in each building, S roof is the roof total surface, A wall the external wall area, L heating loss coefficient, and TL sh the daily thermal load requirement for space heating. Due to the selective monitoring of the electric consumption of some appliances, the electric consumption is integrated with the energy consumption for space heating and domestic hot water (DHW). Even though the use of natural gas for DHW far exceeds the use of EE [26], it is assumed that each household only uses EE, for this means a higher electricity demand from the USRs; hence, less favorable conditions.

USR
An electric profile has been eventually associated with each USR. The association is based on the following assumptions:

1.
The electric profile is proportional to the number of inhabitants, so a reference profile (for one resident) has been obtained by dividing the available measured profile by the actual number of residents. The profile for USRs, including any number of residents, is then obtained by multiplying the reference profile by the selected number of residents, and 2. geometry (type in Table 1); occupancy (number of inhabitants); and routines are the same; the whole residential complex electrical consumption profile is equal to its number of flats times the hourly electric consumption of the respective electric profiles. The flat-type classification in Portugal is TN, where N means the number of rooms. Therefore, a T4 is a flat with four bedrooms, a kitchen, a living room, and a variable number of bathrooms. Similarly, a T2 has only two bedrooms, a bathroom, a kitchen, and so on.

Thermal Load
The daily thermal profile has been estimated with the base on the weather data provided by IST Meteorological Service, the Portuguese regulations [27], and assumed values of the buildings' global heat transfer coefficients. Each building under examination belongs to the district of São Jorge de Arroios in Lisbon. The values of the global heat transfer coefficients (U) of each building were taken from [24], in which, for each district of Lisbon, a statistical analysis was performed. In this work, the minimum, mean, maximum, and standard deviation values of the U for each district of Lisbon are provided. Since the difference between the mean and the maximum U-values is minimal, the Energies 2020, 13, 2919 7 of 22 latter have been chosen for the analysis to be more conservative. The heating loss coefficient is then calculated following the procedure presented by Durmayaz et al. [28].
The thermal load is considered to be the result of two heating necessities: space heating (Q sh ) and domestic hot water (Q dhw ).

•
The approach used to determine the energy necessity for space heating (SH) is the same as that by presented by Durmayaz et al.; the daily mean temperatures were calculated for every day of the year [28]. Their values have been plotted and fitted with a 6th-degree polynomial function and can be seen in Figure 4. The heating season starts and ends when the fitted function crosses the 15 • C value, respectively. The results are that the heating season ends on the 110th and begins on the 313th day, which corresponds to the 20th of April and 9th of November, respectively.
The daily thermal profile has been estimated with the base on the weather data provided by IST Meteorological Service, the Portuguese regulations [27], and assumed values of the buildings' global heat transfer coefficients. Each building under examination belongs to the district of São Jorge de Arroios in Lisbon. The values of the global heat transfer coefficients (U) of each building were taken from [24], in which, for each district of Lisbon, a statistical analysis was performed. In this work, the minimum, mean, maximum, and standard deviation values of the U for each district of Lisbon are provided. Since the difference between the mean and the maximum U-values is minimal, the latter have been chosen for the analysis to be more conservative. The heating loss coefficient is then calculated following the procedure presented by Durmayaz et al. [28].
The thermal load is considered to be the result of two heating necessities: space heating ( ) and domestic hot water ( ).

•
The approach used to determine the energy necessity for space heating (SH) is the same as that by presented by Durmayaz et al.; the daily mean temperatures were calculated for every day of the year [28]. Their values have been plotted and fitted with a 6th-degree polynomial function and can be seen in Figure 4. The heating season starts and ends when the fitted function crosses the 15 °C value, respectively. The results are that the heating season ends on the 110th and begins on the 313th day, which corresponds to the 20th of April and 9th of November, respectively. The average temperature of every design day is above 15 °C, except for the winter one. The winter season is the only one entirely inside the heating season; therefore, the space-heating load will only be present for the winter design day. It is worth making a further correction: it is unusual for a Portuguese household to heat the entire flat.
is reduced by one-third to account for the nonheated parts of the respective flats.
Eventually, the normalized space-heating profile has been applied to obtain the daily space heating energy consumption. The average temperature of every design day is above 15 • C, except for the winter one. The winter season is the only one entirely inside the heating season; therefore, the space-heating load will only be present for the winter design day. It is worth making a further correction: it is unusual for a Portuguese household to heat the entire flat. Q sh is reduced by one-third to account for the nonheated parts of the respective flats.
Eventually, the normalized space-heating profile has been applied to obtain the daily space heating energy consumption.

•
For the energy consumption for domestic hot water (DHW), the daily amount of energy has been calculated according to the Portuguese Regulations [29]. The municipal water feed temperature and the normalized profile for the DHW consumption were retrieved from [30].
If the total thermal load was fulfilled with EE (an electrical resistance of 98% efficiency), the overall electrical consumption profile for each USR in each design day would be the one presented in Figure 5. Note that the morning peak of electricity demand of each USR in the summer (Figure 4) is quite similar to that in the winter because of the high cooling demand in the hot season. If the total thermal load was fulfilled with EE (an electrical resistance of 98% efficiency), the overall electrical consumption profile for each USR in each design day would be the one presented in Figure 5. Note that the morning peak of electricity demand of each USR in the summer (Figure 4) is quite similar to that in the winter because of the high cooling demand in the hot season.
(a) (b) Figure 5. Overall electric load of each USR in the winter (a) and for the summer (b) season, assuming that the whole heat demand is fulfilled with electric energy.

Renewable Energy Generation
The specific solar energy production per unit equipment is modeled as a function of the solar radiation and ambient temperature. Both datasets have been recorded over a period of five years by the Meteorological Service of IST. The hourly records have been aggregated into one representative year through the median, with a process akin to that presented in Section 2.1.2.
The calculations implemented to obtain the total incident solar radiation on a tilted surface are the same as presented by Duffie and Beckman [31]. It is assumed that the modules will be oriented according to the normal of the façade of the building they will be installed on; therefore, each USR will have a different specific solar energy production profile.

PV Energy Generation
The selected PV technology is a monocrystalline silicon (mono-Si) panel manufactured by [32]. The power output of a PV module is modeled as a function of the incident solar radiation and the ambient temperature as proposed by Durisch et al. [33].
To each total solar radiation value, a specific (per module) electricity production for each USR is associated. The total output power of the installation is the algebraic sum of the output powers of the single modules. The inverter efficiency is assumed equal to 98%.

ST Energy Generation
The solar thermal energy output does not only depend on the physical properties of the collector itself but, also, on the inlet fluid temperature. This temperature changes according to the temperature inside the TS, which depends on the tank capacity and the energy subtraction from the users.
To keep the model simple and independent from the storage tank capacity (which is a decision variable of the optimization problem), the collector inlet temperature has been fixed at 60 °C. This is the minimum temperature allowed for the storage of hot water to avoid the proliferation of pathogens.

Renewable Energy Generation
The specific solar energy production per unit equipment is modeled as a function of the solar radiation and ambient temperature. Both datasets have been recorded over a period of five years by the Meteorological Service of IST. The hourly records have been aggregated into one representative year through the median, with a process akin to that presented in Section 2.1.2.
The calculations implemented to obtain the total incident solar radiation on a tilted surface are the same as presented by Duffie and Beckman [31]. It is assumed that the modules will be oriented according to the normal of the façade of the building they will be installed on; therefore, each USR will have a different specific solar energy production profile.

PV Energy Generation
The selected PV technology is a monocrystalline silicon (mono-Si) panel manufactured by [32]. The power output of a PV module is modeled as a function of the incident solar radiation and the ambient temperature as proposed by Durisch et al. [33].
To each total solar radiation value, a specific (per module) electricity production for each USR is associated. The total output power of the installation is the algebraic sum of the output powers of the single modules. The inverter efficiency is assumed equal to 98%.

ST Energy Generation
The solar thermal energy output does not only depend on the physical properties of the collector itself but, also, on the inlet fluid temperature. This temperature changes according to the temperature inside the TS, which depends on the tank capacity and the energy subtraction from the users.
To keep the model simple and independent from the storage tank capacity (which is a decision variable of the optimization problem), the collector inlet temperature has been fixed at 60 • C. This is the minimum temperature allowed for the storage of hot water to avoid the proliferation of pathogens.
Typical solar flat plate collector performance parameters (optic and thermo-physical properties) were retrieved from [14].
Akin to Section 2.2.1, an hourly specific (per collector) thermal energy production is associated to each hour of the year.

Formulation of the Optimization Problem
The design optimization problem of the solar system is defined by taking into account its operation using a mixed-integer linear approach. The problem is written in a general form as: where: • x(t) and β are the arrays of the continuous and integer/binary decision variables (the superscript * indicates their optimum value), respectively, • Z is the objective function, and • g(x(t), β) and h(x(t), β) are the equality and inequality constraints deriving from the model of the system.
The optimization problem was implemented in Python and solved using the MIP solver of GUROBI.

Decision Variables
All the integer/binary decision variables (β in Equation (1)) are associated with the design of the solar system configuration. Accordingly, their values are independent of time t (i.e., it is constant in the total optimization period). The variables belonging to this category of decision variables are: • integer number of PV modules (σ(u)) and ST collectors (χ(u)) to be installed on the roof of the user u [34], and • binary variables used to impose the existence (α(u) = 0) or not (α(u) = 1) of the user u and, if so, whether the ST technology are to be implemented (ε(u) = 1) or not (ε(u) = 0) [35].
Among the design decision variables, there is also the continuous variable V TS (u) associated with the volume of the thermal storage (TS) equipment of each user u. [10][11][12]23]. The remaining continuous decision variables (x(t) in Equation (1)) are instead tied to the optimum operation of the system (their values can vary in the total optimization period). The set of the continuous decision variables includes: • electrical (P A B (u, t)) and thermal (Q A B (u, t)) energy flows between the nodes ("A" is the starting node, and "B" is the arrival node), • thermal energy flows charged to (Q TS ch (u, t)) or discharged from (Q TS disch (u, t)) the thermal storage or dissipated (Q diss (u, t)) for each user u, and • level of charge of the IST (see Equations (18) to (21)) and of the TS (LVL(u, t)), where u is the generic user in the set of the candidate users.
The problem has been defined so that the optimum value of the decision variables can only be either positive or null.

Fixed Parameters
In the optimization procedure, the fixed parameters (quantities that are known beforehand) are: i.
the hourly values of energy consumption and specific production for each node, ii. the physical properties of the involved fluids (for the ST technology), iii. the technological properties for each equipment (efficiencies), and iv. the unitary prices/costs for the technologies and the electrical energy.
For IST ponta phase, the price is composed of two parts: the energy component (0.112 €/kWh) and the power component (0.215 €/kW). Since the model is based on an hourly time-step, it is possible to sum the two components and obtain an overall price per kWh.
In the following, all fixed parameters are identified by the accent "ˆ" above the parameter symbol.

Objective Function
The objective function to be minimized (Z in Equation (1)) is the IST annual costs for energy, as the sum of (Equation (2)): 1.
The actualized investment and O&M costs (the latter is expressed as a percentage of the former) for the equipment installed onto all USRs, C inv+O&M .

2.
The overall cost for purchasing electricity from the grid, C el,GRID . 3.
The negative absolute value associated with the revenues from the sale of electricity to the USRs, Rev IST USR .
The investment cost for the PV appliances is proportional to the peak wattage of the selected PV technology (Wp), which, in this case, is equal to 290 Wp [32], whereas, for the ST equipment, it is the sum of the costs of the collector and thermal storage.

Model of the System
Constraints are linear function setting conditions that variables are required to satisfy. In this problem, the constraints (g(x(t), β) and h(x(t), β) in Equation (1)) are used to impose the conditions under which the system can exist and operate, such as the energy balances and flows management, usage of the available roof surface, and economic conditions.

Energy Balances
Three types of energy balances are written: the electric energy balance of the IST (Equation (3)), a "local" electric energy balance for each USR (Equation (4)), and the only thermal energy balance of IST (Equation (7)). Local thermal energy balance of the USRs are not required, because the possibility to develop a district heating network is not contemplated in this work.
IST electric energy balance: whereη el,t is the average efficiency of the two-way electric transition USR-IST (0.98). USR electric energy balance: Energies 2020, 13, 2919 In Equation (5), Q eh is the thermal power generated by the electric heater having efficiencyη el,c . In Equation (6),p PV is the electric production of each PV module per unit of the active surface area (Â PV ) and it is evaluated as shown in Appendix A.
IST thermal energy balance: where In Equation (9),q PV is the thermal production of each ST collector per unit of the active surface area (Â ST ) and it is calculated using Equation (A14) in Appendix A.
Note that the binary variable α(u) in Equations (5) and (7) is used to set the demand of a USR equal to zero when it is not selected to form the cooperative (α(u) = 0).

Energy Flows Management
The following inequality constraints are included to obtain a proper and feasible management of the electric and thermal energy flows: Equation (10) excludes the possibility of USRs sending to IST electricity purchased from the grid. Equations (11) to (13) exclude any interaction between IST and not-selected USRs. In particular, when a USR is not selected (α(u) = 0), Equation (11) precludes IST from sending electricity to it (P USR ITS (u, t) = 0), its energy consumption for the electric heater is set to zero by Equation (12) (Q eh (u, t) = 0), and its dissipated energy is null (Q diss (u, t) = 0) if there is not renewable solar thermal energy production by Equation (13).

Roof Surface Management
The following constraints are included to guarantee a feasible occupation of the available roof surface: whereŜ(u) is the total available roof surface of the user u. Equation (14) imposes that the combined PV and ST installations not cover more than the available roof surface. Equation (15) imposes that the number of PV modules of a not-selected USR is null. On the other hand, if a USR is selected, Equations (16) and (17) give priority to the PV modules rather than to the ST collectors.

IST as Storage
Since IST is modeled as a sink, it is capable of accepting all the energy generated by USRs that exceeds their consumption. Moreover, the campus is considered to behave like a daily storage system (Equations (18) and (19)); i.e., during the day, it would release up to the amount of energy it was charged with. When there is no production, IST can purchase energy from the grid and sell it to the respective USR, until all the stored energy during the day is returned (Equation (19)). To allow IST to send electricity to the USRs during the first part of the day (from midnight to sunrise, i.e., when there is no production from solar), each USR begins the day with an initial energy credit of 100 kWh.
Finally, Equations (20) and (21) mandate that the electricity cannot be flowing in both directions at the same time.
In Equations (20) and (21), s el is an auxiliary binary variable identifying the direction of electricity (when s el (u, t) = 1 at time t, the electricity flows from IST to the USR u; when s el (u, t) = 0, it flows in the opposite direction), andM is a very big constant parameter (no constraints on the maximum power that can be exchanged between IST and a USR is considered).

Thermal Storage Systems
The model of each thermal storage tank consists in two thermal energy balances, expressed in terms of the volume of hot water within the tank [11,12]: the first is between two subsequent hours (Equation (22)) and the second between the beginning and the end of the same day (the tank is considered a daily one, Equation (23)).
The second term of Equation (22) is the sum of the volume of hot water stored in the previous hour and the variation of hot water volume during the current hour. This variation is found by transforming the difference between charged and discharged thermal flow rates into a difference between charged and discharged volumes (this operation requires the charged/discharged energy flow rates to be divided/multiplied by the round-trip efficiencyη TS ). Equation (23) is used to design the maximum capacity of the storages (V TS MAX (u)), which is an output of the optimization procedure. Inequalities in Equations (25) and (26) are akin to (20) and (21).

Economic Constraints
Finally, the constraint in Equation (27) imposes that-for the solution to be feasible-the USR has to save money compared to the case in which there is no intervention (i.e., it purchases all of the energy from the grid).

Design/Operation Optimization Procedure
The design/operation procedure consists of the following three steps: i. seasonal optimization, ii. annual optimization, and iii. calculation of the contribution of each USR category to the IST savings.
A sensitivity analysis is finally performed to evaluate the effects of the solar technology prices on the optimum results. the value of all the energy streams/quantities that are not fixed as parameters (i.e., electrical and thermal energy flows between nodes, thermal energy flows charged-to/discharged-from the thermal storages, and the level of charges of IST and thermal storages) in each time-step of the season.

Second Step: Annual Optimization
The operation of each of the four optimal design configurations found in the first step is optimized over the entire year, still in agreement with the minimization of the IST costs (Equation (2)). In each of these four operation optimizations, all the design variables are fixed at their "seasonal" optimum values found in the first step.
The resulting lowest optimum value of the objective function (IST yearly cost) is used to identify the best of the four design configurations.

Third Step: Calculation of the Contribution of Each USR Category to the IST Savings
The goal of the third step is twofold: to calculate the share of the IST money savings each individual USR is responsible for, and ii. to evaluate the potential money savings for IST considering all candidate buildings within a radius of 500m from the campus (that is considered an acceptable distance for the purpose of this study).
The money savings for IST (i.e., the reduction of its annual costs due to the installation of solar technologies, Equation (2) are the differences between the annual costs obtained from the optimization minus those in the reference case, in which there is no interaction between IST and USRs. This goal is achieved by: • performing a series of simulation runs with one USR at a time and calculating the money savings for IST. In this step, each USR includes the same number of PV panels and ST collectors of the design configuration identified in the second step, • multiplying the obtained money savings associated with each USR by the total number of buildings belonging the USR category to get the total savings associated with this category of buildings, and • summing the IST savings derived from the four categories of USRs/buildings to obtain the total money savings for IST in each season.

Results
The simulations were performed on a machine with an Intel ® Core™ i7-2720QM CPU @ 2.20 GHz × 8 processor. The solving time of each simulation was about 0.5 s.
The reference case for the calculation of the money savings is the case of no-intervention: IST and the USRs are connected to the grid, and they purchase all the energy they need. In this case, the annual costs are IST 1,684,246 €, USR1 6581 €, USR2 4182 €, USR3 4991 €, and USR4 13,942 €.

First Step: Design Optimization in Each Season with All USRs
All seasonal optimizations (the first step of the design/operation optimization procedure described in Section 3) indicate the convenience of making all the four USRs interact with IST by installing only PV systems (i.e., it is never convenient to install ST collectors and TS capacity; the optimum value of χ(u) is always equal to 0).
In the spring-summer seasons, the rooftops of each category of buildings are to be completely covered by PV panels. Moreover, the highest optimum number of modules is always that of USR4 not only because of the largest available rooftop area (264 m 2 , Table 1) but, also, thanks to the most favorable exposure (sud-oriented roof and less shadow cast by nearby buildings). This results in a high optimum number of modules even in winter (85, the same number as spring-summer) and autumn (54, 36% less than spring-summer). A similar result is obtained for USR1 (54 in winter and spring-summer vs. 29 in autumn), which also has a favorably exposed rooftop. On the contrary, the optimizations in winter and autumn show a very small optimum number of PV modules for USR2 and USR3 due to the less favorable exposure (their rooftops are east-and west-oriented, respectively).

Second Step: Annual Optimizations
In this section, the behaviors of the four optimum design configurations (all including PV modules only) obtained in the first step by the four seasonal optimization runs are simulated over the whole year (Table 2). The design configuration that provides the maximum money savings for IST (best configuration) is the spring-summer one, which has the rooftops of the four selected USRs completely covered by PV modules. This configuration also provides the highest money savings for all USRs (in the range Energies 2020, 13, 2919 15 of 22 24% to 28%). The savings for IST (0.274%) are obviously smaller, because the only power generated by the single four USRs is considered in this second step, which is much smaller than the IST energy requirements. The discussion on the extension of the number of users is made in Section 3.3. Table 2 shows also that the IST annual money savings for the winter and autumn design configurations are significantly lower than those of the spring-summer configuration, mainly because of the strong drop of USR2 and USR3 savings (due to the lower optimum number of PV modules).
The total installed capacity in the chosen design configuration (summer-spring) is 64.09 kWp and results in an initial investment of 128,180 €.
The electricity purchased by IST from the grid during the PV production time is lower than that of the reference case, while it increases at the peak electricity demand of the USRs, as shown in Figure 6. It can be seen that, in autumn and winter, when the sunset occurs before the ponta phase (18:00 to 20:30), the variation of electricity purchased is null; IST "waits" for the most expensive phase to finish before feeding back the USRs with the energy it has accumulated. During this period, the USRs purchase all the electricity they need from the grid.
Energies 2020, 13, x FOR PEER REVIEW 15 of 23 PV modules. This configuration also provides the highest money savings for all USRs (in the range 24% to 28%). The savings for IST (0.274%) are obviously smaller, because the only power generated by the single four USRs is considered in this second step, which is much smaller than the IST energy requirements. The discussion on the extension of the number of users is made in Section 3.3. Table 2 shows also that the IST annual money savings for the winter and autumn design configurations are significantly lower than those of the spring-summer configuration, mainly because of the strong drop of USR2 and USR3 savings (due to the lower optimum number of PV modules).
The total installed capacity in the chosen design configuration (summer-spring) is 64.09 kWp and results in an initial investment of 128,180 €.
The electricity purchased by IST from the grid during the PV production time is lower than that of the reference case, while it increases at the peak electricity demand of the USRs, as shown in Figure  6. It can be seen that, in autumn and winter, when the sunset occurs before the ponta phase (18:00 to 20:30), the variation of electricity purchased is null; IST "waits" for the most expensive phase to finish before feeding back the USRs with the energy it has accumulated. During this period, the USRs purchase all the electricity they need from the grid. Results show also that, from the energy point of view, USR2 is the most suitable user for integration with IST; its electricity demand profile is not very different from that of USR3 (see Figure  5), but the amount of the stored energy profile is remarkably different, as in Figure 7. This is due to the different and opposite azimuth angles of the surfaces; the USR2 peak of PV generation can cover the morning peak of demand (completely in the spring and summer and partially in autumn) thanks to the east orientation of its rooftop; on the other hand, the USR3 surface orientation (west) does not provide benefits with respect to the evening peak (at 20:00).  Results show also that, from the energy point of view, USR2 is the most suitable user for integration with IST; its electricity demand profile is not very different from that of USR3 (see Figure 5), but the amount of the stored energy profile is remarkably different, as in Figure 7. This is due to the different and opposite azimuth angles of the surfaces; the USR2 peak of PV generation can cover the morning peak of demand (completely in the spring and summer and partially in autumn) thanks to the east orientation of its rooftop; on the other hand, the USR3 surface orientation (west) does not provide benefits with respect to the evening peak (at 20:00).
Energies 2020, 13, x FOR PEER REVIEW 15 of 23 PV modules. This configuration also provides the highest money savings for all USRs (in the range 24% to 28%). The savings for IST (0.274%) are obviously smaller, because the only power generated by the single four USRs is considered in this second step, which is much smaller than the IST energy requirements. The discussion on the extension of the number of users is made in Section 3.3. Table 2 shows also that the IST annual money savings for the winter and autumn design configurations are significantly lower than those of the spring-summer configuration, mainly because of the strong drop of USR2 and USR3 savings (due to the lower optimum number of PV modules).
The total installed capacity in the chosen design configuration (summer-spring) is 64.09 kWp and results in an initial investment of 128,180 €.
The electricity purchased by IST from the grid during the PV production time is lower than that of the reference case, while it increases at the peak electricity demand of the USRs, as shown in Figure  6. It can be seen that, in autumn and winter, when the sunset occurs before the ponta phase (18:00 to 20:30), the variation of electricity purchased is null; IST "waits" for the most expensive phase to finish before feeding back the USRs with the energy it has accumulated. During this period, the USRs purchase all the electricity they need from the grid. Results show also that, from the energy point of view, USR2 is the most suitable user for integration with IST; its electricity demand profile is not very different from that of USR3 (see Figure  5), but the amount of the stored energy profile is remarkably different, as in Figure 7. This is due to the different and opposite azimuth angles of the surfaces; the USR2 peak of PV generation can cover the morning peak of demand (completely in the spring and summer and partially in autumn) thanks to the east orientation of its rooftop; on the other hand, the USR3 surface orientation (west) does not provide benefits with respect to the evening peak (at 20:00).  IST is considered as a fictitious storage system; the campus can receive unlimited amounts of energy and release as much as it is convenient. In this framework, on the IST perspective, the most attractive partners would be those that make the level of charge increase from the beginning to the end of the day. USR2 is the most attractive in the set of USRs in this regard; it is the only one giving a positive contribution to the daily energy stored by IST for every season, except winter (Figure 7b). These results suggest that, for such electricity consumption profiles and tariffs, USRs with east-oriented surfaces are preferable for IST.

Third Step: Contribution of Each Category of USRs to the IST Savings
In the third step of the design/operation procedure, the simulations are run with a system comprising IST and only one USR at a time, each with the same number of equipment installed as in the best configuration resulting from the second-step solution. In this condition, the IST money savings, due to the association to each USR, are: 0.0662% for USR1, 0.0317% for USR2, 0.0368% for USR3, and 0.1383% for USR4. The sum of all of these terms is 0.273%, i.e., approximately equal to the total savings calculated with all USRs interconnected with IST (0.274%, Table 2). Therefore, it looks acceptable to consider the contribution of each category of USRs as independent of the others and, therefore, to calculate the IST total savings as the sum of the individual contributions of each USR.
It has been estimated that, in a radius of 500m from the campus, there is an amount of 31 buildings that fit for the category USR1, 16 for USR2, 12 for USR3, and 41 for USR4. The overall potential of IST money savings for each USR category is therefore: 2.052% for USR1, 0.507% for USR2, 0.442% for USR3, and 5.670% for USR4, for a total of 8.671% (146.046 k€), with 6151 modules installed, for an initial investment of 3.568 M€.
More buildings may be included, so that the overall savings be higher, but this might lead to a situation in which IST receives more energy than it requires (at peak production hours), making invalid the IST-as-sink hypothesis.

Sensitivity Analysis
A sensitivity analysis has been performed by varying the specific costs per PV module (c PV ) between 3 €/Wp and 1 €/Wp. Results are presented in Table 3. The same has been done for the ST and TS systems, but those equipment are not part of the optimal solution, even with a cost of 200 € per collector and 500 €/m 3 , respectively. The specific costs for the PV technology have been taken from [36]. In addition to that, two more cases have been examined: those in which the specific costs are 2.5 and 3 €/Wp, for which the optimal configuration of PV modules for USR1 to USR4 is 15,3,9, and 31 and 27,10,13, and 54, respectively.
Results show that the cost per watt peak affects the yearly savings of the campus, whereas those of the USRs remain unaffected when the number of modules installed do not change, because this cost is entirely financed by IST. Thus, the USR savings are affected only when the cost per unit module is high enough that it is not convenient to exploit completely the available surface. The savings for IST are inversely proportional to the unitary cost of the PV modules, whereas, for the USRs, they are proportional to the available surfaces they can offer.
For the lowest specific price of the PV technology, the third step of the design/operation procedure shows that the overall saving potential for IST is 20.878%, with an initial investment of 1.784 M€.

Discussion
The system under analysis has been modeled under some assumptions. Each one is reasonable and is made to simplify the procedure, while, at the same time, keeping a good level of accuracy. However, the following considerations may help understand the limit of these assumptions and suggest directions for development also in applications different from the presented one.
The design day technique is very useful, because it reduces the complexity of the simulations (solving time), but it comes with the drawback of neglecting the positive and negative peaks in energy consumption and environmental conditions. Moreover, the design days are simulated independently; further studies should focus on the consequential simulation of time periods of at least a week long to appreciate the variations from day-to-day and from weekdays-to-weekends. Thermal loads are obtained from an approximation of the geometry of the residential complexes. This procedure can be performed with publicly available data and does not require accessing technical maps, but its accuracy on the amount of electrical and thermal energy used might be insufficient for the actual design of the systems.
The advantages of the ST systems depend on both the correct characterization of the thermal loads and the accuracy of the model describing their behavior. Different results may be obtained with different modeling techniques-i.e., nonlinear programming-and iterative solution processes.
Further assessments should include the possibility to install micro and/or mini-CHP or CCHP systems in IST for the self-production of electric, heating, and cooling energy; these systems would work for many hours per year at rated loads, since IST base electricity consumption is about 800 kW, and also, the energy spent for HVAC during the day might justify cogenerative solutions.
IST makes a profit by purchasing energy from the grid at night and selling it to the USRs at the same price they would normally buy it; this condition might not be acceptable for the grid management company, thus possibly changing the feasibility of the project.
The last remark is that it has been assumed that the behavior of the residents does not change after the intervention; with the possibility of self-consuming the free renewable energy during the day, the electrical energy usage might increase. To avoid a decrease in residential energy efficiency because of the increase in renewable energy generation, compensating mechanisms and conditions should be investigated. For example, IST may demand a maximum (fixed or variable) share of renewable energy for the USR self-consumption or a variable cost of the "discharged" energy, according to the quantity it has received.

Conclusions
This work presents an economic assessment of the design of a distributed PV system supplying with renewable electric energy the residential complexes on which the equipment is installed and the university campus that finances the project. Four typical buildings have been studied as representatives of a wide number of residential complexes present locally. The campus was described by an electric consumption profile based on measured data. The geometry and occupancy of the residential complexes were estimated from publicly available data, such as the number of floors, apartments per floor, and roof surfaces. According to these estimates, an electric consumption profile obtained from the measurements was associated with each apartment. Similarly, the thermal load for space heating was estimated on the basis of the general thermal characteristics of the buildings and environmental recorded data, whereas that for the domestic hot water was calculated as a function of the number of inhabitants. Two candidate technologies for energy generation were considered: photo-voltaic modules and solar thermal collectors with thermal storage. Both have been modeled with a basis on the environmental data (hourly solar radiation and external temperature) and technological parameters. From all the data, four design days have been generated, each representative of a season of the year.
A MILP model was built to find the optimal design configuration of the system made up of IST and the four selected users/producers, the objective function being the yearly energy-related costs of IST.
Results show that photo-voltaic is the only convenient technology, whereas the solar thermal equipment are never part of the optimal solutions. It has been evaluated that, in a radius of 500 m from the campus, there is an estimated total amount of 100 buildings having the characteristics of the four selected users. If the total roof surface of these buildings is covered by PV modules, for a total of 6151 modules at 580 € each, IST, with an initial investment of 3.568 M€, benefits from a reduction of the yearly energy expenses of 8.671%, which equals to a savings of about 146.046 k€ per year during the module's expected lifetime (15 years). The highest share of money savings is for the USRs, each of which saves between 24.47% and 28.78%.
With this intervention, the energy consumption of both the campus and the residents is reduced when the energy costs are at their highest. The campus also returns partially or completely the energy received when there is no renewable generation and the cost of energy is lower. The East-side surface orientation has shown to be preferable, for it anticipates the renewable energy production covering the domestic peak load and allows the campus to receive more energy than the amount returned during the off-peak phase.
A sensitivity analysis on the unitary prices of the technologies was performed. The solar thermal technology is again never part of the optimal solution also when their prices are lowered reasonably. The residential savings depend on the number of installed modules, whereas the campus ones depend on the specific costs of the technology. To higher specific prices of the PV modules correspond a decrease in the number of installed equipment, hence a reduction in economic benefits for both IST and the USRs; the least favorable examined scenario was with a unitary price of 3 €/Wp, and under these conditions, the total number of installed modules was 1892. The yearly profit for IST is 1.263%, about 21.3 k€/year. The USRs savings decrease too, but the minimum one is still 17.5%. On the other hand, in the most favorable scenario, where the cost is 1 €/Wp, the investment cost is only 1.784 M€, and the yearly profit for IST is 20.878%, corresponding to 351.636 k€, the USR savings being the same as the base case.
The MILP model is simple and allows the assessment of many buildings one-by-one. The accuracy of the results can be enhanced with an improved characterization of the residential complexes and their energy flows and an analysis based on extended real-time periods. Smart procedures, conditions, and constraints should be investigated in all future works to avoid the development of energy-inefficient practices as a result of the availability of free renewable energy.
Funding: This research received no external funding.

Conflicts of Interest:
The authors declare no conflicts of interest.