Rolling horizon optimisation based peer-to-peer energy trading under real-time variations in demand and generation

This paper has developed an approach to optimise energy sell and price bids at the sellers along with optimising energy purchase decisions at the buyers in a peer-to-peer (P2P) energy trading market. The optimum price and energy sell bids are designed to maximise the profit at the sellers, while buyers make energy purchase decisions to minimise their energy deficit. The proposed approach relies on a day-ahead optimisation mechanism that can utilise the daily generation and demand patterns as well as a rolling horizon based real-time update strategy when there are variations in generation or demand forecasts. The aforementioned approach is evaluated for a real-life generation and demand dataset under different scenarios. The numerical results demonstrate that when the forecasting error is not very high, the proposed optimisation approach can allow sellers to obtain some profit in most of the time intervals during the day.


Introduction
Recent advancements in renewable energy technologies and increasing government incentives have enabled a significant level of renewable energy penetration in the existing power system network. Such trends add new challenges to the reliable operation and control of the power system network, often caused by the intermittent 1 3 nature of renewable energy generation. With increasing contribution of distributed energy resources (DERs) in mitigating local load demand, more advanced energy management systems have emerged as a necessary component of power system networks. The ability to manage local load demand with locally generated renewable energy promotes the adoption of microgrid systems, the optimal operation of which often depends on intelligent energy management algorithms.
In a microgrid, there could be participants with excess energy generation after meeting their own demand. On the other hand, there could be other participants who do not have sufficient generation (or any generation) to meet their demand. The participants with energy excess can act like sellers, whereas participants with energy deficit can act like buyers and they can form a local energy market. This local energy market enables peer-to-peer (P2P) energy trading [1] or transactive energy trading [2] where the aim is to balance local load demand with local generation as well as to reduce dependencies on the utility grid. A number of practical implementations of P2P energy trading has taken place recently, such as Brooklyn microgrid [3] and the City of Fremantle [4].
Optimum P2P energy trading in a microgrid can accelerate the energy efficiency and reduce the power wastage when diversity in load demand and renewable generation are considered. Bill sharing, auction-based pricing and mid-market rates are the three mechanisms commonly utilised for P2P energy trading [1]. In the bill sharing mechanism, users share the electricity cost for the same community microgrid according to the proportion of their net energy use. Auction based pricing works on the basis of the bids from participants which depends on their demand and generation. On the other hand, mid-market rate corresponds to the mid-point between energy selling and buying prices [1]. A multi-agent based simulation framework for different P2P energy trading mechanisms is investigated in [5], which concludes that mid-market rate mechanism performs well with moderate levels of solar energy penetration whereas bill sharing mechanism is relatively insensitive to seasonal changes in solar generation. The architecture of a smart energy hub enabling P2P energy trading along with the required smart grid communication mechanisms and distributed control schemes for power sharing has been elaborated in [6]. A blockchain based P2P energy trading platform is implemented in [7] which utilises incentive mechanisms to promote increasing levels of P2P energy trading while reducing self-consumption.
The energy utilization of smart homes equipped with DERs has been managed using the distributed optimisation algorithm [8], in which optimisation is decomposed into two levels namely the local home energy management system (LHEMS) and the global home energy management system (GHEMS). Home energy trading and storage systems are in the GHEMS level and consumer preferences for appliances are considered on the LHEMS level. This ensures better computational efficiency as well as maintains consumer privacy [8]. A decentralised energy trading mechanism based on proximal Jacobian alternating direction method of multipliers (PJ-ADMM) and dual decomposition is proposed in [9]. The decentralised technique is evaluated for IEEE 123 bus test systems and is found to converge with the centralised solution while achieving lower execution cost. A bilevel optimisation problem considering profit maximisation of virtual power plant aggregator at the upper 1 3 Rolling horizon optimisation based peer-to-peer energy trading… level and welfare maximisation for day-ahead and real-time P2P markets, has been investigated in [10]. The approach utilises information gap decision theory to manage the uncertainty associated with intermittent renewable generation. A day-ahead bilevel energy trading bid optimisation problem is formulated in [11] considering the uncertainty costs from real-time trading while minimising consumer inconveniences. A long-term delayed reward method is developed in [12] to learn the trading patterns and utilise them to design more effective trading strategies through a deep Q-Network algorithm. A transactive energy management framework is adopted in [13] to minimise energy bills at the users by developing a pricing mechanism based on supply-demand ratio.
A transactive energy trading approach for customer prioritization within a residential microgrid is elaborated in [14] based on a multi-leader multi-follower Stackleberg game. In this scheme the buyers with more energy demand and the sellers offering the cheapest price will have higher priorities. Based on this, optimum utilities for the buyers and sellers is estimated using linear programming [14]. Similarly, modeling buyer and seller interactions in a community microgrid using the M-leader and N-follower Stackelberg game approach is considered in [15]. A Stackelberg game model considering multiple energy sharing regions where the energy sharing provider acts as leader and the prosumers act as followers, has been proposed in [16]. The authors developed a profit maximisation model which optimises different internal prices for different energy sharing regions.
It is important that network standards are maintained while achieving optimal energy trading. In this regard, the authors in [17] developed a sensitivity analysis on the energy trade between the peers on a UK low-voltage network to ensure that the network constraints and parameters are not violated. P2P energy trading can be integrated with ancillary service market to support the utility network operation by maintaining the voltage and power losses within tolerable ranges by optimising pricing for ancillary service procurement [18]. To manage the uncertainties associated with renewable generation, a probabilistic locational marginal price strategy is developed in [19] considering a spread between buying and selling prices in the P2P market. By controlling this spread, the authors have been able to minimise the chances of network constraint violations.
A multi-class energy management scheme considered by [20], co-ordinates the trade between the proactive consumers while considering energy as a heterogenous product with different energy classes. The trading is carried out to minimize the cost of the battery power depreciation and other losses in the P2P energy management platform by considering the prosumer preferences. Based on the load demand, energy prices and the renewable power generation, prosumers control and adjust the power flow by distributed price-directed optimisation mechanism together with receding horizon model predictive control strategy [20]. For prosumers with different levels of interests to trade energy, the authors in [21] have developed a P2P trading platform where the aggregator designs a range of pricing strategies for maximising its profits. An optimisation method for designing energy trading price considering profit maximisation at sellers while minimising energy cost at buyers is proposed in [22]. The authors developed a strategy for uniform pricing as well as an energy allocation policy for the consumers.
Existing research has also considered power exchange between multiple microgrids through contribution based prioritization by considering a stochastic optimisation approach while ensuring the reliable operation of the microgrid with the intermittent renewable energy sources and dynamic load consumption [23]. A new pricing scheme is developed for energy trading between multiple microgrids in [24] where buyers utilize a priority factor for making decisions on energy purchase strategies through a non-cooperative game. Optimal pricing functions for intra-microgrid and inter-microgrid P2P energy trading have been designed in [25] considering different priority groups based on the energy demand. A reputation based ranking system for energy sharing among multiple microgrids is proposed in [26]. The reputation score and power loss reduction are utilised to develop a local pricing scheme which can improve supply reliability and network voltages. The interaction of P2P energy markets with the existing wholesale energy markets need to be considered while designing pricing mechanisms for balancing settlement in the P2P energy market [27]. Recently, a joint bidding model to optimise the income of participants in the balancing energy market has been developed in [28] which aims to manage the real-time imbalances in intermittent renewable generation by considering hydro power plants as dispatchable sources. On the other hand, imbalance price optimisation has been investigated in [29] which aims for increasing profits by considering real-time changes in generation and demand mismatch.
Optimal energy trading strategies often depend on how accurately the energy demand and generation information are known to the market participants. Though existing literature has aimed to predict weather dependent variable cooling and heating load demand [30,31], there can still be uncertainties due to intermittent renewable generation. Thus day-ahead optimisation strategies may not be optimal as generation or demand may change in real time in comparison to the forecast values. These forecasts include solar generation and electricity consumption forecasts which can be over half-hourly or hourly intervals depending on the granularity of the available data. On the other hand, large variations of energy prices with changing generation and demand conditions can cause price volatility and lessen the effectiveness of P2P energy markets. Thus, it is important to design the price bids in such a way that considers the longer term patterns in energy generation and demand and at the same time, has the provision for updating the price bids when generation and demand in real time vary from the forecasts. Existing research has considered these two aspects of the optimal P2P energy trading separately either by incorporating a large number of possible future scenarios [11] or relying completely on the real-time data ignoring longer term trends [26]. Moreover, the existing research does not consider the energy savings aspects of the buyers in the real-time energy trading [28]. To the best of our knowledge, an optimum pricing strategy that designs price and energy sell bids on a day-ahead basis and ensures that these can vary in real-time only within a certain range, has not been investigated yet.
As a result, in this paper, we have developed a new approach for optimising the P2P energy trading problem while taking into account the variations in generation or demand that can occur during the intra-day trading. The proposed approach allows individual participants to maximise their benefits in the P2P market in a decentralised manner rather than depending on the central energy management Rolling horizon optimisation based peer-to-peer energy trading… system for making the sell/purchase decisions. To be specific, we aim to address the aforementioned research gap through the following contributions: • A day-ahead optimisation approach for obtaining the optimal price and energy sell bids at the sellers as well as optimal energy purchase at the buyers in a P2P market is developed. The proposed approach allows each seller to obtain profit more than a given threshold and each buyer to minimise its energy deficit through the P2P market. • Considering the fact that generation and demand forecasts can vary in realtime (e.g. hour ahead) compared to the day-ahead values, the energy sell and price bids are updated at the sellers experiencing the variation in generation or demand. A rolling horizon based optimisation approach is adopted for the real-time updates which ensure that the price can vary within a pre-defined range of the optimal bid. Similarly, the energy purchase is updated at the buyers whose generation or demand varies in real-time. • The day-ahead optimisation and rolling horizon optimisation based real-time update approaches are evaluated for an existing generation and demand dataset under different seasonal conditions as well as different price limits charged to different buyers. It can be observed that the sellers can achieve higher profits and more buyers can experience energy mismatch reduction when all buyers are willing to pay a higher price (yet less than the utility rate).
The rest of the paper is organised in the following manner. Section 2 outlines the approach implemented for day-ahead optimisation of price and energy sell bids along with optimum energy purchase decisions. In addition, the real-time update mechanism to update these optimum values due to generation or demand variation is also elaborated in the same section. Section 3 illustrates numerical results for a real-life generation and demand dataset under different seasonal conditions and pricing scenarios. Finally, Sect. 4 concludes the paper.

