###### Abstract
Reducing its demand from the main grid prevents overloading of the main grid's power lines or transformers, avoiding additional costs for improving main grid infrastructure. Moreover, the adverse effect of the increasing EV penetration, such as higher demand in the main grid or peak demand shifts [2; 19], is also prevented. Many studies (e.g., [20; 21; 22; 23]) assume renewable energy sources for the EV charging supply to decrease the carbon footprint of EVs, even in the power sector. The algorithms presented in these studies can be divided into two main categories: offline and online algorithms. The offline algorithms [22; 23] can be significantly affected by the accuracy of the weather prediction, meaning sub-optimal solutions are present there. The disadvantage of the online algorithms [20; 21] is their high computational cost, yet short-time weather predictions within a small-time window can be very accurate. Therefore, the solutions are very close to, if not exactly, optimal. To support the decarbonization of EVs charging, the charging station microgrid presented in this paper is assumed to cover its demand with its own photovoltaic power plant. To minimize the error of solar irradiation prediction, an online V2G algorithm is proposed. Since the V2G algorithm is implemented solely within the microgrid consisting of one charging station, computational requirements are not high. Moreover, it allows easy real-time implementation of optimal or near-optimal solutions. The scheduling of the charging or discharging of individual EVs within the fleet is usually determined by optimization algorithms, which range from linear optimization methods to more advanced methods with the utilization of AI [24]. Despite well-studied optimization methods in the literature, most of these algorithms assume just the technical aspect of the V2G concept and study it just from the grid or system operator point of view [9; 10]. It contrasts with the V2G concept definition, where the benefit of EV drivers is equally important as the one of the grid or system operators. A few studies (e.g., [8; 25; 26]) focus on EV drivers' cost minimization. However, the authors of those studies usually assume one hundred percent enrollment in V2G services. Furthermore, the cost function of EV drivers in most studies is determined based on the authors' assumptions and is not based on real empirical data [10]. This paper aims to optimize the cost of the charging system operator as well as EV drivers and so maximize the social welfare of the whole system. Unlike previous studies, the cost of EV drivers is based on the utility function estimated from the carried stated preferences (SP) survey in this paper [27; 28]. In our study, the EV drivers can choose what they prefer, and they can even opt for only the charging of their EV. This means that EV drivers must share their preferences with the system operator (in this case, the operator of the charging station). However, the EV drivers' private information is limited to their preferences for charging and discharging, as well as the charges associated with a specific connection session. Our previous study in [29] shows that there is a possibility to disrupt the social welfare concept of the system by reporting false preferences by any of the participants. Therefore, an incentive mechanism ensuring that truth-telling is the optimal strategy for each participant must be added to the system. The study in [30] proposes such a mechanism, though the control policy is defined for a longer period. This means that the participants cannot change during this period. To prevent this unrealistic scenario and create more real operations, our manuscript assumes control policy and incentives definition at each time step. So, this paper is focused on presenting algorithms able to control the charging and discharging of EVs at charging stations equipped with a local photovoltaic power plant while ensuring the maximization of social welfare and demonstrating its properties.