 Research
 Open access
 Published:
Quantum–classical cosimulation for smart grids: a proofofconcept study on feasibility and obstacles
Energy Informatics volume 6, Article number: 25 (2023)
Abstract
With the rising complexity of our electricity infrastructure, smart grid simulations increasingly rely on cosimulation, which involves jointly executing independent subsystem simulations. However, in largescale simulation scenarios, such as those involving costly powerflow analysis, cosimulation may experience computationalperformance issues. Quantum computing offers a potential solution through quantum–classical cosimulation, in which one or more simulators of an otherwise classical cosimulation are executed on quantum hardware. However, there is no practical realization of this concept that establishes its feasibility. To address this gap, we integrate a quantum power flow simulator with a smart grid cosimulation and conduct an exploratory simulation study using a fictitious casestudy scenario. The experiments demonstrate the feasibility of quantum–classical cosimulation; at the same time, they highlight four obstacles to the concept’s realization in practice: (1) To use quantum computing for cosimulation, sessionbased scheduling is required. (2) Distributed simulation limits possible applications and requires proximity of computing resources. (3) For the efficient extraction of classical information from the quantum states, we need carefully designed operators. (4) Current hardware limitations—such as noise susceptibility and the lack of quantum random access memory—limit practical nearterm uses of quantum power flow; therefore, attention should be turned to alternative applications that are more promising in the near term. These findings pave the way for future research on quantum–classical cosimulation and its potential applications in smart grids.
Introduction
Modern electricity infrastructure faces various challenges, including the electrification of transport, and climate change. In response to these challenges, smart grids are being developed, which rely on Information and Communications Technology (ICT) for pervasive monitoring and automated control. These smart grids facilitate more efficient utilization of energy, reduce costs, and enable better integration of renewable energy sources, resulting in enhanced resilience and sustainability in electricity production and distribution (Farhangi 2010).
Cosimulation has emerged as a promising paradigm for overcoming these challenges, especially the heterogeneity and transdomain nature of subsystems, as well as their operational independence (Vereno et al. 2023). With cosimulation, independent subsystem simulators are coordinated to simulate the coupled system (Gomes et al. 2018). However, largescale cosimulation with complex simulators can be computationally expensive. Some powersystem problems require repeated execution (e.g. for analyzing different contingency scenarios (Eskandarpour et al. 2020b)), which further exacerbates the computational cost. While cosimulation can be parallelized and distributed (Steinbrink et al. 2018), some subproblems may still be prohibitively expensive. For example, largescale powerflow computations pose significant computational challenges (Yoon and Han 2020).
Quantum computing may provide a solution. It is a novel computing paradigm that harnesses quantummechanical effects for information processing that promises drastic speedup for many fundamental computational problems (Nielsen and Chuang 2010). In recent years, research has identified the potential value of quantum computing for power systems (Eskandarpour et al. 2020a). For example, quantum mixed binary optimization was applied to unit commitment (Koretsky et al. 2021), and the viability for quantum annealingbased phasormeasurement unit placement was analyzed (Jones et al. 2020). Furthermore, a quantum algorithm for solving linear systems of equations—the HHL algorithm (Harrow et al. 2009)—promises exponential speedup of powerflow analysis, both DC (Eskandarpour et al. 2021) and AC (Feng et al. 2021). For more examples on the state of the art of quantum powersystems engineering, see (Ullah et al. 2022) and (Golestan et al. 2023).
Vereno et al. have proposed utilizing the potential of quantum computing in smartgrid cosimulation by introducing quantum–classical cosimulation, where “one or more simulators of an otherwise classical cosimulation are executed on quantum hardware” (Vereno et al. 2023b, p. 2). They specifically propose the use case of applying quantum power flow in a smart grid cosimulation. Quantum–classical cosimulation can be seen as a form of hybrid quantumclassical approaches, as discussed in Endo et al. (2021). Vereno et al. (2023b) only discusses the concept in theory, however, the authors highlight the need for a proofofconcept study to determine its feasibility and to assess its usefulness. In our research, we address this need by conducting an exploratory case studybased proofofconcept study where we integrate quantum power flow in a smart grid cosimulation. We opted for DC power flow in our experiments due to its simplicity and suitability for cosimulation scenarios involving quantum computing. DC power flow is attractive for applications requiring speed, which could benefit especially from quantum speedup. The limitations of quantum AC power flow, such as the need for Quantum Random Access Memory (QRAM) for efficient retrieval of intermediate results (Golestan et al. 2023), further support our decision to use DC power flow instead.
The paper’s two main goals and research contributions are:

1
We provide a proof of concept for quantum–classical cosimulation and its application to smart grids, using a quantum power flow simulator.