Optimisation of prices and purchased energy
In this section, the mechanism for obtaining the optimum prices for sellers to maximise the profit and optimum amount of purchased energy at the buyers to maximise the savings from P2P energy trading is outlined. The optimisation process initiates in a day-ahead manner based on the forecasts available on generation and demand. However, there could be inaccuracies in the forecasts and as a result, the solutions based on the actual generation and demand can be different from that obtained with forecasts. As a result, the optimisation outcomes need to be updated in real-time (e.g. hour-ahead) when there is a variation between dayahead forecast and real-time information (e.g., hour-ahead forecast). In the following subsections, the optimisation problem for day-ahead and real-time update stages are explained.

Day-ahead optimisation
The day-ahead optimisation takes place based on the forecasts available on generation and demand of the participants of P2P energy trading. Based on the generation and demand forecasts, the central EMS makes decision on how many participants have energy excess (sellers) and how many of them are with energy deficit (buyers). Apart from the day-ahead forecasts, the central EMS also has information on what rate (cents/kWh) each participant is willing to pay for purchasing energy from the P2P market. In addition, the storage capacities, charging and discharging rates for participants with storages are known to the central EMS. The symbols used in this section are defined in Table 1 and have not been repeated here for the sake of brevity.

Optimisation at the seller side
At the beginning, the EMS forwards the demand and generation forecasts, storage status for each buyer, along with the maximum electricity rate that can be charged to each buyer by each seller. Based on the specified information, each seller optimises the amount of energy to be sold and the price to be asked for each available buyer at a certain time interval so that the daily profit achieved by the seller is maximised. The corresponding optimisation problem at the seller side can be formulated as following: (1) max Subject to: Rolling horizon optimisation based peer-to-peer energy trading… where  (1) indicates the objective function for optimising the maximization of profit earned by the jth seller considering how much energy the seller wants to sell at the optimised price on all time intervals (indexed by t). The optimised price offered to the ith buyer will be always between the feed-in tariff and a maximum price level, as explained in (2). Equations (3) and (4) denote the amount of excess energy the seller has, after meeting all the demand. The difference between the initial and final charge on the battery after the discharge at the jth seller is equal to the rate of discharge multiplied with the maximum charge on battery as defined in (6), whereas, (7) defines the difference between the final charge and the initial charge of the battery after getting charged at the ith buyer as equal to the rate of charge multiplied with the maximum charge on the battery. Also, the stored energy will be always between zero and the maximum capacity of battery as showed in (8). If the maximum allowable price for certain buyers are less, they might not be preferred by the sellers. In that case, these buyers will be able to purchase directly from the utility to balance their energy mismatch.

