Conceptualization of Vehicle-to-Grid Contract Types and Their Formalization in Agent-Based Models

. Fuelcellelectricvehicles(FCEVs)havethepotentialtobeusedasflexiblepowerplantsinfutureenergysystems.TointegrateFCEVs throughvehicle-to-grid(V2G),agreementsareneededbetweentheFCEVownersandtheactorthatcoordinatesV2Gonbehalfof them,usuallyconsideredtheaggregator.Inthispaper,wearguethat,dependingonthepurposeofprovidingV2Gandthegoalof thesystemortheaggregator,differenttypesofcontractsareneeded,notcurrentlyconsideredintheliterature.Weproposeprice-based,volume-based,andcontrol-basedcontracts.Usingagent-basedmodelingandsimulationweshowhowprice-basedcontracts canbeappliedforsellingV2Ginthewholesaleelectricitymarketandhowvolume-basedcontractscanbeusedforbalancingthe localenergysupplyanddemandinamicrogrid.Themodelscanprovideabasetoexplorestrategiesinthemarketandtoimprove performanceinasystemhighlydependentonV2G.


Introduction
Flexibility can be defined as the ability of a system to deal with the variability and uncertainty in the balance of generation and consumption of electricity [1].One of the potential flexibility resources that can be exploited by residential consumers for electric power systems is the energy stored in electric vehicles (EVs), which could be used whenever they are parked, to provide storage, demand-side response, or vehicleto-grid (V2G) [2][3][4].This has been an area of interest for over a decade [5] due to the increasing electrification of transport systems [6].In many cases, the supply of flexibility with EVs is an opportunity but also a need, due to the effect that EV charging has on the distribution networks.In the case of fuel cell electric vehicles (FCEVs), hydrogen is used as an energy carrier and therefore it can be stored centrally but also in the vehicles.Thus, the energy demand for mobility does not affect the grid directly, while the energy available in the vehicles can be used for supplying flexible vehicle-to-grid power [7].
Research on Battery Electric Vehicles (BEVs) is usually focused on ancillary services (spinning reserves and regulation) due to the ability of BEVs to provide regulation up and down [8][9][10][11][12].As Kempton and Tomić [2] indicate, BEVs are better for providing regulation and FCEVs are more suitable for spinning reserves and peak power.Wholesale markets have also been considered [13][14][15] as it is expected that a growing EV capacity will eventually saturate the balancing markets [16][17][18].The supply of power in microgrids for load leveling has also been considered [19,20].Regarding FCEVs, most of the literature is focused on local energy supply, for example, vehicle-to-building power [21,22] and more recently microgrids [23][24][25] and smart cities [26].The role of FCEVs in the wholesale market in systems with high wind penetration is also being explored [27].The more recent research presents FCEVs within the Car as Power Plant (CaPP) concept, which combines renewable energy generation, conversion to hydrogen, and storage [4,7].
The technical and economic potential of V2G has been widely explored [2,21,22], but due to political and regulatory barriers [28,29] implementation is still limited to controlled environments and pilot projects [30].In the case of FCEVs, the slow adoption of FCEVs and limited hydrogen infrastructure are additional barriers, as well as the public acceptance of hydrogen [31].When implemented, the operation V2G will depend on the participation of drivers, who must be willing to activate the flexibility from their vehicles when needed.The 2 Complexity aggregator role is considered to be important for the implementation of V2G, given that an actor in the electricity system is needed to participate in markets on behalf of the drivers (prosumers) [9,32].In local energy systems/microgrids, the controller or microgrid operator takes the role of aggregator.The use of vehicles for flexible power supply by an aggregator implies the need of an agreement between vehicle owners and the aggregator, which can be made in the form of a contract [32,33].Contracts can provide the aggregator with information about the availability and activation criteria of the vehicles, to make decisions about when to operate which resources.The literature on V2G contracts, however, is quite limited as only one form of contract is usually considered for different markets.
The goal of this paper is to (1) contribute to the V2G contract literature by adding new types of contracts to provide different ways to manage EVs (FCEVs in particular) for different markets and types of V2G power and (2) demonstrate in two models how price-based contracts can be used to sell power in the wholesale market and how volume-based contracts can be used to coordinate V2G in a microgrid.For the first goal we provide the current insights into the V2G contract literature and propose new V2G contract types within a classification that is used in the demand response (DR) literature: price-based, volumebased, and control-based contracts.We briefly introduce the contract parameters in each one and explain when they may be suitable.For the second goal, we present two agent-based models in which the different energy systems are represented as complex sociotechnical systems.
The rest of the paper is structured as follows: In Section 2 we present a review of the relevant literature that deals with contracts for V2G.In Section 3 we describe three contract types: price-based, volume-based, and control-based.In Section 4 we describe the two models used and the results of the simulations.We end in Section 5 with conclusions about our research.

