1949-3053 (c) 2018 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See http://www.ieee.org/publications_standards/publications/rights/index.html for more information. This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TSG.2018.2888925, IEEE Transactions on Smart Grid 1 Multitask Fuzzy Secondary Controller for AC Microgrid Operating in Stand-alone and Grid-tied Mode R. V. A. Neves, R. Q. Machado, V. A. Oliveira, X. Wang, and F. Blaabjerg Abstract—A common method for load sharing is using fre- quency and voltage droop controllers because there is no need to have communication links in the microgrid. However, the droop control strategy has a drawback, that is, it imposes voltage and frequency deviations, which can be fixed by adding a secondary control loop. On the other hand, if the microgrid operates con- nected to the grid, a tertiary controller for regulating the injected power must be added. This paper proposes a multitask fuzzy secondary controller (FSC) applied to AC microgrids acting only on the secondary control layer. The proposed controller allows stand-alone and grid-tied operations, regulating the voltage and frequency in the secondary and the active and reactive powers, simultaneously, without a tertiary controller. Stability analysis are presented showing that the FSC keeps the microgrid stable while operating within a proposed operation range. A microgrid simulation test bed based on power inverters is presented to validate the FSC operation and to compare to conventional hierarchical controller. The proposed FSC fixes the deviations in the same way as the conventional controller during the islanded operation tests and allows the microgrid to inject power into the grid. Index Terms—Fuzzy control, Hierarchical systems, Power generation control, Uncertainty. I. INTRODUCTION Microgrids (MG)s are getting more spread over remote locations (stand-alone operation) or connected to the grid, and they need to operate with a load sharing strategy among the distributed generations (DG)s units. A common load sharing strategy is using droop controllers in the DGs [1], [2]. However, the droop controllers impose a load dependency, resulting in frequency and voltage deviations that can not be fixed at this control level, usually called primary control layer. The deviations are compensated by adding a secondary control loop. Nevertheless, if the MG is operating in a grid-tied mode, it must have a tertiary control loop to regulate the active and reactive power injected in the point of common coupling (PCC) [3]. The control structure using different control layers is known as hierarchical controller. Hierarchical controllers act on the MG through communi- cation links among their layers. Local measurements at the primary control layers are sent through low-bandwidth com- munication links to the MG hierarchical control structure [4]– [6]. In this context, researchers are using artificial intelligence techniques, as genetic algorithm and fuzzy logic, to manage the MG only with the local measurements [7]. In this sense, the fuzzy logic is being applied to control systems because of its simplicity to translate complex algorithms through fuzzy rules or to manage multiple variables [3], [7]–[11]. In spite of this, the papers in literature are looking after either stand-alone or grid-tied operation. After connecting the MG to the grid, in a hierarchical control structure, a tertiary controller is switched on to regulate the power injection and switched off when the MG changes to the stand-alone operation mode, intentionally or after an islanding occurrence [11]. A hierarchical control structure using fuzzy logic to guarantee the desired power sharing has been proposed in [11]. A fuzzy secondary structure, without switching on and off a tertiary controller, has been proposed in [10]. However, in both studies, the algorithms switch between the regulated variables frequency/voltage and active/reactive power, without exploring all benefits of fuzzy- logic hierarchical control structure. Therefore, this paper proposes a multitask fuzzy secondary controller (FSC) to regulate the voltage/frequency in a stand- alone and the power injection at the secondary control layer if the microgrid works grid-tied, differing from the con- ventional hierarchical control structure. Moreover, the FSC can change from grid-tied to stand-alone control without control switching. The proposed FSC copes with multiple control inputs, keeping the voltage and the frequency of the MG within acceptable limits of operation in the stand-alone mode or supplying active and reactive power to the grid in the grid-connected mode. A stability analysis will prove the feasibility of the proposed approach for stand-alone and grid- tied operations as well as, experimental results were performed to validate the proposed controller and to compare with a conventional hierarchical structure. II. HIERARCHICAL CONTROL STRUCTURE AND DROOP CONTROLLERS The minimal microgrid arrangement to use a hierarchical control structure is composed by two power inverter-based DGs connected in parallel to the PCC like the one presented in Fig. 1. In this case, each DG has its primary control loop which regulates the current through the inverter side (L fc ) and the voltage on the capacitive filter (C f ). The droop control is used in the primary control layer for power sharing among the DGs. To simplify, in the droop control design an inductive net- work is usually considered. Thus, the droop equations result in a curve P–ω and a curve Q–E giving the relationship between the active power supplied by the DG and the PCC frequency