{'fraction_non_alphanumeric': 0.028807250364136592, 'fraction_numerical': 0.00801100501699304, 'mean_word_length': 4.541025257808998, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Coalitional game based cost optimization of energy portfolio in smart grid communities

In this paper we propose two novel coalitional game theory based optimization methods for minimizing the cost of electricity consumed by households from a smart community. Some households in the community may own renewable energy systems (RESs) conjoined with energy storing systems (ESSs). Some other residences own ESSs only, while the remaining households are simple energy consumers. We first propose a coalitional cost optimization method in which RESs and ESSs owners exchange energy and share their renewable energy and storage spaces. We show that by participating in the proposed game these households may considerably reduce their costs in comparison to performing individual cost optimization. We further propose another coalitional optimization model in which RESs and ESSs owning households not only share their resources, but also sell energy to simple energy consuming households. We show that through this energy trade the RESs and ESSs owners can further reduce their costs, while the simple energy consumers also gain cost savings. The monetary revenues gained by the coalition are distributed among its members according to the Shapley value. Simulation examples show that the proposed coalitional optimization methods may reduce the electricity costs for the RESs and ESSs owning households by 20%, while the sole energy consumers may reduce their costs by 5%.


I. INTRODUCTION
O PTIMIZATION of energy consumption imposes changes both at the energy supply side and at the energy demand side. One key global challenge existing today is the achievement of sustainable energy production. More and more energy users choose to install renewable energy systems (RESs) which seem to be a sustainable solution for the current environmental problems, but also for other troubling issues existing in the power network today. Installation of RESs at distribution level can result in significant reduction of power transmission losses, lower operational costs and an overall cut of electricity costs.
Energy consumption optimization at the distribution level can also be obtained through demand side management (DSM) methods. DSM refers to the modification of the energy consumption patterns of the end-users with the purpose of lowering costs, reducing load peaks on the grid and increasing grid reliability. Energy storing systems (ESSs) together with a smart metering infrastructure can be an easy and efficient way of implementing such methods without the need of highly modifying the energy consumption patterns of energy consumers such as residential households and business centers.
One major disadvantage of the RESs is the intermittent nature of their energy production, i.e. not providing reliable energy production. ESSs can be used in conjunction with RESs in order to store the surplus of the produced energy, but also for DSM operations. However, installation of ESSs with high capacities can be very costly. One way of addressing these drawbacks of RESs and ESSs is by employing cooperation among RESs and ESSs owners. Cooperation can improve the integration of renewable energy, reduce the need of large ESSs and provide cost savings for the participants in the cooperation.
Cooperative methods for energy trading have been studied before. The studies in [1]- [7] approach the problem of energy trading and cooperation between microgrids. Methods based on Nash bargaining theory to incentivize the collaboration between microgrids are proposed in [1] and [2]. An approach for cooperative power control in a network of microgrids is proposed in [4] with the purpose of optimizing the use of renewable energy for meeting the demand and to enhance the reliability of the network. In [6] prospect theory has been proposed to formulate a static game between autonomous microgrids that are trading energy.
In this paper we propose two novel coalitional game theoretic based models for optimizing energy portfolios within a smart grid community by sharing and trading energy among households. We consider a community of households some of which own RESs together with ESSs. Some other households in the community own ESSs only, while the remaining households are simple energy consumers. We assume that the households are equipped with smart energy management meters that can predict with sufficient accuracy their energy demand profiles and the profiles of renewable energy production during a finite time period ahead. The households are connected to a centralized energy management unit that finds the solution of the proposed energy cost optimization problems and controls the flow of energy within the community through a twoway communication system. In case of insufficient renewable energy resources, the electricity demands of the households are fulfilled with electricity bought from the utility company. Our main contributions to this paper are described below: • We formulate three cost optimization problems: 1) a method through which households that own RESs and ESSs can individually optimize their costs; 2) a coalitional optimization method in which the RESs and ESSs owners may exchange energy and share the produced renewable energy and storage spaces; 3) a coalitional optimization method in which the RESs and ESSs may exchange energy, share their resources and storage spaces and also sell energy to sole energy consuming households in the community. The sole energy consumers are not participants in the coalitional game. They only act as agents that buy energy from the coalitional group of RESs and ESSs owners at a cheaper price than the one offered by the utility company. The proposed optimization problems are convex and linear and can be easily solved through standard linear programming methods. • We model a coalitional game among the RESs and ESSs owners. The revenue gained by the coalitional optimization is divided among the coalition members in a fair manner, according to the amount of contribution that each member brings to the coalition. A method based on Shapley value is used to calculate the payoff earned by each member. • We perform extended simulations and show that through the collaborative method the smart households owning RESs and ESSs can obtain significant financial benefits in comparison with the individual cost optimization. We also show that by selling energy to the sole energy consumers at a smaller price than the one offered by the utility company, the RESs and ESSs owners can further reduce their electricity costs, while the sole energy consumers also get financial benefits. Game theoretic methods for energy trading in smart grids have also been proposed in [8]- [12]. A noncooperative game among storage units has been proposed in [8]. A cooperative game between households has been proposed in [9] with the scope of flattening the community's load. [10] proposes a noncooperative and a cooperative game among energy users that own distributed energy generation and storages. A coalitionformation game is proposed in [11] for microgrids to trade power in order to reduce the load and the power losses over the power grid. [12] proposes a coalitional game in which microgrids supply a energy to a shared facility controller with the purpose of gaining some revenues.
The coaliotional method proposed in this paper has the following novel aspects: in the proposed game the energy exchange among the coalition members is completely free, the members share their renewable resources and storage spaces and perform DSM services for each other; for further reducing the costs, sole energy consuming households are introduced in the optimization; the cost savings obtained by the sole energy consumers result from the cost minimization achieved by the RESs and ESSs owners through selling them energy at a price lower than the one offered by the utility company.
Preliminary results related to this work were presented in [13]. This paper extends these results by introducing the sole energy consuming households to the coalitional optimization. The optimization problems are improved by adding operational costs and penalty terms. We perform extended simulations to demonstrate the performance of the proposed methods.
The simulations show that over a long term period the coalitional game among the RESs and ESSs owning households can result in a cost reduction of approximately 13.5% more in comparison with individual cost optimization. The introduction of the sole energy consuming households can achieve a further cost reduction of 6.5% for the RESs and ESSs owners, resulting in a total 20% reduction of the cost for these residences. The sole energy consumers can also achieve a cost reduction of about 5% in comparison to buying all needed electricity from the utility company.
The rest of this paper is organized as follows: Section II presents the system model, Section III presents the three cost optimization methods. The coalitional game model for the RESs and ESSs owning households and the Shapley value method are presented in Section IV, Section V shows the simulation results and Section VI presents the conclusions.

