Package: hynet
Welcome tohynethynetis a package for the computation of the optimal power flow (OPF) in hybrid AC/DC power systems, i.e., the cost- or loss-minimizing allocation of generation resources and the corresponding system state to serve a given load while satisfying the system's technical boundary conditions.hynetsupports power systems that comprise an arbitrary interconnection of AC grids and radial DC grids, i.e., point-to-point and radial multi-terminal HVDC systems. With respect to OPF methods, it supports the solution of the nonconvex quadratically constrained quadratic program (QCQP) as well as its semidefinite relaxation (SDR) and second-order cone relaxation (SOCR). For more information, please refer tohynet's documentation (HTML/PDF) for a description the software andthis publication(preprint) orthis dissertationfor the mathematical background.hynetusesSQLite-based SQL databases to store grid infrastructure and scenario information. A library with several grid databases is providedhere.Installationhynetwas developed for Python 3.5 and higher and requiresNumPy,SciPy,pandas,SQLAlchemy,Matplotlib,tqdm,h5pyas well as at least one of the supportedsolvers. For a convenient installation, the Python distributionAnaconda(or the stripped-downMiniconda) may be used, where the included package managerCondasupports a straightforward installation of the supported solvers.To installhynetusing Python's package management system, runpipinstallhynetThe installation ofhynetand the installedsolverscan be tested withpython-mhynettestTo installhynetfrom its sources, get the latest source code by cloning thehynetrepository withGitviagitclonehttps://gitlab.com/tum-msv/hynet.gitand initiate the installation withpythonsetup.pyinstallSolversIn the following, the supported solvers are listed.Currently, the utilization of the following solvers is recommended: IPOPT for the QCQP, MOSEK for the SDR, and MOSEK or CPLEX for the SOCR.Regarding the latter, it was found empirically that CPLEX is more robust while MOSEK is computationally more efficient. Please note thateven if only QCQPs are solved, it is recommended to install MOSEK or CPLEX, as they enable the efficient computation of an initial point for QCQP solvers.IPOPTIPOPTis an open-source software package for large-scale nonlinear optimization andCYIPOPTis a Python wrapper for IPOPT. WithConda, both can be installed as follows.Linux and MAC OS X:condainstall-cconda-forgecyipoptWindows:condainstall-cpycalphadcyipoptMOSEKMOSEKis an interior-point optimizer for large-scale conic optimization problems. It is commercial, but offers afree academic license. WithConda, MOSEK can be installed withcondainstall-cmosekmosekhynet's SDR solver interface for MOSEK supports achordal conversionof the semidefinite program to enable the computation of the SDR for medium- and large-scale systems with a viable computational effort. To utilize the chordal SDR,CHOMPACK, a library for chordal matrix computations, andCVXOPT, a Python package for convex optimization, are required. With Python's package management system, both can be installed withpipinstallchompackcvxoptIBM ILOG CPLEXCPLEXis a high-performance mathematical programming solver for linear, mixed integer, quadratic, and quadratically constrained programming problems. It is commercial, but offers afree academic licensethrough theIBM Academic Initiative. For the installation, please refer to the instructions provided with CPLEX as well as the section "Setting up the Python API of CPLEX" of the CPLEX documentation.PICOShynetsupports the solution of the SDR and SOCR withPICOS. However, the additional modeling layer causes a performance drawback.PICOSis an open-source Python-based modeling language for linear and conic optimization problems. It supports several solvers, including the open-source solverCVXOPT. With Python's package management system, PICOS and CVXOPT can be installed withpipinstallpicoscvxoptPYOMOhynetsupports the solution of the QCQP withPyomo. However, the additional modeling layer causes a performance drawback. Furthermore, the import of Pyomo is demanding andslows down the importofhynetsignificantly, thus the installation is only recommended if Pyomo is actually utilized.Pyomois an open-source optimization modeling language and includes support for the solverIPOPT. WithConda, both can be installed withcondainstall-cconda-forgepyomolibgfortran
condainstall-ccachemeorgipopt_binUsageOpen a terminal, navigate to the directory that contains thegrid databases, and start a Python shell, either the standard shell (python) or a more convenient one likeIPythonorptpython. At the Python command prompt, importhynetviaimporthynetashtTo access the data of the system in the filepjm_hybrid.db, connect to this database usingdatabase=ht.connect('pjm_hybrid.db')The optimal power flow for the default scenario of this system can then be calculated withresult=ht.calc_opf(database)The objectresultcontains all result data. For example, to print a summary, print details of the solution, and access the determined bus voltages, typeprint(result)print(result.details)result.bus['v']By default,hynetselects the most appropriate QCQP solver among those installed. To specify the type of solver explicitly, set thesolver_typeas illustrated below.ht.calc_opf(database,solver_type=ht.SolverType.QCQP)ht.calc_opf(database,solver_type=ht.SolverType.SDR)ht.calc_opf(database,solver_type=ht.SolverType.SOCR)In case that the scenario shall be modified prior to the OPF calculation, it can be loaded explicitly viascenario=ht.load_scenario(database)For example, to set the load at bus 2 to 100MW and 50Mvar, usescenario.bus.at[2,'load']=100+50jThe optimal power flow for this modified scenario can be calculated withht.calc_opf(scenario)For more information and usage examples, please refer to the tutorials inUSAGE.md,hynet's documentation (HTML/PDF), andthis publication(preprint).ContributingContributions tohynetare very welcome.  Please refer toCONTRIBUTING.mdfor more information. In case thathynetis useful to you, we would appreciate if you star this project.CreditsThis software was developed at theProfessur für Methoden der Signalverarbeitung,Technische Universität München(TUM). The principal developer and project maintainer is Matthias Hotz (@matthias_hotz), who would like to recognize the highly appreciated support of the following contributors:Vincent Bode (TUM): Database management, network graph exportMichael Mitterer (TUM): Distributed computation, MATPOWER import, database managementChristian Wahl (TUM): Capability region visualizer, CI configurationYangyang He (TUM): CVXPY and PICOS solver interfaceJulia Sistermanns (TUM): Feature- and structure-preserving network reductionCitationIn case thathynetis used in the preparation of a scientific publication, we would appreciate the citation of the followingwork:M. Hotz and W. Utschick, "hynet:An Optimal Power Flow Framework for Hybrid AC/DC Power Systems," IEEE Transactions on Power Systems, vol. 35, no. 2, pp. 1036-1047, Mar. 2020.The corresponding BibTeX entry is provided below.@article{Hotz2020,
    Author = {Matthias Hotz and Wolfgang Utschick},
    Journal = {IEEE Transactions on Power Systems},
    Title = {\textit{{hynet}:} {A}n Optimal Power Flow Framework for Hybrid {AC}/{DC} Power Systems},
    Year = {2020},
    Month = {March},
    Volume = {35},
    Number = {2},
    Pages = {1036-1047},
    Doi = {10.1109/TPWRS.2019.2942988}}Furthermore, in case that the feature- and structure-preserving network reduction functionality inhynetis utilized, we would appreciate the citation of the followingwork:J. Sistermanns, M. Hotz, D. Hewes, R. Witzmann, and W. Utschick, "Feature- and Structure-Preserving Network Reduction for Large-Scale Transmission Grids," 13th IEEE PES PowerTech Conf., Milano, Italy, Jun. 2019.LicenseBSD 3-clause license