2
We identify and assess potential obstacles to the practical implementation of this concept, and their impact on its utility; we further provide recommendations on how to address them.
The next chapter offers background on the involved disciplines of quantum computing, powersystems engineering, and cosimulation. Chapter Research approach describes how the proofofconcept study is conducted. In Experiments, we lay out the experimental setup and show the results. After that, the chapter Discussion of obstacles presents four main issues we encountered in our experiments and ways of addressing them. Finally, we conclude the paper by highlighting the key takeaways and giving an outlook to future research.
Background
This chapter provides an overview of the key concepts and theories relevant to the research. First, a brief introduction to quantum computing is given; it forms the basis for the consequent section on the HHL algorithm, a quantum algorithm for solving systems of linear equations. Then, we cover how said algorithm is used to perform quantum DC power flow analysis. Finally, we explain cosimulation and its application in smart grid applications.
Quantum computing
Quantum computing leverages properties described by quantum mechanics to perform computation (Hidary 2021). The fundamental unit of information in quantum computing is the quantum bit (qubit in short), which is analogous to the bit in classical computing. In contrast to a classical bit, a qubit can exist in a superposition of basis states \(\mathinner {{0}\rangle }\) and \(\mathinner {{1}\rangle }\) which can be described by a linear combination of the basis states with coefficients \(\alpha ,\ \beta \in {\mathbb {C}}\):
When measuring the state of a quantum system, the superposition collapses, resulting in one of the basis states. According to the Born rule (2), the probability of the measurement yielding either basis state is proportional to the square of the corresponding coefficient in the state vector (Born 1926). In other words, by estimating the probability one can make inferences about the superposition coefficients.
To visualize the state of a qubit, the Bloch sphere can be used (see Fig. 1). It is a complex unit sphere where the antipodes correspond to the basis states, and its surface represents all possible states.
Alongside superposition, entanglement and tunneling are two fundamental quantum phenomena that have important applications in quantum computing. These principles are used in generalpurpose circuitbased quantum computing and optimizationfocused quantum annealing. In this paper, we deal with circuitbased computation. A circuit consists of a series of quantum operators (socalled gates) that act on the circuit’s qubits. The width of a circuit refers to the number of qubits it contains, while the depth refers to the number of gates applied to these qubits (these dimensions are illustrated in Fig. 2). As the width and depth of a circuit increase, so does its ability to perform complex computations; this, in turn, requires more precise control which is difficult to achieve in practice.
Recently, there has been a significant development in platforms and tools for quantum programming that provide access to cloudbased quantum hardware. Popular providers are IBM Quantum (2023), Google Quantum AI (2023), and DWave (Systems 2023). This development has facilitated researchers and practitioners to experiment with quantum algorithms and circuits. The steep growth of the discipline increases the need for softwareengineering practices in quantum programming. This trend has led to the emergence of quantum software engineering (Zhao 2020) and architecture (Khan et al. 2022). The development of standardized software development methodologies, design patterns, and software tools will be key to realizing the full potential of quantum computing.
HHL algorithm
The HHL algorithm is a quantum algorithm for solving linear systems of equations by Harrow et al. (2009). It has generated much excitement since it may provide exponential speedup for many problems in science and engineering. Its goal is to prepare a quantum state that encodes the solution to a system of equations.
Given the linear system
where \(A\in {\mathbb {C}}^{N\times N}\) is a square matrix, and \(\vec {b},\ \vec {x}\in {\mathbb {C}}^N\) are vectors. If A is a sparse, wellconditioned Hermitian matrix—meaning it is its own conjugate transpose—the algorithm prepares the normalized quantum state \(\mathinner {{x}\rangle }\) that is an approximate solution to
Figure 3 depicts the circuit for the HHL algorithm, including four quantum registers. It can be subdivided into six main steps (Quantum 2023b):

1
loading the input vector \(\mathinner {{b}\rangle }\) to a quantum register,

2
estimating the eigenvalues of A using quantum phase estimation,

3
adding an ancilla qubit and applying conditioned rotation,

4
performing uncomputation using inverse quantum phase estimation,

5
determining whether the computation was successful by measuring the ancilla qubit, and

6
applying the observable M to query the output state.
The time complexity of the algorithm is \({\mathcal {O}}(\log {(N)}s^2\kappa ^2/\varepsilon )\), where s is the sparsity, meaning at most s nonzero entries per row. Since A is a Hermitian matrix, the condition number \(\kappa\) represents the ratio of largest and smallest eigenvalue \(\frac{\lambda _{\max }}{\lambda _{\min }}\). The precision is given by \(\varepsilon\). Childs et al. (2017) have further improved the scalability from \(\text {poly}(1/\varepsilon )\) to \(\text {poly}(\log 1/ \varepsilon )\). The classical equivalent to the HHL algorithm is the conjugate gradient method; it also approximately solves a sparse, wellconditioned matrix, but exhibits a complexity of \({\mathcal {O}}(Ns\kappa \log {(1/\varepsilon )})\) (Shewchuk 1994).
Despite the potential advantage of the HHL algorithm, it has several caveats and limitations that restrict its practical utility (for a more detailed discussion, see Aaronson 2015). For our research, four caveats are particularly relevant:

1
Expensive state preparation for input vector: To maintain the exponential advantage of HHL, we need a method to prepare the quantum state for \(\mathinner {{b}\rangle }\) (Step 1) that scales at most logarithmically. In theory, quantum random access memory (QRAM)—as described in Giovannetti et al. (2008)—could help with this task (Aaronson 2015), however, it was not yet realized in practice. Alternatively, the algorithm can be used as a subroutine where another component prepares \(\mathinner {{b}\rangle }\) (Harrow et al. 2009).

2
Precise eigenvalue representation: In Step 2, we apply quantum phase estimation to estimate eigenvalues of A by applying the operator \(U=e^{iAt}\); determining a suitable time t can be a difficult task that diminishes the quantum speedup of the algorithm. An inappropriate value negatively affects both the performance and solution accuracy (Shao 2018).

3
Circuit depth and noise susceptibility: The number of required operations and the circuit depth rises drastically as system size increases. Therefore, the noisy nature of current hardware makes larger systems infeasible (Sævarsson et al. 2022).

4
Solution vector extraction: Reading all components of the solution vector would take linear time, which defeats the purpose of HHL’s sublinear performance (Harrow et al. 2009). Often, however, only a subset of information is required. Consequently, we need a way to efficiently extract the required subset of information from the prepared quantum state \(\mathinner {{x}\rangle }\) in Step 6.
Quantum power flow
Powerflow analysis is a fundamental tool in the operation and planning of power systems. It is used to compute the steadystate voltages, currents, and power flows in a network, given the network topology, component parameters, and load demand (Grainger and Stevenson 1994). The analysis can be carried out for both AC and DC power systems.

\(P_i\) and \(Q_i\) are the injections of real and reactive power at bus i