II. SYSTEM MODEL
We consider a community of N households that can trade and exchange energy with each other through a central energy control unit. We denote by N the set of households in the community and by n we denote the index of a household from this set. A subset of smart residences from the community, denoted by M, M ⊆ N , with cardinality |M| = M , either produce renewable energy, which implies owning an ESS as well, or own ESSs only. We denote the index of a household from this set by m. We denote by P, with cardinality |P| = P , P = N \ M, the remaining subset of households from the community which are sole energy consumers. We denote the index of a household from this set by p. The energy optimization is performed over a finite time horizon T of length T , which is divided into equally long time-slots denoted by t, T = [t, t = 1, . . . , T ].

A. The Energy Model
The electricity demand of each household in the community is considered to be known ahead for the entire period T and it is not flexible. The set of electricity demands of one residence in the community is denoted by u n = [u n (t), t = 1, . . . , T ], n ∈ N . The set of per-time-slot amounts of renewable energy, w m = [w m (t), t = 1, . . . , T ], produced by those households m ∈ M owning RESs is considered predicted with sufficient accuracy over the whole period T . Note that for those households from the set M that do not own RESs, but only ESSs, the renewable energy vector is zero, i.e. w m = 0. In this paper, the problem of exchanging and trading the energy among the households is formulated as a coalitional game in which the participants may produce, store and exchange energy. Hence, we denote by a n = [a n (t), t = 1, . . . , T ] the set of energy amounts that a household n from the community may exchange with the rest of households from the community within period T . This variable may have either positive or negative values. If a n (t) > 0 in a certain time slot t, it means that household n provides this amount of energy to the rest of the households in the community, while if a n (t) < 0 then household n receives this amount of energy from the other members of the community. The set of energy amounts that a household n may have to purchase from the utility company during period T is denoted by b n = [b n (t), t = 1, . . . , T ]. The energy purchased by a household from the utility company in a time-slot t must obey the energy consumption constraint. This constraint is specific for each type of optimization and for each set of households in the community.
The households belonging to set M, owning RESs and/or ESSs, can optimize their cost individually, without collaborat-ing with other members of the community. In this case the following energy consumption constraint may be imposed: This inequation states that in a time-slot t the electricity demand of a household, u m (t), must be fulfilled by the available renewable energy, w m (t), the energy purchased from the grid, b m (t), and by energy from in the storage, r m (t).
In the collaborative case, the households belonging to set M may obey the following energy consumption constraint: (2) The interpretation of this constraint is similar to that of constraint (1). The difference is that in the collaborative scenario one participant to the optimization may also receive or transfer an amount of electricity a m (t) from or to other households in the community.
The energy consumption constraint for the pure consuming households P is defined as follows: This category of households can only receive energy from the other members of the community. This imposes the following constraint: Alternatively, they can buy it from the utility company. For all the households in the community the amount of energy purchased from the power grid in time-slot t, b n (t), may have only positive or zero values: In the proposed model the households cannot sell back electricity to the power grid.