Optimisation at the buyer side
Once each seller optimises the amount of energy to be sold and price to be asked for each buyer, it sends these energy sell and price bids to the corresponding buyers through the EMS. Based on this information, each buyer optimises the amount of energy to be purchased from a given seller so that the total energy mismatch at the buyer at a certain day can be minimised while achieving an energy cost lower than that when purchased from the utility. The corresponding optimisation problem at the buyer side can be formulated as: The objective function in (9) is minimization of the difference between energy purchased by buyer and the energy deficit for the entire trading period . Equation (10) Subject to: briefs that the energy cost of the ith buyer when P2P trading is allowed, will be always less than the total energy cost for the day when the energy is purchased at the utility rate. Equation (11) represents the energy cost for each day when net energy is purchased in the utility rate. The energy purchased by all the buyers will not be more than the energy sold by the sellers as explained in (12). The optimum energy purchase decisions are finally forwarded to the EMS which notifies the corresponding sellers. If the energy prices asked by certain sellers are less, they might not be preferred by the buyers. In that case, these sellers will be able to store excess energy if they have storage or sell directly to the utility to balance their energy mismatch.

Rolling horizon optimisation based real-time update
When the real-time information on energy generation and demand available for each participant and they vary from the day-ahead forecasts, the optimisation results need to be recalculated. Here we consider that the time intervals are discretised and realtime information is available on a certain discrete time interval (e.g. an hour) before the actual event (e.g. change in generation or demand). We adopt a rolling horizon based optimisation approach to update the energy sell and price bids as well as energy purchase decisions repetitively in discrete time intervals over the entire day. During this real-time update, the price bids are allowed to vary within a certain range defined by ±ΔP . In addition, the energy sell bids can vary from the optimum amount of energy to be purchased during day-ahead optimisation by the amount of variation in energy mismatch at the seller.

