1. Introduction
Static, quasi-static, and dynamic models with an appropriate simulation environment play an important role in having good insight into the planning and operation of electric power systems. In recent times, various open-source applications and packages have been developed by researchers to open up the electric power systems modelling and simulation domain. The electric power systems modelling and simulation space is traditionally dominated by commercial applications such as DigSilent, PSS, ETAP, PSCAD, PowerWorld and MATLAB. In cases where there is a need for validation, the coordination of protection devices, and hardware-in-the-loop, platforms that have real-time simulation capabilities are often platforms of choice. IIRTDS and Opal-RT are popularly used for such purposes. Real-time co-simulation for power system monitoring, control, and protection based on eMEGAsim, MATLAB/Simulink, and the Python programming language was implemented in [
1]. Similarly, the simulation of a large-scale power system with distributed generation was conducted using HRTSim and Hypersim in [
2,
3], respectively.
A review of power system analysis software tools in [
4] is skewed toward commercial tools. Most commercial tools do not have once-off payment policy. There are cost implications for upgrades, add-on tools, and product support on license bases which could be yearly or for a specific period of time. In addition, product support is mostly relevant to industrial-based users, not researchers that are usually on the bleeding edge of algorithms and models development. The rationale for open source power system modelling, simulation, and analysis packages is presented in [
5]. Consequently, there are a number of toolboxes and packages in traditional programming languages, interpreted programming languages, or domain-specific languages.
Dynamic power grid simulation (GridDyn) [
6] is written in C++ with a focus on cross-platform simulation, ease of extension, and coupled with other simulation platforms. MATPOWER [
7] and Power System Analysis Toolbox (PSAT) [
5] are Matlab or GNU/Octave-based toolboxes. MATPOWER was developed for static analysis such as ordinary power flow, optimal power flow, and continuation power flow. Similarly, PSAT is capable of most of the static analysis that can be performed by MATPOWER with the addition of dynamic simulation and analysis such as small-signal stability analysis, and time-domain simulation. MATLAB is a proprietary simulation platform that requires licensing. This has consequently led to the development of power system modelling, simulation, and analysis packages in other open-source platforms such as Python, Open-Modelica, and Julia. Pandapower [
8], PyPSA [
9], and ANDES [
10,
11] are a few of the packages developed in Python for static analysis, quasi-static analysis, optimisation, and time-domain simulations. PyPSA can be used for optimisation in electric power systems over time horizon. Pandapower can also be used for quasi-static multi-time horizon optimisation, simulation, and analysis. It also has features for analysis such as state estimation, topological graph searches, and short-circuit calculations. Unlike PyPSA and Pandapower, ANDES was developed for dynamic analysis, time-domain simulation, and analysis based on a symbolic framework. It is generally used for analysis such as small-signal and transient stability analyses.
The Python programming language provides a platform a substantial range of matured packages in scientific computing, data science, and machine learning, just to mention a few. It can also easily be used for rapid prototyping; however, the speed at which series of simulations can be completed is a major challenge. The Julia programming language is now a serious contender in scientific computing [
12,
13]. Though it is an interpreted language, its speed is comparable to traditional programming languages like C, C++, FORTRAN and various flavours of Pascal. Consequently, there are now some reincarnations of power systems modelling, simulation, and analysis packages for static, quasi-static, and dynamic simulations, as well as time-domain simulations. These include packages that are developed for ordinary power flow, optimal power flow and continuations power.
There are already a number of packages in Julia that can be used for the representation of electric power systems static data and models for ordinary and optimal power flow. PowerModels.jl [
14], PowerSystems.jl [
15], and PowerSimulations. jl [
16] are examples of such packages. PowerModels.jl provides a framework for implementing diverse ordinary power flow, power flow approximations, and optimal power flow algorithms, while PowerSimulations. jl is a Julia package developed for quasi-static power systems simulations with production cost models which are important for electric power utilities operation simulations. PowerSystems.jl provides data containers for quasi-static and dynamic simulation applications.
Apart from packages for static and quasi-static analysis, there are now packages in Julia that can be used for time-domain simulations and dynamic analysis. These include PowerDynamics.jl [
17], RMSPowerSims.jl [
18], and PowerSimulationsDynamics.jl [
19]. It should be noted that the success of most of these packages in Julia is because of the inherent nature of the Julia language numerical and symbolic computing packages ecosystem. Packages such as DifferentialEnquation.jl [
20], ModellingToolkit.jl, Symbolic.jl Diffeqflux.jl [
21], Sundials.jl [
22,
23], BifurcationKit.jl [
24], JuMP.jl [
25], and a host of other packages are more than what a researcher can wish for in developing emerging tools for electric power systems modelling, simulation, and analysis. The Julia packages ecosystem is already feature rich; nevertheless, it is also important to ensure that packages in Julia can be used in a co-simulation framework with tools developed in other programming languages. HELICS [
26] is a co-simulation framework that facilitate co-simulation with federates developed in other languages such as C, C++, and Python.
Energy and power system modelling, simulation, and analysis packages in Julia can roughly be divided into two categories. Static and quasi-static simulation packages, and time-domain dynamic simulation package. Despite the fact that the object under study for most of these packages are electric power systems and its operations, there is still a gap in having a unified data model that can be used for these two categories of packages. ePowerSim.jl is designed to bridge that gap as well as providing a framework for the co-existence of static, quasi-static, dynamic, and time-domain modelling, simulation, and analysis. In addition, it can also be used in a federation of co-simulation. ePowerSim.jl can be used for pedagogy as presented in power engineering textbooks such as [
27,
28] or research work to extend the frontiers of components models.
The paper is organised as follows:
Section 2 presents materials and methods that provide a basis for components models, ordinary differential equations, and differential algebraic equation representations of electric power systems. In
Section 3, a snapshot description of the ePowerSim.jl design and subunits in the package are presented.
Section 4 presents validation of ePowerSim.jl static and dynamic simulation with a real-time digital simulator (RTDS). In
Section 5, the use cases of the package are presented. The conclusion and further enhancement of ePowerSim.jl are presented in
Section 6.
3. Description of ePowerSim Package and Subunits
ePowerSim.jl package is available for download at
https://github.com/DSI-NRF-PENO/ePowerSim.jl (accessed on 19 September 2025) [
30]. The design of the package is divided into eight subunits: (i) variables and parameters indexing; (ii) components parameters aggregation; (iii) models functions and variable symbols; (iv) callbacks generation; (v) results and visualisation; (vi) co-simulation interface; (vii) generic functions; and (viii) system initialisation.
3.1. ePowerSim Components Variables and Parameters Indexing
The indexing subunit is responsible for indexing components, state variables, algebraic variables, components parameters, and control variables. Data in various data format are first converted to json format as shown in
Figure 2. The static components and dynamic components data are subsequently separated for the indexing of algebraic variables, components parameters, and state variables.
3.2. Composition of Components, Variables and Functions in ePoweSim
Creation of a dynamic model of device requires, specification of its state variable symbols, components parameter symbols, state function, output function, init function, and in some cases a callback function. Illustration of codes listing for a generic excitation system are provided in
Appendix A. The graphical formation of a dynamic model is shown in
Figure 3. Similarly,
Figure 4 depicts the formation of a model of a static device. A static device model only requires as inputs, algebraic variable symbols, component parameters symbols, and the algebraic equations that govern the behaviour of the device.
The symbolic name of a component type and its state variable are first declared. This information is subsequently added to the appropriate lists in the component state symbols library. Dictionaries are created to hold init, dynamic, and output functions. The keys of the dictionaries are symbols of the component names.
Adding a new type of device requires creating an init function, dynamic function (state equations), output function and in some cases callback function. Once these functions are created, they should be added to the appropriate lists in the package.
3.3. Composition of Components Parameters Set in ePowerSim
The parameters aggregation subunit is responsible for extracting appropriate parameters from components that are used in specific models. The parameters are subsequently organised in data structures in conjunction with an indexing subunit. The creation of parameters for a model is shown in
Figure 5.
3.4. Composition of Callback Set in ePowerSim
Callbacks in Julia provide a reactive infrastructure for dynamic systems. These systems could be represented in different forms of dynamic equations, ordinary differential equations (ODEs), differential algebraic equations (DAEs), the Bounded Value Problem (BVP), stochastic differential algebraic equations (SDAEs), Delay Differential Equation (DDE), stochastic delay differential equation (SDDE), and stochastic differential equation (SDE) just to mention a few. Of interest to the modelling of power and energy systems and the optimisation of networks are differential algebraic equations (DAEs), stochastic differential algebraic equations (SDAEs), and the stochastic delay differential equation (SDDE). A dynamic model of electric power systems that incorporates the dynamics of generators, control devices, and network equations formulated in power flow formalism intrinsically takes the form of differential algebraic equations. Control of the states and algebraic variables of electric power systems necessitate the use of callbacks.
The callback unit in the package is based on the infrastructure of callbacks in DifferentialEquations.jl. Components that have states with callbacks can define the customised callbacks necessary for states. In addition, another set of callbacks can be added externally to the states event list and states affect list.
A typical event callback parameter requires the specification of an event function, the index of the state in which the event will occur in the system states indices, and the value of the state that constitutes an event. Similarly, affect callback parameters require the specification of the affect function, the index of the state that would be affected by the event in the system states indices, a function, or value of the state, post event. It should be noted that in the design of callback unit for the package, an event can affect the state it occurred in or another state. In addition, some events will require a change in the parameter values in addition to a change in state. Such events will require additional information on the set of parameters that would be changed.
3.5. System Initialisation
A snapshot of the processes involved in the system initialisation is shown in
Figure 6 and
Figure 7. A power flow set point is first calculated based on the operating parameter of a network. The results are then used for dynamic components initialisation as shown in
Figure 6. The details of the dynamic components initialisation process are shown in
Figure 7. The initialisation of a system starts with a call to the system init function. The system init function subsequently requests each dynamic device to initialise based on each device init function. In cases of components that have dynamic sub-components, the request is passed to sub-components to initialise based on each sub-component init function. The initialisation of each component and the sub-components initialisation state are aggregated by the system init unit for system initialisation.
4. Models Validation
A validation process that was used to assess models of an electric power system in the package is presented in this section. The validation of models and output of simulations in the package were performed for both static and dynamic cases. The static performance validation was conducted by comparing the results of the ordinary power flow of IEEE 9 test systems obtained using the package with the result obtained from a real-time digital simulator for electric power systems (RTDS). The dynamic validation was conducted through a sudden increase in active power demand at a node in the IEEE 9 bus and IEEE 14 test systems. The results obtained from RTDS and the package were compared for validation purposes.
RSCAD is a graphical user interface software application that is used for management, configuration, and modelling in RTDS. It has two major interfaces for modelling (Draft) and control (Runtime). Components in the Runtime interface are directly linked to equivalent components in the Draft interface. RSCAD comes with a substantial number of benchmark test systems.
The runtime environment for the IEEE 9 bus and IEEE 16 bus test systems in RSCAD were modified to include a trigger unit to implement a sudden change in load at a bus. The trigger unit is shown in
Figure 8. In general, the simulation time step in RTDS is 50 μs for the real-time simulation and integration of hardware-in-the-loop. Since the validation process is not meant to assess the real-time performance but the validity of the models, a few delays were introduced to ease simulation. The push button PB in
Figure 8 triggers a close event of a circuit breaker in RSCAD Draft interface. When a push on PB is detected by an edge detect
, the output of
resets a timer (T). The output of the timer and trigger time
serve as input to a comparator. Once the clock time exceeds the trigger time, a signal is sent to a circuit breaker to connect a load to a pre-determined bus. The load stays connected for the duration set in the edge detector with pulse duration
. The pulse width of ED2 is set to
. The simulation duration is determined by
in combination with the output of timer
T.
A sudden load change simulation in RTDS was conducted first; subsequently, the event time
of the load change was determined to be
.
was then used as the event time for a sudden load change in ePowerSim.jl. The time step
of output signals from ePowerSim.jl was set to
in order to reduce the amount of output results without appreciably affecting the visualisation of the results. In addition, outputs from RTDS were down sampled to give
of
in order to align the results obtained in RTDS with the one obtained in ePowerSim.jl. The specification of the RTDS used for validation is provided in
Table 1.
4.1. Static Model Validation: IEEE 9 Bus Test System
The ordinary power flow results obtained from the package and RSCAD models are presented in
Table 2 and
Table 3. In addition, the results reported in [
31] are also presented in the tables. It is evident from the tables that the results produced by the package for ordinary power flow is in agreement with RTDS and what was reported in [
31]. Although the phase angle of the slack bus in RTDS result is −30.00°, this does not introduce any significant discrepancies since the relative phase angles of all buses voltages to the phase angle of the slack bus voltage is the same for the results obtained by the package.
4.2. Dynamic Model Validation: IEEE 9 Bus Test System
Similarly, dynamic model validation was conducted by a sudden increase and decrease in the active power demand at node 5 by
within
seconds as shown in
Figure 9. The results obtained for the sudden perturbation of active power demand are presented in
Figure 10a,b and
Figure 11a,b. It can easily be seen that the result obtained from the package is in close agreement with the result obtained from RTDS.
4.3. Dynamic Model Validation: IEEE 14 Bus Test System
A dynamic model validation was also conducted by a sudden increase and decrease in the active power demand at node 10 by
within
seconds as shown in
Figure 12a. The results obtained for the sudden perturbation of active power demand are presented in
Figure 12,
Figure 13 and
Figure 14. An expanded view of change in frequency as a result of perturbation is shown in
Figure 12b. It can easily be seen that the deviation in frequency during the steady state and system perpetuation are
pu and
pu. In addition, the result obtained from the package for voltage magnitude is in close agreement with the result obtained from RTDS, except for the voltage magnitude at bus 14. The difference in the values does not come from the dynamic characteristics of the model but the steady-state values (power flow). The values of the voltage magnitude at bus 14 based on ordinary power flow analysis for ePowerSim and RTDS are
pu and
pu, respectively.
6. Conclusions
In this work, ePowerSim.jl, an open-source package in Julia programming language with co-simulation capability, is introduced for electric power system modelling, simulation, and analysis. The package provides a framework for research experimentation and pedagogical engagement. It conceptually factors electric power system model into two independent units: uniform parameter and index interface; and simulation and analysis-specific algorithms. This enables decoupling the modelling of electric power system components and operational entities from algorithms for specific simulation types. It also ensures that solvers for numerical computation can easily be swapped.
The essential features of ePowerSim presented in this paper are as follows:
A close match between the results obtained in the simulation of an electric power system static and dynamic models in ePowerSim.jl and a real-time digital simulator during validation indicates that the package can be used for experimentation where there is no need for hardware-in-the-loop.
ePowerSim produces comparatively good results for distributed slack power flow and optimal power flow. The package provides a common interface for the modelling, simulation, and analysis of static and dynamic behaviour of electric power systems.
ePowerSim provides a framework for the co-simulation of electric power system models with external dynamic systems and events. This implies that an investigation of the impact of an external dynamic system can be conducted with ePowerSim.
The package already has models of synchronous machines, synchronous condensers, governors, power system stabiliser, automatic voltage regulators, and exciters. Nevertheless, in the future, models of inverters, asynchronous machines, rectifier models and energy storage systems would be added to the package.