1949-3053 (c) 2016 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.2017.2690681, IEEE Transactions on Smart Grid Abstract- A new custom power device (CPD) is introduced for real-time control of reactive power and improving the overall network voltage quality of smart grid (SG) at fundamental and harmonic frequencies, respectively. The idea is to take advantage of the online smart meter data transmitted from each bus to the SG central control (SGCC) to concurrently perform the static synchronous compensator (STATCOM) and the active power line conditioner (APLC) operations by optimal compensations of fundamental reactive power and harmonic currents at selected optimal buses. The proposed strategy involves two PSO algorithms. The first algorithm is implemented for the worse operating condition to determine the optimal locations and sizes of CPDs while the second algorithm relies on smart meter information to continuously compute fundamental and harmonic reference currents for real-time operation and control of the allocated CPDs. The objective functions are cost minimizations associated with bus voltage regulations, network THDv and custom device sizing while the constraints include upper limits for CPD sizes, fundamental and harmonic bus voltages. Detailed simulations are performed in Matlab/Simulink to evaluate the performances of allocated CPDs in controlling the reactive power and voltage quality of a distorted 15-bus distorted SG with six nonlinear loads according to the IEEE-519 standard. Index Term- Active power line conditioner (APLC), custom power device, smart grid, STATCOM, power quality. I. INTRODUCTION Smart grids (SGs) are gaining worldwide courtesy among consumers and utilities due to their inherent abilities in increasing demand-size management and enabling real-time control of assets as well as improving network efficiency and reliability by using smart meters and sensors [1-3]. Electric utilities are facing many new challenges due to the increased complexity of their networks and the growing integration of nonlinear loads and renewable energy resources such as poor voltage profiles and high losses at fundamental and harmonic frequencies. The most frequently experienced power quality issue is the voltage instability problem [4]. For example, voltage sags are reported to be responsible for over 80% of the power quality troubles in power systems [5]. The extreme consequence of a voltage collapse can be a full power interruption [6]. The commonly practiced solution for protecting the system from voltage collapse is to inject/absorb reactive power before reaching the point of voltage collapse by installing shunt (fixed and switched) capacitor banks, static var compensators (SVCs) [7] or flexible AC transmission systems (FACTS) such as static synchronous compensator (STATCOM) [8] at suitable locations of the system. Switched capacitors need to be scheduled based on the forecasting of DG generations and loads while SVC uses thyristor switched capacitors (TSC) or thyristor controlled reactors (TCR) for capacitive/inductive M. Moghbel, M.A.S. Masoum, A. Fereidouni and S. Deilami are with the Centre for Smart Grid and Sustainable Power Systems, Department of Electrical and Computer Engineering, Curtin University, Perth, WA, Australia (E-mails: moayed.moghbel@postgrad.curtin.edu.au, m.masoum@curtin.edu. au, alirezafereidouni@curtin.edu.au, s.deilami@curtin.edu.au). reactive power compensation [7]. In general STATCOM has some benefits over SVC such as faster response and smaller size due to the elimination of capacitors and reactors. Moreover, due to high dependency of SVC on the supply voltage, its reactive power compensation is reduced with a decrease in supply voltage, while the STATCOM can supply the required reactive power even at low supply voltage. However, these devices are mainly designed to perform voltage regulation and optimal reactive power flow at the fundamental frequency without considering harmonic current injections of nonlinear loads. Propagation of the injected current harmonics creates harmonic voltage drops and voltage harmonic distortions throughout the network [9]. These distortions need to be controlled according to the upper limits for the total harmonic distortions of current (THDi) and voltage (THDv) as well as the individual current and voltage harmonic magnitudes as recommended by power quality standards such as the IEEE-519 [10]. The usual approaches are insulations of passive, active or hybrid power filters. However, these technologies are designed to limit harmonic currents at the point of common coupling (PCC) without considering the THDv of other buses and the entire network [9]. This issue can be resolved by connecting active power filters (APFs) at all buses with nonlinear loads which is not a practical solution [11]. A feasible approach may be to utilize a custom power device (CPD) with combined FACTS and APF functions. According to the draft IEEE P1409 Guideline [12], CPDs are active power electronic devices with ability to perform current interruption and/or voltage regulation in distribution systems to improve power quality with the following two classifications: 1) CPDs protecting the source (network) from the load by injecting reactive power and compensating harmonics. Examples include SVC, D-STATCOM, unified power quality conditioner (UPQC) and active power line conditioner (APLC). The research on APLCs is very limited [13-18] mainly due to unavailability of online network data which is being resolved with the wide spread installations of smart meters in SGs. 2) CPDs protecting the load from the source by mitigating voltage interruptions such as voltage sags and swells. Examples include static transfer switch (STS), static series compensator (SSC) and static voltage regulator (SVR) as well as DSTATCOM and dynamic voltage restorer (DVR) with energy storages. DVR connected in series with the network can regulate and balance the three phase voltages of the connected bus while also eliminating voltage harmonics. It injects voltage components in series with the main voltage and consequently compensates voltage sag and swell on the load side. Also, harmonic voltages are added to maintain almost pure sinusoidal voltages across the load. There are limited number of resources on simultaneous compensation of both reactive power and voltage harmonics [19-24]. In [19] the APF is designed to provide reactive power Moayed Moghbel, Student Member, IEEE, Mohammad A.S. Masoum, Senior Member, IEEE, Alireza Fereidouni, Member, IEEE, Sara Deilami, Member, IEEE Optimal Sizing, Siting and Operation of Custom Power Devices with STATCOM and APLC Functions for Real-Time Reactive Power and Network Voltage Quality Control of Smart Grid