# Maximizing Efficiency in Energy Trading Operations through IoT-Integrated Digital Twins
## 4 Performance Analysis
### ESS Power Optimization  
The next section presents the simulation outcomes for 12 of the total 21 nano-grids. The results are illustrated in Figures 6 and 7, wherein the simulation outcomes are partitioned into two distinct sections. The figures presented depict the X-axis as representing the \"Days of the Week\", and the Y-axis as representing \"Power (kW)\". Positive numbers imply that a nano-grid functioned as a prosumer, engaging in energy trading by supplying excess energy to other interconnected nano-grids inside the network. In contrast, negative values signify that a nano-grid functioned as an energy consumer, obtaining energy from other nano-grids. The simulation reveals that each nano-grid assumes a distinct role. For instance, NG-10 undertook the position of a consumer due to its insufficient photovoltaic energy generation in meeting its energy requirements. In contrast, nano-grids 1, 2, and 4 exhibited prosumer behavior due to their energy consumption being lower than their photovoltaic energy production. As a result, the surplus energy was effectively employed for commercial transactions with other consumer nano-grids experiencing a demand for electricity. Moreover, the nano-grids that remained exhibited diverse behavior during the energy trading process, which was contingent upon their respective energy production capabilities. In cases where a nano-grid possesses surplus photovoltaic (PV) energy, it assumes the role of a prosumer, and in situations where it experiences a deficit of energy, it operates as a consumer nano-grid. The aforementioned results collectively indicate the successful execution of the suggested methodology for interconnected small-scale nano-grids functioning as a network.  
On the other hand, nano-grids 1, 2, and 4 exhibited prosumer behavior since their energy generation from photovoltaic sources exceeded their energy consumption requirements. As a result, they effectively harnessed the excess energy to fulfill the energy requirements of additional consumer nano-grids through the process of energy sales. Moreover, the remaining nano-grids fulfilled diverse functions in the process of energy sharing, with each nano-grid's role being defined exclusively by the amount of energy it created. To provide an illustration, in cases where a nano-grid possessed surplus photovoltaic (PV) energy, it operated as a prosumer, but in situations where its PV energy was inadequate, it operated as a consumer nano-grid.  
Similar to [19], we also computed average charging and discharging load values for particpating nanogrid houses. Figure 8 denotes the average charging and discharging values for load for all the participating 12 nano-grid houses for times-stamps of 24 h. It can be seen that when energy trading was processed without P2P trading, the load values were quite higher, whereas the best values are reported for P2P trading with optimized ESS values.  
Figure 6: Energy load and traded energy values using energy storage system (ESS) power optimization for NG1 to NG6 (**a**–**f**).  
Figure 8: Average charging and discharging power of nano-grid houses based on average charging and discharging power of nano-grid houses based on optimized energy storage system [19].  
Figure 7: Energy load and traded energy values using energy storage system power optimization for NG7 to NG12 (**a–f**).