Agent Based Modelling of a Local Energy Market: A Study of the Economic Interactions between Autonomous PV Owners within a Micro-Grid

: Urban Photovoltaic (PV) systems can provide large fractions of the residential electric demand at socket parity (i.e., a cost below the household consumer price). This is obtained without necessarily installing electric storage or exploiting tax funded incentives. The beneﬁts of aggregating the electric demand and renewable output of multiple households are known and established; in fact, regulations and pilot energy communities are being implemented worldwide. Financing and managing a shared urban PV system remains an unsolved issue, even when the proﬁtability of the system as a whole is demonstrable. For this reason, an agent-based modelling environment has been developed and is presented in this study. It is assumed that an optimal system (optimized for self-sufﬁciency) is shared between 48 households in a local grid of a positive energy district. Different scenarios are explored and discussed, each varying in number of owners (agents who own a PV system) and their pricing behaviour. It has been found that a smaller number of investors (i.e., someone refuse to join) provokes an increase of the earnings for the remaining investors (from 8 to 74% of the baseline). Furthermore, the pricing strategy of an agent shows improvement potential without knowledge of the demand of others, and thus it has no privacy violations.


Introduction 1.The Problem of Climate Change Has Been Internationally Recognized, The Political Will Is in Place
Climate change is one of the main challenges that threaten the wellbeing or the very existence of human society.This threat cannot be ignored because it can impact a wide range of natural ecosystems and socio-technical systems (e.g., [1][2][3][4][5][6][7]).In the last few decades, numerous technologies have been discovered, or improved, that can dramatically reduce our greenhouse gas emissions: renewable or low carbon energy generation facilities, energy storage systems, energy efficiency, and carbon capture devices.The vast majority of countries and international institutions on the planet agree on the danger of climate change and on the need for action [8].In other words, since the political and social will to build a low carbon economy has been largely achieved, the focus of this study has been put chiefly on practical strategies and effective transition pathways.The subject is how to achieve a transition to a low carbon society in an economically beneficial way and without causing discontent.To reach this goal, it is essential to analyze the impact of different market designs and the choices of different households in creating potentially harmful or unfair economic impacts.

How Change Can Happen
To transform the will for change to actual change, it is important to understand the causes and the mechanisms that activate the changes.According to Giddens' study [9], an important role in the evolution of technology is played by the interaction between socio-technical regimes: (i) the existing dominating technology and the social structure it generated, and technological niches, (ii) newer, smaller and dynamic sociotechnical entities that disturb the existing regime.Geels and Schot [10] elaborated different transition pathways (which include transformation, reconfiguration, technological substitution, and de-alignment and re-alignment) elaborating upon previous work and criticisms.In particular, Geels [11] added new elements on the subject introducing the so called 'socio-technical landscape'.The socio-technical landscape is the sum of morals, beliefs, knowledge, and ideas that can spur change in a socio-technical regime.Suarez and Oliva [12] presented different modifications of the socio-technical landscape: regular, hyper-turbulence, specific shock, disruptive, and avalanche.Also Scott [13] speaks about the forces that drive a transition or the conservation of a socio-technical regime, which can therefore be seen as a socio-technical landscape.These forces are divided into three groups: regulative (such as laws and standards), normative (such as values and norms), and cognitive (such as beliefs and search heuristics).The study argues that the stronger of these forces is the cognitive one since it is the most immersive and invisible for the actors under its influence.Other aspects that are fundamental in a transition are the selection pressure and the coordination of resources; these two are deeply interconnected according to Smith et al.'s findings [14].Specific examples of cognitive forces are the attitudes of end users toward innovative technologies; a large amount of literature exists on this topic (see [15]), but the authors consider obtaining a low carbon economy [16] a rather difficult endeavor.

Existing Optimization of Urban PV Systems and Research Gap
The coordination of resources, in a practical sense, is of the utmost importance in the case of PV technology.PV technology is currently one of the best candidates to shift the main energy source of our civilization away from fossil fuels.The direct use of the energy from the sun offers an abundant renewable supply with no pollutant emissions during the operational phase, thus producing fewer environmental side effects per unit of energy used compared to the present global energy mix.In general, PV systems can be categorized as urban PV or free-standing utility scale.Urban PV, as the adjective claims, is located in cities on buildings or infrastructure and serves the energy need of its immediate surrounding; this category is the subject of this study.On the other end, free-standing utility scales operate similarly to a traditional power plant: the electricity is generated in a rather large facility, then transmitted and distributed by the wider electric grid.
Both these categories of photovoltaic systems have strengths and weaknesses compared to the other, but both are characterized by a prominence of the initial investment compared to the operational costs.In other words, it takes a long time to repay the initial investment, but after that, savings and revenues can be enjoyed at almost no cost.These characters cause the payback time to be long (over 10 years), even amidst positive Net Present Value (NPV) calculated with discount rate of about 3% (see [17]).
Numerous studies have tackled the economic feasibility of the urban PV systems in the past few years, highlighting different aspects in the results [18].In particular, a number of studies have optimized the capacity and positions of PV systems according to their lifetime economic performance in self-consumption within the parent building or district (as briefly explained in Section 2.4) [19].
Lovati et al. [17] performed optimization over a school building where PV can be installed both on the roof and on a tilted façade.Most of the electric demand is in winter due to electric heating.Furthermore, summer break reduces demand during summer.The NPV maximization suggests a capacity of PV that can achieve a self-sufficiency above 30%.Moreover, part of the system is installed over the façade because of better self-consumption despite vast residual space on the roof.
Adami et al. [20] considered the differences in price between roof and façade solutions because of the premium paid for aesthetics and multi-functionality and the price reduction due to substitution of a cladding material.It shows that the optimal capacity on the façade is inversely proportional to its unitary price, and it starts to become advantageous when its unitary price falls below 2000 (€/kWp) (considering a unitary price on the roof of 1440 (€/kWp)).
Similarly, Vigna et al. [21] performed optimization over different building clusters (or districts) with varying urban density and functions.The residential function is shown in single family houses or larger high-rise buildings, and the larger buildings are also hypothesized with office or mixed electric demands.The procedure is repeated with two different reward functions: maximize Net Present Value (NPV) and maximize selfsufficiency.When the self-sufficiency is maximized, the office buildings are the best in performance thanks to the good matching between PV power production and building electricity demand (especially in summer).On the contrary, when NPV is maximized, the optimization in purely office buildings is choked by periods of low demand in spring and autumn.A good mixture (i.e., presence of more than one function in a district) is found to be effective to maximize the economic productivity of urban PV.
In Lovati et al.'s study [22] and Bernadette et al.'s work [23], the focus is on the benefit of the aggregation of the demand.The optimization in [22] is performed on a group of 16 houses.The optimization is first performed on each house separately, then on groups of 4 and finally on the whole block of 16.The optimization is repeated with two different reward functions: maximum NPV and minimum Levelized Cost of Energy (LCOE).For maximum NPV the aggregation of the load allowed the optimal capacity, the NPV, and the self-sufficiency to increase simultaneously.For minimal LCOE, to be obtained guaranteeing a self-sufficiency of at least 27%, both the LCOE values were reduced considerably (i.e., the one relative to the self-consumed fraction and the one relative to the whole energy output).
Huang et al. [24] further applied the method to a small residential district in Sweden, in this case a thermal storage was added as a sink for dumping excess PV power through the use of a heat pump.The presence of storage increases the on-site use of PV power output, and thus encourages a larger optimal capacity.Moreover, the effect of PV design at different Electric Vehicles (EV) penetrations in the district is examined.The results show that the self-consumption can reach nearly 80% with a self-sufficiency above 20% even in the baseline case without storage or EVs.
The previous studies have shown the results of optimization, assuming good quality input data; nevertheless, in design practice, the knowledge of the electric demand of the retrofitted building is often not available or is susceptible of high error.Therefore, Lovati et al. [25] tried the optimization process on a static demand obtained from an annual cumulative value.Even in the case of lack of demand data as an input, the method still outperforms other sizing methods and suggests a capacity that is only about 20% larger than the actual optimum.Even if the capacity suggested is almost correct, the values of NPV obtained by the simulation of said capacity with constant demand were considerably higher than those obtained with a realistic demand.
All these studies have focused on the optimal design of an urban PV system; nevertheless they do not discuss the possibility of financing it, nor how the risks and benefits can be shared among the stakeholders in the case that the system is jointly owned.Due to the aforementioned long-payback time of photovoltaic systems compared to other means of electricity production, the financing and lifetime economic performance of urban systems is of utmost importance in order to upscale this technology.

