Minimizing Energy Loss over Distance and Activating the Energy Trading System in Microgrid

As small-scale distributed energy is gradually expanding, commercialization of peer to peer(P2P) energy trading that freely exchanges energy among individuals in various countries is being commercialized, and the Microgrids (MGs) are considered to be an optimal platform for P2P energy trading. Although conducting electricity trade among individuals without going through power companies is still in its infancy, it is expected to expand gradually as the awareness of the shared economy grows and the MG spreads. Research on more efficient trading systems is needed while trading energy in MG. Therefore we propose a more efficient energy trading system that minimizes the loss in proportion to the distance of the power line when energy trading is performed in the MG. We have constructed a virtual MG environment and experimented with energy trading scenarios. As a result, when the algorithm is applied, loss in proportion to the distance is reduced by 2.495% and energy trading becomes more active. The amount of energy and the number of trades increased by 1.5 times during the energy trading process.


Introduction
Thermal power generation and nuclear power generation are a large part of energy generation. As the development technology of new and renewable energy develops, the amount of renewable energy generation is steadily increasing every year. The development of new and renewable energy can reduce dependence on thermal power generation and nuclear power generation. MG is a small-scale smart grid system capable of self-sufficiency in small areas. It is a next-generation energy system that combines renewable energy sources with energy storage devices. Since MG is mainly a small unit, it produces energy using solar panel and wind turbine etc. However, in case of using solar panel and wind turbine, it is difficult to control the output because it is highly influenced by environmental factors, and the prediction of the power generation amount is uncertain and it is difficult to accurately generate the planned power generation amount at the required point. To overcome these drawbacks, P2P energy trading system is expected to contribute to expanding small scale distributed resources and creating new market. The main advantages are that they can connect their revenue to profit without discarding the energy they produce, that they are developed to meet the end-user's needs, and that the resource utilization is optimized due to the cooperative network between producers and consumers. Because of this, many countries and companies are studying the P2P energy trading system [1]. There are several studies related to P2P energy trading system. [2] Applied P2P energy trading to community MG, [3] created a P2P model for smart homes in a smart grid, [4] implemented a P2P model to apply information and communications technology to local smart grids and control the grid, [5] confirmed that P2P energy trading could actually be done on low voltage electrical distribution networks, [6] investigated and compared current energy transactions, and [7] applied a blockchain technology to P2P energy trading. In fact, if you trade energy in a MG, there will be several losses. Since small amounts of energy are traded, even small losses can have a big impact. Although there are many studies on P2P energy trading, there is lack of research on how to minimize various losses and optimize the system. In addition, existing energy trading systems lacked consideration of the possibility of local energy markets in MGs [6]. We studied the situation of energy trading in the environment of local energy market. We have studied how to minimize the increasing losses in proportion to the distance of the power line among various loss factors caused by the energy transaction. In this paper we proposed an algorithm for minimizing the loss in proportion to the distance of the power line and optimizing the system during the energy trading process. The advantages of the proposed algorithm are as follows: • Minimize energy loss: We show that the proposed algorithm minimizes the energy dissipated in excess of the capacity of the energy storage system(ESS) and reduces the energy loss in proportion to the distance. • Efficient: Through the proposed system, we will show that P2P energy trading becomes more active than existing system, and trading is proceeding faster through organically connected P2P network.
• Reliable: We will improve stability by responding to the sudden energy demand that may arise in MG through the proposed system. The rest of this paper is organized as follows. Section 2 describes the proposed system architecture. Section 3 explained the test infrastructure to apply the algorithm. Section 4 demonstrates the experiment results. Finally, Section 5 concludes the paper.

System architecture
In this section we describe the proposed overall system and the algorithm to minimize energy loss over distance and to manage the ESS in detail. Figure 1. The proposed MG system Figure 1 shows an overview of the proposed MG system, which consists of city-owned ESS, energy prosumer and renewable energy generators. We considered a system where energy trading takes place in MG's local energy market. Unlike conventional MGs, we deployed a large capacity ESS in the centre of the city. Large capacity ESS is managed in the city. The reason for deploying a largecapacity ESS is that if the demand for power suddenly increases unexpectedly in the city and the supply does not meet the demand, a blackout may occur. Even if a blackout occurs, this is because the stability of the system can be improved by preventing accidents. Another important reason is to utilize large capacity ESS actively in energy trading systems. If the ESS has sufficient capacity during the energy trading and the distance between the seller and the buyer is greater than the distance between the ESS and the buyer, the seller will makes a transaction and leaves a record of the transaction. The transaction is recorded in the energy trading system and can be managed and verified in the city. Otherwise, the seller and buyer will make a deal. Large-capacity ESSs are mainly supplied by large-scale solar power, wind power or hydroelectric power generation outside the city, and energy is scarce they will obtain energy from the sellers who traded energy instead.

Figure 2. Minimizing the energy loss over distance algorithm
Houses and buildings in the MG are traded through the algorithm in figure 2. If there is someone who wants to purchase, the energy trading system starts. If there are buyers who wish to make a purchase, it will search for sellers. If the seller does not exist, the transaction can not proceed. If you have found the sellers that want to trade energy, the system will list the sellers in close order and match them to buyers from the nearest order. When matching sellers and buyers, first check to see if the city's ESS is more than 30% full. If the city's ESS is not more than 30% full, the buyer and seller will proceed directly to the transaction. If the city's ESS is more than 30% full, the distance between the buyer and the city's ESS is calculated, and if the distance is shorter than the nearest seller, the city's ESS will proceed on behalf of the buyer. The transactions made on behalf of the buyer is all recorded. When the transaction ends, it returns to the initial state.

