Due to the strong intermittency of micro-resources, the poor grid-tied power quality, and the high generation-demand sensitivity in micro-grids, research into the control methods of micro-grid systems has always been a notable issue in the field of micro-grids. The inverter is the core control equipment at the primary control level of the micro-grid, and the key factors affecting its output performance can be divided into three categories: control methods, hardware configuration, and control parameter design. Taking the classical active and reactive power (P-Q) control structure and the three-phase, two-stage inverter topology model as an example, this paper designs a parameter for offline tuning, and an online self-tuning optimization method for an inverter control system based on the fruit fly optimization algorithm (FOA). By simulating and comparing the inverter controllers with non-optimized parameters in the same object and environment, the designed parameter tuning method is verified. Specifically, it improves the dynamic response speed of the inverter controller, reduces the steady-state error and oscillation, and enhances the dynamic response performance of the controller. communications will seriously influence the control performance of the entire system [14]. In the field of control science, tuning and optimization of the controller parameters are often carried out to improve the performance of a complicated PI-based control system [15]. However, in the process of parameter tuning, the control objects of different parameters vary in their damping coefficients, which leads to different overshoots, oscillations, durations of rise, and durations of adjustment [16]. Therefore, it is of great significance to explore the application of parameter tuning methods of PI controllers in improving the performance of the underlying control system of a micro-grid [17]. Research on PI controller parameter tuning can be divided into two major categories: offline tuning [18,19] and online tuning [20,21]. In Al-Saedi's work [22], online optimization tuning is conducted for PI controller parameters of micro-grid inverters by the particle swarm optimization algorithm (PSO) and error performance index methods. However, as the update calculation process of an individual particle is relatively complex, the overall calculation time is long, which makes it more suitable for offline tuning [23,24]. Compared with PSO, the fruit fly optimization algorithm (FOA) [25] requires less in terms of the calculation process and a simpler structure, with the advantage of shorter calculation time for parameter tuning. Research works [26][27][28] have discussed the feasibility of optimizing PI controller parameter tuning in an industrial process by using FOA, and they have provided guidance for this paper. Appl. Sci. 2019, 9, 1327 2 of 24 control network communications will seriously influence the control performance of the entire system [14]. In the field of control science, tuning and optimization of the controller parameters are often carr...