Vehicle-to-Grid and Its Value Chain. The Universal Smart
Energy Framework (USEF) defines the relationships in flexibility trading using prosumer-side resources [34].Since all electric vehicles (EVs) can be considered prosumer-side flexibility resources, the framework can also be used to describe the V2G value chain (Figure 1).Drivers provide V2G to the electricity system via an aggregator that may interact with balance responsible parties (BRP), the Transmission System Operator (TSO), and/or the Distribution System Operator (DSO) for the supply of V2G in different markets.The framework also indicates the several stages in flexibility trading, in which the interactions among actors occur [35]: Contract, Plan, Validate, Operate, and Settle.The Contract phase can include the agreements between prosumer and aggregator on the capacity available and the conditions for activation.The Plan and Validate stages are similar to the processes in current markets, where market actors make plans for energy supply and demand, which are validated if feasible.The Operate stage refers to the dispatch of resources, which would refer to the use of vehicles to provide electricity.While generally the V2G literature is focused on the Plan and Operate stages and the participation in electricity markets [8,36,37], there is limited knowledge on the Contract phase and how it affects the daily operations.

Role of Contracts in the Coordination of Vehicle-to-Grid.
We define operational coordination of V2G as the set of decisions that are made to operate individual vehicles in order to achieve a certain goal in the technical system.Although the aggregator offers aggregated energy or capacity in the markets, it also has to make decisions about the operation of individual vehicles, taking into account the different needs and preferences of the drivers and the technical characteristics of the vehicles.These aspects which define the availability and activation criteria of each car delineate how it can be operated by the aggregator and have to be explicitly defined in a contract.
Guille and Gross [32] present a V2G implementation framework that consists of using contracts to get the commitment from vehicles before the aggregator can make a contract with the system operator.A package deal is formed, consisting of preferential rates for purchasing the battery but also discounts for charging and parking.The obligations indicated in the contract consist of plugging in at times that are predefined in the contract.Failing to comply with the contract terms leads to penalties.The authors in [33] describe two options for the relationship between the aggregator and EV driver: a contractual and a noncontractual form.The former would involve obligations for the service and a yearly cash payment and the second a free participation and "payas-you-go" type of remuneration.A choice experiment about V2G-enabled EVs is carried out, using a simple contract concept.Required plug-in hours (ranging from 5 to 20 hours) and a guaranteed minimum range (ranging from 25 to 175 miles) are two of the contract terms.One of the conclusions is that the upfront payments for V2G to drivers might not be enough to participate in V2G.
One econometric study quantifies the influence of contract parameters on the economic potential of V2G in the German secondary reserve markets [37].The contract parameters used are those presented in [33].Driver characteristics from mobility data are used to assume contract parameters (based on the theoretical participation potential) and to make subsets of drivers with similar characteristics.Using the subsets, the value of different vehicle characteristics for the aggregator are determined.Although the authors use market data of a whole year, they extract two weeks with the highest and lowest reserve market demands to calculate the optimal car pool size, as well as the annual profits.Broneske and Wozabal [37] conclude that the value of certain contract parameters for the aggregator depends on the characteristics of the market; that is, markets where more energy is supplied will value drivers that are able to provide enough energy (lower guaranteed minimum range) while also providing enough availability, while markets where less energy is supplied, the availability (plug-in hours) will be more valued.