Relevant Research
As a possible solution for the financing and wider diffusion of renewable energy systems, micro-grids, and in general positive energy districts, are gaining importance in industry and academia.A comprehensive literature review on the subject would perhaps be beyond the scope of this study; nevertheless, the reader might consult the work of Gjorgievski et al. [26], of which a set of highlights is attempted.The review examines three broad aspects: one is mainly occupied with social arrangements, one is focused on the quality of system design, and one on economic, environmental, and social impacts of the energy communities.The first section contains numerous examples, both proposed and realized, of energy communities of consumers or prosumers.These communities, according to Caramizaru and Uihlein, are already more than 3000 in the EU [27].Furthermore, the first section of the review describes the role of service providers or initiators such as those described in Capellán-Pérez et al., [28] or Lowitzsch et al. [29].It also contains a detailed classification of different types of energy communities drawn from categories found in Moroni et al. [30], among others.The section relative to the design of the shared infrastructure offers numerous examples of techno-economic evaluation and optimization studies.A wide variety of technologies and design criteria are presented, most relevant in this context are the works concerned with the overall profitability of rooftop photovoltaic based energy communities.These analysed the operational phase: Roberts et al. [31] and Fina et al. [23], or the design: Novoa et al. [32], Abada [33], Sadeghian and Wang [34], and Awad and Gül [35].The present study is focused on the operational phase, but it starts from an optimally design shared PV system (see Sections 1.3 and 2.5).In the last section of [26] the economic, environmental, technical and social impacts of micro-grid are discussed by a large set of empirical and theoretical studies.

Aim and Objectives
The aim is to favour a quick and effortless transition to a higher share of Distributed Renewable Energy Systems (DRES) in residential areas.To achieve this result, different market designs for micro grids of positive energy districts are simulated and the tecnoeconomic effects of different arrangements are presented and commented on.In particular, the fairness and the resilience of the system is investigated by answering the following research questions/objectives: What is the effect of the price scheme adopted by the prosumers on their savings and revenues?2.
Is the micro-grid of a positive energy district economically feasible when some of the households refuse to invest any money in the shared PV system? 3.
Which are the most promising market designs to encourage the adoption of a shared PV system?
In other words, this paper deals with the integration of PV systems in a distributed environment.In particular, it shows the interaction of different owners of a co-owned system in a local energy market (i.e., a loose and free form of energy community).The results show the techno-economic outcome of the different choices that the inhabitants of an energy community can have.It follows a discussion on why such choices could be made, who the potential winners and losers are, and how such an energy community could impact the energy infrastructure and the environment in general.
In order to reach carbon neutrality, it is necessary to integrate suitable onsite renewable energy generation and storage technologies which can offset imported energy from grids.These technologies need to be sustainable; thus, they have to achieve economic, social, and environmental sustainability.The present study is concerned with the path to reach a sustainable positive energy district, and thus it analyses how to finance, build, and run a decentralized renewable energy facility within a residential district.The economic sustainability and the correct policy to avoid excessive inequality in risks and benefits is analysed.Furthermore, the impact of photovoltaic energy sharing in increasing the self-sufficiency of an energy district is simulated and discussed.

Research Methodology
This section will provide a brief introduction of the agent-based modelling algorithm used in terms of rules (which define behaviour of the agents), and different scenarios analysed (including various sets of PV distribution within the micro-grid and price schemes).
After that, since the algorithm is applied on a case study, the case study will be described according to its features, how it is modelled, and the determination of the ideal PV system to be installed.
Figure 1 shows the workflow performed in this study, including the geometry of the building, the aggregated demand of the 48 households, a series of techno-economic inputs (see Table 4) and a local weather file.All these inputs are used to obtain the optimal PV system (i.e., the optimal capacity and positions for the modules in the system).After that, the optimal system is tested in a series of scenarios (see following section) using the agent-based modelling.

Research Methodology
This section will provide a brief introduction of the agent-based modelling algorithm used in terms of rules (which define behaviour of the agents), and different scenarios analysed (including various sets of PV distribution within the micro-grid and price schemes).After that, since the algorithm is applied on a case study, the case study will be described according to its features, how it is modelled, and the determination of the ideal PV system to be installed.
Figure 1 shows the workflow performed in this study, including the geometry of the building, the aggregated demand of the 48 households, a series of techno-economic inputs (see Table 4) and a local weather file.All these inputs are used to obtain the optimal PV system (i.e., the optimal capacity and positions for the modules in the system).After that, the optimal system is tested in a series of scenarios (see following section) using the agentbased modelling.

Agent Based Modelling and Scenarios
Occupant behaviour in buildings is complicated with different patterns and distribution properties [36][37][38].An agent-based model is a model of a complex system where the behaviour is not controlled by a single algorithm, but it comes/emerges from the interaction of a number of sub-systems (i.e., the agents).Lovati et al. [39] proposed a 3D map of the possible algorithms (as shown in Figure 2); the dimensions represent the emergent versus controlled axis, the centralized versus decentralized axis, and the individual versus collective axis.The simulations presented in this study occupy the pink area in the map, and thus are individual, de-centralized systems causing an emergent behaviour in the micro-grid.In fact, in the scenarios described, there are multiple PV owners in the micro-grid and each one can set the price according to its own independent will.