Optimisation at the seller side
In each round of rolling horizon optimisation, each seller compares its day-ahead forecasts on energy generation and demand with the real-time information and based on this difference, updates its energy sell and price bids. The seller still aims to maximise its profit while ensuring that the price bids vary within a certain limit and the energy to be sold takes into account any real-time variations in generation or demand. As a result, during real-time updates, the optimisation problem at the seller side can be formulated in the following manner: Subject to: Equation (13) indicates the objective function for the real time energy update at seller side, which is the maximization of the energy sold by the jth seller to the ith buyer at the current trading interval. The updated energy price will not vary more than the maximum allowed price variation compared to the price charged by the jth seller to the ith buyer, as explained in (14). Equation (15) shows the amount of energy sold by the jth seller to the ith buyer should be bounded by the excess energy available at the seller during current trading interval. The energy sold by the jth seller in real time will not change by more than the variation of generation and demand at the jth seller compared to the day-ahead optimised amount for the current trading interval, as explained in (16). The difference between the initial and final stored energy on the battery after the discharge is equal to the rate of discharge multiplied with the battery capacity as defined in (17), whereas, (18) defines the difference between the final and the initial stored energy of the battery after getting charged as the rate of charge multiplied with the maximum capacity of the battery. Also, the stored energy will be always between zero and the maximum capacity of battery as shown in (19).