Different Vehicle-to-Grid Contract
Types.For all types of markets and services, the supply of V2G has different characteristics and needs.As Broneske and Wozabal [37] concluded, in markets with different "energy throughput" characteristics, different contract parameters are suitable and thus valuable for the aggregator.Kempton and Tomić [2] also suggest that when providing ancillary services the availability (capacity) is more valuable than the actual energy supplied, since even when there is a loss for selling electricity, the capacity payments sufficiently make up for the costs incurred [2].Since the characteristics for participation in V2G differ in each market and system, different types of contracts should be made to account for the different needs.
In the demand response (DR) literature, demand response programs can be categorized into "explicit" (volumebased) and "implicit" (price-based) mechanisms [38].The first one refers to explicitly defining the level of flexibility to be activated and is appropriate for system reliability purposes.The latter refers to the reaction of consumers to prices and thus the provision of flexibility without a previous agreement on the volume [39].He et al. [40] emphasize the importance of activating consumers for demand response to be successful.To achieve that, the authors present different types of contracts that can cater to consumers with distinct technical capabilities and preferences: price-based, volume-based, and control-based contracts, all of which have different technical characteristics and high level implications for prosumers.
The concepts from demand response can be extended to V2G, although there are fundamental differences between DR and V2G.In the case of DR, the service is a deviation of the normal consumption pattern, usually provided through household load or EV charging.V2G on the other hand implies allowing the use of a vehicle as a dispatchable generation unit.These are two different ways to provide flexibility in electricity systems [1] and have in common the fact that small prosumers can participate.The concepts from [40] and the DR literature can be used as a guideline to define different ways in which the V2G service can be activated, although specific characteristics related to mobility have to be applied to activate drivers for V2G supply.In the case of FCEVs, which are usually not connected to the grid, it can be a challenge since additional efforts are needed by the prosumer to plug in the vehicle and provide energy.
Currently only one type of contract is considered in the literature, which is defined by the plug-in time (timing and length) and the guaranteed driving range after V2G.In [13], different strategies for V2G participation with BEVs in the wholesale market are explored.One of them allows the driver to define a selling price for V2G, leading to the lowest battery cycles and highest savings (net profits) when compared to other strategies where the driver does not control the minimum price.Although the aggregator's role is implied, there are no details about the contractual relationships and there seems to be no profit sharing with the aggregator.This example demonstrates that in some cases allowing drivers to set a minimum price for activating V2G would help them control the level of expected revenues and thus make participation more attractive.

Conclusions.
In conclusion, the need for contracts in V2G supply is evident from the literature and is in line with the processes of flexibility trading defined in [35].The use of V2G contracts is mentioned in the literature either to imply agreements on the level of participation of the vehicles [8], or as a means to ensure or increase participation [32,33].Broneske and Wozabal [37] demonstrated that contract parameters influence profitability in the market and that different market characteristics value contract parameters differently.The only V2G contract type explicitly mentioned in the literature (based on plug-in time and energy available) [32,33,37] may not be enough to engage drivers in different markets.This is supported by the distinction made in DR programs and contract types [38,40] and the possibility that setting a selling V2G price can be more profitable for drivers in some cases [13].There is still limited focus in the literature on V2G contract design or on how contracts made with drivers with different needs and behaviors affect the operational coordination in the system in which the vehicles are integrated.When viewing future energy systems with V2G as complex sociotechnical systems, we cannot ignore the interactions between actors in the whole V2G value chain and the role of V2G contracts on the operation of the system.For aggregators to sell V2G power in different markets, the contract parameters used to coordinate drivers must be aligned with the characteristics of both individual drivers and the markets.Therefore, there is a clear need to define new V2G contract types and their corresponding parameters and to explore their possible effects on the operation of future energy systems.

