# Differential Evolution and Fuzzy-Logic-Based Predictive Algorithm for V2G Charging Stations
## 3 Results  
To validate the proposed algorithm, two photovoltaic scenarios were considered as shown in Figure 3. These are directly expressed in terms of the available current \(I_{pv}\). The blue curve, referred to as \"sunny\", represents a typical sunny day with few clouds and a high overall energy availability. The red curve, referred to as \"cloudy\", represents a day with intermittent rains and a greater number of clouds. The time-varying energy tariff employed in this study is shown in Figure 4, displaying the usual peaks at around noon and in the early evening due to the high demand in these periods. The latter peak is seen to correspond to a cost 67% higher than the base price of USD 0.30. Figure 3: Photovoltaic generation for sunny and cloudy days. From the established scenarios, the first tests were performed to analyze the behavior of the algorithm for different values of \"\(K_{4}\)\". It is worth mentioning that these tests were carried out to observe how \"\(K_{4}\)\" could prioritize or not the state of charge of the battery bank, directly influencing the profit achieved throughout the day, the current that flowed to the batteries, and the current that flowed to the grid. In Figure 5, it is possible to analyze the behavior of the algorithm for the \"sunny\" curve, assuming values between zero and one for this constraint. For values of \"\(K_{4}\)\" greater than one, the behavior of the variables under study can be seen in Figure 6.  
In Figures 5 and 6, (a) shows the state of charge of the battery; (b) the profit obtained throughout the day with the purchase or sale of electricity, with positive quantities corresponding to expenses; (c) shows the current flowing to the battery, where positive values indicate battery charging; (d) presents the mains current, where positive values indicate a current flow from the mains to the batteries. Figure 4: Energy cost throughout the day. Figure 5: System parameters’ behavior for a sunny day, “\(K_{4}\)” between 0 and 1. In this scenario, \(SoC_{0}=90\%\), and USD \(\mu=100\). (**a**) SoC (%) of the battery; (**b**) Expense (USD) throughout the day; (**c**) Battery current; (**d**) Grid current. The results show that the lower the value observed for \"K4\", the greater the effort of the system to sell the energy stored in the battery banks. As can be seen in Figure 5c, as \"K4\" approached zero, the time during which the discharging current in the battery is maximum increased. In Figure 5a, for each value of \"K4\", it is possible to see the speed at which the battery state of charge decayed, as well as the balance point between purchased and stored energy. As an example, assuming \"K4\" equaled 0.1, the algorithm sought to maintain the state of charge at approximately 50% (Figure 5a). As shown in Figure 5d, this balance led to the situation in which all the energy generated at the electric charge station was sent to the grid, which produced profits throughout the day (Figure 5b). Something interesting to observe is that, at the end of the day, for the condition of \"K4 = 0.1\", the batteries were activated to send energy to the grid in an interesting moment considering the energy price; however, soon after, they drain some current from the grid to maintain the previous state of charge. This may also be associated with the fact that the peak of energy cost matched the moment when the photovoltaic generation rapidly decayed. On the other hand, in Figure 6, the efforts of the system to preserve the batteries charged can be observed. The value of \"K4\" directly interfered with the final state of charge. In Figure 6a, it is observed that the system stabilized the state of charge at 95%, 98%, and 99% for the respective values of \"K4\" of 1, 2.5, and 5. In Figure 6b,d, it is confirmed that the system balanced quickly, allowing the energy generated throughout the day to be fully sent to the grid, keeping the batteries sufficiently charged, and maximizing profits.