{'fraction_non_alphanumeric': 0.028972106642009554, 'fraction_numerical': 0.0070375507268711154, 'mean_word_length': 4.476230661040788, '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}}
A novel payment scheme for trading renewable energy in smart grid

With the increasing diffusion of renewable energy producers in electricity grids, new policies and tariff systems have been recently developed. This work revolves around a particular support system named NRG-X-Change, which makes use of a virtual currency called NRGcoin. The NRG-X-Change system is based on two NRGcoin payment functions: one to establish the price at which prosumers are rewarded for their energy production, and the other to establish the price at which consumers pay the energy they consume. The detailed analysis provided in this paper identifies some important issues in these payment functions limiting their applicability, namely: (i) not taking congestions into account; (ii) encouraging curtailment of renewable energy production; and (iii) not ensuring that the prosumers consume their own energy before selling it. This work addresses these limitations by proposing two novel payment functions whose advantageous properties are demonstrated by theoretical analysis and in simulation using real data coming from an existing grid.


INTRODUCTION AND RELATED WORK
Different support policies have been developed to promote the integration of renewable energy sources (RES). Some are based on a market-based approach [1,2] in which consumers and prosumers in a neighbourhood bid in a local market for selling/buying local RES production. Instead, in [3], Mihaylov et al. propose NRG-Xchange, a mechanism that combines the advantages of traditional support policies and market-based mechanisms. Similarly to traditional renewable support policies, NRG-X-change does not rely on an energy market -locally produced renewable energy is simply fed into the grid, and is withdrawn by consumers without the need of any complex bidding process. However, unlike traditional support policies, the mechanism offers incentives for both, producers and consumers, linking their incentives at each time slot to a local market-signal -the local energy balance. The NRG-X-Change mechanism exploits a virtual currency, called NRGcoin, which is its key feature. The use of this currency can offer some important benefits to energy trading although it does not address some relevant points, such as the local energy trading and the management of congestion.
This work aims at exposing how the NRG-X-Change mechanism works relatively to certain aspects, and how it can be modified and improved in order to face the issues we have identified, maintaining the employment of the NRGcoin currency. We analyzed the NRG-X-Change project and identified the main issues with its import and export price functions and the situations where they appear. We designed new import and export price functions that can work better within the NRG-X-Change mechanism and provided theoretical background on those. The validity of the proposed proposed functions is demonstrated through mathematical proof and experimental evaluation using historical data from a real grid in Cardiff (UK).

REVISING NRG-X-CHANGE MECHANISM
NRG-X-Change was originally proposed and described in [3] to regulate the payments between the energy producing and consuming agents. The mechanism relies on a virtual currency, called NRGcoin. In every time slot, the energy production (t p ) and consumption (t c ) within the neighborhood is communicated to the local substation. The received information serves as the basis for computing rewards and payments for the corresponding agents.
The reward for injecting the energy is computed by the function д defined as where q is a constant representing the maximum price per unit at which producers are rewarded for their injected energy x (which occurs when the total energy supply matches the total demand) and a is a constant representing the scaling factor for the case when there is no energy balance (t p t c ). This function is shaped as a bell curve so that the maximum payment for the producers is obtained when t p = t c .
The payment for pulling the energy from the grid is determined by the function h defined as where r is a constant representing the maximum price per unit of consumed energy (y).
As we can see from the definition of its functions, in the NRG-X-Change project, the highest priority has been given to the balance between t p and t c . This brings important consequences. The most important is related to the д function defined as in Eq. (1). If a prosumer produces a certain amount of energy, surpassing a certain threshold, it may happen that the more she produces, the less she will receive in return. The reason is that her production breaks the balance between t p and t c implying that the prosumer may consider the idea of limiting her own energy production. However, having producers curtailing their own energy generation is not a desirable property for an incentive mechanism.
Another important aspect which has to be considered is that the Distribution System Operator (DSO) is responsible for: (i) the cost-effective and secure transfer of energy over its distribution grid and (ii) for ensuring the distribution system's long-term ability to meet electricity distribution demands. In particular, it may happen that the local energy consumption or production exceeds the grid capacity. This condition is referred to as congestion and it may be harmful for the stability of the grid. For this reason, it is important to discourage local users from consuming too much energy at a given time -or from producing too much energy.
Finally, self-consumption is another important matter that should be prioritized. In order for prosumers to consume their own energy first, the buying function h has to always be higher than the selling function д. If this does not happen, a prosumer may actually choose to sell all of her produced energy and buy the energy she needs from another source, since she would have a higher profit. This is something we want to avoid, since it creates unnecessary stress on the grid. In formal terms, the constraint has to hold for every value of x, t p and t c , taking into account that t p and t c depend on x. Thus, when defining the parameters of д and h, they have to be chosen so that Eq. (3) is verified. However, this creates a further issue for the functions defined in Eq. (1) and Eq. (2): for t c and x very close to zero, it may be possible that the constraint in Eq. (3) does not hold.

PROPOSED PAYMENT SCHEME
Our study aims to address the potential issues of NRG-X-Change functions identified in the section above. The first one is the energy production curtailment issue, which is related to the shape of the д function, defined by Eq. (1). It can be seen that in some cases, д may induce prosumers to limit their own energy production, which is something to avoid, except for the specific case where the amount of produced energy causes damage to the grid. In order to avoid curtailment, д(x, t p , t c ) has to be a monotonic increasing function in x for each possible value of t p and t c . This way, the more energy the user produces, the higher her reward will be, encouraging the production of energy. Also, it has to be considered that, from the prosumer's point of view, t p depends on x too. This means that, if a prosumer wants to determine her revenue from energy production by using a certain function д(x, t p , t c ), she must consider that t p also includes the energy she produces, and t p will change accordingly to her energy production.
Given this, we propose the following formulation of the function д: д where P(x, t p , t c ) is a penalty term, which is positive if t p and t c are such that a congestion will occur (i.e. |t p − t c | > T ), and zero otherwise, and P max is a scaling factor used to determine the tariff. In this definition, д 1 is a function defined as which determines the shape, and t is a function defined as where T is a constant, depending on the maximum difference between t p and t c which will not correspond to a congestion. Note that we wrote t p (x) since the local production t p varies as x varies: for this reason, t p (0) indicates the value of the local production if the prosumer produces 0. The formulation of the above function is motivated by the following considerations: 1. It is a monotonically increasing function, and as such, it encourages prosumers to produce all the energy they can, avoiding the need for curtailment. 2. Its derivative is higher when the difference between t p and t c is small, lower when it is large. This means that the balance between consumed and produced energy is encouraged, since the closer t p and t c are, the more prosumers will earn in relation to their produced energy. 3. Contrarily to other possible functions which address these issues and have these properties, e.g. cumulative distribution functions of continuous random variables, this function does not rely on computation of integrals, which may cause problems in terms of approximation. 4. We chose д 1 as a function which is constant outside the (0, 1) interval. As a result, our д will not reward prosumers for producing energy in case of congestion; they will instead be penalized by the P(x, t p , t c ) term in Eq. (4). This also encourages curtailment for prosumers if and only if overproduction causes a congestion. Thus, the prosumers, besides being discouraged from producing energy when it is needed less, will actually pay for the energy they inject if it is harmful for the stability of the grid. 5. The derivative of this function is very low when t c ≪ t p . For this reason, it is possible to find values for the parameters such that the constraint in Eq. (3) is satisfied as shown later on in this section.
In particular, when the production gets closer to the congestion threshold, it can be seen that the reward increases much more slowly, but never decreases. This eliminates the need for curtailment for the prosumer.
Regarding the function h defined in Eq. (2), it does not present particular issues, but some of its aspects can be improved. For example, a function which grows more rapidly when a congestion is about to occur will discourage more easily consumers from using energy in that situation.
A possible function with such a behavior can be defined as where Q max is a parameter used in order to determine the tariff value, corresponding to the maximum cost per unit of energy; T is a parameter corresponding to the congestion threshold like in the definition of Eq. (6), and P(x, t c , t p ) is a penalty factor which is zero for t c − t p < T and positive otherwise. Note that we are using the notation t c (y) because, as it has been pointed out in the definition of д, the value t c depends on y.
In the above definition, the function h 1 is defined as: This h function works in a similar way to Eq. (2), but has a higher derivative when the local grid is close to the congestion. This means that consumers will be more encouraged to consume energy in case of overproduction since the tariff goes to zero quicker, and, on the other hand, they will be more dissuaded from consuming energy in the case of overconsumption, since the tariff increases much faster when a congestion is close.
Furthermore it is possible to verify that the constraint in Eq. (3) is verified for the functions д and h we are proposing, as proven in the following proposition. Proof of this proposition is in Appendix A. In particular, if P max < √ 0.2 · Q max , Eq. (3) will be satisfied for every possible choice of x, t p and t c .  Table 1: Curtailment in a local grid with 40 users, 10 of which are prosumers. The columns indicate, in order: value of parameter a in Eq. (1), instances of energy production curtailment in a 24 hour time interval, total curtailment in the local grid in a 24 hour time interval, the quantity of energy curtailed for each instance of energy production curtailment and the ratio between energy curtailed and the number of curtailements.

SIMULATION RESULTS
We performed computational experiments using real data to show the behaviour of NRG-X-Change mechanism with original and proposed payment functions (д and h). For the simulations, scenarios of local grids have been created. From now on, in this section, we will refer to a local grid as a grid made of 40 users, chosen randomly from the 184 users that compose the Cardiff grid, so that 10 of them are prosumers.

Energy production curtailment
Simulations have been run to measure the amount of energy curtailment with the NRG-X-Change selling function. We simulated the behavior of the users in real settings where they choose the actions that will maximize their economic profit: they will curtail energy if and only if it would be profitable for them, and the amount of energy curtailed will be chosen in order to get the highest possible profit. We simulated 400 different local grids, and measured: • the number of times producers curtail energy production, during 24 hours, considering time intervals of 15 minutes (# Curtailments); • how much energy has been curtailed among all the prosumers during a 24 hours time interval (Energy curtailed); • the average quantity of energy production reduction for each production curtailment. In other words, the ratio between the second and the first quantities above measured. (Ratio) This process has been carried out employing the selling function of the NRG-X-Change mechanism (the one in Eq. (1)). In Table 1 the results relative to the NRG-X-Change selling functions are reported.
The amount of curtailed energy depends on the parameter a in Eq. (1). From Table 1, it can be seen that for relatively low values of a there is an energy curtailment on average around 3.8 kWh, while without curtailment the average production in 24 hours is 89.75 kWh. Also, for low values of a, the number of times a producer applies curtailment goes up to 80. The reader notices that the average daily electricity consumption for the Cardiff grid users is around 14.11 KWh. As the parameter a becomes higher, the number of instances of curtailment becomes larger on average, although in several scenarios this does not occur. The amount of curtailed energy for each instance, on the other hand, becomes smaller when a becomes larger.
The same simulation has been run with the function we proposed in Eq. (4). Unlike the NRG-X-Change mechanism, no prosumer was encouraged to curtail their production. This is because our proposed scheme is designed to promote energy balance without curtailment. Curtailment is only considered in the extreme case of a congestion caused by overproduction.These results show that the proposed scheme allows to avoid significantly the curtailment of energy, which is working towards the energy policy targets to increase the renewable hosting capacity of the grid.

Self-consumption
The selling function д and the buying function h should incentivize self-consumption. It can be easily deduced by looking at the functions that the likelihood of an intentionally reduction of the self-consumption depends mainly on the choice of parameters for д and h, and on size of the grid, since the higher the number of users, the higher t p and t c . More in detail, from the definitions of д and h, it can be seen that an intentionally reduction of the selfconsumption is more likely to occur with higher values of q and a, and with lower values of r . However, q and r directly determine the maximum value for the tariffs, so once they are chosen, the chance of a reduction on the self-consumption depends mainly on the parameter a. In fact, lowering this parameter makes this situation less likely to occur, and it can be avoided if a certain value for x + t c is guaranteed at any time; however, if the grid is smaller there may be the chance of a reduction of the self-consumption. Also, a low value for a reduces the reward for the produced energy when t p and t c do not match perfectly, so there is a limit on how much it can be reduced.
In order to illustrate this issue we carried out an analysis defining and running simulations on local grids, defined as described at the beginning of this section. Users of the grid had the possibility to see their costs/revenues for energy in case of self-consumption (of all their needed energy), and to reduce this amount (therefore buying additional energy from the grid, and selling more energy) if it was economically more profitable. We simulated 500 small local grids: they have been built from the Cardiff grid data. For each small local grid we considered a period of 24 hours (00:00 -23:45) and time intervals of 15 minutes, and measured the following quantities: • The number of times an intentional reduction of the selfconsumption occurred in the local grid through the 24 hours period, considering time intervals of 15 minutes. It corresponds to the number of time slots in which some reduction in the self-consumption occurs (# Self-consumption reductions). • The total amount of energy which has not been self-consumed in all the grids during 24 hours (Energy not self-consumed).  Table 2: Reduction of the self-consumption in a local grid with 40 users, 10 of which are prosumers. The columns indicate, in order: value of parameter a in Eq. (1), instances of reduction on the self-consumption in a 24 hours time interval, and total amount of energy unnecessarily taken from/injected into the grid.
are as close as possible to the values of the ToU tariffs in fiat currency. Since the NRG-X-Change tariffs depend on various factors while ToU tariffs are fixed, we chose the parameters so that, on average, the values of д and h are as close as possible to the Cardiff grid ToU tariffs. In our case, with the appropriate unit of measurement, q may range between 0.06 and 0.1, and r between 0.2 and 0.3. We run simulations with different values of a, ranging between 100 and 200: reductions on the self-consumption occurred only when q = 0.1, r = 0.2. Results can be seen in Table 2. In particular, with these settings, it can be seen that the average number of intentional reductions of the self-consumption in a local grid can go up to 7.118 kWh. Also, we recall that a reduction on the self-consumption occurs when a prosumer does not self-consume all of her produced energy: as a result, a certain amount of energy is unnecessarily withdrawn from the grid and injected into the grid. In our simulations, the total energy through the grid goes up to 2.1149 kWh in a 24 hours time interval. This causes additional stress to the grid and potential additional problems for the DSO, and can be avoided by ensuring the existence of a set of parameters that prevents such reductions on the self-consumption to occur. In Proposition 1 we defined conditions for the parameters to ensure this.

CONCLUSIONS
This paper has exposed some important issues in the NRG-X-Change mechanism, and addressed them by proposing new functions to determine payments for energy production and energy consumption. These functions efficaciously solve the issues presented, by actively discouraging curtailment in energy production for prosumers, taking into account situations where a congestion may occur, and encouraging prosumers self-consumption.
As for future directions, we plan to explore different options for the penalty functions that control congestion in our scheme. Moreover, further experiments will be performed by simulation of other grid environments.