A Classification of Vehicle-to-Grid Contract Types
In this section we present three V2G contract types and introduce the distinct sets of parameters.To conceptualize these contracts we use the generic classification of contracts from the DR literature [38,40], which can be applied to V2G: price-based, volume-based, and control-based V2G contracts.
We use the characteristics of V2G as explored in [13,23,32,33]  The contract types presented here can be used to for plugin EVs as well as FCEVs.Although the coordination of smart charging with plug-in EVs can also be arranged through contracts with an aggregator, V2G refers strictly to the power flows from vehicle-to-grid, and therefore we exclude the arrangements of power flows from grid-to-vehicle (G2V).For the implementation of combined smart charging and vehicleto-grid (charging and discharging) with battery EVs, we suggest adding or adjusting the contract parameters to provide the appropriate limits to use the battery.In the rest of this paper we will conceptualize and explain the contract parameters assuming they are used to manage FCEVs, which technically allow exclusively power flows from vehicle-to-grid.

Price-Based Contracts.
Price-based vehicle-to-grid contracts involve a price signal for the activation of V2G.As shown in Table 1, the driver defines a minimum price he wants to receive for V2G.Therefore, the aggregator will use the vehicle only when he can provide this remuneration (e.g., market price is higher) and as long as there is enough energy in the vehicle.The availability or time at which the FCEV is plugged in is voluntary and therefore not committed.Depending on the market, the aggregator may define a remuneration structure such that the driver gets the minimum price and a percentage of the additional profit (difference between the market price and the minimum V2G price).This percentage could depend on the available energy at plug-in or the plug-in duration so that availability is rewarded.
This type of contract could be used for drivers to participate in the wholesale market, where average prices may not be high enough but peak prices can make V2G profitable [13].

Volume-Based Contracts.
Volume-based contracts involve commitment of a predefined volume of energy within a certain time interval, as shown in Table 2. Thus, drivers can limit the amount of energy they are willing to provide (maximum volume).Since the fuel capacity in the FCEV tank is limited, this means that FCEVs need to have a certain amount of volume at plug-in.By defining the guaranteed fuel level, the required fuel amount can be also calculated for drivers to comply with the commitment.
Volume-based contracts can be attractive for drivers who have a very predictable driving schedule and can be plugged in regularly, for example, at the workplace parking facilities or at home.This type of contract can be used when the commitment of availability and energy is important such as in local energy systems depending on variable RES and FCEVs [23,24,26] or when providing reserve capacity.Since there is a commitment on the time and volume, the remuneration structure could be designed such that the commitment is rewarded.

Control-Based Contracts.
With control-based contracts the driver cedes control to the aggregator as soon as the car is plugged in.The availability is defined by the time interval, which could be precommitted or informed at plug-in by indicating the expected departure time.As shown in Table 3, the activation criterion is defined by the guaranteed fuel level to be left after V2G.Although it is similar to the volume-based contract, there is no commitment on the maximum volume available.Implicitly, it is defined once the car is plugged in, by the initial level of fuel and the guaranteed fuel level.However, the total available volume can change every time.
This may be the contract form with lowest complexity and in the absence of a time interval commitment it gives freedom to the driver to plug in anytime.However, when plugged in, the driver cannot limit how much energy may be used by the aggregator.High levels of availability or fuel levels may be incentivized by designing V2G remuneration structures that consist of a V2G tariff plus a capacity remuneration that is linked to the time duration and the fuel level at plug-in.
This type of contract is in practice implied in the assumptions made in the microgrid in [23], where all FCEVs are assumed to be plugged in whenever they are in the neighborhood and the controller can use them until the minimum fuel level is reached.It is also similar to the V2G contracts in the literature [32,33,37].Control-based contracts could be attractive in cases when vehicle availability is high without commitment, for example, large fleet of FCEVs that are usually plugged in at regular times, and/or when volume commitment beforehand is not necessary because it is not scheduled ahead.
The three contract types described in this section show different ways for drivers and aggregators to make agreements on the availability and activation criteria of their flexible V2G resources, specifically FCEVs in this case.The main differences are the level of commitment of the plug-in time and the activation criterion: either the energy available (volume) or a minimum price preference.In each case, the aspect over which the driver has control is different.In practice, hybrid forms of contracts could be used by aggregators to ensure a certain level of participation of drivers.