Agent Based Modelling and Scenarios
Occupant behaviour in buildings is complicated with different patterns and distribution properties [36][37][38].An agent-based model is a model of a complex system where the behaviour is not controlled by a single algorithm, but it comes/emerges from the interaction of a number of sub-systems (i.e., the agents).Lovati et al. [39] proposed a 3D map of the possible algorithms (as shown in Figure 2); the dimensions represent the emergent versus controlled axis, the centralized versus decentralized axis, and the individual versus collective axis.The simulations presented in this study occupy the pink area in the map, and thus are individual, de-centralized systems causing an emergent behaviour in the micro-grid.In fact, in the scenarios described, there are multiple PV owners in the micro-grid and each one can set the price according to its own independent will.
It should be noted that, despite separate ownership, the agent-based model can be described by a simple set of rules: a.
Every household is represented by one independent agent in the simulation.b.
Every agent has an energy balance in each HOY (Hour of the Year).The energy balance is determined by its PV power (if it owns a PV system) minus its power demand in that particular HOY.If the balance is negative, the agent will be a net buyer in that HOY, otherwise it will be a seller.This rule implies that each agent can only sell electric power if it has already satisfied its own demand.Simply, each household can sell only excess PV production.c.
Each seller can set the price for the power he has to export.d.
If the electricity is offered by multiple sellers, the buying agent will buy preferentially from the cheapest source. e.
If the aggregated demand of the district exceeds the offer of the cheapest source, the demand of each household is satisfied proportionally by the cheapest source.If, for example, the cheapest source covers 30% of the aggregated demand in that HOY, each household is provided 30% of its power demand by the cheapest source.f.
If the on-site renewable power exceeds the power demand in a certain HOY, the cheapest sources are consumed preferentially, while the more expensive ones risk being in excess of the demand and sell part (or all) their power to the grid.Those who sell to the grid cannot set the price but are simply valued by the price paid by the grid (which is always way lower than that of the local sellers).
Although this paper only analyses three different setups, it attempts to lay the groundwork for a systematic study of the subject.In other words, the results and the discussion presented in this paper, although not conclusive by themselves, are part of a well-defined search-space.This allows the outcomes to be interpreted from the perspective a larger systematic endeavour.
In summary, the elements of novelty of this paper are described as the following: (1) The particular result of the study: To the knowledge of the authors, no study has linked the price of the electricity offered within a shared RES to both the risk of economic loss and the potentials for earning among the individual households within the shared microgrid.Furthermore, the dominance of shear annual cumulative consumption over self-sufficiency in determining the earning potential in a shared RES is an unknown phenomenon.It deserves to be further analysed (i.e., tested under different datasets) to be proven.(2) The examples of business models presented in the study are included in a well-defined search space map (see Figure 3).This facilitates a systematic inquiry and offers a way to organise the results presented in this study and in the follow-ups.
model.Although this paper only analyses three different setups, it attempts to lay the groundwork for a systematic study of the subject.In other words, the results and the discussion presented in this paper, although not conclusive by themselves, are part of a well-defined search-space.This allows the outcomes to be interpreted from the perspective a larger systematic endeavour.
In summary, the elements of novelty of this paper are described as the following: (1) The particular result of the study: To the knowledge of the authors, no study has linked the price of the electricity offered within a shared RES to both the risk of economic loss and the potentials for earning among the individual households within the shared microgrid.Furthermore, the dominance of shear annual cumulative consumption over self-sufficiency in determining the earning potential in a shared RES is an unknown phenomenon.It deserves to be further analysed (i.e., tested under different datasets) to be proven.( 2) The examples of business models presented in the study are included in a well-defined search space map (see Figure 3).This facilitates a systematic inquiry and offers a way to organise the results presented in this study and in the follow-ups.The same set of rules is applied on a set of six different scenarios; these are explained in the following paragraphs and summarized in Table 1.Scenario 1: All residents agree to purchase the PV system; every household purchases an equal share of the total system and has thus the right to 1/48 of the power at any time (i.e., ca.1.36 kW of capacity each).The price for the sale within the micro-grid is agreed for the long term as the summer grid price/1.2(thus a static 1 SEK/kWh at the year 0); therefore, whoever buys electricity from another household saves ca.17% on the electricity cost in summer and 45% in winter.
Scenario 2: All residents agree to purchase the PV system, like in Scenario 1.The price for the sale within the micro-grid is agreed for the long term as 99% of the grid price; therefore whoever buys electricity from another household has almost no savings compared to the grid.In this case it is assumed that using local energy is perceived as a value in itself by the participants in the grid.Scenario 3: Only 50% of the residents agree to purchase the PV system; every PV equipped household purchases an equal share of the total system and has thus the right to 1/24 of the power at any time (i.e., ca.2.73 kW each).The price for the sale within the micro-grid is agreed for the long term as the summer grid price/1.2,like in Scenario 1.
Scenario 4: Only 50% of the residents agree to purchase the PV system; every PV equipped household purchases an equal share of the total system like in Scenario 3. The price for the sale within the micro-grid is agreed for the long term as 99% of the grid price, like in Scenario 2.
Scenario 5: All residents agree to purchase the PV system, like in Scenario 1.The price for the sale within the micro-grid is left to the choice of the single household; 50% of the households decide to charge a high price (i.e., 99% of the grid, like case 2 and case 4), the others charge the summer price /1.2 like in Scenario 1 and Scenario 3.
Scenario 6: All residents agree to purchase the PV system.The price for the sale within the micro-grid is left to the choice of the single household like in Scenario 5, and 50% of the households decide to adopt a dynamic price system based on their energy balance in every hour of the year.With this strategy the energy is sold at LCOE whenever the balance is more than double the average balance in that hour of the day.The other 50% charges the 1 SEK per year like in Scenario 1 and Scenario 3.
In general, regardless of the scenario, the behavior of each agent in a time-step can be summarized as shown in Figure 3.
micro-grid is agreed for the long term as the summer grid price/1.2,like in Scenario 1.
Scenario 4: Only 50% of the residents agree to purchase the PV system; every PV equipped household purchases an equal share of the total system like in Scenario 3. The price for the sale within the micro-grid is agreed for the long term as 99% of the grid price, like in Scenario 2.
Scenario 5: All residents agree to purchase the PV system, like in Scenario 1.The price for the sale within the micro-grid is left to the choice of the single household; 50% of the households decide to charge a high price (i.e., 99% of the grid, like case 2 and case 4), the others charge the summer price /1.2 like in Scenario 1 and Scenario 3.
Scenario 6: All residents agree to purchase the PV system.The price for the sale within the micro-grid is left to the choice of the single household like in Scenario 5, and 50% of the households decide to adopt a dynamic price system based on their energy balance in every hour of the year.With this strategy the energy is sold at LCOE whenever the balance is more than double the average balance in that hour of the day.The other 50% charges the 1 SEK per year like in Scenario 1 and Scenario 3. In general, regardless of the scenario, the behavior of each agent in a time-step can be summarized as shown in Figure 3.

Modelling of the Economic Performance
To understand the profitability and the risks associated to the investment in the shared PV infrastructure the CAGR (Compound Annual Growth Rate) was used as key performance indicator.The CAGR has been considered in its real value i.e., without inflation, and expressed in percentual form according to the following equation:

Modelling of the Economic Performance
To understand the profitability and the risks associated to the investment in the shared PV infrastructure the CAGR (Compound Annual Growth Rate) was used as key performance indicator.The CAGR has been considered in its real value i.e., without inflation, and expressed in percentual form according to the following equation: In Equation ( 1), real Compound Annual Growth Rate is used to infer the profitability of the investment in the shared PV for each household.

•
Inc. represents the cumulative income derived by the ownership of the share of the PV system during its lifetime; it represents the figure before costs (i.e., capital expenditure and operational expenditure) and it is calculated according to Equation (2).
• CAPEX is the capital expenditure; it includes the turn-key cost of the system including design and installation costs, but it assumes no taxation.It can be calculated by multiplying the unitary cost by the installed capacity (see Table 4).

•
OPEX is the operational expenditure; it includes a standard annual cost of 80 SEK/kWp year for the substitution and cleaning of the modules, plus substitution of the inverter in case of rupture.The inverters have a cost of 3.5 KSEK/kWp and should be changed at least once in the planned lifetime of the system.

•
Lifetime is expressed in years and is assumed as 30 years in this model.
Equation ( 2): cumulative income derived by the ownership of the share of the PV system during its lifetime

•
T represents the number of years since the construction of the PV system.

•
Sav. Represents the savings due to the avoided purchase of electric power from the external grid, it is calculated according to Equation (3).

•
Rev. Represents the revenues obtained by each shareholder by selling excess PV power from their share, it is calculated according to Equation ( 4).

•
∆η is the variation of the efficiency due to ageing of the PV system.The shared PV is assumed to lose 1% per year (see Table 4).