B. The Energy Storage Model
All households from subset M own ESSs. We denote by C m be the maximum storing capacity associated with each ESS m . The maximum amount of energy that can be charged or discharged from a storage is limited by the charging/discharging rate. In this work the charging rate is equal to the discharging rate and we denote this parameter by ρ m . Another parameter that characterizes a storage system is the storage leakage factor, η m , which shows the proportion of energy that a storage loses during a time unit. This parameter has values between 0 and 1, but typically η m 1. We further define by r m = [r m (t), t = 1, . . . , T ] the set of amounts of energy charged or discharged from a storage unit ESS m during period T . This value can have either positive or negative values. If r m (t) > 0 then energy is charged into the storage, while if r m (t) < 0 then energy is being discharged from the storage in time-slot t. The amount of energy charged or discharged from storage is bounded by the charging/discharging rate ρ m : Let s m = [s m (t), t = 1, . . . , T ] be the energy storage vector containing the total amounts of energy stored in an ESS m at the end of each time slot. The dynamics of the ESS m is defined by the following equation: where s m (0) would be the initial storage value, i.e the amount of energy remained in storage at the end of the previous optimization period. The amount of energy existing in storage at any time-slot must obey the storage capacity constraint:

III. THE COST MINIMIZATION PROBLEM
We propose two coalitional game based approaches for minimizing energy costs among cooperating households. In the first proposed coalitional optimization problem the households that own RESs and ESSs share their energy storage units and their renewable energy resources and exchange energy among themselves. We show that through participating to the proposed coalitional optimization the households that own RESs and/or ESSs may significantly reduce their electricity costs in comparison to the case in which they would individually optimize their energy costs, using only their own renewable resources and energy storages. Moreover, we propose another coalitional game model in which we show that by including the households that only consume energy in the optimization model, the households owning RESs and ESSs may reduce their costs even further by selling energy to these households at a price lower than the one offered by the utility company. By participating in this optimization, the sole energy consuming households can also reduce their energy costs.
The market electricity prices per unit of energy are given by the utility company and they are known ahead for each time-slot t in the period T . We denote this set of electricity prices by ξ = [ξ(t), t = 1, . . . , T ].
In the following subsections we describe the proposed cost minimization problems. First we formulate a cost minimization problem which can be performed by each household m ∈ M individually, without collaborating. Then we formulate the coalitional cost minimization problem that includes only the residences that own RESs and ESSs. Finally, we formulate the coalitional cost minimization problem which includes the households that are sole electricity consumers as well.