Exploring the Role of V2G Contracts Using Agent-Based Models
In this section we demonstrate how V2G contracts can be used for different types of V2G power supply.We present two agent-based models built in Python: one where pricebased contracts are used for participation in the dayahead market and another where volume-based contracts are used to coordinate FCEVs in a microgrid.The models are described following guidelines of the ODD (Overview, Design, concepts, and Details) protocol [42].In this section we only include the main aspects in summarized form, and more details can be found in the Supplementary Materials (available here).The complete descriptions are also available upon request.

Conceptual Framework and Approach.
We use the complex sociotechnical systems approach to describe the system as a combination of the technical subsystem consisting of the physical units and processes, the social subsystem with the actors involved, and the institutions that guide the interactions [43][44][45].The operation of such system is influenced by the interactions between the technology, the involved actors, and the institutional arrangements.In this paper, we focus on the effect of V2G contracts as institutional rules in two systems with heterogeneous actors.We conceptualize the two agent-based models using the three pillars of complex sociotechnical systems, technology, actors, and institutions, in this case the V2G contracts.

Model 1: Price-Based Contracts for Participation in
the Day-Ahead Market

Model Overview
Purpose.The purpose of this model is to formalize pricebased contracts within an agent-based model and to explore the effect of contract parameters.We do this by modeling FCEVs in a car park that are used by an aggregator to sell V2G in the day-ahead market.We model the hourly actions and interactions of the agents, focusing on the role of individual contracts in the amount of V2G sold in the market.The minimum bid volume in the market means that selling power depends also on other drivers' availability and contract parameters.The revenues for the aggregator depend on the aggregated drivers' availability, their contract parameters, and the fluctuating market prices.The revenues for the drivers depend on their own availability and contract, other drivers' behaviors and their contracts, and the changing market prices.With this model, we want to understand these micromacro-micro relationships to further explore how contract parameters could be used to better understand how to engage drivers to participate in wholesale markets and to design strategies for aggregators.
Figure 2 shows the model concepts, which distinguish the technical and social subsystems.Data sources are used to feed driving schedules to the driver agents and to model future electricity prices and forecasts externally and use them as inputs in the model.The main performance evaluation is based on the net profits and the V2G supplied by the drivers.The model is based on our previous work; please refer to [27] for the description of the day-ahead market model and scenarios.Agents and Objects.In the model there are three types of agents: the drivers, the aggregator, and the day-ahead market agent.Drivers represent both the characteristics of the driver, for example, the driving schedule or V2G contract, and the technical characteristics of the car, for example, the level of hydrogen in the tank.They drive and use the car park to park and plug in their car either during "work" or "home" hours.Driver agents own a price-based V2G contract object that contains the contract parameters.The aggregator agent accesses the information in the V2G contracts to sell V2G in the day-ahead market.It also buys electricity to produce hydrogen using the electrolyzer.It makes forecasts about the predicted market price and predicted availability to make decisions in the market.When V2G is sold, available FCEVs are used, based on the contract between the driver and the aggregator.V2G contracts are built as objects in the model, which contain the contract parameters.
Process Overview.At the beginning, contracts are created between driver agents and the aggregator agent.Every day at 12.00 noon, the aggregator agent uses its forecasts on the next day's expected hourly availability of FCEVs and the hourly market price forecasts for the next day in order to place offers for V2G in the market or bids to buy electricity to produce hydrogen.Given the minimum bid volume of 100 kW in the market and the assumed V2G power of 10 kW, for every 100 kW bid at least 10 vehicles with a minimum price lower than the expected market price are needed.Every day drivers drive cars according to their driving schedule.Based on their parking profile, they use the car park during either "work hours" or "home hours."Once parked, they plug in the vehicle to the grid.When they leave again, they refill if necessary.Based on the volumes of V2G sold in the day-ahead market, plugged in FCEVs with a minimum price lower than the market price are operated to supply V2G.At the end of the simulation run, the revenues for the period are calculated for every driver as well as the aggregator.
Inputs for Simulation.We initialize the agents using the inputs indicated in Table 4.The model is simulated for 8760 steps (one year) for two scenarios: Equal minPrice and Random minPrice.Since there is no knowledge on how drivers would set this contract parameter in practice, we compare a situation in which all drivers set the price based on the cost of providing V2G and a situation in which some agents increase the minimum price, up to 1.5 times the cost of providing V2G.This is done by using a factor calculated randomly between 1.0 and 1.5.The cost of providing V2G using FCEVs is calculated using (1), where the first part indicates the cost of energy, that is, the cost of purchased energy  pe divided by the fuel cell efficiency and the Higher Heating Value of hydrogen.The second part indicates the degradation cost, which consists of the unit price of the fuel cell  FC divided by its lifetime in hours and multiplied by a factor of 0.5.Similarly, as in [26], the degradation cost of V2G operation is assumed to be 50% of that of the degradation when driving.
The remuneration is calculated by adding the driver margin to the minimum price.The driver margin is the percentage of profit that the driver receives for the difference between the market price and the minimum price.It is assumed that the aggregator will receive the market price for the V2G supplied, and every €/MWh above the minimum price is to be shared between the two.Since there is no reference on how to calculate this margin, we used different levels of margins according to the fuel available at plug-in.Therefore, the driver margin can change every day, and it will reward drivers with fuller tanks.
The day-ahead market prices used in the simulation runs correspond to the "high wind" scenario in [27].Please refer to Supplementary Materials for more information about the energy scenarios and the data sources used.