•
∆d is the variation in the price of the electricity for the consumer, it is assumed as +1.5% per year in design stage (see Table 4), but it is then assumed 0 or 2% in the agent based model (see Figure 8 Equation ( 3) savings due to the avoided purchase of electric power from the external grid.

•
Ts represents the internal time-step of the model, in this case it is set as 1 h.
Equation ( 4) revenues obtained by each shareholder by selling excess PV power from their share

•
P peer,Ts is the power sold to all peers in a specific time-step • d peer,Ts is the price set for selling power to the peers in a specific time-step • P grid,Ts is the power sold to the grid in a specific time-step • d grid is the price at which the grid purchases power.This price is static, thus is independent by the time-step.

Case Study Description
A small district (or cluster) of residential buildings was adopted as a case study to test different behaviours of the co-owners (see Figure 4).The district is composed of three multi-family apartment blocks and it is located in Sunnansjö (Ludvika), in the Dalarna region of Sweden.The district is currently undergoing energy retrofit within the project Energy Matching [40] and is already the subject of scientific publication in [24,39,41].While the geometric and technological properties of the site are known, the demographic information shall not be disclosed to respect the privacy of its inhabitants.For this reason, the electric demand used for the study was generated using LPG (Load Profile Generator) [42] assuming population characteristics as described in the following section (see Section 2.3).In total, there are 48 households in the three multi-family apartment blocks.

Case Study Description
A small district (or cluster) of residential buildings was adopted as a cas test different behaviours of the co-owners (see Figure 4).The district is compos multi-family apartment blocks and it is located in Sunnansjö (Ludvika), in th region of Sweden.The district is currently undergoing energy retrofit within Energy Matching [40] and is already the subject of scientific publication in While the geometric and technological properties of the site are known, the de information shall not be disclosed to respect the privacy of its inhabitants.For t the electric demand used for the study was generated using LPG (Load Profile [42] assuming population characteristics as described in the following section ( 2.3).In total, there are 48 households in the three multi-family apartment block

Electric Demand Assumptions
From previous study, the characteristic of electric demand with differ scales possesses various properties, and the aggregated electric use curves of m holds indicate weaker randomness [43,44].The composition of the district, m households, was assumed to reflect the demographic composition of Sweden a in the official statistics [45].Due to the small sample of households, it was deci tail all the households listed in the 'other' category of the official data.These difficult to transfer to a small sample because are numerically small, heteroge less specified than the main categories.For this reason, the district has been d match the main categories of household in Sweden (Table 2) as shown in Tab tables it is visible that the group 'single + 3 kids' has been removed as in pr amounts to almost zero households and would misrepresent the overall num if one household was introduced.Please note that each household does not own any physical portion of the roof as it is commonly owned.If a household decides to invest in the shared PV system, it becomes shareholder of the common infrastructure (it does not purchase a physical small system on the roof).

Electric Demand Assumptions
From previous study, the characteristic of electric demand with different spatial scales possesses various properties, and the aggregated electric use curves of more households indicate weaker randomness [43,44].The composition of the district, made of 48 households, was assumed to reflect the demographic composition of Sweden as reported in the official statistics [45].Due to the small sample of households, it was decided to curtail all the households listed in the 'other' category of the official data.These groups are difficult to transfer to a small sample because are numerically small, heterogeneous, and less specified than the main categories.For this reason, the district has been designed to match the main categories of household in Sweden (Table 2) as shown in Table 3.In the tables it is visible that the group 'single + 3 kids' has been removed as in proportion it amounts to almost zero households and would misrepresent the overall number of kids if one household was introduced.
Once the composition of the households was determined, the age and gender of the components have been estimated to match the data available online from the world factbook [46].The resulting composition of the whole district have been reported in the Appendix A (see Table A1).

Calculation of the Optimal PV System
The optimal PV system, used in the micro-grid simulation, is the system that can maximize the self-sufficiency of the district while maintaining a positive NPV.The capacity and positions of such a PV system were found with the same technique and tool from the studies enumerated in the introduction (Section 1.3), which is one result of the H2020 project EnergyMatching.The parameters of the optimization are capacity and position of the PV system, if the capacity is too small the self-sufficiency will be low, but if the capacity is too high the overproduction of electricity will be too frequent, and the system will not be profitable.With the correct capacity (which leads to the largest profitable system) the self-sufficiency can be maximized; furthermore, installing parts of the PV system on the façade instead of on the roof can increase the contemporaneity between production and consumption [17].In the case study described, considering the assumptions described in Table 4, the optimal system has a PV capacity of ca.65.5 kWp, and no electric storage.The capacity on the southern slope of the roof (which is the most irradiated) is as high as it can be at 28.4 kWp, while part of the system has been installed on the southern façade (i.e., 5.3 kWp) despite large available spaces on the east and west slopes of the roof.The system can achieve an annual average self-sufficiency of ca.24.6%.For the detailed design optimization of the PV systems, please refer to [24].The optimization algorithm has a single target: its parameters are the capacity and positions of the PV system, and its reward function is the average annual self-sufficiency of the PV and building system.In the initial stage the building does not feature any PV system (capacity equals 0), then portions of PV area or electric storage are added or moved in an iterative procedure to maximize the reward function.Once it is not possible to further improve the function by adding or moving any component, the system is considered optimal and the algorithm ends.
The assumptions in Table 4 have been used for the dimensioning of the PV system according to the technique described in [17] and in numerous other studies mentioned in Section 1.3.The lifetime of the system is assumed at 30 years.However, the lifetime of the inverters is considered about 12.5 years and the expenses for its substitution are taken into account among maintenance costs (see [17]).The performance ratio of the system is considered 0.9.This value is not conservative as the average for urban installed systems is generally lower.Nevertheless, it should be considered that this is the performance ratio at standard test condition, which is therefore measured before temperature correction.Several examples in literature are considering the final performance ratio which is either measured experimentally or takes into account the temperature related losses.Several studies regarding urban photovoltaic systems, if controlled for calculated temperaturerelated losses, show values similar to 0.9 (see [47,48]).Significantly lower performance ratio at standard test condition could be expected in situations of strong partial shading.Furthermore, lower values can also arise in systems characterized by multiple facades if performance ratio is calculated measuring the irradiation in a single point, while production is calculated over the aggregated system.Nevertheless, these situations do not occur in the system under study.In term of efficiency, 16.5% was chosen; this value is conservative respect to the datasheets provided by numerous manufacturers.It should be noted that here, as in [17] and numerous studies mentioned in Section 1.3, the system does not represent the active area or the cumulative area of the modules, but the underlying area dedicated to the PV system.Since this a moderate sized rooftop system, and thus not equipped with empty passages for inspection, a utilization factor of the area of about 80% was assumed.This factor was taken into account by lowering the overall efficiency of the system.

Results and Discussion
After the simulation over an entire year in hourly time-step, all the exchanges of money and electric power that have happened in every time step between the different households are recorded in a ledger.The ledger is a Json archive; its size is large as it contains every interaction, both economic and of power, between a every single household with every other single household and the grid.Analysing this large file is possible in order to discover who has earned and who has lost in economic terms.Furthermore, it is possible to track the origin of the power that every household has consumed.

Self-Sufficiency within the Micro-Grid
Figure 5 shows the distribution of self-sufficiency throughout the district.Every point of the line describes the percentile of households that have a self-sufficiency lower than that described in the y-axis.It is visible, for example, that 90% of the district has a selfsufficiency lower than 29%.In other words, most of the district uses at least seventy percent of its energy from the grid.The flip side is that less than 10% of the households in the district has a self-sufficiency below 20%.This implies that the vast majority of households consumes at most 80% of their cumulative demand from non-local electricity.The result is notable because it far exceeds the solar fraction in the energy mix of even the best countries according to [49].In general, the gradient of the curve seems to be slightly stronger at the extremes.It is rare to have an outlier with high or low self-sufficiency.In fact, about 70% of the households in the district fall within a variance of five percentage points of self-sufficiency (i.e., 22.5% and 27.5%).

Effects of the Local Energy Market on the Price
Figure 6 describes the average hourly price for Scenario 1 during the different hours of the day within the district.The grey bands represent the variability between different households of the district.If a bar is longer, it means that some households have an average price that is significantly lower than others in that hour of the day.The red ticks represent the average price in that hour for the whole district.It is immediately visible that between 7 P.M. and 4 A.M. the price is almost stable at one point five SEK.The price is stable because there is no electric storage installed in the micro grid and, therefore, when a photovoltaic system is not producing, the price is that of the power provided by the electric grid.Considering that the night-time consumption of the district remains stable throughout the year, and that the electricity is sold at 1.8 SEK/kWh in winter and 1.2 SEK/kWh in summer, the night price paid by the whole district equals almost exactly the average of the two (i.e., 1.5 SEK/kWh).During daytime the price is lower; there are two reasons for this phenomenon.The first reason is that each household owns a share of the local PV system, and therefore all the electricity produced by their own share already belongs to them and is thus free for themselves.The second reason is that they can purchase electricity from their peers, the price of which is consistently lower than that of the grid.For these reasons, those households that are able to use larger share of their own electricity, or at least of the electricity from their peers, can enjoy a lower price for the electricity.It is visible, indeed expected, that the price of electricity is generally lower during the central hours of the day.Furthermore, it can be observed that times of the day of comparatively higher price correspond with moments of high electric demand.For example, it can be seen that the price is comparatively higher at seven and eight AM (when people prepare and consume breakfast) and at noon (when many prepare and consume lunch).This is due to the fact that, despite a large photovoltaic production in that hour, the outlier high demand forces the whole district to supply part of its demand from the external electric grid.

Effects of the Local Energy Market on the Price
Figure 6 describes the average hourly price for Scenario 1 during the different hours of the day within the district.The grey bands represent the variability between different households of the district.If a bar is longer, it means that some households have an average price that is significantly lower than others in that hour of the day.The red ticks represent the average price in that hour for the whole district.It is immediately visible that between 7 P.M. and 4 A.M. the price is almost stable at one point five SEK.The price is stable because there is no electric storage installed in the micro grid and, therefore, when a photovoltaic system is not producing, the price is that of the power provided by the electric grid.Considering that the night-time consumption of the district remains stable throughout the year, and that the electricity is sold at 1.8 SEK/kWh in winter and 1.2 SEK/kWh in summer, the night price paid by the whole district equals almost exactly the average of the two (i.e., 1.5 SEK/kWh).During daytime the price is lower; there are two reasons for this phenomenon.The first reason is that each household owns a share of the local PV system, and therefore all the electricity produced by their own share already belongs to them and is thus free for themselves.The second reason is that they can purchase electricity from their peers, the price of which is consistently lower than that of the grid.For these reasons, those households that are able to use larger share of their own electricity, or at least of the electricity from their peers, can enjoy a lower price for the electricity.It is visible, indeed expected, that the price of electricity is generally lower during the central hours of the day.Furthermore, it can be observed that times of the day of comparatively higher price correspond with moments of high electric demand.For example, it

Savings and Revenues
Figure 7 shows the relationship between savings and revenues for each single household within the micro grid.All the sixth scenarios described previously are shown in the chart.In general, the savings are obtained either by using the electricity produced by one's own system, therefore saving 100% of the price from the grid, or else by using the electricity from a peer household at a discounted price.On the other end the revenues are ob-

Savings and Revenues
Figure 7 shows the relationship between savings and revenues for each single household within the micro grid.All the sixth scenarios described previously are shown in the chart.In general, the savings are obtained either by using the electricity produced by one's own system, therefore saving 100% of the price from the grid, or else by using the electricity from a peer household at a discounted price.On the other end the revenues are obtained either by selling electricity to the grid, or else by selling electricity to another household, the latter providing a much higher price.In each of the charts, every household is displayed as a circle, its position on the x-axis represents its annual revenues, while its position on the y-axis represents its annual savings.The colour of the circle line represents its belonging to a different category, according to the number of people living in the household.In general, these charts should be studied in their relative difference between each other, rather than in their absolute values.In fact, the absolute value of revenues and savings are not interesting when the cost of initial investment and those for the maintenance of the system are not taken into account.To see the lifetime techno-economic performance of the system, please check the next paragraph, which displays the CAGR.Observing the colour in all the cases it is visible that the smaller households (those which have a smaller electric demand) tend to show lower savings and higher revenues.This phenomenon is quite unsurprising because in the example considered every household purchases an equal capacity to all the others.Therefore, the small households will have a PV capacity that is larger relative to their demand, and will, thus, export and sell a larger fraction of the electricity that they produce.

Small Consumers Are 'Sale Oriented', Large Consumers Are 'Savings Oriented' (Scenario 1 vs. Scenario 2)
There is a noticeable difference between Scenario 1 and Scenario 2. In Scenario 1 every household agreed to sell their electricity at a significantly lower price compared to what they agree in Scenario 2 (see Table 1).Therefore, scenario one seems to be particularly

Small Consumers Are 'Sale Oriented', Large Consumers Are 'Savings Oriented' (Scenario 1 vs. Scenario 2)
There is a noticeable difference between Scenario 1 and Scenario 2. In Scenario 1 every household agreed to sell their electricity at a significantly lower price compared to what they agree in Scenario 2 (see Table 1).Therefore, scenario one seems to be particularly advantageous for the largest consumers.This is due to the fact that the largest consumers have high savings but low revenues, and therefore, the sale of electricity at a lower price from others leads to higher savings for them, while it does not impact their revenues significantly.On the contrary, the smallest consumers, that have in general lower savings and higher revenues, will benefit from higher price of electricity.In this case, they will be able to increase their revenues greatly without changing their savings too much.In fact, being smaller, most of their savings comes from their own PV system, which is already overdimensioned compared to their size.Going back to the largest consumers, a large fraction of their savings implies purchasing electricity from the smaller peers.Another noticeable aspect is that in Scenario 2, all the points are almost linearly correlated.This is due to the high price of the electricity sold, which is almost the same of the cost of electricity from the grid.The smaller remaining differences can be explained by the correlation between the private electric demand and the demand of the whole district.If a household overproduces electricity when the whole district is in over-production, its performances will be slightly lower because it will often sell to the grid.In the opposite case, when a household overproduces at times when there is need from other households, then its performance will be slightly higher.

When Some Agents Refuse to Invest in the Shared System, The Remaining Investors Have
Larger Benefits and Lower Risks (Scenarios 3 and 4 vs. 1 and 2) Scenarios 3 and 4 reflect Scenarios 1 and 2 in terms of price, but they have the peculiar aspect that only half of the households choose to purchase a PV system.This state of affairs would be very important for any practical application of the micro-grid.This is because, in practice, it is difficult to convince 100% of the tenants in a multi-family dwelling to participate, and especially to invest money, in a PV system.In a realistic setting it is expected that part of the population is unwilling to invest in the system; nevertheless, in the simulation it is assumed that they decided to participate in the micro-grid as simple consumers (i.e., those who do not own any part of the system).The assumption is safe because being a simple consumer only requires to always purchase the electricity from the cheapest source.In this way, to participate as a simple consumer does not have any initial cost nor risks, but it might have a benefit during the lifetime of the system.If Scenario 1 is compared to Scenario 3, it is visible that the points in the latter overwhelmingly outperform those in the former both in terms of revenues and in terms of savings.It is tolerably intuitive that, if only half of the households own a PV system, their revenues will increase.In fact, all the households who do not own PV can only buy the electricity from those who own it, and therefore, the whole local market moves in the direction of a "seller's market".Also, the increase in savings is readily explained.In fact, since the optimal capacity is unchanged in every scenario (see Section 2.4), every PV owner has at his disposal a larger capacity.This fact implies that there is more available electricity for self-consumption in every HOY, even at times of relatively high private electric demand.This spare over-capacity favours an increase in self-sufficiency.Looking at the bottom left corner of the chart for Scenario 3, it can be seen how there is a benefit in terms of savings also for those who do not own a PV system.Of course, these savings are minor compared to those of the other households, and this is due to two specific reasons.The first one is that, by lacking a PV system of their own, these households do not have their own electricity for free, and therefore can only purchase electricity from their peers.The second reason is that every household, before selling electricity, satisfies his own demand (see Section 2.1, in the rule b), and therefore those in the micro-grid who do not own a PV system can only benefit from the left-over electricity from the others.In other words, the household without PV can only purchase electricity when they happen to be in need of power at times when others are in overproduction.Scenario 4, like the Scenario 2, presents a linear correlation between the revenues and the savings of each household.Like Scenario 2 over Scenario 1, Scenario 4 also presents relatively higher revenues and lower savings compared to Scenario 3, thus favouring the smallest consumers.Furthermore, like Scenario 3, it presents a sharp contrast between the PV owners and the other households.It should be noted, though, that this time there is absolutely no benefit in participating in the micro-grid, or at least the benefits are so tiny that cannot be seen by the naked eye.There is nevertheless a benefit for those households: the possibility to increase the share of renewable on-site electricity in their energy consumption.It can be expected that, given the absence of initial investment, most consumers would be willing to increase their renewable energy share.By doing so, they have the possibility to save the planet with a costless, and thus effortless, action.

Interaction of Competing Sale Strategies within the Micro-Grid (Scenario 5 and Scenario 6)
In the first four scenarios, the price for the sale of PV power and the number of PV owners has been changed.Nevertheless, in all these cases, every PV owner agreed to maintain the same price as everybody else.In Scenario 5 the hypothesis is made that a half of the PV owners prefer to sell at the lower price (i.e., the price of the whole group of PV owners in Scenarios 2 and 4).Meanwhile the other half of the owners prefers to sell at the same price of Scenarios 1 and 3. Observing the revenues and the savings in this arrangement, it can be noted that, in general, the sellers who decide to sell for a lower price ('cheap sellers'), enjoy a higher revenue compared to the others.Savings are not affected by the price of the sale of one's own electricity, but rather by the price of available energy from the other households.For every savings level in the chart, the lowest selling households, which are marked as 'cheap sellers', appear to be on the right side compared to the others, which means that they have managed to obtain higher revenues.There are two factors at play when measuring the revenues in this type of market (where there are two different prices groups).The first factor is the sheer revenues per kWh sold; this acts by lowering the revenues for the so called 'cheap sellers'.The second factor regards the ability to effectively sell your electricity within the micro grid at all.The capacity of not be in over supply, and thus forced to sell most of your power to the grid.If a different price was chosen, the result might have been different, but in this case the increased revenues derived from a higher price scheme are not enough to offset the increased instances in which the electricity cannot be sold due to high price and low demand.Also, in Scenario 6, the last one, the group of households was divided into two sub-groups.As in the previous scenario, some households were selling their electricity at a lower price compared to others.This time, though, the expensive sellers were given the ability to change the price according to a behaviour of their own.The mechanism used to change the price was set as explained in Scenario 6 of Section 2.1.In practice, these households, identified in the chart as 'smart sellers', will sell their power at the LCOE of the system, which is lower than the static price of the cheap sellers, whenever they have an outlier high energy balance in that specific hour of the day.In other words, when a smart seller has an outlier, low power consumption, or an outlier high power production from PV, it will sell its electric power at the lowest possible price.This strategy is extremely simple and is prone to numerous fallacies.In fact, if for example a particular household is on holiday during an unpopular period, its power demand would be unusually low, thus resulting in an outlier high balance.This could cause it to sell at LCOE in a time in which the electricity is indeed in high demand throughout the district.In this example, the household would be selling at the lowest possible price in a time in which the maximum price would still manage to sell to the peers.Conversely, if a household will experience an outlier high demand for its own reasons, it might find itself selling its available power dearly, while there might be plenty of energy available for everyone.It this case it will be forced to sell most its power to the electric grid.Despite the simplicity of this strategy and its obvious flaws, it is visible from the chart that such a simple behaviour is good enough for outsmarting the cheap sellers in the competition for the sale of electric power.Given any savings level, the smart sellers undeniably manage to obtain higher revenues.This is a very important result because it shows that it is possible to create an effective strategy without knowing the consumption of the other agents in the micro grid, thus avoiding privacy issues.), the CAGR are real (i.e., would be higher if adjusted for inflation), and assume a case in which there is no growth in the price of electricity, a chart assuming a 2% linear increase in the price of electricity from Scenario 4 is in the Appendix A.
This time no information is provided on the 'y' axes; the households are simply divided into groups to enhance the readability of the chart.The black crosses represent the average CAGR of each group (according to the number of inhabitants in the household).At first glance these CAGR might look low, but it should be noted that they are produced with two strongly conservative assumptions: the CAGR is real (note it does not consider inflation over a period of 30 years) and the price of electricity for the consumer is considered stable throughout the lifetime of the system (which means it will not grow despite the large investments needed to renew the grid infrastructure and potential future carbon taxation).Some examples of real CAGR considering a 2% linear price growth for the household electricity can be found in Appendix A. In general, it can be seen that larger households, those with higher number of inhabitants and higher electric demand, fare better than the smaller ones in terms of CAGR.This fact must be due to larger households being able to exploit the savings derived by their own PV system more often, and more often benefit from purchasing energy from their peers.Looking at the difference between Scenarios 1 and 2, it is visible how the relative difference in average CAGR between groups is lower in Scenario 2. This means that larger households benefit more from inter-  (1)(2)(3)(4)(5)(6), the CAGR are real (i.e., would be higher if adjusted for inflation), and assume a case in which there is no growth in the price of electricity, a chart assuming a 2% linear increase in the price of electricity from Scenario 4 is in the Appendix A.
This time no information is provided on the 'y' axes; the households are simply divided into groups to enhance the readability of the chart.The black crosses represent the average CAGR of each group (according to the number of inhabitants in the household).At first glance these CAGR might look low, but it should be noted that they are produced with two strongly conservative assumptions: the CAGR is real (note it does not consider inflation over a period of 30 years) and the price of electricity for the consumer is considered stable throughout the lifetime of the system (which means it will not grow despite the large investments needed to renew the grid infrastructure and potential future carbon taxation).Some examples of real CAGR considering a 2% linear price growth for the household electricity can be found in Appendix A. In general, it can be seen that larger households, those with higher number of inhabitants and higher electric demand, fare better than the smaller ones in terms of CAGR.This fact must be due to larger households being able to exploit the savings derived by their own PV system more often, and more often benefit from purchasing energy from their peers.Looking at the difference between Scenarios 1 and 2, it is visible how the relative difference in average CAGR between groups is lower in Scenario 2. This means that larger households benefit more from internal sale of electricity compared to smaller ones.This fact is quite intuitive since every household owns an equally sized PV system, and thus having a larger electric demand increases the frequency of over-consumption with respect to one's own electricity.In Scenario 2, where the benefit of buying from peers has been almost completely removed, there is a residual advantage in being a large consumer.This is due to the higher self-consumption of the large consumers.In fact, having a large self-consumption of one's own electricity reduces the risk of not having buyers in a specific HOY; it does so by reducing the very number of hours in which one needs a buyer.Furthermore, though negligible, in case 2 there is also the 1% difference in price between the external and the internal electricity.Scenarios 3 and 4 reflect Scenarios 1 and 2 except that only 50% of the households decide to install PV, and thus are entitled to twice the capacity of before.In Scenario 3 and 4 the CAGR of every group are sensibly increased compared to the respective Scenarios 1 and 2. This at first might sound counter-intuitive for Scenario 3 (i.e., electricity sold for cheap) considering the lower self-consumption given by a larger per capita system.Nevertheless, even though the instances of over-production are more frequent for PV owners, there is a larger number of buyers among the peers because half of the households do not own a PV system, and the price of sale, though low, is still higher than the LCOE of the system.Furthermore, even though self-consumption is lowered by a larger system, self-sufficiency is increased and allows for higher savings from avoided electricity consumption.In other words, having a larger system increases the savings of the owners, and being in a 'seller's market' due to the lower proportion of PV owners, the risk of selling to the grid is also reduced.This explains the sensible increase of CAGR from Scenario 1 to Scenario 3, and the massive increase from Scenario 2 to Scenario 4. In terms of CAGR, Scenario 5 and Scenario 6 reinforce the signal obtained previously in terms of revenues.In fact, in Scenario 5 (when part of the households sells at generally at a lower price) the so called 'cheap sellers' drive the others outside of the market forcing them to sell a large fraction of their electricity to the grid.This is visible by the fact that the cheap sellers consistently occupy the right side of the dispersion in every group (i.e., achieve higher CAGR for every group).Conversely, when the expensive sellers are given the ability to modulate the price according to their own energy balance, despite the simple and flawed nature of the algorithm, they secure the rightmost side of the dispersion in the different groups.

Key Findings
Several previous studies have demonstrated that urban PV systems can be economically feasible while covering a large portion of the residential electric demand (i.e., more than 20% or even 30%); this can be achieved in large parts of Europe without incentives and without necessarily adding any electric storage.It has also been found that the aggregation of the demand strongly increases the optimal capacity of PV, regardless of the reward function used for the optimization.
The optimal design of the PV system does not address the problem of financing and distribution of the risks and benefits of the system, especially if it is shared between multiple owners (which is the most promising case to ramp up urban PV capacity).For this reason, an agent-based modelling environment has been developed.The environment is capable of simulating potential PV production, electric demand, and price setting for each household independently and recording their interactions.The behaviour and PV distribution of the agents has been varied in six different scenarios in which the agents have been free to interact.The annual average self-sufficiency of the whole district reaches 24+%, this is remarkably considering the latitude and the absence of incentives and electric storage.
In general, smaller households (with less components and a lower annual cumulative demand) are characterized by higher revenues and lower savings compared to larger households (see Figure 7); this is due to having a larger system comparative to their size and, thus, a frequent over-production of electricity.The smaller household, being more 'sale oriented' benefitted from scenarios in which the price schemes in the micro-grid were high (see Figure 8 (2) and ( 4) against ( 1) and ( 2)).It seems, therefore, that high prices of the electricity within the micro-grid favour a more equal distribution of the risks and benefits.That said, being the households free to choose their price, they are unlikely to move toward a very high price, which is almost the same as the grid.Even more so, because the lowering of the price appears to be the simplest effective strategy to increase the CAGR (see in Figure 8 (5)).
Considering a real case study, it is very likely that some of the households in a microgrid (which could be located in a multi-family building or a district) would absolutely refuse to invest money in the shared PV system.Simulating this hypothesis in two scenarios (i.e., 3 and 4) showed increases in both revenues and savings for every group (see Figure 7 (3) against (1), and ( 4) against ( 2)).This, unsurprisingly, resulted in improved CAGR for those who own a PV system (see Figure 8 (3) against (1), and ( 4) against ( 2)).This result is fortunate in the sense that incentives to invest are automatically generated whenever somebody is unwilling to participate in the investment.In this sense, Scenario 4 is a particularly promising one because a limited fraction of the households could form a consortium and provide renewable electricity at the same price of the one offered by the external grid.This could allow the investor to have safe and interesting CAGR (see case 4 assuming a price growth of 2% in the Appendix A), while the non-investors, albeit without any economic advantage, could increase their renewable use without costs nor risks.
In the last scenario it was hypothesized that part of the households, to out-compete the 'cheap sellers', would adopt a dynamic price scheme based on their own energy balance.In practice, they would sell their excess power at a very low price whenever their balance was above average (compared to that hour of the day).Conversely, they would sell their power at the highest possible price whenever their balance is below the average of that hour.This strategy, despite its simplicity, and despite being unaware of the actual balance of the other households, is shown to easily out-compete the 'cheap sellers'.This is remarkable as it proves that effective strategies are possible without invading other household's privacy, but are solely based on data relative to oneself.

Future Work
The findings from this technique inevitably lead to new questions; in particular, there are four aspects that should be investigated more deeply: 1.
It has been shown that reducing the number of PV owners (leaving unchanged the aggregated PV capacity, which is the optimal one) boosts the CAGRs for those who remain.Nevertheless, this has been done only in two scenarios, in which the percentage of owners was invariably 50% instead of 100%.It would be useful to explore an array of different percentages of PV owners combined in different price schemes, thus understanding the phenomenon more thoroughly.Being a very encouraging aspect of the micro-grid, this advantage of the 'rare owners' might be hiding some effective business models.

2.
One feature of this local energy market is represented by rule 'e' from Section 2.1.This rule commands that, in the case of insufficient supply of the cheapest source, the power from the cheapest source should be provided proportionally to every agent's demand.Given the disadvantage experienced by smallest consumers, especially when the overall price of the electricity is low, it would be interesting to explore what happens with a different rule.For example, it would be interesting to provide each agent with equal power instead of satisfying the same proportion.With this difference, having a low consumption would actually boost the self-sufficiency considerably, and perhaps lead to a more balanced share of benefits and risks.

3.
The dynamic pricing behaviour with which half of the agents were endowed in Scenario 6 demonstrates the effectiveness of a simple dynamic pricing strategy.While only a proof of concept, this strategy is the first step in exploring a large array of behaviors that the agents could assume.It would be interesting to explore the impact of machine learning driven behaviours varying in complexity and in inputs required (both historical and real-time) [50].

4.
This study focuses on economic sustainability and fairness of different ownership and pricing schemes.Thus, it assumes the regulatory aspects as capable to allow a fruitful market structure.However, the regulatory design will be essential to achieve such local market, such as metering, and billing/collection, as well as responsibility allocation etc. 5.
The results of this study are obtained in a purely residential district; nevertheless, the presence of commercial, office, or public buildings would increase the contemporaneity of production and load.This effect would generally improve the techno-economic performance of the whole system; this improvement should be quantified to allow for spatial planning of the electric infrastructure.
capability, or, alternatively, three DC loops (one for each building) that are connected to a unique inverter would be ideal.If the regulation allows it, the ideal installation of the single inverter would be such that it can modulate its aggregated power to balance the 48 loads of the households, so as to reduce or cancel the voltage drop (or even generate an increase in tension) in the existing low-voltage alternating current (AC) infrastructure.In this arrangement, the 48 households will maintain their existing meter.This arrangement would imply that the 48 households will keep paying the fixed distribution costs to the grid operator.In the simulation presented, the household electricity prices are assumed as varying between 1.2 and 1.8 SEK/kWh; these prices represent the part of the electricity bill that can be avoided by using PV electricity and represent the cost for the electricity, the variable distribution costs, and the levies (i.e., does not include the fixed distribution costs).Of course, this arrangement is only feasible if there is the possibility that the grid operator can obtain data from the inverter of the shared system and charge the electric bill accordingly.The arrangement described would not be different, in terms of physical infrastructure, from the existing grid connected PV systems; in fact there would be no physical connection of the loads to the DC side of the inverter.The only difference would be that the voltage regulation in part of the existing low voltage grid would be distributed to the private inverter rather than managed directly by the grid infrastructure.Other options would be feasible, for example having a single inverter at the interface to the parent grid and one small inverter to connect each household to the DC loop.This arrangement would avoid each household maintaining its own connection and meter to the parent grid but would require each household to purchase an inverter to connect to the DC micro-grid.Furthermore, in this arrangement the micro-grid should be authorized to reduce or shut down the equipment in case of missing payment.This would be essential to protect shareholders to pay for energy from the parent grid or from other peers delivered to insolvent shareholders.Ultimately the issues regarding regulation deserve their own consideration in separate studies, the reader interested in this topic might review [27] for a comprehensive list of types of energy communities substantiated by 24 case studies.For a review of forerunner projects see [51], notable the virtual community from Sonnen (batteries manufacturer).For a comprehensive view of different physical infrastructures [31] can be studied.The present study focusses on the economic aspects of the microgrid, it analyses it in terms of economic sustainability and fairness of different ownership and pricing schemes, and thus, it assumes the regulatory aspects as capable to allow a fruitful market structure, although they might not yet be so.Given the overall socioeconomic conditions of the district where the study is located, it is highly likely that the majority of household will have the ca.16.3 kSEK (1600 €) to invest for one share (1.36 kWp/household, see Table 1 at the assumed price in Table 4).In case some households are unable or unwilling to pay, the conditions in Scenario 3 or Scenario 4 will happen (see Section 2.1).If, instead, some households are unable yet willing to invest in the system, thus willing to borrow money, the investment will become highly risky whenever the interest rate will be above the 3% used in the optimization phase (see discount rate in Table 4).In areas where the socioeconomic conditions do not allow for investment in the system, the use of public incentives might be the only solution to enable the installation of the system.Since such a system is probably profitable, the incentives do not have to necessarily be direct investments but can simply be borrowings or guarantees to the borrowing institution.These kinds of incentives have the advantage that they only constitute a very limited cost for the public, and primarily mean a social distribution of the risk.For this reason, these types of incentives might be preferred, especially at times of high debt/GDP (Gross Domestic Product).
It so happens that an apartment might change owner or remain vacant.The change of ownership is not modelled in the present framework, and it is unlikely to change the overall profitability of the investment.Anyone, especially if moving in the district, can purchase a share of the system if other households are willing to sell part of their share at an agreed upon price; in this way the residual value of the initial investment is simply bought and exploited by a new owner without changing the work or the profitability of the existing share.Conversely, if the share of the PV system is sold in combination with the property in a change of ownership, it can be resold by the new owner to others if a customer is found at an agreed price.On the other end, if an apartment remaining vacant, or strongly reduces its electricity demand, it can be a threat to the business model.This possibility is strongly affected by the frequency of such events within the community and the size of the community itself, thus it is a subject for parametric study and requires a future work of its own.

Figure 1 .
Figure 1.Flow diagram of the data and operations performed for this study.

Figure 1 .
Figure 1.Flow diagram of the data and operations performed for this study.

Figure 3 .
Figure 3. District scale renewable energy systems behaviour map.

Figure 3 .
Figure 3. District scale renewable energy systems behaviour map.Figure 2. 3D map of the behaviours in a district scale renewable energy system from [39].

Figure 2 .
Figure 3. District scale renewable energy systems behaviour map.Figure 2. 3D map of the behaviours in a district scale renewable energy system from [39].

Figure 3 .
Figure 3. Schematic of the behaviour of each agent in every time-step of the simulation.

Figure 3 .
Figure 3. Schematic of the behaviour of each agent in every time-step of the simulation.

Figure 4 .
Figure 4. View of the (a) 3D model used to calculate PV production in the district and (b is possible to dedicate to PV highlighted.The model represents the three multi-family bu comprise the 48 households in the study.Please note that each household does not own a portion of the roof as it is commonly owned.If a household decides to invest in the sha tem, it becomes shareholder of the common infrastructure (it does not purchase a ph system on the roof).

Figure 4 .
Figure 4. View of the (a) 3D model used to calculate PV production in the district and (b) areas that is possible to dedicate to PV highlighted.The model represents the three multi-family buildings that comprise the 48 households in the study.Please note that each household does not own any physical portion of the roof as it is commonly owned.If a household decides to invest in the shared PV system, it becomes shareholder of the common infrastructure (it does not purchase a physical small system on the roof).

Figure 6 .
Figure 6.Average price for each hour of the day and its variability within the district (Scenario 1).

3. 7 .Figure 8
Figure 8 represents the real CAGR for the PV owners in the micro-grid; as in the previous set of charts, every circle represents one household.Buildings 2021, 11, x FOR PEER REVIEW 17 of 25

Figure 8 .
Figure 8. CAGR (Compound Annual Growth Rate) % in the different scenarios(1)(2)(3)(4)(5)(6), the CAGR are real (i.e., would be higher if adjusted for inflation), and assume a case in which there is no growth in the price of electricity, a chart assuming a 2% linear increase in the price of electricity from Scenario 4 is in the Appendix A.

Figure 8 .
Figure 8. CAGR (Compound Annual Growth Rate) % in the different scenarios(1)(2)(3)(4)(5)(6), the CAGR are real (i.e., would be higher if adjusted for inflation), and assume a case in which there is no growth in the price of electricity, a chart assuming a 2% linear increase in the price of electricity from Scenario 4 is in the Appendix A.

Buildings 2021 , 25 Figure A1 .
Figure A1.Relation between annual cumulative energy demand and cumulative energy received from the shared system for Scenario 1.

Figure A1 .
Figure A1.Relation between annual cumulative energy demand and cumulative energy received from the shared system for Scenario 1.

Figure A1 .
Figure A1.Relation between annual cumulative energy demand and cumulative energy received from the shared system for Scenario 1.

Figure A2 .
Figure A2.CAGR for Scenario 4 assuming a linear annual growth of the price of electricity for households of 2% of the initial price.

Table A1 .Figure A2 .
Figure A2.CAGR for Scenario 4 assuming a linear annual growth of the price of electricity for households of 2% of the initial price.

Table A1 .
Composition by gender and age bracket of the inhabitants in the 48 HH (HouseHolds) in the district.

Table 1 .
PV capacities per household and prices in the 6 different scenarios.

Table 1 .
PV capacities per household and prices in the 6 different scenarios.

Table 2 .
Number of persons and households in Sweden (excepts those listed in the 'other

Table 2 .
Number of persons and households in Sweden (excepts those listed in the 'other' category).

Table 3 .
[45]er of persons and households in the district under exam as assumed to match the Swedish data[45].

Table 4 .
Assumption used in the optimization of the PV system.