Optimisation at the buyer side
Once the sellers update their energy sell and price bids, they forward the information to the corresponding buyers through the EMS. Each buyer compares its day-ahead forecast and real-time information on generation and demand. Based on these information, the buyer recomputes the amount of energy to be purchased in each round of rolling horizon optimisation so that its difference with the day-ahead energy purchase decision plus any variation in generation and demand can be minimised. The optimisation problem can be formulated as following: Rolling horizon optimisation based peer-to-peer energy trading… The real time update of the energy trading at the buyer side is the minimization of the difference between the updated amount of the energy purchased by the ith buyer and the day-ahead optimised amount of energy purchase added with real-time variation in energy deficit, as demonstrated in (20). The updated energy cost at the ith buyer is less than the energy cost when purchased at the utility rate, as shown in (21). The optimised amount of energy purchased by all the buyers in real-time will be always less than the optimised energy bid by the sellers for the current trading interval as explained in (22). Once the buyer obtains the optimum amount of energy to be purchased from a certain seller, it forwards the information to the central EMS who finally coordinates the energy transaction between the corresponding buyer and seller. The day-ahead optimisation and real-time update mechanisms are illustrated in the flowchart shown in Fig. 1.

Simulation results
In this section, we consider a case study with 6 houses whose renewable generation and electricity demand data are extracted from the Ausgrid Solar Home Electricity Dataset [32] for the location of New South Wales, Australia. Houses 1 and 2 have both solar panels and storages, houses 3 and 4 have solar panels only. On the other hand, houses 5 and 6 do not have either solar panels or storages. The solar panel capacities of the houses 1, 2, 3 and 4 are 2.16, 1.02, 1.02 and 1.05 kW, respectively. The storage capacities of houses 1 and 2 are considered as 2.16 and 1.02 kWh, respectively. The generation and demand data are collected over 48 half hourly time intervals for the dates of 1st July, 2012 and the 1st January, 2013 to represent the winter and summer conditions, respectively. The utility rate and feed-in tariff are considered as 30 cents/kWh and 10 cents/kWh, respectively. The charging and discharging rates of the storages are 50% of the storage capacities. The maximum prices charged to the houses 1, 2, 3, 4, 5 and 6 (when they are buying energy from peers) are 15, 20, 23, 28, 18 and 12 cents/kWh, respectively. These prices have been obtained as uniformly distributed random numbers between the utility rate and feedin tariff. The half-hourly profit thresholds for the houses 1, 2, 3 and 4 are 0.1, 0.08, 0.05 and 0.05 cents, respectively. When the prices are updated in real time, the maximum allowed variation in price is 5 cents/kWh. The real-time updates are computed when the hour-ahead forecasts vary from day-ahead forecasts by ±10% . We consider three cases: the impact of real-time update for (i) the month of July, (ii) the month of January, and (iii) the maximum price charged as 25 cents/kWh. For all of the aforementioned cases, we investigate the impact on profit, energy purchased, average bid (21) Subject to: and maximum bid of the sellers, as well as the reduction in energy mismatch. We also analyse the impact of 20% and 60% forecasting errors for case (i) while comparing the results with that of day-ahead optimisation.  The seller op r timises energy sell and p a a rice bids in such a way a a that a a they can v a a ar a a y within a cert r r ain range of th t t eir d r ay a aah a a ead optimal values Are the energy sell and price bids d d diffe f f rent fr f f om the day a a -ah a a ead valu l l es? ? ?