Results
. The driver agents' and aggregator's results from the two-simulation run are shown in Table 5.As it is expected, the Equal minPrice run results in more volume of V2G supplied and higher profits both for drivers and for the aggregator.The potential profits are calculated as the profits that would be realized by the driver if the driverMargin had been always the highest, 75%.This value is also higher in the Equal minPrice case.The reason is that the minimum price to sell in the market is lower (63.45 €/kWh) in this run.In the Random minPrice case, the minimum price is calculated for every agent as the cost of V2G times a random factor between 1.0 and 1.5.In the simulation, the agents have a factor between 1.002 and 1.499, and the average is 1.233, which means that the minPrice ranges from 64.57 to 95 €/kWh, with an average of 78.24 €/kWh.In the model, the aggregator offers V2G in the market when it expects enough capacity and the expected market price is above the average minPrice of all drivers.Due to the high average minimum price, it is possible that some driver agents lose the opportunity to sell.On the other hand, some drivers that have a higher minimum price might sell when the market price is lower, but the aggregator still pays the minimum price.In this case, there could be reduced revenues for the drivers from the difference between the market price and the minimum price.The strategy used by the aggregator to offer V2G in the wholesale market could be different as the one used in the model.The possible bidding strategies of the aggregator and their influence on the drivers' net profits could also be explored using this model.The purpose of adding randomness in the minPrice contract parameter was to illustrate how the actions (availability) and different contract parameters (minimum price) influence the aggregate availability of the vehicles.This in turn affects the profits that individual agents realize in the wholesale market.In the model, the contract parameters and driving schedule of every agent can be changed depending on the availability of data and the purpose of the research.