\(V_i\) is the voltage magnitude at bus i

\(\theta _{i,j}=\theta _i\theta _j\) is the voltage angle difference between bus i and j

\(G_{i,j}\) and \(B_{i,j}\) are the conductance and susceptance of the line connecting bus i and bus j
In practice, the nonlinear equations are solved approximately using approaches such as the Newton–Raphson method, where an initial estimate is iteratively refined using linear approximations. However, for some problems, such as transmission system planning and economic dispatch, the nonlinear AC system can be treated as a DC system, under several simplifying assumptions, such as neglecting reactive power flows, voltage magnitudes, and line losses (Purchala et al. 2005). This results in the simplified power flow equation
which can be formulated as an equivalent linear system of equations including the vector of nodal power injections \({\textbf{P}}\), the nodal voltage angles \(\varvec{\uptheta }\) and the susceptance matrix \({\textbf{B}}\). By removing the row and column corresponding to the slack bus, we make \({\textbf{B}}\) invertible:
We can then use the voltage angles \(\varvec{\uptheta }\) to calculate the flow of a specific line \(P_{i, j}\):
Since both AC and DC power flow come down to solving systems of linear equations, they are amenable to be conducted using the HHL algorithm. For quantum AC power flow, Feng et al. (2021) have proposed an approach that was later experimentally realized by Sævarsson et al. (2022). In contrast, Eskandarpour et al. (2021) showed that the HHL algorithm can be used to perform quantum DC power flow. Their work was later expanded with a hybrid approach by Gao et al. (2022).
Smart grid cosimulation
In a cosimulation, independent simulators are coupled that differ regarding their simulation tool, solver algorithm, or step size (Hafner and Popper 2021). The paradigm allows for jointly executing independent simulations to simulate a larger system. It is therefore possible to perform the modeling on the subsystem level “without having the coupled problem in mind” (Schloegl et al. 2015, p. 516). The coupling of the simulators can either be done bilaterally or they can be connected to a central orchestrating framework, yielding orchestrated cosimulation. When a larger number of simulators is involved, this simplifies the simulation architecture (Nguyen et al. 2017). The orchestrating framework has three main tasks: initializing the simulators, synchronizing them, and facilitating data exchange between them (Palensky et al. 2017). A simulator comprises a simulation model together with a simulation kernel for executing it (Denil et al. 2015). For this study, we assume simulators to have the capability of instantiating multiple homogeneous entities; for example, a powerplant simulator can handle multiple simulated power plants, each connected to a different bus in the grid. The topology of data exchange between simulated entities is specified in the simulation scenario.
The emergence of complex cyberphysical systems and systems of systems has brought with it an increased research interest in cosimulation. A broad stateofthe art analysis can be found in Hafner and Popper (2021) whereas Gomes et al. (2018) provide an indepth technical discussion. The simulation paradigm has proven promising in various application domains, among them maritime and automotive engineering as well as robotics (Gomes et al. 2017). The most prominent domain for cosimulation seems to be power grids. Palensky et al. (2017) provide an extensive primer on cosimulation of power systems together with ICT. For an empirical analysis of smart grid cosimulation see (Schweiger et al. 2019) and for a literature review see Mihal et al. (2022).
Cosimulation requires synchronizing simulators with varying step sizes and even time paradigms, e.g. discreteevent or continuous time. It further requires facilitating complex, at times asynchronous, data exchange. Therefore, frameworks are usually used that take care of these difficult tasks and provide interfaces to both connect already developed simulators and also define the scenario. A comprehensive overview of different frameworks can be found in Vogt et al. (2018). One critical aspect of such frameworks is their adherence to the two most important cosimulation standards: First, the HighLevel Architecture enables the reuse and interoperation of simulations (Dahmann 1997). Second, the Functional MockUp Interface (FMI) allows for interchange of dynamic cosimulation models (Blochwitz et al. 2011).
Research approach
This study aims to demonstrate the technical feasibility of quantum–classical cosimulation and identify potential issues. The integration of quantum DC power flow with smart grid cosimulation is the primary area of focus. The evaluation of the integration’s scalability and usability will determine its practical applicability.
Casestudy scenario selection
To conduct the study, an exploratory approach was adopted, which relies on a fictitious casestudy scenario. The scenario involves a highly simplified loadshedding situation, in which a power line in a transmission system is monitored for potential overloads. If an overload is detected, the power of a solar farm is throttled and instead provided by a different generator. The scenario is implemented on a simple 5bus test system, details of which are provided in the next chapter. The scenario was chosen based on the following criteria:

1
Small scale: A 5bus transmission system with a low number of interacting subsystems was used. The limited scale makes it easier to find freely available quantum hardware that is compatible.

2
Low complexity: The scenario was simplified to be suitable for a proofofconcept study; domainspecific aspects are of little relevance. For example, time series replay was used for the solar generation and aggregate loads.

3
Suitability of DC approximation: DC simplification is appropriate for frequently computed line overload detection in transmission systems.

4
Sign negligibility: The direction of flow is not important when monitoring overload. This is necessary since we have no way of efficiently recovering sign information when using HHL.