Case 1: Performance in winter month
The buyer o r ptimises th t t e am a a ount of energy to be purchased fo f f r minimising the gap with t t the day a a -ah a a ead valu l e and a a the variati a a on in energy mismat a a ch Rolling horizon optimisation based peer-to-peer energy trading… errors are present. It can be seen that the amount of the energy purchased with 20% forecasting error is higher than that of the 60% forecasting error for house 2. The amount of energy purchased by the house 2 for both the forecasting errors peaks at 12 pm with 0.5 kW energy purchased. When there is forecasting error, the house 4 only purchases energy after 3 pm and it is identical with 20% and 60% forecasting errors. House 3 does not purchase any energy when the forecasting error is 60% . Note that with 0% forecasting error, the day-ahead optimisation results will coincide with the real-time updates. Figure 3 shows the profit obtained by sellers with day-ahead optimisation of the P2P energy trading at the top, the real-time updated profit with 20% and 60% forecasting error at the middle and bottom, respectively. When there is forecasting error, house 1 can offer excess energy during real-time update, which could not be predicated during day-ahead optimisation. Thus, the profit gained by the house 1 is the highest of all other houses and is maximum at 12pm in both cases with 20% and 60% forecasting errors. Profit earned during the optimisation with 20% forecasting error is higher than that with the 60% forecasting error. House 2 does not earn profit in any conditions as the house 2 is purchasing energy most of the times during optimisation. It is evident that the houses 3 and 4 earn more profit in the day ahead optimisation. For example, at 2 pm, house 3 and 4 do not earn any profit with realtime updates, but with day-ahead optimisation they earned some profits. The maximum profit earned by the house 4 is at 1 pm during day-ahead optimisation and realtime update with 20% forecasting error, which is approximately 0.04 AUD. When the forecasting error is 60% , house 4 earns the maximum profit at 12 pm, which is approximately 0.02 AUD. Figure 4 demonstrates the profit obtained with a benchmark mechanism for P2P energy trading, which is the double auction (DA) mechanism [33]. It can be observed that in the DA mechanism, House 4 obtains the maximum profit which is similar to the outcome of the proposed optimisation approach, as in Fig. 3a. However, the maximum profit obtained is slightly less in the DA approach. Another difference is House 1 achieves some profit with the DA approach, whereas it is not able to sell energy in the proposed approach. This is because house 1 bids a higher price in the proposed approach due to its higher profit threshold and as a result, it is less preferred by the buyers. Figure 5 illustrates how the maximum price bid by each seller after real-time updates vary with 20% and 60% forecasting error at the top and bottom, respectively. Each seller bids a different price for each buyer and the maximum of these bids are demonstrated in the aforementioned figures. It can be seen that house 2 did not participate in bidding as it did not have energy excess. The maximum bid values are relatively higher during mid to late afternoon periods. When there are higher levels of forecasting error, the maximum bids reach the utility rates sooner in the day. This is because the sellers try to ensure that their profit thresholds are maintained with the variations in energy excess/deficit scenario, which is again incorrectly estimated due to forecasting errors. Figure 6 shows the average bid obtained by each seller during real-time updates at the top and bottom while a forecasting error of 20% and 60% are present, respectively. The different prices bid to different buyers are averaged for 1 3 Rolling horizon optimisation based peer-to-peer energy trading… each seller to calculate this average bid. It can be observed that the average bid never reaches the utility rate, though it can be less than the feed-in tariff due to the fact that the real-time price variation of 5 cents/kWh is allowed in the simulation settings. With 20% forecasting error, house 3 has the highest average bid of 18 cents/kWh. On the other hand, house 4 bids the highest on average, which is 22 cents/kWh. Similar to maximum bid, the average bid also increases sooner on the day (2 p.m. instead of 5 p.m.) when 60% forecasting error is present. Figure 7 illustrates how the energy mismatch decreases after real-time updates among the participants when 20% and 60% forecasting errors are present, respectively. The mismatch reduction is occurring in more number of trading intervals during the 20% forecasting error rather than the 60% forecasting error. The maximum reduction in energy mismatch is 100 W. With 20% forecasting error, most houses achieve the maximum reduction in energy mismatch after 11.30 am. On the other hand, with 60% forecasting error, this occurs after 2 pm.   Figure 8 shows the energy purchased by all the houses for the energy generation and consumption scenario in 1st January 2013 in the presence of 20% forecasting error. It can be seen that the purchased energy is maximum for the house 5 during the afternoon hours and peaks at 0.5kW. During the morning hours, house 4 is purchasing most of the energy. When real-time energy optimisation is updated, houses 3, 4 and 5 purchase most of the energy. Figure 9 illustrates the profit obtained by the seller houses in the summer condition when real-time updates of energy optimisation is considered. The sellers are gaining profits for more hours throughout the day as the duration of sunlight is more during the summer months. When compared with the winter months the house 2 is having better profit levels during the summer months, whereas it didn't have any profits during the winter months. Similar to winter month, house 1 obtains the Rolling horizon optimisation based peer-to-peer energy trading… maximum half-hourly profit among all the sellers with a value of 0.072 AUD at 4 p.m. Figure 10 demonstrates the maximum bid and the average bid asked by each seller (for all available buyers) at the top and bottom, respectively in summer conditions when energy trading is updated in real-time. It can be seen that all sellers took part in the bidding during the afternoon hours from 1.30pm to 5pm as they have excess energy. The maximum bid varies from 0.22 AUD to 0.3 AUD. A lower price occurs with high levels of solar generation. On an average, house 3 has a higher bid compared to other houses, which is 0.23 AUD at 11.30am. The average bid varies between 0.1 AUD to 0.23 AUD throughout the trading period.