Model 2: Volume-Based Contracts in a Microgrid with
Fuel Cell Vehicles 4.3.1.Model Overview.The Car as Power Plant microgrid is a community energy system consisting of household loads, renewable generation, conversion to hydrogen and storage, and FCEVs as power plants.In this system, the photovoltaic (PV) panels are used to provide power, and when PV generation is not sufficient, FCEVs are used as power plants.In our previous work [23], cars were assumed to be available for V2G whenever in the neighborhood (similar to control-based contracts).With the introduction of volume-based V2G contracts, drivers are able to reduce the plug-in time and set the maximum amount of energy supplied with their vehicle.
Purpose.The purpose of this model is to show how volumebased contracts can be formulated within an agent-based model and to understand the effect of the contract parameters on the system under study.We model a microgrid with residential households that depends on variable renewable energy sources (V-RES), storage, and FCEVs for the energy supply.Thus, the microgrid operator (aggregator role) depends on FCEV drivers and their availability to supply power to the microgrid.Using the volume-based V2G contracts we want to understand the relationship between self-sufficiency of the microgrid (system performance), the commitment made by the drivers, and the actual use of their vehicles (individual performance).The demand for V2G depends on the renewable generation and the availability of vehicles, and the extent to which a car is used is limited by the contract but depends also on other drivers and their availability.With this model we want to provide insights into designing contract parameters that are more aligned with system goals, for example, self-sufficiency in this case.
Figure 3 shows the concepts of the model, distinguishing the technical and social subsystems.As the figure indicates, households have loads and PV panels, which feed the microgrid at times of surplus to produce hydrogen using an electrolyzer.Whenever PV generation is insufficient, FCEVs are used, and ultimately power is imported if necessary.Wind turbines are also used to produce hydrogen.Data sources are used to input driving schedules to the drivers, for the generation profile of PV panels, and for the electricity consumption in households.The evaluation of the system performance is based on the capacity of self-supply and the amount of power imported.This model is based on our previous work; please refer to [23] for more details on the operation of the microgrid.
Agents and Objects.There are three agent types in the model: the households, the drivers, and the microgrid operator.The households are modeled as simple agents that have no other behavior than updating the electricity consumption and the PV generation.In this model, too, driver agents represent both the characteristics of the driver and the car.In principle they are part of the household agents, but the link is not explored in this model.Drivers drive in and out of the neighborhood according to their driving schedules.Every driver owns a volume-based V2G contract object that contains the parameters.The microgrid operator agent acts like an aggregator and uses the information to know which cars can be operated when needed.The microgrid operator also controls the other technical components of the system, such as the wind turbine and the electrolyzer.
Process Overview.At initialization, volume-based contracts are created.Every hour, drivers either drive, refill, or plug in their vehicle.Households generate electricity using their PV panels and use it for self-consumption.Whenever there is a surplus, it is injected to the local grid.The microgrid operator   checks the balance in the microgrid: if additional power is needed, it operates available FCEVs, taking into account the limits set by the contract parameters; if there is a surplus from the PV panels and whenever the wind turbine is generating electricity the electrolyzer is used to produce hydrogen, which is stored in the neighborhood.If the microgrid is not capable of supplying enough power or when the electrolyzer capacity is exceeded, power is exchanged with the distribution grid.
Inputs for Simulation.We initialize the agents with the inputs indicated in Table 6.Since we want to represent the possible varying degrees of FCEV availability due to heterogeneous preferences, we randomly initialize the contract parameters within reasonable bounds.For the time interval (start, duration), we define the start by using a random gamma distribution to delay the plug-in time after arrival and choose a duration that ranges from 50 to 100% of the total daily parked time.The maximum volume committed is chosen randomly between 30 and 90 kWh (1.5-4.5 kg hydrogen).In practice, these parameters would be defined by the drivers based on their preferences.The actual distribution of contract parameters in a group of drivers could be very different than the one from this model.Data on driver preferences could be used as input in the V2G contracts of the model, instead of the random values.The model is simulated for 168 steps (one week) for the months of March, June, September, and December, as well as for 8760 steps (one year).