A. Individual cost minimization problem
We define the cost of electricity bought from the utility company by any household n ∈ N as: In addition to this cost, the households m ∈ M are also incurred with an energy storage cost. It is well known that while being charged and discharged multiple times, storage units suffer a certain degradation and the lifetime of a storage unit is limited to a number of charging/discharging cycles. We define by π the storage degradation price corresponding to charging/ischarging one unit of energy. The resulting ESS m storage degradation cost within period T can be defined as: Households m ∈ M, owning RESs and/or ESSs can individually optimize their costs, without collaborating with the other members of the community. We denote by c indiv m the individual cost of a household from set M: The individual cost minimization problem for one single household m ∈ M can be stated as follows: such that the constraints (1), (5)-(8) are satisfied. The last term of the objective function: is a penalty term which is closely related to the energy consumption constraint (1). The purpose of this penalty is to make sure that the renewable energy produced in a timeslot is either consumed or stored in the ESS m . By σ we define a penalty price for a unit of renewable energy that may be wasted. As mentioned in Section II, the set M of households contains households that own both RESs and ESSs and households that own ESSs only. For the second category w m = 0 and the optimization is performed by using their energy storages alone.
The set of solution variables of the individual cost minimization problem is {b m , r m , s m }.

B. Coalitional cost minimization problem for households owning RESs and/or ESSs
In this scenario the households belonging to the set M collaborate and share their renewable resources and storage units in order to jointly optimize their costs. Besides the cost of electricity purchased from the power grid and the cost incurred for storage degradation, a third type of costs shall be added to the optimization problem in the collaborative scenario. This cost represents the cost for operating the central control unit. The optimization is performed by a central energy management unit that performs the optimization and controls the energy flow and transfer within the community. For this, we define by τ the price charged for transferring one unit of energy from one household to another. The overall cost incurred by a household m during the period T for the energy transfer operations is equal to: We denote by c ResEss The coalitional cost minimization problem for the households m ∈ M that own RESs and/or ESSs is formulated as: such that the constraints (2), (5)-(8) are satisfied. A penalty term is added to the objective also in case of the coalitional optimization. The penalty ensures that the produced renewable energy is either consumed, either transferred to the storage. In this case penalty term is expressed by: and it works in corroboration with energy consumption constraint (2).
To ensure a correct functionality of the optimization problem we add another balance constraint which makes sure that the total amount of energy that is given away by some households is equal to the total amount of energy received by the rest of households from the set M: The final set of constraints for this problem is (2), (5)-(8), (14). The set of solution variables is {b m , r m , s m , a m } M m=1 .

C. Coalitional cost minimization problem for the whole community of households
In this scenario we include as well the households p ∈ P which are sole energy consumers. This set of households participates to the community coalitional energy optimization by just buying energy from those owning RESs and ESSs.
We define by λ = [λ(t), t = 1, . . . , T ] the set of prices corresponding to the energy sold by the households m ∈ M, owning RESs and ESSs, to the households p ∈ P. These prices are lower than the per-time-slot prices offered by the utility prices: λ(t) = αξ(t), where 0 ≤ α ≤ 1. For a household p the cost of purchasing energy from the community can be stated as: We denote by c community M the overall cost incurred by those households from the community owning RESs and ESSs after selling energy to those that are sole energy consumers. This cost is expressed as: We may formulate the whole community optimization problem that also includes sole energy consuming households as: such that the constraints in (2)- (8) and (14) are satisfied, with the difference that (14) is reformulated for the whole community N : N n=1 a n (t) = 0.
Just like in previous cases, we add a penalty term: We denote by c indiv p the cost paid by a household p ∈ P that participates in the community optimization. This cost would be equal to: c indiv For making sure that all sole energy consumers p ∈ P also benefit and reduce their energy cost the following constraint is imposed: This constraint states that the cost paid by a sole energy consuming household that participates in the optimization should be less than the cost that the household would pay by simply purchasing electricity directly from the utility company. The final set of constraints for this problem is (2)-(8), (15) and (18). The set of solution variables is {b m , r m , s m , a n } M m=1 , N n=1 . It can be observed that the objective functions and the constraints of the formulated optimization problems possess linear relationships among the variables of the problems. Hence, we are able to model both optimization problems as linear programs. The solutions of the proposed optimization problems can be easily obtained through algorithms such as the interior point algorithm [14].