Case 3: Maximum charged price=25 cents/kWh
Case 3 investigates the impact of prices on the energy purchased, profit, energy mismatch reduction and bids. Figure 11 illustrates the energy purchased by   different participants with real time updates when 20% forecasting error is present and P max,i is set as 25 cents/kWh for all buyers. It can be seen that house 6 purchases the highest amount of energy in this case. This is different in case 1, when different buyers are charged different maximum prices. The reason is that in case 1, house 6 was charged with a lower maximum price, which made it less profitable for sellers to consider. On the other hand, in case 3, sellers are allowed to charge a higher price to house 6, which made most sellers sell energy to house 6. Figure 12 shows how the profit obtained by different sellers change when P max,i = 25 cents/kWh and there is 20% forecasting error. It can be seen that house 1 achieves maximum profit of 0.12 AUD at 12 p.m. as it has higher levels of excess generation. On the other hand, house 3 and 4 earn profit for more number of hours compared with other houses as they have a smaller profit threshold. All houses (except house 2) earn higher profit (both on half-hourly or daily basis) than in case 1 as they are charging a higher price to all houses on average. Figure 13 demonstrates how the energy mismatch is reduced at different participants when P max,i =25 cents/kWh. It can be seen that house 6 observes energy mismatch reduction in 6 half-hourly intervals (including 100% reduction in 3 of the intervals). This is different from case 1 when house 6 did not observe any reduction in energy mismatch. The reason is that all sellers now sell energy to house 6 as they are able to charge higher prices to house 6, as explained in the discussion of Fig. 10. House 2 energy mismatch is reduced only at 2 time intervals, which is less than that in case 1. The reason is house 6 will have a higher energy mismatch than house 2 as house 6 does not have any solar panel to offset its energy demand. Figure 14 shows the maximum bid asked by each seller over all available buyers for P max,i =25 cents/kWh. Unlike case 1, all sellers are now asking for 30 cents/kWh in all the time intervals. This is because all buyers can now be charged 25 cents/kWh, and a variation of 5 cents/kWh is allowed real-time. On the other hand, in case 1, maximum bid reached 30 cents/kWh only after 2 p.m., when House 4 started purchasing energy and it can be asked a higher price than other houses. Given that all houses can be charged the same maximum price in case 3, all sellers have the chance to ask the same maximum bid of 30 cents/ kWh. Figure 15 illustrates how the bids from different sellers change with P max,i =25 cents/kWh when averaged over all available buyers at different time intervals. It can be seen that the average bids at different sellers are now same at all time intervals as the same price is asked by all sellers to a buyer for maximizing their profit. The average bid over all buyers remain similar to that in case 1 for most time intervals. However, in case 3, the average bid at 3.30 p.m. (12 cents/kWh) is smaller than that in case 1 (18 cents/kWh). This is because in case 1, house 4 was purchasing energy and could be charged a higher price. On the other hand, in case 2, house 2 is purchasing energy during 3.30 p.m. at a lower price (than that for house 4 in case 1).

3
Rolling horizon optimisation based peer-to-peer energy trading…

Conclusions
In this paper, a day-ahead optimisation approach along with a rolling horizon optimisation based real-time update strategy has been evaluated to optimise the energy sell and price bids at the sellers and energy purchase decisions at the buyers. The impact of the seasonal changes and forecasting errors are investigated on the energy purchase, profit, price bids and reduction in energy mismatch. It can be observed that the real-time energy purchase do not vary significantly from the day-ahead values unless the level of forecasting errors is very high. Moreover, when all buyers are willing to pay a higher price which will still be less than the utility rate, the energy mismatch reduction and profit increase compared to the case when only certain buyers are paying higher prices. Future work will focus on evaluating the impact of information exchange mechanisms on the effectiveness of the proposed P2P energy trading optimisation approach.
Funding Open Access funding enabled and organized by CAUL and its Member Institutions.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/ licenses/by/4.0/.