# PV-Powered Charging Station with Energy Cost Optimization via V2G Services
## 4 Simulation Results for PVCS with V2G Service
### Case 1: Sunny Day
#### 4.1.2 Scenario b: Variable Power  
The power flow of the PVCS with V2G service at variable power with the \"Sim w/o opti\" and \"Sim w/ opti\" algorithms is presented in Figure 7, where the predicted PV power is used only to run the optimization, and the real PV power is used in both simulation scenarios. Figure 7a shows that EV1 as well EV3 are discharged at peak periods for 15 min at 50 kW each, and then they are recharged with the appropriate charging power after V2G service to meet the needs of the users while considering the duration of the remaining parking time. The PVCS operates in storage-priority mode, meaning that any excess PV power is initially used to charge the stationary storage. Once the stationary storage is either full or its maximum charging power is reached, which occurs around 11:00-11:30 and from 15:00 until 18:00, any additional PV power is then injected into the public grid. Furthermore, the public grid provides power when EV2 charges in fast mode and during peak periods when EV1 and EV3 recharge after V2G. Thus, charging EVs during peak periods will increase the energy cost. Sharp variations in power levels might lead to stability issues. To prevent this, Constraint (23) limits steep power variations, which can be seen in Figure 7a's zoom-in during the peak hour of 12:00 to 13:00. On the other hand, in Figure 7b, EV1 and EV3 are discharged simultaneously during peak periods (serving a total of 100 kW power to the grid), and then each EV recharges after V2G with the optimized power to meet user preferences. EV1 and EV3 are primarily charged by PV power. However, due to uncertainty in the PV power prediction, the public grid may supply power to the EVs between 10:25 and 12:00, although it is not very significant. The injection of power into the public grid is determined by the optimization result to maximize profits in the event of excess PV power, which occurs before 10:00 during V2G service and from 15:00 until 18:00. The power and SOC of the EVs in \"Sim w/o opti\" and \"Sim w/ opti\" are shown in Figures 8 and 9, respectively. Figure 6: Power (**a**) and SOC of the EVs (**b**)—scenario a in “Sim w/ opti”. Figure 8: Power (**a**) and SOC of the EVs (**b**)—scenario b in “Sim w/o opti”. Figure 7: Power flow with V2G service—scenario b (**a**) in “Sim w/o opti” and (**b**) in “Sim w/ opti”. Figure 8a shows that EV1 begins discharging at 50 kW and then recharges with 50 kW to reach the desired SOC at the time of departure. The EVs have enough remaining charging time after V2G to recharge with 22 kW. In Figure 9a, the optimized charging/discharging profiles of EV1 and EV3 allow them to participate in V2G service, reach the desired SOC at departure, and satisfy the users with minimization of the cost. When EV2 arrives, the optimization is actualized again, and as a result, EV1's charging power is dropped to reduce the total power demand because EV2 charges in fast mode. After EV2 leaves, EV1 starts recharging again, which helps to discharge power during peak periods. After providing V2G service, EV1 resumes charging its battery to achieve the desired SOC at the time of departure. In the same way, the optimization is actualized every time a new EV comes to the PVCS, and thus the optimization procedure is realized five times during the day in this case. The power provided to recharge EV1 and EV3 is synchronized with PV power, even during peak periods. Consequently, all EVs have achieved their desired SOC values at the time of departure, as shown in Figures 8b and 9b. Scenario a, where the charging/discharging power is constant, is proved to be impractical because EVs will never achieve their desired SOC at the time of departure. On the other hand, scenario b proves its feasibility by allowing EVs to recharge with variable power after participating in V2G service, irrespective of their initially selected charging mode, in order to satisfy the EV user.