Results
. The results in Table 7 show that in the one week periods in June and September the microgrid is selfsufficient and electricity is not imported.The volume of V2G provided on average every day by each car is also the lowest in those months: 13.25 and 17.9 kWh per day.In the weeks in March and December, there is more demand for V2G from FCEVs, but the microgrid still has to import electricity.On a yearly basis, the microgrid needs to import about 8% of the electricity consumption, and on average every car provides about 21 kWh per day.In the yearly simulation run, the average maxVolume is 28.36 kWh in weekdays and 29.72 kWh in weekends.This means that on average more volume was committed than actually used.This does not mean that drivers should commit lower volumes, because  there are still moments in which power has to be imported after all available FCEVs are used.The times of demand for V2G also have to match the times when FCEVs are available.
There are two things that these results indicate.First, as the demand for V2G changes with the seasons due to the weather-dependent PV generation, the contract parameters could be adjusted to reduce the commitment from drivers in the summer months and increase it in the winter months.The difference between the average volumes in June versus September or December shows that there is opportunity to reduce contract parameters in summer.Second, with the same level of commitment, self-sufficiency in the system could be improved by adjusting the parameters to increase availability at times it is needed.As Figure 4 shows, there are certain hours where there is a shortage of vehicles (in red).When the potential moments of reduced availability are known, the operator can reward drivers for adjusting their time availability as well as the volume.As shown in Figure 5, in the summer months there is lower demand for FCEVs and there is no shortage.These results, although only illustrative, show that volume-based contracts can be used to allow drivers to participate in a more flexible way while taking into account the system performance.Although not included in this paper, control-based contracts could also be used in this system.In our previous research, we provide a comparison between volume-based and control-based contracts in the same microgrid [46].
In the model, the contract parameters of every driver agent depend on their driving schedule, which is constant for weekdays and weekends.With the availability of data on drivers' preferences and day-to-day variability of driving behavior, this model could be used to answer different if-then questions.

Conclusions
In this paper we discussed the need to explore new types of contracts for the operational coordination of vehicle-to-grid.The current literature presents only one form of contract, but it may not be suitable for all markets and types of V2G supply, as it has been proven that in markets with different characteristics the value of certain parameters is more appropriate than others.
We introduced three different types of contracts, the first two of them being new in the V2G contract literature: price-based, volume-based, and control-based contracts.We also proposed a set of parameters in each contract, which Complexity distinguishes them in terms of availability commitment and the activation criteria, as well as the type of remuneration.We defined these parameters specifically for FCEVs.
To illustrate the use of different contract types for the coordination of V2G, we developed two agent-based models.The V2G contracts were formalized in each model as the set of rules used by the aggregator to control the FCEVs.The models presented in this paper are exploratory, and therefore they can help us gain insights about the relationship between driver needs, contractual agreements, and system or aggregator goals and increase our knowledge on the role of contracts in the implementation of V2G.
In the first model we show how price-based contracts can be used in the participation of FCEVs in the day-ahead market.Using the minimum price in the contract and the market price forecast, aggregators place offers to sell V2G.We compared a scenario with homogeneous and heterogeneous minimum prices, and the results show that when all prices are the same the net profits are higher.When there are differences in the minimum price within a vehicle pool, the aggregator tends to offer V2G at higher prices.As a result, the average revenues per kWh are higher but the total profits are lower due to reduced sales.Some drivers lose the opportunity to sell due to the higher offering prices.The results show that the strategies of an aggregator in the market have to be explored in combination with the drivers' contract parameters, especially when drivers have different preferences.
In the second model we show how volume-based contracts can be used in a microgrid with renewable generation, storage, and FCEVs.We let the drivers choose the contract parameters and see that (1) demand for V2G varies across seasons and (2) the availability pattern does not match the demand pattern at all times, which is especially visible in months of solar generation shortage.This opens up possibilities to adjust contracts to increase participation when it is most critical and to reduce the commitment for drivers whenever V2G demand is relatively low, such as in the summer months.The results show that in such a system where the overall system performance (e.g., self-sufficiency) may be valued, contract parameters can be used to align the system goals and characteristics with the participation and availability of drivers.
In terms of implementation of V2G, the contract types presented in this paper can be used by aggregators to choose a market for V2G and then attract drivers with the characteristics that can be suitable for that market, and vice versa.Moreover, aggregators can use the structure of contracts to design incentives for the participation of drivers, for example, by rewarding availability, energy, or the commitment of time or volume.Although it was not the focus of this paper, the contracts presented here and the agent-based models could be used in the process of designing energy systems with vehicleto-grid from a complex sociotechnical systems perspective.

Figure 1 :
Figure 1: Relationships of actors in the V2G value chain, based on [35].

Figure 4 :
Figure 4: Number of FCEVs needed versus those operated every hour, in a week in December.

Figure 5 :
Figure 5: Number of FCEVs needed versus those operated every hour, in a week in June.

Table 5 :
Simulation results: drivers and aggregator profits.

Table 7 :
Results: system and driver performance.