5
Bidirectionality: The computed line flow is influenced by the other simulators, and vice versa.
Assessment criteria
The study involves the implementation of the chosen casestudy scenario, followed by simulation runs in three main configurations: classical power flow, HHL run on simulated quantum hardware, and HHL run on real quantum hardware. The results obtained from each configuration will be compared to evaluate the accuracy and usefulness of quantum–classical cosimulation for realworld applications. Although the primary motivation for quantum–classical cosimulation is to make smart grid cosimulations faster, the timing analysis is not the main criterion at this stage of research. This is because of the overhead introduced by cloudbased quantum computing in a smallscale scenario, which vastly outweighs the potential advantage of improved scalability. Furthermore, the current implementation does not fully realize the logarithmic scalability promised by HHL due to inefficient circuit preparation (HHL caveat 1 in the background section on HHL algorithm). In addition to discussing timing aspects, the evaluation will also qualitatively assess how well the quantum solutions correspond to the classical ones, with an emphasis on feasibility not quantitative analysis. The main focus of the study is to use the implementation and simulation runs to identify and assess potential issues to determine the utility of the concept for near to midterm applications with realworld grid sizes.
Designing observables for information extraction
A central goal of DC power flow is computing the flow of active power for transmission lines based on grid characteristics and nodal injections. This computation is usually done via the voltage angles, which are then used to compute line flows. Since (at least) one bus—in our case Bus 0—serves as a slack bus and is therefore our reference angle with \(\theta _0=0\), our goal is to find the remaining angles
With the HHL algorithm we can approximately prepare a normalized quantum state
In order to use the results of the algorithm in any classical routine, we have to extract information from the quantum state via measurement. Specifically, we have to apply an operator M (represented by a square matrix) to compute
To retrieve the \(k{\rm{th}}\) element of \(\mathinner {{x}\rangle }\) (which corresponds to \(\theta _{k}\)) we can use a diagonal matrix with a single 1 at position k:
For example, to retrieve \(x_3\) we can perform the computation
yielding the square of \(x_3\). Note that the information on the sign is lost. Consequently, we cannot distinguish a negative or positive voltage angle in relation to the reference angle \(\theta _0\). This is a critical issue, since we cannot get an accurate estimate of a line flow if the angles of the involved buses differ in sign. Therefore, we use an alternative approach: We design the observable in a way that extracts the differences of two coefficients in the state vector \(\mathinner {{x}\rangle }\). Consider how to compute the power flow \(P_{k,l}\) of the transmission line connecting buses k to l:
Therefore, if we are able to compute \(x_lx_k\) we are able to estimate the magnitude of the line flow \(P_{k,l}\). To extract the difference, we define the matrix
If we want to compute the voltageangle difference between the slack bus and any other bus, we end up with a matrix as defined in (13). To illustrate, let us estimate the magnitude of the line flow between Bus 2 and Bus 3 which correspond to \(x_2\) and \(x_3\); therefore, \(k=2\) and \(l=3\). Computing F(x) yields
which we can take the square root of to receive \(x_3x_2\). As in (15) we can multiply by \(B_{2,3}/\varvec{\uptheta }\) to get the magnitude of the line flow \(P_{2,3}\). In contrast to (14), the sign information we lose here is that of the differences and not that of the components, which allows for a proper estimation of the magnitude of the angle difference and consequently the line flow. However, the information on lineflow direction is lost; we are therefore limited to applications that are not dependent on it.
Tool selection
Selecting appropriate tools is crucial for quantum–classical cosimulation. To support quantum computing and cosimulation, tools that can abstract lowlevel complexities and provide highlevel programming are necessary. Additionally, the quantumcomputing platform and cosimulation framework must be free and opensource to facilitate reproducibility and further research. The quantumcomputing tool must provide local and cloudbased quantum simulators to enable efficient development and testing. Furthermore, it must allow simulators for both noisefree and noisy hardware, which is valuable in the Noisy IntermediateScale Quantum (NISQ) era—where noise is a critical aspect—to evaluate algorithm performance. Providing free access to real quantum computers is another essential criterion. Furthermore, the tool should offer sessionbased computing job scheduling to avoid queuing for each simulation step, prioritizing subsequent jobs after the initial wait. We chose IBM’s Qiskit platform (2023), specifically Qiskit Runtime (Quantum 2023). For the cosimulation framework, in addition to being free and opensource, it needs to have an easytouse programming interface to connect simulators to the framework, and a programmatic interface to specify simulation topology. We have determined the framework Mosaik (originally introduced by Schütte et al. (2011) and Rohjans et al. (2013)), specifically Version 3.0 (Ofenloch et al. 2022). The framework is designed for largescale smart grid scenarios and uses the python programming language, which makes it particularly suitable for use with Qiskit.
Experiments
Based on the determined research approach, simulation experiments were conducted. We describe the details of the casestudy scenario and how it was implemented, including cosimulation architecture and quantum computingspecific configurations. Then, we present the simulation results.
Casestudy scenario
As a basis for our experiments we have chosen a 5bus test system. Our choice of testsystem size hinges on us being able to execute it on freely available quantum hardware. The test system is derived from one used by Sævarsson et al. (2022) in their quantum AC power flow experiments; however, we use it in a DC setting. It is depicted in Fig. 4. Accounting for the slack bus, the system results in a \(4\times 4\) modified susceptance matrix:
Just as in Sævarsson et al. (2022), the admittances are chosen not to correspond to a realistic network, but to yield eigenvalues that can accurately be represented using a small number of bits. Therefore, any inaccuracies of eigenvalue representation do not influence the simulation results. In realworld applications, accurate eigenvalue representation requires careful consideration. However, the accuracy can be improved drastically by just a few additional qubits (Sævarsson et al. 2022). Here, the eigenvalues of \(B'\) are \(\{1, 2, 3, 4\}\).
In our casestudy scenario, a slack generator is connected to Bus 0. It simply matches the slack power, be it positive or negative; in this simplified example, it does not have limitations such as a maximum output. On Bus 1 is a solar farm with a peak generation of \(3\ \text {MW}\). It is implemented as a time series that is based on the synthetic load profiles for a PV module provided by Austrian Power Settling and Clearing (APSC) (2023) for July \(1{\rm {st}}\) 2022. The other buses—2, 3, and 4—are aggregate loads with a peak consumption of \(0.5\ \text {MW}\), \(0.5\ \text {MW}\), and \(1.5\ \text {MW}\) respectively. As with the solar farm, the loads are based on the APSC synthetic load profile of a household for the same day; it is scaled to the respective maximum power.
Cosimulation architecture
For this study, we have chosen the smart grid cosimulation framework Mosaik (Version 3.0). It provides two programming interfaces: One is responsible for the interaction between the orchestrator and a simulator. The other specifies how a simulation scenario can be defined, including instantiating and connecting entities. A central aspect of cosimulation is the selection of participating simulators and the nature of their information exchange. Here, we briefly describe each simulator and Fig. 5 shows their connections. Please note that for all but one simulator, there is only one instance. For example, in our smallscale casestudy scenario, there is only one solar farm even though the solarfarm simulator is capable of handling multiple instances. In contrast, the aggregateload simulator handles three instances.
The simulators are:

Grid: It contains the grid topology and line admittances, and executes powerflow simulation using information on nodal injection. The simulator is capable of quantum power flow computation.

Slack generator: An idealized slack generator that compensates for generation–consumption mismatch.

Solar farm: The simulator outputs a scaled prerecorded generation profile. The simulator has an input for the amount of power shedding.

Aggregate load: Like the solarfarm simulator, this simulator also outputs a scaledup, prerecorded time series, specifically of household consumption.

Slack controller: It aggregates all power generation and consumption to tell the slack generator how much load to generate or absorb.

Line monitor: This simulator monitors a transmission line and compares the power flow to a predetermined threshold and outputs a powershedding amount.

Collector: The cosimulation contains a simulator for retrieving all relevant data and recording it in a format suitable for analysis. It is an example of a simulator that has no equivalent in the realworld system but exists purely for the simulation study.
Quantum configuration
We utilize Qiskit as our quantumcomputing platform and the IBM QASM simulator as our simulated quantum hardware. Using simulated hardware reduces queuing times and provides a noisefree simulation of a quantum machine. We select the IBM Oslo quantum computer, which employs the Falcon r5.11H processor, for our HHL implementation since it requires seven qubits to solve the \(4\times 4\) system of equations. In quantum computing, estimating coefficients—\(\alpha ,\ \beta\) in (1)—involves repeatedly preparing a quantum state and measuring its outcome, which yields the underlying coefficients via Born’s rule (2) from the estimated probability. The number of iterations or shots performed impacts the accuracy of the estimation, but also affects computational expense. For our experiments, we use \(10^5\) shots, but the optimal number of shots is casedependent and must be evaluated accordingly.
Implementation
The implementation of the HHL algorithm is derived from the one used in Sævarsson et al. (2022). However, we employ Qiskit Runtime primitives, i.e. elementary subroutines. Specifically, we use the Estimator primitive where an operator M is applied to a repeatedly prepared quantum state to estimate the expected value. The operator definition is described in Designing observables for information extraction.
One significant benefit of Qiskit Runtime is sessionbased scheduling, which avoids the need to queue each time for every simulation step. In a cosimulation scenario, for each time step, a new computing job is created, which is then submitted to the hardware in the cloud. Queuing for each simulation step would be completely unworkable, and Qiskit Runtime enables starting a session for the entire cosimulation, prioritizing each job once the session has started. This control sequence is illustrated in Fig. 6. The orchestrator initializes the simulator which in turn queues on the quantumcomputing platform to create a new session, then the actual cosimulation may start. For each of the simulator’s time steps, a computing job is submitted to the session with prioritized access to the quantum resources. Only after the entire simulation run is ended, the session is closed.
Simulation results
Multiple simulation experiments were conducted to allow for a comparison between different ways of computing power flow: classical solution, simulated quantum computer, and real quantum hardware. The focal point of this comparison was the loadshedding behavior of our casestudy scenario, determining whether quantum computing could be a valuable substitute for classical computation.
In Fig. 7, we have the power flow on the monitored line on top, and the powershedding amount on the bottom. In both diagrams, one can see the classical solution and the two quantum solutions, one with simulated and one with real hardware. For the power flow, we also include a baseline reference that shows the power flow in the observed line without having loadshedding measures that curtail overload. One can observe that the noisefree quantum simulator corresponds closely to the classical result. However, the flow computed with real quantum hardware deviates so drastically from the actual solution as to be unusable in practice. The severe effects from noise become more apparent when looking at the output distribution of measuring the state of an exemplary HHL circuit: Fig. 8 illustrates estimated probability distributions, which correspond to the squares of the coefficients, and thus the normalized solution vector—see Borne rule (2). Whereas the noisefree quantum simulator yields clearly distinguishable values, both the noisy quantum simulator and the real quantum hardware result almost in uniform distributions. This is to be expected when dealing purely with noise. It is highly likely, that the large circuit depth of 2620 leads to an overwhelming accumulation of noise and an execution time that well exceeds the coherence time of the quantum computer.
Finally, we should address the timing aspects. The central motivating factor for quantum–classical cosimulation is accelerating largescale smart grid cosimulations. However, for this early feasibility study, we do not focus on timing improvement. The simulation experiments have shown that both runs using simulated and real quantum hardware take orders of magnitude longer than the classical solution. Even with a perfect quantum implementation that preserves the potential logarithmic scalability of the HHL algorithm, we would expect the overhead introduced by the quantum solution to far outweigh the scalability advantages at a small scale. Future research should address these issues in an indepth quantitative way.
Discussion of obstacles
Our experiments have exposed four major obstacles related to quantum–classical cosimulation and quantum power flow for smart grid cosimulation. In this chapter, we describe each of the obstacles and their impact, and discuss how they can be addressed. This is summarized in Fig. 9.
Queuing time
Processing time on real quantum hardware is a highdemand, limited resource. A low number of quantum computers is accessed by numerous users via the cloud. Except for specialized scenarios, this paradigm will likely remain for the near to midterm future. As a result, scheduling and prioritizing computing jobs is a constant challenge. For cosimulations, submitting a single large computing job is not possible since there are constant interactions between the simulators. Instead, each time step creates a new computing job, making queuing for each job impractical.
In our study, we have found a simple, easytoimplement way to deal with this issue: Using sessionbased scheduling, we queue only once to start the session and then submit computing jobs to it. This way, the jobs get prioritized, which minimizes wait time for all jobs but the first. The session is started when instantiating the simulator and is ended once it is destroyed; this sequence is illustrated in Fig. 6. Qiskit Runtime has proven to be an effective facilitator for this scheduling paradigm.
Distributedcomputing challenges
In the context of quantum computing, cloudbased access is common. Integrating a quantum computingbased simulator in a cosimulation results in distributed simulation, where the execution of a simulation is distributed across multiple processors (Fujimoto 1999); specifically, we are dealing with distributed cosimulation. As communication relies on the internet, highspeed, lowlatency connections, such as InfiniBand, are not viable (Mirz et al. 2018). Therefore, significant overhead and latency are introduced, which can either occur within a simulator (e.g. when only the quantum processing is done on the cloud) or between the orchestrator and a purely cloudrun simulator.
To mitigate these issues, one strategy is to restrict the application of cloudbased resources to simulators with infrequent interaction, where the data and time overhead is less critical than for simulators with highfrequency communication. Palensky et al. (2017) suggest running closely coupled simulators on the same machine. Another way to address the problem is through geographical proximity. According to Mirz et al. (2018), geographical distance is the main factor contributing to roundtrip time, indicating that it is preferable to have quantum resources located as close as possible. In an ideal scenario, a local or even an onsite quantum computer laboratory is available for some industrial or academic applications.
Efficient information extraction
Our quantum algorithm for solving power flow, the HHL algorithm, promises logarithmic scalability, in principle. However, there are various limitations and caveats that threaten this advantage. Importantly, we cannot retrieve all components of the solution vector, since that would require a linear number of steps. Therefore, we need an efficient means of extracting the necessary information from the quantum state that does not diminish the algorithms scalability. Furthermore, when measuring the quantum state, we lose sign information, meaning we cannot distinguish positive and negative coefficients; this requires further consideration on how to compute the required quantities.
The main way to deal with this issue is to only extract a subset of information from the prepared state. If the subset’s size scales at most logarithmically with system size, we can theoretically maintain the exponential speedup of HHL. With powerflow analysis, for example, often only the power flow in a few lines is of interest. Efficiently extracting the line flow requires designing suitable observables that can be implemented in a quantum circuit (for more details, see Designing observables for information extraction). In our case study, we are only interested in the magnitude of the line flow, not having its direction is therefore irrelevant. For other applications, this issue could potentially be a decisive factor.
Hardware limitations
We are currently in the era of NISQ hardware; therefore, we have to deal with noise and decoherence impeding computation. The impact of these limitations is evident for the HHL algorithm; it results in excessively large circuits whose size scales poorly for larger systems. The coherence time of quantum hardware may be much too short to reliably execute a full circuit, and the noise accumulates over many gates in a largedepth circuit. In our experiments, the effects of noise and decoherence make the results basically unusable, resulting in output distributions (Fig. 8) barely distinguishable from pure noise. Currently, quantum error correction and mitigation techniques are not nearly advanced enough to compensate for this. Although the number of qubits has been touted as an indicator for the improvement of quantum computers, for quantum power flow with HHL, it is not a major issue. The number of required qubits rises only logarithmically; therefore, computing largescale systems potentially only requires a few qubits. However, error mitigation and correction may require additional qubits, increasing the need for quantum hardware with a large qubit count. Additionally, the lack of QRAM poses a challenge for efficiently preparing the input vector; it is also a likely prerequisite for an efficient HHLbased implementation of quantum AC power flow (Golestan et al. 2023).
Even though hardware development is progressing at a rapid pace (Brooks 2023), useful quantum power flow—in the context of quantum–classical cosimulation or not—is unlikely in the nearterm future. Therefore, a degree of patience is required until we have largescale faulttolerant quantum computing and new technologies like QRAM. Until then, we can focus on quantum approaches that are more suitable for NISQ hardware, such as variational algorithms (e.g. Variational Quantum Eigensolver) and quantum annealing. Alternatively, Bertels et al. (2021) suggest assuming perfect noisefree qubits for algorithm and application development, to have them ready once the hardware is sufficiently advanced.
Conclusion
Cosimulation is a powerful paradigm to address smart grid simulation challenges, but largescale scenarios suffer from performance issues. Quantum–classical cosimulation can alleviate these issues by using quantum computing to run constituent simulators. Although the approach was previously postulated, a proofofconcept study was missing. This study demonstrates the technical feasibility and identifies potential issues, using a case study–based approach focused on integrating quantum DC power flow with smart grid cosimulation. Four major obstacles are uncovered, varying in relation to quantum–classical cosimulation, HHLbased quantum power flow, and quantum computing generally: queuing delays, distributedcomputing challenges, the need for efficient information extraction, and hardware limitations.
The key findings from our proofofconcept experiments are:

It is feasible to integrate a quantum computing–based simulator with smart grid cosimulation using commonly available software tools with moderate integration effort.

Sessionbased scheduling is critical for quantum–classical cosimulation to avoid significant performance penalties; there are tools that enable this.

All distributed, networkbased cosimulation challenges are inherent to quantum–classical cosimulation and must be addressed.

The HHLbased quantum DC power flow works in principle and may be applicable in some cosimulation scenarios given sufficient hardware advancement.

Efficient solution extraction of a subset of the HHL solution is achievable by designing appropriate observables without compromising scalability.

HHL faces significant issues on NISQ hardware and may require largescale faulttolerant quantum computing for practical use.
In conclusion, our study demonstrates the technical feasibility of quantum–classical cosimulation for smart grid applications, and identified several key challenges that need to be addressed. While the practical realization of quantum power flow on NISQ hardware appears unlikely in the near to midterm, the potential for using quantum computing to address optimization problems in smart grid cosimulation is promising. In particular, variational algorithms and quantum annealing show promise for improving the scalability and efficiency of smart grid cosimulation. We anticipate that further research at the intersection of quantum computing, cosimulation, and powersystems engineering will open up new opportunities for solving complex problems in largescale smart grid systems.
Availability of data and materials
The data as well as the code for simulation and data analysis can be found in https://github.com/DominikVereno/quantumclassicalcosimulationproofofconcept.
References
Aaronson S (2015) Read the fine print. Nat Phys 11(4):291–293
APCS—Austrian Power Clearing and Settlement AG (2023) Synthetic load profiles.https://www.apcs.at/en/clearing/physicalclearing/syntheticloadprofiles. Accessed 15 Mar 2023
Bertels K, Sarkar A, Ashraf I (2021) Quantum computing—from NISQ to PISQ. IEEE Micro 41(5):24–32
Blochwitz T, Otter M, Arnold M, Bausch C, Clauß C, Elmqvist H, Junghanns A, Mauss J, Monteiro M, Neidhold T, Neumerkel D, Olsson H, Peetz JV, Wolf S (2011) The functional mockup interface for tool independent exchange of simulation models. In: Proceedings of the 8th International Modelica Conference, 105–114
Born M (1926) Zur Quantenmechanik der Stoßvorgänge. Zeitschrift für Physik 37(12):863–867
Brooks M (2023) What’s next for quantum computing.https://www.technologyreview.com/2023/01/06/1066317/whatsnextforquantumcomputing/. MIT Technology Review. Accessed 18 Mar 2023.
Childs AM, Kothari R, Somma RD (2017) Quantum algorithm for systems of linear equations with exponentially improved dependence on precision. SIAM J Comput 46(6):1920–1950
Dahmann JS (1997) High Level Architecture for simulation. In: Proceedings of the 1st international workshop on distributed interactive simulation and real time applications, Eilat, Israel, pp 9–14
Denil J, Meyers B, DeMeulenaere P, Vangheluwe H (2015) Explicit semantic adaptation of hybrid formalisms for fmi cosimulation, ser. DEVS ’15. San Diego, CA, USA: Society for Computer Simulation International, 99–106
Endo S, Cai Z, Benjamin SC, Yuan X (2021) Hybrid quantumclassical algorithms and quantum error mitigation. J Phys Soc Jpn 90(3):032001
Eskandarpour R, Ghosh K, Khodaei A, Paaso A, Zhang L (2020a) Quantumenhanced grid of the future: a primer. IEEE Access, 8, 188993–189002
Eskandarpour R, Gokhale P, Khodaei A, Chong FT, Passo A, Bahramirad S (2020b) Quantum computing for enhancing grid security. IEEE Trans Power Syst 35(5):4135–4137
Eskandarpour R, Ghosh K, Khodaei A, Paaso A (2021) Experimental quantum computing to solve network DC power flow problem. Available: arXiv:2106.12032
Farhangi H (2010) The path of the smart grid. IEEE Power Energ Mag 8(1):18–28
Feng F, Zhou Y, Zhang P (2021) Quantum power flow. IEEE Trans Power Syst 36(4):3810–3812
Fujimoto RM (1999) Parallel and distributed simulation systems, ser. Wiley Series on Parallel and Distributed Computing. Nashville, TN: Wiley
Gao F, Wu G, Guo S, Dai W, Shuang F (2022) Solving DC power flow problems using quantum and hybrid algorithms. Available: arXiv:2201.04848
Giovannetti V, Lloyd S, Maccone L (2008) Quantum random access memory. Phys Rev Lett 100:160501
Golestan S, Habibi MR, Mousazadeh Mousavi SY, Guerrero JM, Vasquez JC (2023) Quantum computation in power systems: an overview of recent advances. Energy Rep 9:584–596
Gomes C, Thule C, Broman D, Larsen PG, Vangheluwe H (2017) Cosimulation: state of the art. Available: arXiv:1702.00686
Gomes C, Thule C, Broman D, Larsen PG, Vangheluwe H (2018) Cosimulation: a survey. ACM Comput Surv 51(3):49
Google (2023) Google quantum ai. https://quantumai.google. Accessed 15 Apr 2023
Grainger J, Stevenson W (1994) Power system analysis. McGrawHill Education, New York
Hafner I, Popper N (2021) An overview of the state of the art in cosimulation and related methods. SNE Simul Notes Eur 31(4):185–200
Harrow AW, Hassidim A, Lloyd S (2009) Quantum algorithm for linear systems of equations. Phys Rev Lett 103(15)
Hidary JD (2021) Quantum computing: an applied approach, 2nd edn. Springer International Publishing, Cham, Switzerland
IBM (2023) Ibm quantum. https://www.ibm.com/quantum. Accessed 15 Apr 2023
Jones EB, Kapit E, Chang CY, Biagioni D, Vaidhynathan D, Graf P, Jones W (2020) On the computational viability of quantum optimization for PMU placement. IEEE Power & Energy Society General Meeting (PESGM) 2020:1–5
Khan AA, Ahmad A, Waseem M, Liang P, Fahmideh M, Mikkonen T, Abrahamsson P (2022) Software architecture for quantum computing systems: a systematic review. Available: arXiv:2202.05505
Koretsky S, Gokhale P, Baker JM, Viszlai J, Zheng H, Gurung N, Burg R, Paaso EA, Khodaei A, Eskandarpour R, Chong FT (2021) Adapting quantum approximation optimization algorithm (QAOA) for unit commitment. IEEE International conference on quantum computing and engineering (QCE) 2021:181–187
Mihal P, Schvarcbacher M, Rossi B, Pitner T (2022) Smart grids cosimulations: survey and research directions. Sustain Comput Inform Syst 35:100726
Mirz M, Vogel S, Schäfer B, Monti A (2018) Distributed realtime cosimulation as a service. IEEE international conference on industrial electronics for sustainable energy systems (IESES) 2018:534–539
Nguyen VH, Besanger Y, Tran QT, Nguyen TL (2017) On conceptual structuration and coupling methods of cosimulation frameworks in cyberphysical energy system validation. Energies 10(12):1977
Nielsen MA, Chuang IL (2010) Quantum computation and quantum information. Cambridge University Press, Cambridge, UK
Ofenloch A, Schwarz JS, Tolk D, Brandt T, Eilers R, Ramirez R, Raub T, Lehnhoff S (2022) Mosaik 3.0: Combining timestepped and discrete event simulation. In: 2022 open source modelling and simulation of energy systems (OSMSES), 1–5
Palensky P, van der Meer AA, Lopez CD, Joseph A, Pan K (2017) Cosimulation of intelligent power systems: fundamentals, software architecture, numerics, and coupling. IEEE Ind Electron Mag 11(1):34–50
Purchala K, Meeus L, Van Dommelen D, Belmans R (2005) Usefulness of DC power flow for active power flow analysis. In: IEEE power engineering society general meeting, 1, 454–459
Qiskit contributors (2023) Qiskit: an opensource framework for quantum computing
Quantum I (2023a) Qiskit runtime overview. https://quantumcomputing.ibm.com/lab/docs/iql/runtime/. Accessed 2 Apr 2023
Quantum I (2023b) Solving linear systems of equations using hhl and its qiskit implementation. https://learn.qiskit.org/course/chapplications/solvinglinearsystemsofequationsusinghhlanditsqiskitimplementation. Accessed 8 Feb 2023
Rohjans S, Lehnhoff S, Schütte S, Scherfke S, Hussain S (2013) mosaik—a modular platform for the evaluation of agentbased smart grid control. IEEE PES ISGT Europe 2013:1–5
Sævarsson B, Chatzivasileiadis S, Jóhannsson H, Østergaard J (2022) Quantum computing for power flow algorithms: testing on real quantum computers. Available: arXiv:2204.14028
Schloegl F, Rohjans S, Lehnhoff S, Velasquez J, Steinbrink C, Palensky P (2015) Towards a classification scheme for cosimulation approaches in energy systems. In: International symposium on smart electric distribution systems and technologies, pp. 516–521
Schütte S, Scherfke S, Tröschel M (2011) Mosaik: a framework for modular simulation of active components in smart grids. IEEE first international workshop on smart grid modeling and simulation (SGMS) 2011:55–60
Schweiger G, Gomes C, Engel G, Hafner I, Schoeggl J, Posch A, Nouidui T (2019) An empirical survey on cosimulation: promising standards, challenges and research needs. Simul Model Pract Theory 95:148–163
Shao C (2018) Reconsider hhl algorithm and its related quantum machine learning algorithms. Available: arXiv:1803.01486
Shewchuk JR (1994) An introduction to the conjugate gradient method without the agonizing pain. Carnegie Mellon University, USA, Tech. Rep.
Steinbrink C, Schlögl F, Babazadeh D, Lehnhoff S, Rohjans S, Narayan A (2018) Future perspectives of cosimulation in the smart grid domain. In IEEE International Energy Conference (ENERGYCON), 1–6
Systems DW (2023) Dwave. https://www.dwavesys.com/. Accessed 15 Apr 2023
Ullah MH, Eskandarpour R, Zheng H, Khodaei A (2022) Quantum computing for smart grid applications. IET Gener Transm Distrib 16(21):4239–4257
Vereno D, Harb J, Neureiter C (2023a) Paving the way for reinforcement learning in smart grid cosimulations. In 6th Workshop on formal cosimulation of cyberphysical systems
Vereno D, Khodaei A, Neureiter C, Lehnhoff S (2023a) Exploiting quantum power flow in smart grid cosimulation. In: 11th Workshop on modeling and simulation of cyberphysical energy systems. IEEE, San Antonio, Texas, USA
Vogt M, Marten F, Braun M (2018) A survey and statistical analysis of smart grid cosimulations. Appl Energy 222:67–78
Yoon DH, Han Y (2020) Parallel power flow computation trends and applications: a review focusing on GPU. Energies 13(9):2147
Zhao J (2020) Quantum software engineering: landscapes and horizons. Available: arXiv:2007.07047
Funding
The financial support by the Austrian Federal Ministry for Digital and Economic Affairs and the National Foundation for Research, Technology and Development and the Christian Doppler Research Association as well as the Federal State of Salzburg is gratefully acknowledged.
Author information
Authors and Affiliations
Contributions
DV: Conceptualization, Methodology, Software, Investigation, Writing—Original Draft, Visualization. AK: Conceptualization, Methodology, Writing–Review & Editing. CN: Resources, Funding acquisition. SL: Conceptualization, Supervision.
About this supplement
This article has been published as part of Energy Informatics Volume 6 Supplement 1, 2023: Proceedings of the 12th DACH+ Conference on Energy Informatics 2023. The full contents of the supplement are available online at https://energyinformatics.springeropen.com/articles/supplements/volume6supplement1.
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Vereno, D., Khodaei, A., Neureiter, C. et al. Quantum–classical cosimulation for smart grids: a proofofconcept study on feasibility and obstacles. Energy Inform 6 (Suppl 1), 25 (2023). https://doi.org/10.1186/s42162023002921
Published:
DOI: https://doi.org/10.1186/s42162023002921