*2.1. Energy Management System*

The proposed Energy Management System (EMS) block continuously collects power information from EV charging stations, the PV generation system, and microgrid demand. The EMS uses the power profile of all subsystems in order to coordinate the EV charging. To optimize the microgrid operation, EMS also collects the individual EV charging profile provided by the EV users upon arrival at the parking lot. The EV data profile consists of a data structure identified by *EVi*,*j*.{*struct*}, which includes identification, storage system profile, and user preference parameters, wherein *i* is related to the charger group and *j* specifies the outlet of the charger. The main information in the structure is: user/vehicle identifier (*ID*), charging mode chosen by the user (*Mode*), connection time (*t*0), expected disconnection time (*tf*), current (*SOCn*) and final desired SOC (*SOCf*), maximum battery capacity (*Ebat*), and nominal charging power (*Pnom*).

From the microgrid diagram, in Figure 2, a simplified arrangement is proposed and brings together the EVs by charging modes (*PEVM* ), as presented in Figure 3. The power flows in PV panels, and loads are identified by *PPV* and *PL*, respectively. In addition, the EMS receives power system measurements and dispatches the individual charging commands (*PEVv* ) based on an optimization algorithm for all charging demands. The proposed EMS provides a set M = {*EVU*, *EVF*, *EVE*, *EVV*<sup>2</sup>*G*}

of four EV charging modes: ULTRA, FAST, ECO, and V2G. The total power flows related to all vehicles in the same charging mode are given by *PU*, *PF*, *PE*, and *PV*<sup>2</sup>*G*, respectively.

**Figure 3.** Simplified arrangement of the proposed microgrid.

Based on Figure 3, it can be assumed that the power balance of the proposed system arrangement is given by *Pgrid* = *Pnet* + *PEVM* , herein *Pnet* = *PL* − *PPV*, and represents the resulting power between demand and generation.

The logical architecture of the EMS block is defined in Figure 4, and it consists of four functional modules: acquisition, supervision, optimization, and prediction.

**Figure 4.** Proposed manager architecture.