IV. THE COALITIONAL GAME MODEL FOR HOUSEHOLDS
OWNING RESS AND ESSS The proposed coalitional cost optimization problems are using the energy storage systems and the renewable energy produced by the households m ∈ M in order to minimize the electricity cost. In this work we propose a characteristic coalitional game with transferable utility among the RESs and ESSs owning households.
A coalitional game in characteristic form [15] is uniquely defined by the pair (M, υ), where M represents the set of players participating in the game, |M| = M , and υ : 2 M → R is the characteristic function of the game which quantifies the worth of a coalition. In the proposed optimization problem, the players M of the coalitional game are the households owning renewable energy production and storage systems. In order to minimize their electricity costs, these households may form different coalitional groups. We denote by G, G ⊆ M, any non-empty subset of households from the set M that may form a coalitional group. The cardinality of the set G is |G| = G. In case the coalition is formed by all the residences from the set M, G = M, then this coalition is called the grand coalition. The worth of a coalition, which we generally denoted by υ(G), is a real value representing the total revenue received by the coalitional group for cooperating.
In this work the worth (revenue) of a coalition is defined as the cost saved by a coalitional group in the collaborative scenario in comparison with the total electricity cost that the members of that coalitional group would pay in the case of performing individual cost optimization. In this work we propose two coalitional optimization methods. Let us denote by υ(G) ResEss the worth of a coalition for the case in which the optimization includes only the households m ∈ M owning RESs and ESSs. This worth is expressed as: Then, we denote by υ(G) community the worth of a coalition for the case in which the optimization includes the whole community: RESs and ESSs owners and also the households p ∈ P that only consume electricity. In this case the worth is expressed as: (20) Here c indiv g is computed using the formulation in (11), while c ResEss G and c community G are computed using (13) and (16), respectively. The index of a household from the subset G that forms the coalitional group is denoted by g.
In coalitional games with transferable utility the worth of a coalition υ(G) is generally distributed among the members of the coalitional group using a fairness rule. There are various fairness methods in the literature for division of rewards like nucleolus, egalitarian, Shapley value [15], [16] for example. In this work we choose that the monetary revenues obtained by the coalition is divided among its members using the Shapley value [16]. The Shapley value is a method in which the worth of the coalition is distributed according to the amount of contribution that each player is bringing to the coalitional game and to the revenue. Shapley value does not depend on the order in which the players are joining the coalition.
For a coalitional game defined by (M, υ), the Shapley value, Φ(υ), assigns to each player m ∈ M a payoff Φ m (υ) given by the following expression: where the sum is computed over all possible subsets G (even of single players) of M not containing player m. The payoff of a household taking part in a coalition represents the fraction of the total revenue of that coalition, that is achieved through the participation of that household in the coalitional game. In the proposed game all households from set M participate in the coalition. The distributed payyofs must obey the following rule:

