{'fraction_non_alphanumeric': 0.024391087140659302, 'fraction_numerical': 0.010613839478642674, 'mean_word_length': 4.686621448933451, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Internet of Energy Approach for Sustainable Use of Electric Vehicles as Energy Storage of Prosumer Buildings

: Vehicle-to-building (V2B) technology permits bypassing the power grid in order to supply power to a building from electric vehicle (EV) batteries in the parking lot. This paper investigates the hypothesis stating that the increasing number of EVs on our roads can be also beneﬁcial for making buildings sustainably greener on account of using V2B technology in conjunction with local photovoltaic (PV) generation. It is assumed that there is no local battery storage other than EVs and that the EV batteries are fully available for driving, so that the EVs batteries must be at the intended state of charge at the departure time announced by the EV driver. Our goal is to exploit the potential of the EV batteries capacity as much as possible in order to permit a large area of solar panels, so that even on sunny days all PV power can be used to supply the building needs or the EV charging at the parking lot. A system architecture and collaboration protocols that account for uncertainties in EV behaviour are proposed. The proposed approach is proven in simulation covering one year period for three locations in different climatic regions of the US, resulting in the electricity bill reductions of 15.8%, 9.1% and 4.9% for California, New Jersey and Alaska, respectively. These results are compared to state-of-the-art research in combining V2B with PV or wind power generation. It is concluded that the achieved electricity bill reductions are superior to the state-of-the-art, because previous work is based on problem formulations that exploit only a part of the potential EV battery capacity.


Introduction
Battery energy storage has emerged as an obvious solution for coping with intermittency of renewable electricity generation, such as photovoltaic [1] or wind [2]. As the cost of battery storage remains a critical factor [3], several researchers have proposed schemes for using electric vehicles' (EV) batteries instead of, or in addition to the stationary battery storage resources of buildings. A building with local generation can be referred to as a prosumer, since it is a consumer and a producer of electricity. Vehicle-to-building (V2B) technology permits supplying power from EV batteries to cover a part of the building's energy consumption. One of the first commercially available V2B technologies is the Nissan LEAF, which offers 200 V, three wires, single phase AC to the building [4]. V2B is an emerging alternative to other more established approaches to exploit the distributed energy resources (DERs), such as V2G (vehicle-to-grid), demand response and microgrids.
V2B integrated into the concept of the Internet of Energy [5,6] could enable sustainable buildings running primarily on the local photovoltaic (PV) generation. With a critical mass of renewable generation installed and electric vehicles deployed and empowered with the Internet connectivity one could expect that these infrastructures would complement each other for a sustainable green energy solution, when both EVs and buildings will be running mostly on renewable energy. Similar to car hiring services, such as Uber, buildings could dynamically incentivize the EVs to get charged or partially discharged dependent on the prosumer´s current needs. Moreover, since power utilities have not yet embraced this approach, local solutions to balance differences between power production and consumption may prove effective since they avoid power transmission over the grid and the investment to equipment such as grid tie inverters.
This paper investigates the hypothesis stating that such local solutions for a building that has PV generation and a parking lot with many EVs can lead to sustainable reliance on local renewable generation, or, in the current economic conditions, to give substantial economic benefits to both buildings and participating EVs. The positive economy would lead to wider adoption of both EVs and prosumer buildings thus enabling sustainable green society.
In the USA and many other countries, there is a net metering system for feeding the surplus solar generation into the grid, resulting in a corresponding deduction of kWh from its next energy bill [7]; however, utilities are only required to offer net metering to customers with up to certain solar generation capacity: for example, variable in dependence on previous years consumption for New Jersey, or fixed values 25 kW for Alaska and 1000 kW for California. Even the much higher latter limit is not sufficient to enable net metering for significantly larger producers such as the commercial buildings investigated in this article. For that kind of producers, a market of Solar Renewable Energy Certificates (SRECs) exists in the USA [8], but it requires suppliers to reserve a portion of their generation, resulting in a corresponding decrease of capacity to cover the building consumption. For the real-world applicability, it is advantageous to propose a solution, which would not require any co-operation from the power utility, such as new investments or changes to their business models. Thus, our proposal is to exploit the DERs locally to lower electricity bills for the prosumer. This can be achieved by ensuring that PV generation is not wasted on sunny days, but is used to cover the building's energy consumption and EV charging needs. As the PV generation capacity increases, so do the challenges to exploit the potential EV battery capacity despite uncertainties in EV behaviour.
Our goal is to propose a solution to address these challenges that consists of an architecture, heuristic algorithms and protocols of V2B interaction. It is complemented by a mathematical and simulation model of a sample building, configurable for different geographical conditions required to estimate the expected savings.
The paper is structured as follows: relevant state-of-the-art research results are discussed in Section 2. The problem formulation and the proposed solution are presented in Section 3. Section 4 presents model parameters and constrains. Section 5 presents a case study using a large office building as prosumer. Section 6 presents quantitative results and analysis. Section 7 concludes the paper.

Related Research in Electric Vehicle Battery Exploitation
Immediately with the advent of electric vehicles, proposals were made to use them in interaction with smart grid infrastructure; a comprehensive review of such approaches was performed in [9]. EVs may contribute to a deeper integration of renewable energy resources (RES) into electric power systems. According to the review [9], the smart mapping of EV charging helps to significantly slow down the infrastructure ageing, because of load optimization. Another example of applications is smart charging scheduling based on forecasted hourly prices, exploiting hours with low price and thus minimizing the costs [10]. A prime competitor to V2B is V2G, in which the EV batteries are used to supply power to the grid instead of to a local consumer [11]. The V2G increases stability of the power system: with proper primary frequency control and dynamic grid support, the grid can receive the power back from connected vehicles when it is required [12]. The EVs are actively developing towards participating in demand response and frequency containment control [13][14][15]. The common disadvantage of using EVs as energy storages is that the main vehicle's function remains driving, and it results in inconstant presence of EV batteries in the system. Neglecting this uncertainty leads to a serious overestimation of possible profits, for example [16] disclosed 23.8% difference of profit values. Further, the battery loses some of its value with each use. Shang and Sun [17] investigated the financial prospective of using the plug-in EVs for electricity-price arbitrage, taking into account flexible electricity prices, typical EV driving behaviour and battery characteristics. They found out that EV owners could not reach positive arbitrage profit in the near future because of the degradation costs of batteries, which were counted based on the expensive battery cost of $825 per kWh, with optimistic forecast for reducing to $475 in the coming years. However, General Motors already declared that it will be paying just $145 per kWh for Li-Ion batteries [18]. This is the wholesale price for manufacturers, and it is assumed that similar price will be soon available to EV owners when they replace their car batteries. With this price value, a distributed storage based on EVs can be sufficient to supply the prosumer and same time be beneficial for the EV owners.
As shown in [16,19], attempts to optimize EV charging from the PV sources without coordination of EV charging schedule with PV generation, would result in sub-optimal solutions. However, by combining V2B and local PV generation, it is possible to bypass the power utility that currently acts as a middle man that defines market mechanisms in order to exploit the distributed energy resources while preventing free market competition that would maximize the DER owner's profits. Our hypothesis is that the electricity savings will significantly outweigh the costs involved, especially costs related to battery degradation. An even more interesting hypothesis would be that our proposed system is more profitable than approaches using V2G and selling the PV generation to the grid, but unfortunately such a direct comparison is not possible, since the other proposed approaches neglect some consideration that would have been essential for the comparison. References [20][21][22] focus on V2G without PV. Reference [23] ignores battery degradations costs, and [20] has an unrealistically small and unjustified figure of 1 ¢/kWh. References [24,25] only use EV batteries to cover the difference between forecasted and actual PV generation, without exploiting the batteries for storing the surplus generation and thus underusing the capacities of the batteries. Reference [26] does not consider cloudy days. References [24,25] do not consider the fact that each vehicle has individual state of charge (SOC), departure time and intended minimum SOC level on departure. Reference [23] requires investment to local energy storage in addition to the EV batteries, but this cost is not discussed. The listed approaches cannot be directly quantitatively compared to our proposal due to the issues, which can be classified into one of the following categories: (1) issues related to the technical soundness of the proposed approach; (2) a cost that has not been identified or which has an unrealistically low value; (3) design decisions that limit the possibility to fully exploit EV storage capacity and local PV generation.
Other studies more comprehensively exploit distributed energy resources without the above-mentioned weaknesses. A state-of-the-art approach is to use a microgrid as in [27,28], while our work targets sites where a microgrid is not required; further, one must make buy and sell decisions on the previous day which is problematic when the EV behaviour for the next day is not known. Several scenarios for exploiting PV based EV charging are thoroughly investigated in [29] and the scenario of the consumption peak shaving is similar to our work; however, in [29] the solar energy cannot be directly supplied to the building, resulting in battery degradation costs that are not present in our system. Further, the assumptions made in [29] about how excess solar production can be sold to the grid do not apply in the general case; for example, our case study is from the US where the Net Metering mechanism is similar to [29] but it is only available to customers with small capacity. There is the possibility to use EVs to make profits on the demand response [15] or ancillary services [30] markets, while our intention is to save on the electricity bills of the prosumer. The approach in [30] only uses photovoltaic generation to support the EV charging station without considering the possibility to supply the building. Reference [31] investigates distributed night time charging of EVs with wind power in residential areas, and the authors conclude that with a large number of EVs the hosting capacity of the distribution network will be exceeded; reference [32] has a similar approach and will face similar issues, although the system has potential for higher profits than [31] due to the capability for trading on ancillary markets. Our approach of using daytime charging at the prosumer premises will in contrast balance the grid impact that results from high photovoltaic generation and intensive EV charging occurring at different times. Unfortunately, a direct quantitative profitability comparison is not possible between our V2B approach and the said approaches that exploit the EV and local generation capacity in the context of demand response, ancillary services, microgrids or distributed charging. Photovoltaic generation, wind power generation, electricity prices and ancillary market prices depend significantly on the time period and geographical region. There is no uniform approach to account for battery degradation costs, and relevant cost-benefit information is only partially provided there. Thus, despite the qualitative advantages of our approach that were identified above, a definitive quantitative profitability ranking of these approaches is not possible.
The closest relevant previous research is other works on V2B. Reference [33] claims 24% cost savings based on simulating one sunny day in the summer in Chicago, but battery degradation costs are not considered and uncertainties in building energy consumption and EV behavior are left for further work. Reference [34] focusses on households and small buildings and does not provide comparable savings data; uncertainty in EV behavior is also neglected. Reference [35] uses V2B for a purpose different from ours: to minimize the penalty that a customer has to pay for power consumption that exceeds the subscribed power according to a pricing scheme used by a utility in Quebec, Canada. EV batteries were replenished to 80% of their capacity for free while reducing the site electricity bill up to 1.6% when the population of EVs participating in the system account for 1-4% of the vehicles at the site, but the system cannot exploit larger numbers of EVs while maintaining this level of profitability. Reference [36] uses V2B as a technique that supplements local battery storage, while our goal is to exploit the EV batteries as much as possible in order to avoid the investment to local storage; reference [36] also ignores battery degradation costs.
Finally, [37] presents an approach for V2B, which does not have any of the above-mentioned weaknesses; the setup is very similar to ours, and we consider this paper to be the state-of-the-art solution to which our system should be compared. In [37], EV batteries are only used as a countermeasure to balance the mismatch between day-ahead power scheduling and realization, while local battery storage is also present to manage PV generation peaks. The simulation has been performed for one year in California with real data, resulting in 7.2% savings while our results for one year in California provide 15.8% savings. The differences in the experimental setups between these two figures are discussed in the results section. Figure 1 illustrates the concept of a prosumer building with electricity consumption (the load in Figure 1), local PV generation, a parking lot with V2B infrastructure and Building Energy Management System (BEMS) coordinating these resources. The system proposed in this paper is intended as additional functionality to current BEMS systems. A user interface ("EV app" in Figure 1) allows the drivers to communicate to the BEMS the constraints for using the EV battery. The app may request the user to enter answers to questions such as the following: "will you permit the use of your battery for energy management in the facility?", "for how long the vehicle will remain plugged in?" and "what are acceptable values for the minimum and maximum SOC when you depart?" Within these constraints, the BEMS should exploit the EV batteries as fully as possible to ensure that local PV generation will not be wasted on sunny days even if the installed PV generation capacity is high. Thus, PV generation that exceeds the load may be used to charge the EV batteries, and the EV batteries may later be used to supply the load in order to reduce the cost of buying electricity from the grid. To provide the services, the prosumer makes The prosumer's energy supply situation is illustrated in Figure 2. The curves on this figure are for illustrative purposes only. The purpose of this figure is to introduce the concepts and symbols in general terms, so the figure is not based on any data or simulation results from the case study. The time milestones on horizontal axis mean the following: T1 and T2 are the time boundaries within which the local generation dominates on consumption; TS and TE are the time boundaries within which some number of EVs are present at the parking lot. In Figure 2a, Ta and Td are the arrival and departure times of a single EV; SOCa and SOCd are the SOC values at arrival and departure, correspondingly. SOCT is the intended (target) SOC; and SOCm is the maximum SOC that EV has after charging. In Figure 2b, EB is the energy balance. In Figure 2c, V is the number of EVs.  The prosumer's energy supply situation is illustrated in Figure 2. The curves on this figure are for illustrative purposes only. The purpose of this figure is to introduce the concepts and symbols in general terms, so the figure is not based on any data or simulation results from the case study. The time milestones on horizontal axis mean the following: T 1 and T 2 are the time boundaries within which the local generation dominates on consumption; T S and T E are the time boundaries within which some number of EVs are present at the parking lot. In Figure 2a, T a and T d are the arrival and departure times of a single EV; SOC a and SOC d are the SOC values at arrival and departure, correspondingly. SOC T is the intended (target) SOC; and SOC m is the maximum SOC that EV has after charging. In Figure 2b, E B is the energy balance. In Figure 2c, V is the number of EVs. The prosumer's energy supply situation is illustrated in Figure 2. The curves on this figure are for illustrative purposes only. The purpose of this figure is to introduce the concepts and symbols in general terms, so the figure is not based on any data or simulation results from the case study. The time milestones on horizontal axis mean the following: T1 and T2 are the time boundaries within which the local generation dominates on consumption; TS and TE are the time boundaries within which some number of EVs are present at the parking lot. In Figure 2a, Ta and Td are the arrival and departure times of a single EV; SOCa and SOCd are the SOC values at arrival and departure, correspondingly. SOCT is the intended (target) SOC; and SOCm is the maximum SOC that EV has after charging. In Figure 2b, EB is the energy balance. In Figure 2c, V is the number of EVs.   . Negative values of power balance correspond to periods when consumption is greater than own generation, and positive values to the opposite case, when local generation exceeds own consumption. For simplicity, the illustration presents this as one continuous period during the day between times T 1 and T 2 . Figure 2c presents the number of electric vehicles parked at the prosumer's parking lot as a function of time. As one can observe, the vehicles are present in the time interval T S and T E with distribution as per the graph. Figure 2a presents state of charge of an EV arrived at T a and departed at T d moment with intended state of charge SOC T . After arrival, the EV is getting charged until time moment T 2 , when the power balance changes to negative. Then the EV is getting discharged until the departure moment, when the state of charge is still greater than the intended one.

System Concept
Assuming the rate of charge and discharge are r c and r d respectively, the EV's energy balance E can be described by the following Equation (1): The costs balance M of the EV i is the difference between money paid and received as follows: In Equation (2), P c and P d are the agreed cost of charge and discharge respectively. The cost of discharge shall include the component compensating the EV for the battery degradation, which can reflect particular properties of the battery, and the basic intention of the EV owner is to minimise M EV , while maximising cd − ca ( Figure 2).
On the other hand, the prosumer's intention is to sell the surplus of the energy balance as much as possible and minimise costs of covering the negative energy balance in the periods [T S , T 1 ] and [T 2 , T E ]. When using EVs for this purpose, the prosumer will be comparing the current grid electricity price P g with the costs of discharge P d , and use EVs only if P g > P d .
The price of charge P c shall be lower than market price P c < P g , and the prosumer shall try to maximise the income from selling energy to EVs (max M p = ∑ i=1,n M P EVi ), while respecting the constraint that energy sold cannot be greater than the energy generated at any unit of time. Maximising M p can be achieved through incentivizing EVs to come and selecting the attractive combination of the charge and discharge prices. Predictions of the energy balance would play a decisive role in planning the incentivisation of EVs.
The proposed protocol for the interaction between the BEMS and EVs is shown on Figure 3 in a form of a Unified Modelling Language (UML) activity diagram. The prosumer agent is a new functionality that is proposed as an extension to the current BEMS systems. The EV agent functionality resides in the EV app in Figure 1. This protocol starts with the prosumer estimating the day-ahead power balance by consulting the BEMS. Then it receives the planned departure times and SOC intentions of all EV agents. The SOC is measured from the battery without any input from the user and the user only enters the SOC required at the time of departure. It is assumed that the user can estimate the desired SOC level, e.g., knowing the mileage he needs to drive to his destination. Based on all this information from EV agents and BEMS, the EVs are sorted by the prosumer agent into participating and non-participating vehicles. The criteria for enabling the participation is the availability of surplus PV generation during the proposed EV's stay at the parking lot. The "[Contract not awarded]" branch in Figure 3 will apply to all non-participating EVs, which are placed on a waiting list. The prosumer doesn't make contracts with all the EVs but only with a sufficient number of EVs to get the required battery capacity needed to handle the surplus PV generation. These EVs are selected by the order of remote announcement and their parameters. A similar method for awarding contracts is used to select an EV from the waiting list whenever a participating EV leaves before the announced time. It is assumed that the BEMS has the ability to read SOC values from EVs; using, for instance, the OCPP 2.0 protocol [38].

Estimation of Profitability
The profitability of a system that follows the protocol in Figure 3 will be estimated by simulating power flows for a large prosumer building during the day. The building has its own large parking lot that is capable of accommodating substantial number of vehicles, e.g. several hundred as suggested in [39]. The load profile and EV behaviour data have been selected based on the assumption that the prosumer is an office building. The prosumer is characterized by the power balance function Pbal: Pgen in Equation (3) is the power that is generated by PV panels on the roof. Pcon is the power consumed by the building, i.e., the load in Figure 1. When local generation is greater than power demand, the prosumer will store its temporary surplus to the EV batteries and may later use the batteries to supply the load. The EV owners get free recharging of their cars, and the difference between free and paid "refuelling" is supposed to be higher than the degradation costs of EV batteries (discussed in Section 4.1 of this paper). The additional compensation of the EV owners is formed from the difference between the cost of charge Pc and discharge Pd. In this work these costs were chosen as Pc = 0 and Pd = 1.5 ¢/kWh, i.e., as if the prosumer will charge the EVs for free and pay 1.5 ¢/kWh when it discharges the battery. The reason for choosing these numbers is discussed in the end of Section 6.3 of this paper; it was used as an example to demonstrate that the system is profitable for the prosumer as well as for the EVs in all regions taken for the case study. Deeper market analysis may certainly affect these figures.
In order to evaluate whether such an arrangement will be profitable, several factors need to be considered. Firstly, the arriving EV driver has the intention to recharge the battery to the desired level. It is assumed that financial savings are only a secondary priority for the EV driver, so our system is designed with the constraint that the intended SOC will always be achieved unless the EV driver violates the contract and leaves before the announced time.
The following significant aspects affect the financial benefit. The battery's degradation cost directly depends on the depth of discharge. With every V2B related discharge, the battery loses some of its value; therefore, the possible savings of the contract should at least cover those losses. For the prosumer, the weak side of the collaboration is that EVs have unpredictable presence at the parking lot. Even if they initially announced a certain departure time, our system will cope with EVs that

Estimation of Profitability
The profitability of a system that follows the protocol in Figure 3 will be estimated by simulating power flows for a large prosumer building during the day. The building has its own large parking lot that is capable of accommodating substantial number of vehicles, e.g., several hundred as suggested in [39]. The load profile and EV behaviour data have been selected based on the assumption that the prosumer is an office building. The prosumer is characterized by the power balance function P bal : P gen in Equation (3) is the power that is generated by PV panels on the roof. P con is the power consumed by the building, i.e., the load in Figure 1. When local generation is greater than power demand, the prosumer will store its temporary surplus to the EV batteries and may later use the batteries to supply the load. The EV owners get free recharging of their cars, and the difference between free and paid "refuelling" is supposed to be higher than the degradation costs of EV batteries (discussed in Section 4.1 of this paper). The additional compensation of the EV owners is formed from the difference between the cost of charge P c and discharge P d . In this work these costs were chosen as P c = 0 and P d = 1.5 ¢/kWh, i.e., as if the prosumer will charge the EVs for free and pay 1.5 ¢/kWh when it discharges the battery. The reason for choosing these numbers is discussed in the end of Section 6.3 of this paper; it was used as an example to demonstrate that the system is profitable for the prosumer as well as for the EVs in all regions taken for the case study. Deeper market analysis may certainly affect these figures.
In order to evaluate whether such an arrangement will be profitable, several factors need to be considered. Firstly, the arriving EV driver has the intention to recharge the battery to the desired level. It is assumed that financial savings are only a secondary priority for the EV driver, so our system is designed with the constraint that the intended SOC will always be achieved unless the EV driver violates the contract and leaves before the announced time.
The following significant aspects affect the financial benefit. The battery's degradation cost directly depends on the depth of discharge. With every V2B related discharge, the battery loses some of its value; therefore, the possible savings of the contract should at least cover those losses. For the prosumer, the weak side of the collaboration is that EVs have unpredictable presence at the parking lot. Even if they initially announced a certain departure time, our system will cope with EVs that abruptly leave earlier. The number of EVs that arrive on a particular day and the inputs that EV driver provides through the EV app are not known in advance. This study will investigate the combined benefits to EVs and to the prosumer with realistic durations of stay and charge level intentions for employees and visitors of office buildings.

Simulation Model
The proposed collaboration scenario was modelled in MATLAB R2015a (The MathWorks, Inc, Natick, MA, USA). The structure of the model is shown in the conceptual block diagram in Figure 4. Some assumptions are made as follows. The parking lot is covered and air-conditioned to 25°C, in order to prevent more rapid battery depletion at high temperatures [40]. It has necessary V2B infrastructure allowing both-way power flow to the vehicles, as well as all the arriving EVs also assumed to have V2B capacity. In other words, the model computes the energy transfer inside the battery, but does not detail transmission systems between the battery and the building, such as power converters. The state transition logic of how the prosumer operates the EV during the day is schematically presented on Figure 5; the general principles are given next. abruptly leave earlier. The number of EVs that arrive on a particular day and the inputs that EV driver provides through the EV app are not known in advance. This study will investigate the combined benefits to EVs and to the prosumer with realistic durations of stay and charge level intentions for employees and visitors of office buildings.

Simulation Model
The proposed collaboration scenario was modelled in MATLAB R2015a (The MathWorks, Inc, Natick, MA, USA). The structure of the model is shown in the conceptual block diagram in Figure 4. Some assumptions are made as follows. The parking lot is covered and air-conditioned to 25 ℃, in order to prevent more rapid battery depletion at high temperatures [40]. It has necessary V2B infrastructure allowing both-way power flow to the vehicles, as well as all the arriving EVs also assumed to have V2B capacity. In other words, the model computes the energy transfer inside the battery, but does not detail transmission systems between the battery and the building, such as power converters. The state transition logic of how the prosumer operates the EV during the day is schematically presented on Figure 5; the general principles are given next.   abruptly leave earlier. The number of EVs that arrive on a particular day and the inputs that EV driver provides through the EV app are not known in advance. This study will investigate the combined benefits to EVs and to the prosumer with realistic durations of stay and charge level intentions for employees and visitors of office buildings.

Simulation Model
The proposed collaboration scenario was modelled in MATLAB R2015a (The MathWorks, Inc, Natick, MA, USA). The structure of the model is shown in the conceptual block diagram in Figure 4. Some assumptions are made as follows. The parking lot is covered and air-conditioned to 25 ℃, in order to prevent more rapid battery depletion at high temperatures [40]. It has necessary V2B infrastructure allowing both-way power flow to the vehicles, as well as all the arriving EVs also assumed to have V2B capacity. In other words, the model computes the energy transfer inside the battery, but does not detail transmission systems between the battery and the building, such as power converters. The state transition logic of how the prosumer operates the EV during the day is schematically presented on Figure 5; the general principles are given next.

Discharge
When the prosumer's power balance from Equation (3) is negative, the remaining electricity will be supplied either from EV batteries, or if that is not possible, from the grid. The following algorithm describes the logic of discharge (Algorithm 1). Charge the EV // charge from grid if P bal + SUM(DISCHi, i = 1, n)) < 0 supply the remaining electricity from the grid else supply building from the grid.
The 2 h reserve time value is defined because the charge current should be moderate. The recommended current rate in respect to battery's capacity is 0.5C [41]; a higher rate will lead to more rapid battery's degradation and capacity fade, especially after 1C [42]. The maximal discharge current is also limited by BMS because of battery's degradation and safety reasons [43]. Increasing the reserve time value will decrease the savings, and the value of 2 h was empirically determined to be adequate in the case studies.
The battery degradation costs have been quantified as follows. The cycle ageing depends on number of charge-discharge cycles performed by the battery, therefore it is directly related to our utilization of the battery as a temporary electricity storage unit. The number of full charge-discharge cycles for Li-Ion battery during its lifetime is limited; concrete figures specified in the literature vary between 1000 [44] and 3000 [16,45]. Further difficulties in deriving a standardized battery lifetime arise from the fact that it depends on operating conditions, such as intensity of discharge and temperature. It is well studied that lifetime directly depends on Depth of Discharge (DoD) and the number of cycles decreases exponentially when the battery is discharged deeper [44]. The current study operates SOC values from 0.2 to 0.9, i.e., the maximal possible DoD of 70%, but the actual values for our application vary case by case. To solve this problem, Han  DoD and the current SOC of the battery [46]. The current study uses continuous-time model from [46], where the degradation costs are obtained by the following expression (4): where TWC is total wear costs during the day, Q is the battery capacity in kWh, T is the horizon size (i.e., total operation time), C-SOC of the battery. Only SOC changes during discharge are considered. W(C) is the wear function of the SOC that was obtained by curve-fitting the data from a lithium-ion cycle life model [44]. In Equation (9) of [46], the function W(C) was built for the high battery price 625 $/kWh. As motivated in Section 2, the current study assumes the price of 145 $/kWh, so the final revised equation for W(C) is: These calculations consider the battery charge/discharge cycle efficiency of 0.95 (95%). Thus, the Equations (4) and (5) together specify the degradation cost model used in this paper.

Charge
When local PV generation exceeds local consumption at the prosumer building, the prosumer tries to use all the excess power to charge EVs. The maximum SOC threshold is set at 0.9 to prevent negative effects from overcharging [47]. Additionally, the battery of EV must always have some reserve capacity to be able to accumulate energy from regenerative breaking [48]. The Algorithm 2 below describes the charge logic. The model in Figure 4 computes the total amount of energy received by the prosumer and EVs during the day, considering the energy sources used. Then the cost values are formed, consisting of the electricity cost and possible penalties. The penalty to the prosumer applies whenever a vehicle is undercharged at its announced leaving time. The EV is penalized if it leaves before its announced departure time. In this study, the prosumer was implemented so that it undercharges 5% of the time and EVs leave early 10% of this time. Follow-up work on market analysis may come up with different values.

Case Study
The current study simulates large office buildings in three states of the USA: Alaska, California and New Jersey. The main parameters of the cased studies are summarized in Table 1. The consumption data for a typical building of each area over a whole year are used [50]. The roof of the building is partly covered by photovoltaic panels. The buildings may greatly vary by their spacious parameters, but the data [50] do not detail the building size. Taking into account that the floor area of large office buildings may reach tens of thousands of square meters [53], we assume that our building contains at least 3000 m 2 of rooftop area on which the prosumer has installed the PV panels. Solar radiation data for one year is used for each state [49].
The presence of the EVs at the parking lot of the building is modelled stochastically. Each vehicle is assigned with arrival and departure times. The probability of arrival and departure at a certain time of day varies accordingly to the expected number of arrived and departed vehicles at every hour using data from [54]. This results in the distribution of number of vehicles during the day as in the Figure 2c. It is assumed that all the vehicles coming to the parking lot are EVs. The grid energy is always available to the prosumer with fixed utility price according to the average state retail electricity price in 2015 [52]. The participating EVs recharge for free, but EVs that were not awarded a contract pay for the charging according to the utility grid price.
In case of peak EV penetration, the system does not fully exploit the overall EV battery storage capacity. The PV capacity has been dimensioned in such a way that sufficient EV battery capacity is available all year round to handle surplus generation. This approach is not claimed to be optimal, and a topic for further research is to dimension the PV capacity relative to the parking lot EV battery storage capacity for highest annual profits.
In order to obtain a conservative assessment of the system's annual electricity bill savings, weekends and other public holidays were excluded. The power consumption in office buildings is significantly lower on weekends and holidays; the building and its parking lot are expected to be almost empty these days. The modelling procedure is the same for all the three states, so the following Results chapter will be organized as follows: Sections 6.1 and 6.2 will detail and discuss the simulation for the Alaska, and then Section 6.3 will compare the results with the two other regions.

Results
The main obtained results are summarized in Table 2. The most important numerical values are absolute savings, i.e., the reduction in electricity bills, and the relative savings, i.e., the percentage of reduction of electricity bills. Combined savings consider the cost of supplying the building load and charging the EVs. The combined cumulative savings during the year for all three states are shown on Figure 6. The savings are significant in all states despite large variation in solar radiation and retail electricity price.

One Day Simulation Results
The proposed collaboration during one sunny day in Alaska will be discussed to illustrate the workings of the system over a period of 24 h. Figure 7 shows the power balance profile in the simulated day, and how it changed after a different number of EVs participated. In total, 252 EVs could use the opportunity of free recharge during this day; this number allowed the prosumer to fully exploit the excess of PV generation. The system enabled the prosumer to avoid purchasing electricity from the grid during several hours in the morning and evening. At the end of the reporting day, the total prosumer's costs were $466, including electricity from the grid, reward to EVs, charging participated vehicles and penalties to those of them who were undercharged. The figure in the case if no collaboration with EVs was possible is $662.

One Day Simulation Results
The proposed collaboration during one sunny day in Alaska will be discussed to illustrate the workings of the system over a period of 24 h. Figure 7 shows the power balance profile in the simulated day, and how it changed after a different number of EVs participated. In total, 252 EVs could use the opportunity of free recharge during this day; this number allowed the prosumer to fully exploit the excess of PV generation. The system enabled the prosumer to avoid purchasing electricity from the grid during several hours in the morning and evening. At the end of the reporting day, the total prosumer's costs were $466, including electricity from the grid, reward to EVs, charging participated vehicles and penalties to those of them who were undercharged. The figure in the case if no collaboration with EVs was possible is $662.
In the case of no collaboration with EVs, the prosumer will at times have surplus solar generation that exceeds the consumption of the building. It was discussed in the Introduction that there is SRECs program [8] in the USA, but it requires participants to reserve a portion of their generation, therefore the daily amount of energy to supply the building consumption is reduced. For that reason, in the calculations in this paper for the chosen states, no value is assigned to the surplus solar generation in the case of no collaboration between prosumer and EVs. A quantitative comparison to state-of-the-art research on combining V2B with local PV generation is performed in Section 6.4. fully exploit the excess of PV generation. The system enabled the prosumer to avoid purchasing electricity from the grid during several hours in the morning and evening. At the end of the reporting day, the total prosumer's costs were $466, including electricity from the grid, reward to EVs, charging participated vehicles and penalties to those of them who were undercharged. The figure in the case if no collaboration with EVs was possible is $662.

Figure 7
The original power balance profile and its change after different number of participating EVs. The curve 252 veh corresponds to the maximum total daily number of EVs awarded by a contract; the curve 150 veh is for illustration purposes to show the results of partial exploitation with less EVs than the prosumer needs to dispose its PV energy excess.
In the case of no collaboration with EVs, the prosumer will at times have surplus solar generation that exceeds the consumption of the building. It was discussed in the Introduction that there is SRECs program [8] in the USA, but it requires participants to reserve a portion of their generation, therefore the daily amount of energy to supply the building consumption is reduced. For that reason, in the calculations in this paper for the chosen states, no value is assigned to the surplus solar generation in the case of no collaboration between prosumer and EVs. A quantitative comparison to state-of-theart research on combining V2B with local PV generation is performed in Section 6.4. Figure 7. The original power balance profile and its change after different number of participating EVs. The curve 252 veh corresponds to the maximum total daily number of EVs awarded by a contract; the curve 150 veh is for illustration purposes to show the results of partial exploitation with less EVs than the prosumer needs to dispose its PV energy excess. Figure 8 depicts the costs for each EV, comparing two scenarios. The solid line shows the case with the collaboration proposed in this paper. The dashed line represents "normal bill", which is how much the EV would pay if it charges from its SOC on arrival to the intended SOC using the flat electricity price for Alaska. If the EV i participates, the cost value b i is calculated in the following way: where M P Fi is the penalty from EV i if it left earlier, M R Fi is the penalty from the prosumer if the EV i was undercharged, M EVi and TWC i are the values calculated by Equations (2) and (4). Figure 8 shows only the cases with M P Fi = 0 to evaluate the profitability for the EVs that did not renege on their contracts. In some cases, the total EV owner's expenses including battery degradation cost are close to zero, e.g., for EV number 93 in Figure 8. This scenario that is highly beneficial to the EV is because the prosumer had time to only slightly discharge the battery. Right after the discharge, either the power balance turned positive, or it became time to recharge the EV due to impending departure. By the contract term, the prosumer charges the EV free of charge if it used the EV's battery at least once.
Energies 2018, 11, x FOR PEER REVIEW 13 of 18 Figure 8 depicts the costs for each EV, comparing two scenarios. The solid line shows the case with the collaboration proposed in this paper. The dashed line represents "normal bill", which is how much the EV would pay if it charges from its SOC on arrival to the intended SOC using the flat electricity price for Alaska. If the EVi participates, the cost value bi is calculated in the following way: where is the penalty from EVi if it left earlier, is the penalty from the prosumer if the EVi was undercharged, and are the values calculated by Equations (2) and (4). Figure 8 shows only the cases with = 0 to evaluate the profitability for the EVs that did not renege on their contracts. In some cases, the total EV owner's expenses including battery degradation cost are close to zero, e.g. for EV number 93 in Figure 8. This scenario that is highly beneficial to the EV is because the prosumer had time to only slightly discharge the battery. Right after the discharge, either the power balance turned positive, or it became time to recharge the EV due to impending departure. By the contract term, the prosumer charges the EV free of charge if it used the EV's battery at least once. Collaboration brings cost reduction for most of the EVs. Average b value from (6) is $0.57 while the average normal bill is $2.9. Individual EVs may lose, such as EV number 15 in Figure 8. Its expenses are higher than normal bill, because it spent a lot of energy for discharge. The SOC intention was just from 0.44 to 0.66. It could recharge and pay $3.2 for that amount of energy. But from the collaboration, it spent in total 125% of full SOC (in multiple discharge-charge cycles), and the degradation costs by those operations exceed the savings that EV got by free charging. The EV lost in the current single case. Still, as it was stated before, the average savings for an EV with high capacity in the current day are $2.33.

Estimating Year Savings
The cost reduction described in the previous section is promising, but it became possible largely due to a PV-productive day. To motivate investment into this kind of system, a potential investor needs to estimate the benefit over longer period, which includes less favourable days. Thus, the simulation was extended for one year with real weather and electricity consumption data. This resulted in 252 working office days. In Alaska, 120 of these days had at least one period with surplus energy. On other days, the proposed collaboration did not start at all and the costs for both sides Cost, $ are higher than normal bill, because it spent a lot of energy for discharge. The SOC intention was just from 0.44 to 0.66. It could recharge and pay $3.2 for that amount of energy. But from the collaboration, it spent in total 125% of full SOC (in multiple discharge-charge cycles), and the degradation costs by those operations exceed the savings that EV got by free charging. The EV lost in the current single case. Still, as it was stated before, the average savings for an EV with high capacity in the current day are $2.33.

Estimating Year Savings
The cost reduction described in the previous section is promising, but it became possible largely due to a PV-productive day. To motivate investment into this kind of system, a potential investor needs to estimate the benefit over longer period, which includes less favourable days. Thus, the simulation was extended for one year with real weather and electricity consumption data. This resulted in 252 working office days. In Alaska, 120 of these days had at least one period with surplus energy. On other days, the proposed collaboration did not start at all and the costs for both sides stayed unchanged. Figure 9 shows the prosumer's costs comparison among sunny-productive days; on all these days, the collaboration brings savings to the prosumer. Total savings for one year are $14,258, or $57 per working day on the average. The cost comparison for the prosumer at energy productive days over one year, from January to December.
The average cumulative daily savings for all participated EVs in a single day are $37; the days with no surplus energy are also counted. Dividing this figure by the number of vehicles results in $1.08 per vehicle per day. The number of vehicles changes from day to day depending on surplus energy available and varies from a single EV on a poor sunny day with a very small burst of extra energy, to 342 on a brilliant sunshine day.
The significant limiting factor is PV investment costs. According to the report of National Renewable Energy Laboratory of the USA [55], the approximate PV costs benchmark for utility-scale systems is $1.03 per watt of installed power. The precise cost value depends on various factors such as the system's size, its location and electricity market conditions there. Nevertheless, it is a serious investment load for large systems as ours. However, some aspects smooth out this drawback. At first, these cost values tend to decrease and nowadays there is a significant reduction comparing to 2010 [52]. Secondly, the lifetime of the installed power will be for long years and will bring a payback. And finally, even without accurate PV investment cost numbers, it is possible to compare to other stateof-the-art solutions (that are observed in Sections 2 and 6.4 of this paper) in which there is a similar PV investment required.

Results Comparison Between the Regions
It is expected that savings values will depend significantly on the geographical region that will affect solar generation. The discussion so far concerned Alaska, which is an unfavourable region for solar energy production, in order to demonstrate that significant financial benefit can be obtained The average cumulative daily savings for all participated EVs in a single day are $37; the days with no surplus energy are also counted. Dividing this figure by the number of vehicles results in $1.08 per vehicle per day. The number of vehicles changes from day to day depending on surplus energy available and varies from a single EV on a poor sunny day with a very small burst of extra energy, to 342 on a brilliant sunshine day.
The significant limiting factor is PV investment costs. According to the report of National Renewable Energy Laboratory of the USA [55], the approximate PV costs benchmark for utility-scale systems is $1.03 per watt of installed power. The precise cost value depends on various factors such as the system's size, its location and electricity market conditions there. Nevertheless, it is a serious investment load for large systems as ours. However, some aspects smooth out this drawback. At first, these cost values tend to decrease and nowadays there is a significant reduction comparing to 2010 [52]. Secondly, the lifetime of the installed power will be for long years and will bring a payback. And finally, even without accurate PV investment cost numbers, it is possible to compare to other state-of-the-art solutions (that are observed in Sections 2 and 6.4 of this paper) in which there is a similar PV investment required.

Results Comparison Between the Regions
It is expected that savings values will depend significantly on the geographical region that will affect solar generation. The discussion so far concerned Alaska, which is an unfavourable region for solar energy production, in order to demonstrate that significant financial benefit can be obtained even in such a region. The same simulation has been repeated for New Jersey and California; Figure 6 depicts the combined annual cumulative savings, and Table 2 summarizes the main numerical values from all the simulations.
Much higher solar generation in New Jersey and California results in a higher number of days when the prosumer is able to benefit from the proposed collaboration. It is seen from the Figure 6, that sunnier states indeed have higher savings, but their values are also affected by differences in electricity prices. The prosumers located in regions with lower retail electricity price have lower yearly energy cost, which affects the absolute savings value. Still, the savings as a percentage of annual electricity costs are highest in states with highest solar generation ( Table 2).
Further research on market analysis is encouraged to design a better compensation mechanism for the EVs; the focus of this paper is to determine combined savings for the prosumer and EVs. The figures in the Table 2 show that there exist parameters for the profit sharing mechanism that result in profits both to the prosumer and to EVs, but the share of the latter is much less for the regions with lower electricity price. The simulation for New Jersey has determined that free charging only is not enough to cover the degradation costs, and the contract must include partial compensation of degradation costs. This study identified the figure P d = 1.5 ¢/kWh as the minimum value that makes the collaboration profitable for the EVs in all the states; any lower value makes the case in New Jersey disadvantageous for the EV owners and therefore is unacceptable.

Comparison with the State of the Art
Our approach is not based on multi-objective optimization, so it is a suboptimal solution. However, our problem formulation allows us to exploit the EV battery capacity more fully than in the state of the art work [37] that was identified in Section 2. The battery degradation cost model and the EV behaviour of our setup and [37] are comparable. The differences between our setup and the setup in [37] are as follows: our system assumes fixed prices, while [37] aims to intelligently capitalize on hourly price differences, so in further work there is potential to further improve our performance relative to [37]. Reference [37] considers a year as 365 consecutive days, regardless of weekends and holidays, while our system assumes that EVs will arrive at the building only on work days. Thus, our savings are obtained from 252 days and they would be higher if 365 days would have been used as in [37]. The system in [37] has smaller PV area and thus smaller PV investment cost, whereas there is an additional investment to local battery storage. Since EVs capacity is only used for coping with the mismatch between day-ahead power scheduling and realization, any additional PV capacity to the system in [37] would require corresponding additional investment to local battery storage. In summary, the differences in the setups are not in our favour so our saving of 15.8% vs the 7.2% in [37] may be considered a conservative estimate. Our approach has not been based on multi-objective optimization, so we cannot claim that it is an optimal solution; however, its performance is better than state-of-the-art multi-objective optimization in [37]. The significant performance improvement is because our system exploits the EV battery capacity more fully and thus permits large rooftop solar installations without wasting generated power on sunny days. In summary, none of the works reviewed in Section 2 on combining V2B and local renewable generation has a problem formulation that permits effective exploitation of the potential EV battery storage capacity for a large fleet of EVs, with the exception of [33]. However, the 24% saving reported in [33] was obtained by ignoring battery degradation cost, simulating only one sunny day in the summer and by neglecting uncertainties related to building electricity consumption and EV behaviour.

Conclusions
The hypothesis in Section 1 stated that the proposed approach would lead to financial incentives to prosumer buildings as well as EVs and increase the share of renewable resources. Key elements of our approach have been the use of EV batteries as local temporary electricity storage in times of surplus PV generation, the ability to cope with unexpected EV behavior, allowing 100% of the battery to be used for driving and managing a large population of EVs to handle the variability of PV generation and EV presence at the parking lot. These elements significantly constrain the solution, but they are important for testing the hypothesis in real world conditions. The simulation results using real power consumption, PV generation and electricity price data demonstrated the electricity costs reductions that are possible to achieve for the prosumer and EV owners. In this paper, the combined reduction of 15.8%, 9.1% and 4.9% was obtained for the three different regions of the USA; the figures consider battery degradation costs. These economic benefits could motivate expansion of the corresponding infrastructure on both buildings and EVs side, leading to the economies of scale multiplicative effect. The individual contract system developed in this paper allows flexible distribution of the savings between the prosumer and multiple EV owners. One line of future work is market analysis to determine parameters for profit sharing between EVs and the prosumer and for the penalties if they break the contract.