*2.2. EMS Operation*

When a vehicle connects to the charger station, the EV user selects the desired charging profile, and an acquisition module reads and organizes data from EV users. Furthermore, the PV generation and load demand data are acquired continuously. The supervisor module manages the real-time tasks of the system. It receives the data from the acquisition module and verifies if it is necessary to perform an optimization operation. At each calculation step, the ULTRA and FAST power references are updated, and the supervisor module splits and sends the results to the inverter controllers. When ECO and V2G modes are selected, the supervisor also requests an optimization operation. In this case, a dynamic programming method is used to calculate the EV charging power references for all EV connection period. The optimization method uses dynamic programming in order to reach the optimal progression of charging throughout the day. In the optimization process, forecast data provided by the prediction module are used, such as energy price (*r*ˆ*g*), PV generation forecast (*P*ˆ *PV*), and load demand (*P*ˆ *L*).