Algorithm to manage ESS
The city's ESS within the MG is managed through the algorithm in Figure 3. The algorithm works when the city's ESS drops below 30% of its charge amount. When the city's ESS drops below 30% of its charge amount, it finds records that the city's ESS has traded on behalf of the seller. The transactions made in this case are listed in time order. The person who traded first will check the charge capacity of the ESS. If the seller's charge amount is more than 30% of the total capacity, 20% of the total capacity to the city's ESS will be charged and the transaction record made one behalf of the seller is deleted. If the seller's charge capacity is not more than 30% of the total capacity, the record is not deleted. Repeat the above procedure until the charging capacity of the city's ESS exceeds 50% of the total capacity. Figure 4 shows the ESS management algorithm for the house and building. If energy is produced in excess of the capacity of the ESS is not used for a long time, a renewable energy generator is connected to the city's ESS to store the excess energy production in the city's ESS. When reusing energy charged to the ESS in the house and building, the connection between the renewable energy generator and the city's ESS is terminated.

Test infrastructure
To evaluate the performance of our proposed algorithm, we constructed a virtual MG environment shown in Figure 1 using software. In order to compare how the performance of the algorithm is improved when the algorithm is applied, experiments were conducted under the same conditions when the algorithm was applied or not. We used python as a software language because it has the advantage of having short codes and plenty of libraries for data analysis. Since there are limitations in testing a large number of conditions in a real environment, we constructed and tested a simple virtual environment through several assumptions and conditions.

MG environment
We considered the case where the MG was implemented in one city. The MG is ideally constructed in the city, so it is assumed that various entities with ESS in the MG can exchange electric energy using low power. There is only one power company that manages the city, so we assumed that the power system used in the MG is the same.

Energy loss
There are many conditions that cause losses when trading energy. Among them, we focused on losses caused by power lines.  Assuming that the other conditions in the MG are the same, we calculated the loss using the sum of the distances. The reason for the loss using the distance is as follows. (1) Is a formula for obtaining a loss occurring on a power line, and (2) is a formula for obtaining a value of a resistor. (2) Is substituted into (1) and the proportional expression of (3) can be obtained when all the conditions except the distance are the same. In this paper, the saving rate of energy is calculated by the equation (4). is the sum of the total energy traveled in the energy trading system when the algorithm is not applied.
is the sum of the total distance traveled by the energy trading system when the algorithm is applied.
is the energy saving rate and the unit of the result is percent. (1)

Energy trading
Both houses and buildings in the city have an ESS and a renewable energy generator, so it is assumed that they can participate in energy trading. The city's ESS capacity was set at 20 times the capacity of the home's ESS, and the building's capacity was set at three times the ESS capacity of the home. The amount of energy to trade at one time was set to 10% to 30% of the capacity of the home ESS.

Test deployment and results
To see how effective the algorithm is when applied, we used the virtual MG environment built in Section 3. In order to experiment under various conditions, we first set the basic environment(BE). In the BE, the area of the city is set at 2500 , and the number of houses and buildings participating in the trade is set to 20 in total. The number of transactions occurring in a day is randomly set within 80% of the number of entities participating in energy trading. We also set the trading period to 30 days to ensure a sufficient number of transactions. Since the locations of houses and buildings in different cities are different, the final energy saving rate is obtained by averaging the energy saving rate through 100 simulations through different models. The existing energy trading method did not consider the distance between the seller and the buyer. In the simulation, the total distance traveled by the energy was 5801.417km and the total volume of energy was 9324KWh. In the case of a large -scale ESS in the center of the city and applying the algorithm, the total distance traveled by energy was 5669.487km and the total volume of energy was 13808KWh. As a result of calculating the energy saving rate through the total distance traveled by the energy, we could save 2.495% of energy on average and the total volume of energy increased 1.48 times. Through this, we can see that applying the proposed algorithm reduces the energy loss in energy trading and activates the transaction. Figure 5 shows how the energy saving rate varies depending on the number of transactions. The results were obtained by adjusting the number of transactions occurring in a day in the BE. In the graph of Figure 5, the energy saving rate was less than 0 when the number of transactions per day was set to less than three. This result shows that when the algorithm is applied, energy loss may occur if not enough transactions are made in one day. The graph shows that the energy saving rate increases as the daily transactions are actively performed. Figure 6 shows how the energy saving rate varies depending on the number of transactions involved.   The greater the number of participants, the lower the energy saving rate. In the BE, the number of participants in the trade was reduced by half, and the energy saving rate more than doubled. In the BE, when the number of participating in the transaction is 40, the energy loss is obtained. As a result, it was found that there is an optimal participation rate that maximizes the energy saving rate. Figure 7 shows how the conservation of energy varies with the size of the area in the BE. Initially, the area of the city was set at 2500 and the simulation was carried out by gradually increasing the area. When the