V. SIMULATION EXAMPLES
In this section we present simulation examples and quantitative results that demonstrate the performance and cost savings achieved by the proposed methods. For simulating and testing the performance of the proposed methods we considered a smart grid community composed of N = 9 households. The set M of residences is composed of 6 households. In our simulations we denote these households by M = {m1, m1, . . . m6}. Out of this set, 3 households, {m1, m2, m3}, own RESs as well as ESSs, while the other 3 households, {m4, m5, m6}, own ESSs only. The remaining |P|=3 households in the community are sole energy consumers: P = {p1, p2, p3}. For the presented results, except those in Fig. 4, we considered equal ESS m capacities, C m , of 5kWh. We also assumed equal charging/discharging rates, ρ m , of 2kWh. The storage loss factor is assumed to be η m = 0.001, m = 1, . . . , M . We perform simulations over a time horizon T of length T=24 hours divided into hourly time slots. The utility company  pricing data, ξ, is true pricing data taken from Finnish Nord Pool Spot database [17] for May 2013. Other pricing data used in simulations is the following: π=0.0001 e per each kWh of charged/discharged energy, σ=0.001 e per each kWh of renewable energy not stored or consumed, τ =0.0001 e per each kWh of electricity transferred or received by each household. The price of energy sold by the RESs and ESSs owners to the sole energy consumers is λ = αξ, α = 0.9, i.e. the sole consumers get a 10% discount compared to the price offered by the utility company. The influence of α over the performances of the proposed methods is depicted in Fig. 3. A high variation of the chosen values for the prices mentioned above ,π, ρ, τ , may have an influence of about ±1.2% on the cost savings resulted from the proposed methods. In this paper we show simulation results of the proposed methods over 31 days. In these simulations we assumed empty storages, s m (0)=0, m = 1, . . . , M , at the beginning of the first 24-hours optimization period. Further, each proposed optimization method updated its corresponding initial storage values, for each new optimization period, with the storage levels resulted at the end of the previous period s m (0) = s m (24). Hence, the proposed optimization methods may have had different initial storage levels at the beginning of the 24-hours optimization periods from the 31-days simulation. In order to simulate the 24-hours electricity demands of the households, u n , we used the load modeling framework presented in [18]. We assumed residences with the following numbers of inhabitants: {3, 4, 4, 2, 5, 4, 3, 4, 2}. We considered that the households were equipped with wind energy producing systems. For simulating renewable energy data values we used the following mathematical model to approximate the power generated by a wind turbine [19]: where D represents the air density, K p =0.3 is the power coefficient of the turbine, A is the swept area of the turbine, A = 3.14R 2 , R = 2.63m, and V is the wind speed. For this, we used true weather data for May 2013 in Helsinki region [20]. To represent the energy production of each household, we added a small variation to the values calculated with the above formulation. For solving the linear programs resulted from modeling the proposed optimization problems we used the CVX package for convex optimization [21]. The results of the performed simulations are presented further. Fig. 1 (a)-(f) shows an example of 24-hours input data and results of the whole community optimization problem. We used the pricing and weather data for May 17 [17], [20]. Fig. 1.(a) shows the electricity prices, ξ, in e/kW h. Fig. 1.(b) shows the individual and cumulated hourly electricity demands of those households that own RESs and ESSs: {m1, . . . , m6}. Fig.  1.(c) shows the individual and cumulated hourly renewable energy production of households {m1, m2, m3} that own RESs. Fig. 1.(d) shows the individual and cumulated hourly profiles of the ESSs, i.e how much energy exists in the energy storages of households m ∈ M at the end of each hour. Fig.  1.(e) shows the amounts of energy exchanged during each hour by all the households in the community. At each time-slot, the positive blocks show the amounts of energy that are provided by some households to the others, whereas the negative blocks show the amounts of energy that are being received by the other households. In this example it can be observed that in most cases the households which produce renewable energy provide energy to those households that own ESSs only and to the sole energy consuming households in the network. Fig.  1.(f) shows the amounts of energy purchased from the power grid by those households, m ∈ M, that own RESs and ESSs. It can be seen that the households buy energy from the utility company during those hours when the electricity price is low.   Fig. 2 shows in (a) the 31-days cumulative electricity costs of the households m ∈ M that own RESs and ESSs and in (b) the cumulative electricity costs of the households p ∈ P that are sole energy consumers. It can be observed in (a) that the coalitional cost minimization method for the households owning RESs and ESSs (28.21e) provides for these residences a cost reduction of about 13.5% versus the individual cost optimization (32.74e). The whole community cost minimization problem (26.2e) provides an additional 6.5% reduction in cost, resulting in an overall 20% cost reduction for the RESs and ESSs owners. In (b) it can be observed that the sole energy consumers, through participating to the whole community cost optimization (30.03e) reduce their costs, in this example by approximately 4% in comparison to buying all electricity from the utility company only (31.32e).
In Fig. 3 we want to show how the 31-days cumulated monetary gains of the proposed coalitional optimization problems are varying for different values of the set of prices λ. As specified in Section II, λ is the set of electricity prices corresponding to the energy sold by the RESs and ESSs owners to the sole energy consuming households. The values of λ are smaller than the utility company set of electricity prices, ξ: λ = αξ, where α: 0 ≤ α ≤ 1. In this simulation we used For the sole energy consumers the highest cost reduction, of about 5% from from cost of purchase from utility company, is obtained when α = 0.8. In the whole community cost optimization the cost reduction of the sole energy consumers is a consequence of the cost minimization performed by the RESs and ESSs owners. Households m ∈ M minimize their cost by selling energy to households p ∈ P.
The higher are the prices λ, the higher are the amounts of energy sold by the households m ∈ M. Hence, the cost reduction of the sole energy consumers gets higher with the amounts of energy purchased from RESs and ESSs owners. Fig. 4 shows the variation of the 31-days cumulated the monetary gains of the proposed coalitional optimization methods versus the storage capacity existing within the community. Initially we assumed capacities of 5kWh for each ESS m , resulting in an overall storage capacity of 30kWh within the community. Then we increased the storage capacity of each ESS m by 1kWh, until reaching 20kWh, which resulted in an overall 120kWh storage capacity within the community. It can be observed that the monetary gains of the RESs and ESSs owners are actually decreasing while the capacity increases. This is due of the fact that the result of the individual cost optimization is used as a comparison benchmark in (19) and (20) for the calculation of the revenues of the coalitional optimizations. The increase of the ESSs capacities allows for better performance of the individual cost minimization problem. Hence, the coalitional optimizations' gains for RESs and ESSs owners are not so significant anymore. However, we can see that the gains of the proposed coalitional methods don't totally decrease. Actually, even with very large storage capacities, the proposed coalitional methods still obtain significant monetary gains in comparison to the individual optimization. Contrary to the gains of RESs and ESSs owners, it can be observed that the gains of the sole energy consumers become larger as the storing capacity within the community increases.
The bar plot in Fig. 5 depicts the daily cost savings of the community and of the individual households for the case in which the cooperation is done according to the proposed whole community coalitional game optimization. Fig. 5(a) shows the cost savings of the RESs and ESSs owners. The daily cost savings are divided among the members of the community as shown by the blocks composing each bar. Each block indicates the amount of monetary payoff received by a household as resulted the Shapley value calculation. We can observe that a big part of the daily cost savings are allocated to the renewable energy producers. It can also be observed that during five days of the month, days 3,6,8,18 and 23 the coalitional optimization does not perform better than the individual optimization. This is also due to the fact that, as mentioned before, the storages of the EESs owners do not have same initial values for the individual optimization as for the coalitional optimization. During some days, the initial storage values may be full for the individual optimization, while for the coalitional optimization the initial storage values may be empty. For the majority of the days of the month each household in the community receives some monetary revenue for their participation in the coalitional optimization. Fig. 5(b) shows the cost savings of the sole energy consuming households as resulted from the optimization, by buying energy from the RESs and ESSs owners at a lower price than the one offered by the utility company. Each of the sole energy consuming household obtains daily cost savings.

VI. CONCLUSIONS
In this paper we proposed two novel coalitional game theory based optimization methods for minimizing the cost of electricity consumed by households in a smart grid community. We first proposed a coalitional optimization through which the RESs and ESSs owning households from the community can form coalitions for exchanging energy and sharing their renewable energy and storage units. Simulation examples showed that through participating to this coalitional optimization game, these households can reduce their energy consumption costs by roughly 13.5%. We then proposed a secondary coalitional cost optimization model through which the RESs and ESSs share their renewable energy and storage units among themselves, but also sell electricity to the pure consuming households in the community. We show that by selling electricity at a cost lower than the one offered by the utility company, the RESs and ESSs owners may further reduce their costs with about 6.5%, resulting in a total 20% cost reduction in comparison with the cost incurred for individually optimizing their cost. Also, by participating to the optimization, the sole energy consuming households may also obtain electricity cost reductions up to 5%.