Power engineering researchers have introduced Harmony, an open-source symbolic and numerical framework implemented in C++ designed to streamline the modeling, simulation, steady-state optimization, and stability assessment of alternating current and multi-terminal direct current hybrid power systems. As modern electrical grids increasingly incorporate large-scale renewable generation facilities such as wind and solar farms, voltage source converter technology has become central to managing flexible power integration, efficient electrical conversion, and long-distance transmission across interconnected networks. However, the widespread deployment of converter interfaces introduces complex physical and dynamic interactions among distributed converter control loops and surrounding electrical networks, creating notable operational challenges. To evaluate these phenomena reliably, power system engineers traditionally depend on a broad assortment of analytical methodologies, spanning dynamic phasor simulation, continuous-time state-space derivation, small-signal harmonic stability assessment, and mathematical optimal power flow routines.
Historically, conducting these varied grid evaluations has required deploying separate software packages, each tailored exclusively to an individual analytical objective. For instance, small-signal stability assessment and impedance characterization are frequently conducted using specialized tools like the Python-based Z-tool or the Julia-based package PowerImpedanceACDC.jl. Similarly, optimal power flow studies across alternating current and direct current networks often rely on Julia implementations like PowerModelsACDC.jl or specialized Python packages such as pyflow_acdc. While these domain-specific utilities have demonstrated strong individual performance, relying on fragmented tools obliges engineers to construct redundant network models and repeatedly execute tedious data translation routines. This repetitive workflow increases software engineering overhead and regularly introduces mathematical inconsistencies across distinct analysis stages, particularly as circuit topologies scale up in complexity.
A more fundamental obstacle identified by the development team is the preservation of consistent mathematical abstractions across disparate formulation paradigms. Power system analysis methods require fundamentally different mathematical models derived from the same underlying physical network: harmonic stability evaluation often utilizes frequency-dependent equivalent admittance matrices, small-signal stability relies on state-space matrices, and optimal power flow utilizes algebraic optimization constraints. Deriving each representation manually through separate software environments demands substantial human intervention, is prone to transcription errors, and creates severe software maintenance burdens. Harmony resolves this fragmentation by establishing an automated symbolic-numerical bridge, allowing users to define a component-based electrical network once and automatically generate corresponding nodal admittance matrices, state-space representations, dynamic phasor formulations, and optimal power flow equations within a unified computational environment.
Architecturally, Harmony adopts a hierarchical, modular, object-oriented design organized across three distinct primary layers: the Network layer, the Element layer, and the Solver layer. At the top level, the Network layer models the electrical infrastructure as an interconnected graph comprising buses and physical devices stored within hash maps to achieve rapid element access. Every bus represents an electrical node with one pin for direct current systems or multiple pins for multiphase alternating current systems. Circuit topologies are assembled by binding component terminals to designated buses through dedicated connection methods. To integrate cleanly with preexisting industrial and research workflows, Harmony accepts network descriptions directly through a built-in modeling interface, parses custom structured JavaScript Object Notation files, or imports comma-separated values files conforming to widely used power system conventions similar to the MATPOWER data structure.
The foundational physical representations within Harmony reside inside the Element layer, which provides an abstract base class for all electrical component models. Derived classes fulfill two primary interfaces: an admittance calculation routine that evaluates the component terminal admittance matrix at a specified frequency, and an equation stamping routine that registers the component contribution into a modified nodal analysis system utilized for symbolic state-space derivation. Component admittance parameters can be declared as explicit numerical matrices or expressed as symbolic functions of angular frequency via the SymEngine symbolic mathematics library, enabling unified evaluation across continuous frequency spectra. Harmony provides an extensive built-in library of models spanning passive branches such as resistors, inductors, capacitors, and coupled multi-phase branch impedances; standard three-phase transformers and real-transformer models capturing winding phase shifts and voltage ratios; lumped and distributed transmission lines and cables; constant power and series loads; conventional alternating and direct current sources and synchronous generators; switching devices; renewable wind turbines and aggregated solar plants; and power electronic converters including detailed modular multilevel converter models.
Above the component definitions, the Solver layer provides dedicated analysis modules that directly ingest the common network representation and shared data structures. The optimal power flow module utilizes the PowerFlow class and formulates the nonlinear alternating current and direct current dispatch problem through either second-order cone programming relaxations or strengthened mixed-integer second-order cone programming formulations, solving the resulting optimization problems through the Gurobi C++ application programming interface. The dynamic phasor simulation module, known as DQsym, extends rotating-reference-frame dynamic phasor formulations into C++, representing electrical quantities as time-varying Fourier coefficients that evolve slowly relative to grid carrier frequencies. This enables substantially larger numerical simulation time steps than conventional full electromagnetic transient approaches. Furthermore, Harmony incorporates automated continuous-time state-space extraction through modified nodal analysis stamping and SymEngine-based symbolic reduction, producing state matrices that directly facilitate participation factor analysis, eigenvalue calculation, and control system design.
To assess stability in power electronic dominated networks, Harmony features an advanced impedance-based harmonic stability estimation module based on harmonic resonance mode analysis and adjusted modified nodal analysis techniques. Operating upon the assembled network, the module partitions the complete grid at designated converter interfaces into decoupled alternating current and direct current subnetworks. It then systematically reduces each subnetwork to derive its equivalent admittance matrix across swept frequency ranges. By combining these subnetwork admittances with linearized converter admittance models, the module constructs interface return-ratio transfer matrices. Harmony subsequently evaluates these matrices across user-configured frequency bands, producing interactive Bode and Nyquist plots through an integrated graphics library to facilitate graphical resonance screening and robust stability margin verification without requiring external visualization tools.
The researchers demonstrated the operational accuracy of Harmony through several concrete engineering test cases bundled with the software distribution. In one benchmark evaluating dynamic phasor simulation, the authors analyzed a simplified hybrid power system based on a modular multilevel converter connecting a three-phase alternating current bus to a two-terminal direct current bus equipped with representative voltage sources. Following initialization, Harmony automatically extracted the continuous-time state-space equations, executed the dynamic simulation within the DQsym solver, and reconstructed time-domain electrical waveforms in the abc phase frame. Tracked dynamic variables included differential arm currents, common-mode arm currents, differential capacitor voltages, and common-mode capacitor voltages. When compared against reference electromagnetic transient simulations executed in MATLAB, the dynamic phasor trajectories tracked the electromagnetic transient reference closely across both transient and steady-state regimes, with residual errors settling into a narrow, bounded band once switching initialization transients decayed.
To evaluate the harmonic fidelity of the dynamic phasor solver quantitatively, the researchers performed fast Fourier transform decomposition on the differential arm current waveforms produced by both models under a harmonic truncation order set to five. The comparative analysis demonstrated close agreement between the MATLAB electromagnetic transient reference and Harmony across all retained harmonic frequencies. Specifically, the fundamental 50-hertz component exhibited an identical magnitude of 100.00 percent and an identical phase angle of negative 68.3 degrees in both implementations. Higher harmonic components closely matched: the second harmonic at 100 hertz registered a relative magnitude of 51.83 percent and a phase of negative 7.0 degrees in both models, the third harmonic at 150 hertz showed 27.75 percent magnitude and negative 2.0 degrees phase, while the nineteenth harmonic at 950 hertz registered 3.84 percent magnitude with identical 3.2 degrees phase. Across the entire spectrum, both methods yielded an identical total harmonic distortion figure of 71.07 percent, confirming that the dynamic phasor module accurately captures harmonic profiles within the specified truncation limit.
In another demonstration case, the researchers showcased an integrated three-step workflow coupling steady-state optimization directly with small-signal stability evaluation for a point-to-point hybrid grid containing two modular multilevel converters, sending-end sources, transmission lines, and receiving-end loads. In the initial step, the optimal power flow module solved the network operating state, printing computed bus voltages, branch flows, converter injections, and system power losses. In the second step, the solver updated the internal equilibrium operating points of the converter models using the optimization results, computing the internal state variables required for small-signal linearization. In the final step, the stability module calculated the small-signal converter admittances and equivalent network impedances at the newly determined operating point, generating frequency-domain transfer functions and interactive Bode and Nyquist plots. This automated coupling eliminates the manual transfer of operating points between distinct steady-state and dynamic tools, although the authors noted that operating points derived from relaxed optimal power flow formulations may exhibit minor deviations from exact nonlinear optima.
To validate the accuracy of component-level linearization, the authors benchmarked the modular multilevel converter small-signal admittance derived by Harmony against PowerImpedanceACDC.jl, an established open-source tool developed in Julia. Evaluating 200 logarithmically spaced frequency samples across a range from 1 to 1000 hertz, the researchers calculated relative Frobenius-norm errors between the resulting three-by-three admittance matrices. The benchmark demonstrated tight numerical agreement across the entire frequency range, reporting a mean relative error of 0.08 percent, a median relative error of 0.09 percent, and a maximum relative error of 0.14 percent. At specific sample frequencies of 1, 50, 100, 500, and 1000 hertz, the relative discrepancy remained constant at 0.10 percent, confirming that the symbolic-numerical linearization implemented in Harmony accurately reproduces small-signal admittance behavior without introducing numerical distortion.
Computational efficiency benchmarks were conducted on a personal computer equipped with a twelfth-generation Intel Core i9 processor, comparing Harmony against equivalent script implementations in Python and Julia across five repeated trials per test. In a dynamic phasor simulation benchmark of an RLC circuit, Harmony achieved an execution runtime of 0.084 seconds with a peak memory footprint of 18.8 megabytes, whereas an equivalent Python and NumPy implementation required 4.714 seconds and 32.1 megabytes of memory, and a Julia implementation required 0.078 seconds but consumed 375.9 megabytes of peak memory. In an optimal power flow benchmark evaluated on a mixed alternating current and direct current test grid using second-order cone programming, Harmony utilizing the Gurobi C++ interface completed the solve in 3.464 seconds with a compact peak memory usage of 0.8 megabytes. By contrast, a Python implementation using Pyomo took 5.063 seconds and consumed 2.6 megabytes, while a Julia implementation using JuMP achieved a faster runtime of 0.799 seconds but required 129.4 megabytes of memory, illustrating that Harmony provides an advantageous balance between execution speed and memory conservation.
The developers emphasize that implementing Harmony in standard C++17 provides substantial practical advantages, enabling the compilation of high-performance standalone executables and shared libraries that run without external programming language interpreters or virtual environments. To ensure user accessibility, the software incorporates a structured CMake build system, a Conda-based dependency environment, comprehensive developer documentation, terminal execution scripts, and an interactive graphical user interface built with ImGui and ImPlot. The research team identified several avenues for future enhancement, including broadening the component model library to incorporate advanced grid-forming converter controls and communication delays, developing tighter optimal power flow relaxations with integrated stability constraints, strengthening numerical diagnostics for ill-conditioned network matrices, and expanding automated data exchange interfaces for industrial grid formats.
Subject of Research: Symbolic and numerical framework for modeling and stability analysis of AC/MTDC hybrid power systems
Article Title: Harmony: A symbolic–numerical framework for modeling and comprehensive analysis of AC/MTDC hybrid power systems
Article References: Li, H., Alsarayreh, S., Kermansaravi, A., Quintero, Y., Dimitrovski, R., & Lekić, A. (2026). Harmony: A symbolic–numerical framework for modeling and comprehensive analysis of AC/MTDC hybrid power systems. SoftwareX, 36, Article 103243. https://doi.org/10.1016/j.softx.2026.103243
Image Credits: AI Generated
DOI: 10.1016/j.softx.2026.103243
Keywords: Harmony framework, hybrid power systems, voltage source converters, multi-terminal direct current, dynamic phasor simulation, harmonic stability assessment, optimal power flow, modified nodal analysis, state-space modeling, modular multilevel converters, SymEngine, Eigen, Gurobi Optimizer, DQsym, PowerImpedanceACDC.jl, second-order cone programming, power grid simulation
News Source: Denise Maddox. (November 22, 2026). Harmony Framework Unifies Modeling and Stability Analysis for Hybrid Power Grids. Scienmag.



