## 1 Introduction  
Microgrids (MGs) are a part of distribution systems that include several means of distributed generation (DG), renewable energy sources (RESs), storage devices and controllable loads and have the capability to operate either in connected or isolated mode [1, 2]. During islanded operation, due to low inertia of MG and intermittent nature of RESs such as wind and solar, there might be some frequency deviations beyond the acceptable range. Thus, an islanded MG requires specific primary and secondary frequency control schemes, in order to maintain power balance between generation and load and restore frequency to the nominal value [3]. Moreover, MG requires sufficient spinning reserve provided by DG units or energy storage systems (ESSs) to keep power balance during islanded operation [4]. With increasing penetration level of EVs and considering that they are available most of the times in a day, they can play the role of ESSs in a way to alter their energy consumption/production level under the vehicle-to-grid (V2G) concept and exchange the power with the grid [5]. Thus, with V2G capability, EVs can provide ancillary services for the grid, such as frequency regulation [5], load levelling [6, 7] and spinning reserve [8]. With the application of a well-designed energy management system (EMS), EVs can act as an effective solution to compensate the uncertain behaviour of RESs. On the other hand, EVs without any proper management strategy could cause a number of issues such as energy losses, overloads, and voltage and frequency fluctuations [9]. Different methods have been used in recent literature to manage EVs' charging and discharging process to facilitate ancillary services in the presence of RESs [10; 11]. The role of EVs in primary frequency response and in the presence of renewable energies was investigated in [5] for the Great Britain power system. By considering three EV charging strategies, it was shown that a proper EV charging strategy is effective in primary frequency response and can stabilize the grid frequency when is needed. In [12], with regard to the randomness of renewable energy generation, the operation of EVs in the MG was scheduled to minimize cost of charging. Moreover, economic incentives for EV owners to compensate the wind forecast uncertainties were provided in [13]. Coordination of EVs and minimization of the penalty cost associated with wind power imbalances was studied in [14]. Authors in [15] presented an aggregated primary frequency control model, where a participation factor, based on the state-of-charge (SOC), was used to determine the droop characteristic. It was investigated that EVs can effectively improve the system frequency response due to their ability to participate in primary reserves. The work in [16] performed a comparative study in order to evaluate benefits of EVs providing primary frequency control in an islanded system with high penetration of RESs. A control strategy was also presented in [17] in order to provide active participation of EVs for load frequency response purposes. In the same study, the SOC of EVs was managed by using a smart charging strategy in order to obtain a scheduled charging level requested by an EV owner. In a similar manner, Ref. [18] provided frequency regulation to the power grid using EVs with an effective pricing policy, and Ref. [19] presented a frequency control method considering both EVs and controllable loads. When an MG enters an isolated mode due to loss of the main grid or a blackout/fault, it necessitates appropriate control and management schemes such that both the economical and stability targets are achieved. In this regard, this paper proposes an EV energy management scheme for MG autonomous operation based on local frequency measurements such that EVs will contribute. The participation of EVs will contribute to the frequency stability of the MG in off-grid times.