OpenDSS-Based Distribution Network Analyzer in Open Source GIS Environment R. Gonza´lez, Student Member, IEEE, A. Arguello, Graduate Student Member, IEEE, G. Valverde, Member, IEEE, and J. Quiro´s-Torto´s, Member, IEEE Electrical Power and Energy Research Laboratory School of Electrical Engineering, University of Costa Rica 11501-2060 UCR, San Jose´, Costa Rica gvalverde@eie.ucr.ac.cr, jquiros@eie.ucr.ac.cr Abstract—The adoption of low carbon technologies (e.g., pho- tovoltaic systems) is expected to increase in the near future given their contribution to reduce greenhouse gas emissions. However, high penetrations of these new technologies are likely to result in technical problems on the distribution networks. To truly understand these impacts, nonetheless, utilities need to have detailed models of their networks and advanced simulation tools, so studies can then be performed. This paper presents an OpenDSS-based distribution network analyzer in an open source GIS environment that enables engineers to easily carry out complex network analyzes ranging from snapshot to harmonic power flows. Critical to facilitate its use, the simulation tool needs limited input information to undertake these detailed studies. Illustrations on a real distribution network with more than 10,000 customers demonstrate the efficiency of the analyzer to perform studies, display and store the corresponding results. Index Terms—Distribution network analyzer, distribution net- work, low carbon technologies, OpenDSS, Python, QGIS. I. INTRODUCTION The increasing adoption of photovoltaic systems, electrical energy storage systems and electric vehicles will contribute in reducing greenhouse gas emissions - the main cause of climate change [1], [2]. Although the uptake of these technologies is expected to create new opportunities for the electricity system, high penetrations are likely to result in significant technical problems on the distribution networks (e.g., thermal overloads, high/low voltages, voltage unbalance, harmonics) [3], [4]. To truly quantify the corresponding benefits and/or impacts on the Medium Voltage (MV) and Low Voltage (LV) distri- bution circuits, it is, therefore, critical for power utilities to have detailed models of their networks as well as advanced simulation tools [5]. To ensure accuracy and efficiency in this quantification, particularly in networks with thousands of customers, it is important to develop these tools with pow- erful modeling techniques and high performance computing capabilities. To make these simulation tools more attractive, flexible and accessible, open source software packages should be used. In this context, OpenDSS [6] is a powerful, open source software developed by EPRI (USA) to model and simulate the electrical behavior of the distribution network. Although it is a script-based simulator with limited Graphical User Interface (GUI), it can be driven from other platforms (e.g., Python - a programming language to perform computing tasks [7]) through the Component Object Model (COM) server. From the perspective of utilities, the development of these simulation tools should consider their Geographical Informa- tion System (GIS). This is critical as most of the data needed to create network models (e.g., type and length of conductors, type and location of customers, voltage levels, etc.) is stored in their GIS platform, which typically cannot perform power flows. However, the stored data can be efficiently translated to the corresponding network models ready to be used in software packages for power flow studies as detailed in [8]. The number of reported applications that combine the above requirements is limited. A Monte Carlo simulation platform implemented in Matlab R© for modeling and simulating only LV networks considering 24h periods with a resolution of one snapshot per second is presented in [9]. A real-time simulator that adopts LabVIEW R© to allow hardware-in-the- loop applications is discussed in [10]. A framework that helps assessing the effects of communications on control actions is introduced in [11]. Although these simulation tools can carry out power flow studies, they usually require the adoption of a proprietary software, they have been tested in small networks, and/or they require the construction of the network model in a platform that is unusual for engineers (new GUI). This paper presents an OpenDSS-based simulation tool driven by Python that is developed in an open source GIS environment. The tool, which can be used in Spanish or En- glish depending on the machine’s Operating System language, takes advantage of the advanced modeling techniques and high performance computing capabilities available in OpenDSS, so detailed studies can be efficiently performed. Illustrations on a real distribution network in Costa Rica with 10,000+ customers demonstrate its flexibility and efficiency to carry out complex network studies (e.g., daily power flows), to display results and to store them in comma separate value (csv) files. This paper is organized as follows. Section II introduces the open-source software used to create the simulation tool. The OpenDSS-based distribution network analyzer in an open source GIS environment is presented in Section III. Section IV illustrates three different network studies that can be carried out up to today. A discussion is presented in Section V and conclusions are drawn in Section VI. II. OPENDSS AND QGIS: OPEN SOURCE SOFTWARE This section presents the open source software packages used to develop the distribution network analyzer, which is presented in section III as a plugin. These software packages are selected to take advantage of their computing capabilities, and also because they can be easily integrated, as detailed in section II-C. This has the potential to increase the flexibility and accessibility of the network analyzer. A. OpenDSS OpenDSS is an open source software package developed by EPRI (USA) that can be used to simulate distribution networks [6]. It contains detailed models of several network components (e.g., lines, loads, generators, monitors, etc.). A key aspect of this script-driven, frequency-domain simulation tool is that it allows considering the time dimension (e.g., daily simulations with different time step) - critical to quantifying the impacts of variable sources and loads. To create a network model, OpenDSS follows a sequence of definitions [6], i.e., source, lines, transformers and loads. However, given the script-written nature of this software, the creation of large-scale networks must be done carefully. In order to run this plugin, a network model needs to be added by means of *.dss files. The latter can be created automatically as reported in [8]. The database (other *.dss files) that contain the characteristics and configuration of conductors is also used. • WireData: Database that contains the characteristics (e.g., name, resistance, diameter and GMR) of each wire. • Config Lines: Database that contains the geometry (e.g., number of conductors, phases and spacing) of each line. • Loadshapes: Database that provides the electrical behav- ior of a load along a given period. • MVLines: File that details the connectivity of each MV line/cable segment, geometry of line/cable and its length. • Transformers: File that provides the information of all transformers (e.g., losses, impedance, voltages, etc.). • LVLines: File that details the connectivity of each LV line/cable segment, geometry of line/cable and its length. • ServicesLV: File that details the connectivity of each service cable, its linecode and length. • Loads: File that indicates load location, type, nominal voltage and power factor and the associated loadshape. OpenDSS is known to have a limited GUI. Although this can be overcome using the COM server, which allows users to drive OpenDSS from other platforms (e.g., Python), the development of a GUI that will enable engineers to perform advanced network studies in a more friendly way is critical. This, in turn, is expected to further enhance the flexibility and acceptability of this powerful software package. B. Quantum GIS Many power utilities use GISs to store, read, edit and analyze data of the distribution network (referenced by a spatial coordinate system [12]). A GIS platform cannot run itself power flows. However, the GISs of utilities usually contain the data needed to create detailed network models [8]. COM COM Figure 1. Interfacing OpenDSS with QGIS via Python One of the most popular open source GIS software package is Quantum GIS (QGIS), under the GNU-GPL license. A key feature of QGIS is that it allows the development of Python- written plugins for extra data processing and analysis not available in the existing software [13]. From the perspective of power utilities, the development of Python-written plugins to integrate OpenDSS within their GIS environment (for instance to create a user-friendly GUI for OpenDSS) can be significantly beneficial as this allows them to study their distribution networks, while performing the corresponding analyzes within their database. C. Integration of OpenDSS and QGIS A plugin that drives OpenDSS from QGIS via the Python console available in the latter has been developed to integrate these software packages. This, in turn, results in a GUI that is introduced below. To achieve this, the library comtypes.py needs to be installed using the package management system pip. This integration is illustrated in Fig. 1. III. OPENDSS-BASED DISTRIBUTION NETWORK ANALYZER IN QGIS ENVIRONMENT The plugin (i.e., the OpenDSS-based distribution network analyzer in QGIS environment) presented in this section is developed in combination with the work discussed in [8]. These two works together represent part of the efforts made at the University of Costa Rica to provide distribution com- panies with the necessary simulation tools, so they can easily understand the state of their networks, as well as to assess the benefits and/or impacts of adopting low carbon technologies. A. Plugin Architecture The OpenDSS-based distribution network analyzer in QGIS environment (named hereafter QGIS2RunOpenDSS) can be used to carry out, so far, three different types of net- work studies: snapshot, daily and harmonic power flows. QGIS2RunOpenDSS can be used in Spanish or English. The selection of the language can be done automatically, and it is based on the machine’s Operating System language. Translation has been achieved using QT Linguists. Fig. 2 shows the architecture of QGIS2RunOpenDSS. A user-friendly GUI developed in Qt Designer (formally pre- sented below) is used to introduce key information of the distribution network (e.g., frequency and voltage) as well as to select the type of network study to be carried out. The information is then read so as to upload the network model and input data. Depending on the selected network study, the corresponding workflow (i.e., function that contains the logic of each network study) is performed. QGIS2RunOpenDSS Tr an sf or m er C irc ui t S tu dy 00:00 03:00 06:00 09:00 12:00 15:00 18:00 21:00 00:00 3500 4000 4500 5000 5500 6000 6500 7000 7500 8000 8500 Results Workflow Network2modelUser2interface Figure 2. Architecture of QGIS2RunOpenDSS finally carries out the studies, displays and stores the simu- lation results in a user-predefined folder. QGIS2RunOpenDSS enables users to carry out these studies in a stochastic approach (i.e., Monte Carlo simulations). B. Graphical User Interface (GUI): Input Requirements To perform network studies using QGIS2RunOpenDSS, the GUI shown in Fig. 3 needs to be completed with some electrical parameters of the circuit, which are usually known by engineers. More specifically, users need to: • Select the network to be assessed. • Introduce basic information of the circuit and main trans- former (e.g., voltage, frequency, phase angle and short circuit currents). Default values extracted from the GIS data are used otherwise. • Select the demand curve monitored in the circuit (from historical data). • Select the type of study to be carried out (e.g., snapshot, daily and/or harmonic power flows). • Select the output folder where results will be saved. • Define the number of simulations (if a Monte Carlo approach is to be adopted). C. Network Model When the GUI is filled with the required informa- tion, QGIS2RunOpenDSS imports the corresponding network model. This is selected from a previously created database, which has been produced here using the tool developed in [8]. QGIS2RunOpenDSS uses the input information to create a master file. Based on architecture of OpenDSS, this file contains the circuit definition (e.g., voltage, frequency and main transformer) and redirects the files previously created (WireData, Config Lines, Loadshapes, Lines, Transformers and Loads). For instance, if the distribution network shown in Fig. 4, which contains high voltage (HV), MV, and LV networks, is converted to OpenDSS files, the master file for this circuit will contain the information shown in Fig. 5. QGIS2RunOpenDSS then reads the input data, which corre- sponds in this paper to a pool of daily, real domestic load profiles (15-min resolution, i.e., 96 points). This pool was created using information from the utilities. In future studies, data for industrial, commercial and electric vehicle [14] loads, as well as photovoltaic generation can be used to produce different load/generation pools. To illustrate the input data used here, Fig. 6 shows four domestic load profile examples with different energy consumptions, as well as the average demand of the pool. Note that the average peak demand (circa 0.60 kW) occurs approximately at 6:00 pm. D. Workflows for Network Studies This section provides some details of the routines imple- mented in Python to perform network studies. The routines are based on OpenDSS architecture. The results to be dis- played and stored are arbitrarily selected; however, this can be changed as per utility’s needs. As discussed in Section V, a plugin to visualize the results in QGIS is under development. 1) Snapshot Power Flow: QGIS2RunOpenDSS can be used to carry out instantaneous power flows. This assessment is useful to understand the network conditions during a specific instant of the day (e.g., peak demand and minimum load). This approach, however, might result in under or overestimation of network impacts, particularly when considering the variability of renewable energy sources (e.g., photovoltaic systems) and loads (e.g., electric vehicles). To solve snapshot power flows, the user also needs to select the corresponding snapshot box (see Fig. 3) and define the date (dd/mm/yyyy) and time (hh:mm) of the simulation, which are used in a load allocation algorithm implemented in the plugin. The load allocation algorithm allows matching the aggregated demand of customers and losses with the monitored demand of the whole circuit. QGIS2RunOpenDSS allows assessing any instant of the day. Due to the nature of the input data (15-min resolution), snapshot simulations can be performed every quarter of an hour (i.e., 0, 15, 30 and 45 min). This can be adapted so as to consider other input data resolution. If the user sets a time that is different to the resolution of the simulation, the plugin finds the nearest available simulation point and the user is notified of the change. For instance, if the user defines 18:05, the simulation will actually be executed for 18:00. Simulation results are displayed and saved in *.csv files in the folder predefined by the user (a default folder is defined otherwise). In this folder, a sub-folder named snapshot (i.e., in \user defined folder\snapshot\) is created to store the results. 2) Daily Power Flows: QGIS2RunOpenDSS can also per- form time-series daily power flows. This assessment is crucial to quantify the impacts of variable sources and loads. To solve daily power flows, the user needs to define the basic infor- mation of the circuit, as well as to select the corresponding daily box (see Fig. 3). The date (dd/mm/yyyy) of the year to be assessed must also be defined, so as to perform the load Figure 3. Graphical User Interface of QGIS2RunOpenDSS HV MV SOURCEBUS BUSMV5 BUSMV4 BUSMV2 BUSMV1 BUSMV3 BUSMV6 BUSLV1 BUSLV2 BUSLV3 BUSLV4 BUSLV5 BUSLV6 LVMV Figure 4. Example distribution network clear New Circuit.Test_circuit set defaultbasefrequency=60 Edit Vsource.Source BasekV=___ pu=___ angle=___ ~ frequency=___ phases=___ MVAsc3=___ MVAsc1=___ New transformer.HVMV phases=___ windings=___ ~ buses=[sourcebus,BUSMV1] conns=[wye,wye] ~ kvs=[___,___] kvas=[___,___] ~ xhl=___ maxtap=___ mintap=___ redirect WireDataAAAC.dss redirect WireDataAAC.dss redirect WireDataACSR.dss redirect WireDataCU.dss redirect Config_Lines.dss redirect LoadShapes.dss redirect LinesLV.dss redirect LinesMV.dss redirect LoadsLV.dss redirect ServicesLV.dss redirect Transformers.dss Figure 5. Sentences for defining a circuit in the plugin 0h 2h 4h 6h 8h 10h 12h 14h 16h 18h 20h 22h 24h Time 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 A ct iv e P o w e r, k W 125 kWh/month 136 kWh/month 186 kWh/month 267 kWh/month Average Figure 6. Example of domestic load profiles allocation algorithm. The load allocation is carried out here simulation point by simulation point (i.e., every 15 min). Once the daily power flow is solved, the results are displayed. The plugin also stores the results in *.csv files in the user-defined folder or default path (i.e., in \user defined folder\daily\). 3) Harmonic Power Flows: QGIS2RunOpenDSS can also perform harmonic power flows. This study is crucial to assess the quality of the service as well as to understand the impact of harmonic distortion produced by loads and sources on distribu- tion networks. This also allows determining the propagation of current components of frequency other than the fundamental and the resultant distortion on the voltage waveform. This assessment is today even more important due to the increasing adoption of new technologies with converters. To solve harmonic power flows, the user needs to define the basic information of the circuit, to select the harmonic analysis box (see Fig. 3), to specify the number of harmonics to be assessed and to define the spectrum of each load and Substation HV/MV LV overhead line LV underground cable MV overhead line MV underground cable Legend Figure 7. Real Costa Rican circuit used to illustrate QGIS2RunOpenDSS source. As before, the simulation results are displayed and the plugin stores the results in *.csv files in the user-defined folder or default path (i.e., in \user defined folder\harmonics\). IV. ILLUSTRATION OF QGIS2RunOpenDSS This section illustrates the results obtained using QGIS2RunOpenDSS for each type of study. To do so, the real distribution network shown in Fig. 7 is used. This network is available in the GIS database of one of the largest power utilities in Costa Rica. This network is operated radially, and it consists of several transformers, MV segments and LV segments supplying 13,324 customers. The OpenDSS model of this network has 2,194 MV buses and 22,490 LV buses. Times reported below are based on a PC Intel R© Core i5, 4GB RAM, 32 bits. 1) Snapshot Power Flows: Fig. 8 shows the normalized frequency of occurrence of voltages at all 13,324 customer connection points for an arbitrarily selected day at 6:00 pm (peak time in Costa Rica). A snapshot simulation takes on average 2.3 s. This includes the time needed in the load allocation algorithm. QGIS2RunOpenDSS can also display the current and voltages through monitored transformers and/or lines. This, however, is not presented in this work. It must be mentioned that the above analysis can be performed in a Monte Carlo approach, and QGIS2RunOpenDSS will quantify the average results with one standard deviation. 2) Daily Power Flows: Fig. 9 shows the active power demand monitored in the actual circuit through the main transformer, as well as the active power demand simu- lated using QGIS2RunOpenDSS through the same asset. The daily simulation (in a 15-min resolution) takes on average 50 s, including the runtime of the load allocation algorithm. QGIS2RunOpenDSS allows users to export the simulation results of any element (transformer, line and/or cable) in the 1.13 0.26 1.43 4.51 18.18 73.76 0.69 0.00 0.00 0.00 0.00 0.00 0.04 0.94 0.96 0.98 1.00 1.02 1.04 1.06 Voltage (p.u.) 0 20 40 60 80 N or m al iz ed F re qu en cy (% ) Figure 8. Normalized frequency of customer voltages in snapshot power flow 0h 2h 4h 6h 8h 10h 12h 14h 16h 18h 20h 22h 24h Time of day 6 8 10 12 14 16 18 Ac tiv e Po w er (M W ) Real demand Simulated demand Figure 9. Demand through the main transformer in a daily power flow circuit. For this, the user only needs to select the corresponding monitor from the pull-down list of monitors. 3) Harmonic Power Flows: Fig. 10 shows the distribution of harmonics spectrum calculated at the main transformer that supplies the circuit shown in Fig. 7. This distribution has been found for an arbitrary day during peak time (i.e., 6:00 pm). A harmonic power flow takes on average 20 s for 25 harmonics. It can be noted that QGIS2RunOpenDSS can 1 3 5 7 9 11 13 15 17 19 21 23 25 Harmonic number 0 10 20 30 40 50 R M S Cu rre nt (A ) Phase A Phase B Phase C Neutral Figure 10. Distribution of harmonics during peak time Table I TOTAL HARMONIC DISTORTION FOR VOLTAGE AND CURRENT THDV THDI Phase A 0.47 19.18 Phase B 0.25 18.82 Phase C 0.35 21.09 calculated harmonics in each phase as well as in the neutral. QGIS2RunOpenDSS also calculates the total harmonic dis- tortion (THD) for both voltages (THDV) and currents (THDI). To illustrate this, Table I shows THDV and THDI, per phase, monitored at the main transformer of the circuit. QGIS2RunOpenDSS is also capable of determining the Total Demand Distortion, though this is not shown in this work. V. DISCUSSION QGIS2RunOpenDSS can perform, so far, snapshot, daily and harmonic power flows. However, additional network analyzes can be introduced so as to provide a wider range of possibil- ities to understand the electrical behavior of the distribution network. Indeed, the University of Costa Rica is working to provide in the near future the possibility to carry out yearly power flows, short circuit analyzes and network losses quan- tification. In addition, although QGIS2RunOpenDSS allows storing results, a new tool that enables engineers to visualize the results in GIS environment is currently under development. Finally, it must be mentioned that this simulation tool will be used by the eight distribution companies in Costa Rica to assess the future penetration of low carbon technologies in their distribution networks. VI. CONCLUSION This paper has presented an OpenDSS-based simulation tool in an open source GIS environment (i.e., QGIS) that enables engineers to perform different network studies ranging from snapshot to harmonic power flows. QGIS2RunOpenDSS enables power utilities to rapidly and adequately assess their distribution networks. QGIS2RunOpenDSS requires limited input information to carry out these complex studies, thus the daily network analyzes performed by engineers is facilitated. The creation of this simulation tool not only allows power utilities assessing their existing networks, but it also enables them to understand the hosting capacity of their circuits, and to study the impacts and future interactions of new technologies with the distribution network. Moreover, it is likely that the tools being developed at the University of Costa Rica will also help quantifying the benefits of future Smart Grid schemes (e.g., demand side management programs). The performance of the simulation tool has been demon- strated on a real circuit in Costa Rica with more than 10,000 customers. The illustrations presented here have highlighted the efficiency of the tool to perform network studies, display and store the corresponding results. VII. ACKNOWLEDGEMENTS The authors would like to thank Mr. Rau´l Ferna´ndez and Mr. Guido Godı´nez, affiliated to CNFL, for providing the GIS database of the analyzed circuit. REFERENCES [1] IEA, “Energy Technology Perspectives,” International Energy Agency, Tech. Rep., 2015. [Online]. Available: http://www.iea.org/etp/etp2015/ [2] IPCC, “Climate change 2014: Impacts, adaptation, and vulnerability,” Intergovernamental Panel on Climate Change, Tech. Rep., 2015. [3] A. Navarro-Espinosa and L. F. Ochoa, “Probabilistic impact assessment of low carbon technologies in LV distribution systems,” IEEE Trans. Pow. Syst., vol. in Press, pp. 1–12, 2015. [4] J. Quiros-Tortos, L. F. Ochoa, S. Alnaser, and T. Butler, “Control of EV charging points for thermal and voltage management of LV networks,” IEEE Trans. Pow. Syst., vol. in press, pp. 1–11, 2015. [5] G. Shirek, B. A. Lassiter, W. Carr, and W. H. Kersting, “Modeling secondary services in engineering and mapping,” IEEE Transactions on Industry Applications, vol. 48, no. 1, pp. 254–262, Feb. 2012. [6] R. Dugan and T. E. McDermott, “An open source platform for collab- orating on smart grid research,” in IEEE PES General Meeting, 2011. [7] Python Software Foundation, Python Language Reference, version 3.5. [Online]. Available: http://www.python.org [8] P. Quesada, A. Arguello, J. Quiros-Tortos, and G. Valverde, “Distribution network model builder for OpenDSS in open source GIS software,” in IEEE PES Transmission and Distribution Latin America, 2016. [9] R. Torquato, Q. Shi, W. Xu, and W. Freitas, “A monte carlo simulation platform for studying low voltage residential networks,” IEEE Trans. Smart Grid, vol. 5, no. 6, pp. 2766–2776, Nov. 2014. [10] D. Montenegro, M. Hernandez, and G. Ramos, “Real time OpenDSS framework for distribution systems simulation and analysis,” in IEEE PES Transmission and Distribution Latin America, 2012. [11] A. Awad, P. Bazan, and R. German, “SGsim: A simulation framework for smart grid applications,” in IEEE International Energycon, 2014. [12] P. Bolstad, GIS Fundementals, a First Text on Geographical Information Systems, 4th ed. Minnesota EEUU: Eider Press, 2002. [13] QGIS, PyQGIS developer cookbook, February 2016. [Online]. Available: http://docs.qgis.org [14] J. Quiros-Tortos, L. F. Ochoa, and B. Lees, “A statistical analysis of EV charging behavior in the UK,” in IEEE Innovative Smart Grid Technologies - Latin America, 2015.