SeQUeNCe: A Customizable Discrete-Event Simulator of Quantum Networks

Recent advances in quantum information science enabled the development of quantum communication network prototypes and created an opportunity to study full-stack quantum network architectures. This work develops SeQUeNCe, a comprehensive, customizable quantum network simulator. Our simulator consists of five modules: Hardware models, Entanglement Management protocols, Resource Management, Network Management, and Application. This framework is suitable for simulation of quantum network prototypes that capture the breadth of current and future hardware technologies and protocols. We implement a comprehensive suite of network protocols and demonstrate the use of SeQUeNCe by simulating a photonic quantum network with nine routers equipped with quantum memories. The simulation capabilities are illustrated in three use cases. We show the dependence of quantum network throughput on several key hardware parameters and study the impact of classical control message latency. We also investigate quantum memory usage efficiency in routers and demonstrate that redistributing memory according to anticipated load increases network capacity by 69.1% and throughput by 6.8%. We design SeQUeNCe to enable comparisons of alternative quantum network technologies, experiment planning, and validation and to aid with new protocol design. We are releasing SeQUeNCe as an open source tool and aim to generate community interest in extending it.


INTRODUCTION
Quantum networks promise to deliver new, revolutionary applications that include distributing cryptographic keys with provable security [6,27], solving distributed computational tasks with exponential reduction in communication complexity [13], or synchronizing clocks with unprecedented accuracy [32] to name just a few.Recent breakthroughs in quantum engineering have allowed experimental realizations of quantum network prototypes [29,60] that are supplemented by commercial efforts in the network security arena [57].
Prototypes of metropolitan quantum networks with multiple nodes are currently under construction e.g. in Chicago [58], the Netherlands [15], the United Kingdom [24], and South Korea [62].The most significant remaining engineering challenge is building networks that scale both in the number of users and communication distance.Achieving this goal requires a combination of advances in hardware engineering, standardization of new network architectures, development of robust control plane protocols, and techniques that allow reproducible performance testing.
Quantum network simulations can help in understanding the tradeoffs of alternative quantum network architectures, optimizing quantum hardware, and developing a robust control plane.As the size of experimental networks grows and new protocols and technologies are developed, the need to use simulations to model the behavior and interactions of these complex systems increases.The classical networking community has been relying on network simulators to achieve similar goals, with simulators such as ns-3 [51] receiving widespread use in academia and industry alike.
This work builds a Simulator of QUantum Network Communication (SeQUeNCe), a customizable discrete-event quantum network simulator that models quantum hardware and network protocols.We introduce a modularized design of the simulator that separates functionality at different network layers into modules, a concept similar to the OSI model in classical networking [70].This modularized design allows the testing of alternative quantum network protocols and hardware models and the study of their interactions.Our simulator design also allows easy customizability.SeQUeNCe is freely available as open source on GitHub [50], allowing users to test the performance of new algorithms, protocols, and devices by implementing new functionality in Python and running one of our built-in benchmarks.
Simulating quantum networks is challenging for three reasons.First, although recent work has provided important insights about future quantum network architectures [61,64], the lack of consensus about architectural principles requires abstracting certain details and considering many alternatives.We address this challenge by using a modularized design that allows intermodule communication and is more flexible than the OSI model.Second, quantum network protocols are typically described as algorithms [3,8], and significant effort is needed to map each of these algorithms to the correct network layer and define its behavior and interactions with other protocols.Our work translates a comprehensive suite of quantum network protocols into state machines that capture all possible protocol states and interactions.The third set of challenges comes from the fundamental differences between quantum and classical networks.For example, while classical networks use packets, quantum networks carry information inside photons generated at megahertz frequencies [14].We designed SeQUeNCe to track millions of events per second, and the most intensive simulations reported in this paper generate approximately two billion events.
Development of quantum network simulators that capture the complexity of full-stack quantum networks started receiving significant attention in the past two years.In addition to SeQUeNCe, two other concurrently developed simulators, NetSquid [19] and QuISP [37], were introduced as software packages in mid-2020.Because all three simulators have different internal structure and differ in key assumptions and implementation details, we strongly believe that comparing the work of the three teams will lead to an exchange of ideas and better understanding of quantum networks.We compare the three simulators in §6.
The main contributions of this work are fourfold: • Design and implementation of a scalable, customizable, discrete-event quantum network simulator, Se-QUeNCe, that models the behavior of quantum networks with picosecond precision • Release of the simulator as an open source tool freely available on GitHub [50].
• Description of a modularized quantum network architecture, including detailed descriptions, models, and implementations of key protocols in each module • Three representative use cases that demonstrate the functionality of the simulator by modeling a metropolitan quantum network under construction in Chicago The paper is organized as follows.In §2 we introduce basic terminology, explain how quantum networks operate, and highlight some of their most prominent features.In §3 we introduce simulation requirements and the design of the SeQUeNCe simulator that consists of five elementary modules and a simulation kernel.§4 describes models and presents detailed descriptions of quantum network hardware and control protocols.Simulation results obtained with the SeQUeNCe simulator are presented in §5, and related work is discussed in §6.

BACKGROUND
In recent years, much work has gone into the development of hardware that enables quantum networks [55], understanding potential network architectures [33], and finding new applications [64].However, architectural principles and the associated control protocols remain nascent, and significant advances in both traditional networking disciplines and quantum engineering are needed to realize a full-stack quantum internet.
We begin by introducing the basic concepts in quantum communication.Quantum networks transmit information encoded in quantum states, mathematical constructs that yield a probability distribution for the measurement outcomes on a quantum system.For an isolated two-level atom, a quantum state is a complex vector denoting a superposition of the atom in the two energy levels.Such a quantum state can be used to encode quantum information-a qubit-with the two levels representing a "0" (i.e., |0⟩) or "1" (|1⟩).
Quantum states are operated on by quantum gates.They act on a qubit or multiple qubits and change their quantum state.Quantum gates perform reversible logical operations on qubits, in contrast to classical gates that can be irreversible.An example of a quantum gate is the controlled NOT (CNOT) gate [43], which takes 2 qubits as input and flips the second qubit (the target qubit) if and only if the first qubit (the control qubit) is |1⟩.
Applying CNOT gates on independent qubits can create entanglement, a multipartite (2 or more particles) quantum state that cannot be expressed as a product of states of individual particles [26].In other words, when entangled, each particle's state is not independent of the others.A wellknown example is a Bell state [43]: 1/ √ 2(|01⟩ + |10⟩).Entanglement is a fundamentally unique property of quantum mechanics.It can exist among particles even though they are physically separated in space [26].
Entanglement can be used for quantum teleportation, a process to transfer an arbitrary quantum state (and the qubit information it encodes) from a sender to a distant receiver [7].In order to teleport quantum information, a high-fidelity entanglement shared between the two parties must be first established; classical communication is then used to complete the teleportation protocol and transfer the quantum state from the sender to the receiver.
Noise and loss can harm the high-fidelity entanglement required for teleportation [8].Thus one must perform entanglement purification (or distillation), a process that transforms many copies of entangled states (typically of a lesser degree of entanglement) into fewer copies of maximally entangled states, using local quantum gates and classical communication [5,8].
Global efforts have been undertaken to physically realize quantum networks.These efforts typically resort to technological platforms based on either ground-based fiber-optic networks [18,29,45,54,57,60] or satellite links [68].The first method can be naturally realized through the use of existing global telecommunication fiber-optic infrastructure.These fibers, while having minimal attenuation at the telecom band, still suffer from transmission loss of approximately 0.2 dB/km [17].To date, point-to-point photonic fiber links for quantum key distribution have been experimentally realized, with many metropolitan networks already deployed or currently under construction [25,45,54,60].Transmitting quantum information beyond metropolitan distances, however, would require quantum repeater nodes at intervals of a few tens to a hundred kilometers in order to relay the quantum information.Physical realization of a functional quantum repeater is a subject of active research, but long-distance fiber-based quantum networks still remain undeveloped.
The second way to realize a long-distance quantum internet relies on ground-satellite links, which can connect distant nodes of 1,000 km separation with a single satellite station.Nevertheless, satellite-based quantum networks have obvious shortcomings, including weather restrictions, intermittent operations, and low throughput.In this paper, we thus focus on simulation of a fiber-based quantum network.However, our simulator can be easily extended for satellite-based quantum networks as well.
The unique properties of quantum physics result in three fundamental differences between quantum and classical networks.First, the no-cloning theorem prevents copying quantum information without destroying the original [34].Unlike in a classical network, one therefore cannot use an amplifier to regenerate signals on long-distance links.Combined with the unavoidable loss during transmission, directly transmitting quantum information in a scalable quantum network is almost impossible [2].
The second difference is reliance on quantum entanglement, which does not exist for classical networks.To provide reliable information transmission, quantum networks use entanglement to teleport quantum states or rely on quantum error correction.Although entanglement can be established among qubits, classical users cannot directly observe such states from qubits.Only heralded signals (conveyed as classical information) can determine the current quantum state.The usage of entanglement then relies on both classical and quantum information.
The third fundamental difference is the time sensitivity of quantum networks.Many operations, such as Bell state measurement (BSM), require synchronous operations over long distances.Furthermore, quantum information that decoheres over time cannot be easily refreshed as classical information.The lifetime of quantum information simulated in this work is usually on the order of milliseconds to seconds [1,48].

SYSTEM DESIGN
The differences between quantum and classical networks call for a flexible and scalable quantum network simulator that allows accurate performance analysis of network architectures.We explore its design in this section.

Quantum Network Simulation Requirements
We desire the following simulator characteristics: Realism of Quantum States: The simulator must be able to accurately trace quantum states, such as entanglement, as well as their fidelity.Furthermore, states can be encoded as time bins [36], in the polarization of light [12], or as states in quantum memories [41].The quality of entanglement is a key quantum network performance metric, and loss and decoherence that affect it must be modeled.In SeQUeNCe, entanglement states are represented as complex arrays and hardware models record entanglement fidelity.
Realism of Timing: Simulation events must be precisely executed at their respective timestamps with their exact ordering to avoid causality errors.Quantum networks are time-sensitive systems, and the arrival times of photons that encode quantum information determine their identity.In addition, the lifetime of qubits in memories is limited, requiring that certain operations be performed with as low latency as possible.Our simulator operates with picosecond precision.
Flexibility: In order to support development of future quantum networks, the simulator must be able to simulate alternative network architectures and new protocols and applications and allow reconfigurable topologies and traffic traces.To that end, SeQUeNCe uses a modularized design that separates functionality into modules that contain protocols that can be reprogrammed.Quick testing of a large number of scenarios is possible by changing parameters in JSON files.
Scalability: We must be able to perform large-scale studies of wide area networks with many components, as well as track quantum states at the individual photon level.Compared with classical packet-level network simulations, we must track photons generated with megahertz frequencies, increasing the number of simulated events by several orders of magnitude.Although this paper focuses on sequential discrete event simulation, we started exploring efficient parallel simulation methods [67] and designed a stand-alone simulation kernel to allow portability to high-performance computing systems.

Modularized Design of SeQUeNCe
To simulate quantum networks, we have to make some assumptions about their architecture.However, quantum network architectures have not been standardized yet, and this topic is the subject of many lively discussions in the recently established Internet Engineering Task Force (IETF) standardization group [40].We carefully studied the often conflicting quantum network designs, including the seminal works of Rodney Van Meter [61] and Stephanie Wehner [64].To allow simulation of alternative and emerging quantum network architectures, we made minimal assumptions and identified the nascent architectural principles that are common to most quantum network designs.Doing so allowed us to design a simplified quantum network architecture that consists of five modules.SeQUeNCe follows the same modularized design and uses a sixth module, the simulation kernel, to generate events.This design is shown in Figure 1.Next we describe the role and interactions of these six modules.Simulation Kernel is the heart of SeQUeNCe and enables discrete-event simulation.Simulation time advances in discrete clock ticks, and events generated by the simulation models in all other modules are stored in a priority queue (i.e., min-heap) sorted by the event timestamp.The kernel continuously executes the top event in the heap and advances the simulation time to that particular timestamp.This procedure repeats until the priority queue is empty or a simulation end condition is met.The kernel gives users extreme control over the event execution orders for timing realism and provides interfaces for future parallelized implementation for scalability enhancement.
Hardware module includes models of elementary hardware components used in a quantum network, including quantum channels, classical channels, quantum gates, photon detectors, and quantum memories.Each hardware model provides an interface to allow the Application, Entanglement, and Network modules to query and update its states.Our prior work evaluated the realism of the models of some of these components and demonstrated their interactions [65,66].This work significantly extends these models and introduces new components, such as quantum memories necessary for long-distance quantum communication.
Entanglement Management module includes models of protocols for reliable high-fidelity end-to-end distribution of entangled qubit pairs between network nodes.Specifically, this module includes protocols for entanglement generation, entanglement purification, and entanglement swapping.The role of entanglement generation is to create pairs of entangled qubits.Next, entanglement purification is used to improve the fidelity of the entanglement.Entanglement swapping is used to transform multiple shorter-distance entangled pairs into a single long-distance entangled pair.SeQUeNCe models these protocols and tracks the quantum state, lifetime, and fidelity of entanglement.Quantum states (including entanglement) are stored as complex arrays of amplitudes together with a list of states that are entangled.This module is allowed to change the quantum state in hardware and release the hardware resource upon completion.
Resource Management module manages local resources within one node.It records the state of the hardware, efficiently allocates resources to applications and entanglement protocols based on commands issued by the network management, and regains control of the hardware with updated states when resources are released.Although the resource manager controls only local resources, the instantiation of entanglement protocols requires cooperation between resource managers on different nodes.This ensures that entangled memories are mapped to the corresponding entangled pairs managed by entanglement protocols.
Network Management module provides quantum network services based on requests from the local Applications and remote Network Managers.It communicates with the Resource Manager to check the available local resources and generates commands for the Resource Manager to realize an appropriate resource allocation scheme.
Application module represents quantum network applications and their requests for quantum network resources.Although scientists envision a variety of disparate quantum network applications, including precise clock synchronization, quantum teleportation, or highly secure cryptographic key distribution, all these applications rely on entanglement.An application can initiate distribution of entanglement between another network node and specify the start time, duration, frequency, and fidelity of the entanglement distribution.
The SeQUeNCe simulator is highly reconfigurable.The user is allowed to specify the network topology and a variety of network and protocol parameters in a JSON file.The JSON file automatically creates and configures the appropriate simulation models.In addition, the modularized design was created for easy extendability and allows advanced users to create their own models of new quantum hardware and network protocols.
Here we show an example sequence of steps required to create a flow for entanglement distribution between node-1 and node-3 in a linear network topology node-1 → node-2 → node-3.After node-1 requests a reservation, the network utilizes quantum memories to distribute entanglement.This example is illustrated step-by-step with the step number corresponding to the labels in Figure 1: (1) The Application on node-1 requests a service from its local Network Manager.(2) The Network Manager invokes a routing protocol to identify a route and announces the request to the network managers on that route, namely, in node-2 and node-3.The Network Managers verify the availability of memories with their local Resource Managers.The request is served upon approval by all nodes.The Network Manager notifies the Application of the approval or rejection of the request.(3) The Resource Manager allocates memories for use by the Entanglement Manager.(4) The Entanglement Manager utilizes the allocated memories to execute entanglement generation, purification, and swapping protocols to establish entanglement between node-1 and node-3.(5) The Resource Manager continuously updates the state of quantum memories and allocates memories to the Application.(6) The Application consumes the entanglement between node-1 and node-3.The Application releases the quantum memory after use.At that point, the released memory can be reused to distribute entanglement again.

DESIGN, IMPLEMENTATION, AND SIMULATION OF MODULES
This section describes the design and implementation of models that follow the modularized architecture described in §3.We describe models of the elementary hardware building blocks of quantum networks in §4.1.The Entanglement Management module is discussed in §4.2.We implemented the Barrett-Kok entanglement generation protocol [3] to generate entanglement between adjacent nodes, the BBPSSW [8] protocol to purify entanglement, and a swapping protocol [31] to extend the distance of entanglement.Our Resource Management module, described in §4.3, consists of a memory manager and a rule manager.We present the Network Management module in §4.4.It uses both a reservation and a routing protocol to create paths.In §4.5 we describe a simplified Application module that mimics quantum network traffic generated by real applications.

Hardware
Here we describe how we model the key hardware elements in a quantum network.Our models of hardware elements simulate the behavior of the physical system and track its state and operational parameters.We model the loss rate of the quantum channel as 10 − L•αo 10 , where α o is the attenuation measured in dB/km.To avoid transmitting multiple photons at the same time over the same channel, the modeled quantum channel uses time-division multiplexing (TDM) and assigns a time of transmission to each photon source.Our simulator synchronizes all photon sources sharing a channel in order to ensure proper spacing of photons from different sources.
The classical channel is used to transmit classical information.Users can define the delay manually.For simplicity, we assume no-loss and perfect reliability for the classical channel in the current version of the simulator.

Single Photon Detectors.
A single-photon detector (SPD) is used to detect individual photon arrivals.An SPD generates an electrical signal upon absorption of a photon and records its arrival time.The detector efficiency η is the probability that a photon is successfully detected when it hits the detector.The detector resolution determines the precision of the timestamps.The count rate determines the constant cooldown time between detection events.This "dead time" is the inverse of the count rate.Another property of the SPD is the dark count rate, giving the average number of false positive detections per second caused by outside photons and electrical noise.We model dark count events as a Poisson process.Within the simulation, detectors can be used in a Bell state measurement device.This component receives photons, directs them to an SPD, and ensures the proper entanglement of the photon sources.We evaluated the accuracy of the channel and detector models in our previous work [65,66].

Quantum Memory.
A quantum memory is used to store quantum information in the form of matter (or stationary) qubits.In this work, we model single-atom memories [56], where the qubit is stored as the spin state of a single atom, atomic defect, or ion [10,22,56].We simulate a quantum network composed of multiple single-atom memories connected by fiber-optic channels.
The matter system of a quantum memory consists of two long-lived, low-lying states | ↑⟩ and | ↓⟩ and one excited state |e⟩.The "excite" operation induces the transformation | ↓⟩ → |e⟩ and | ↑⟩ → | ↑⟩.The transition | ↑⟩ ↔ |e⟩ is not allowed in the physical system.Along with the transformation | ↓⟩ → |e⟩, one photon entangled with the memory may be emitted.
The modeled quantum memory has two functions: excite and expire.The excite function implements the excite operation described above and may cause the memory to emit a photon.The probability of photon emission is decided by the quantum state and the efficiency of memory e.Given quantum state α | ↓⟩ + β | ↑⟩ stored in a memory, the probability of emitting a photon is given by e |α | 2 .The quantum memory then needs time to relax its quantum state back to the ground state before the next excite operation.This time of relaxation determines the frequency of the quantum memory.The excite function is typically used for generating entanglement in conjunction with a BSM (described in §4.1.2).The generated entanglement has a limited lifetime (the coherence time) that starts with the excite operation and ends with a scheduled expire operation that resets the quantum state.
When entanglement is established between the states of two memories, both need to maintain additional information such as the identity of the entangled quantum states.In our implementation, the quantum memory also maintains the fidelity of entanglement, ranging from 0 (no entanglement) to 1 (perfect entanglement).
We consider a repeater architecture based on single-atom memories (as defined above), where the fidelity of entanglement is dependent on atom-cavity cooperativity-an experimental parameter quantifying the coupling strength between an atom memory and a single photon.Based on [1], we have Equation 1 for entanglement fidelity, where C denotes the atom-cavity cooperativity, γ denotes the bare atom's optical decay rate, γ * denotes the optical pure dephasing rate, and ∆ ω denotes the difference between the optical transition frequencies of the two atomic memories to be entangled.Our SeQUeNCe simulator models quantum memories based on single erbium (Er) ions in solids, because Er optical emission is conveniently within the telecommunication Cband and Er has demonstrated spin coherence of over 1 second [48].We choose the following experimental parameters for the simulation: 50 ≤ C ≤ 500 [22,47], γ = 14 Hz [11,38], γ * = 32 Hz [1], and ∆ ω = 0. Figure 2 shows the entanglement fidelity as a function of C according to Equation 1.
We also have a relation of the memory efficiency e to the photon collection efficiency η c [1] as where e ≈ η c for C ≫ 1, which is typical in experiments.Realistic values for e range from 10 −2 to ≈1 depending on specific photonic coupling techniques used [10,22,59,69].
4.1.4Nodes.We follow the outline from a recent IETF draft [35] and define two types of network nodes.The router nodes implement the full-stack functionality described in this section in order to reliably distribute entanglement in the network.Our router node has all the functionality of a quantum repeater to overcome photon loss described in §4.1.1.The router also allows routing in the traditional sense.The second type of node is the BSM node that is required by the Barrett-Kok entanglement generation protocol described in §4.2.These nodes are placed in the middle of each link as shown in Figure 3.

Entanglement Management
The Entanglement Management module includes models of protocols for entanglement generation, purification, and swapping.We reference existing protocols and model their functional behavior, including state machines and the exchange of classical messages.The Entanglement Management module provides an interface for instantiating and terminating entanglement protocols, which the Resource Management module utilizes to establish entanglement.It also provides interfaces to receive notifications of events such as photon detection and entanglement expiration, used by the Hardware module.Upon receiving an entanglement expiration notification, the corresponding protocol instances will release their resources and terminate themselves.The protocol involves two rounds.The first round generates entanglement between two qubits, and the second round verifies the entangled state.The protocol produces a pair of entangled memories with maximal entanglement state |Ψ + ⟩ or |Ψ − ⟩.For more details on the operation of the protocol as well as our implementation, see Appendix A.

BBPSSW Purification
Protocol.Entanglement purification protocols were developed to address entanglement imperfections caused by factors including imperfections and decoherence in quantum memories.A purification protocol [23] consumes several pairs of entangled qubits with low quality F to produce a pair of entangled qubits with high quality F ′ .Purification requires the use of quantum gates.
In this work, we implement the BBPSSW protocol [8] for purification.The fidelity improvement is shown in Equation 3 and the success probability in Equation 4, where p suc denotes the probability of success.For more details on the design and implementation of our BBPSSW protocol model, see Appendix B. The success probability and degradation of swapping F d are defined by the operations performed at the intermediate node.The degradation comes from imperfect gate operations.Given two pairs of entangled memory with fidelity F 1 and F 2 , the fidelity F of new entanglement after swapping is [1] (5) For details on the design and implementation of our entanglement swapping protocol model, see Appendix C.

Resource Management
We design and implement a Resource Manager module to manage local resources.Similar to the design of QuISP [37], the Resource Manager uses an internal set of rules to manage quantum memories.Figure 5  Within the Resource Manager, the Memory Manager traces the states of quantum memories.The quantum memories can be in one of three states: raw, entangled, or occupied.The raw state means that the memory is not entangled to other memories and is not in use.The entangled state means that the memory is entangled to another memory or memories; entanglement information (such as the identity of entangled memories and fidelity) is also recorded by the memory manager.The occupied state means that the memory has been allocated to an entanglement protocol instance, which prevents conflict in memory allocation.The transition between states relates to the results of entanglement protocols.
Another component of the Resource Manager is the Rule Manager.The Rule Manager applies a rule set to manage the hardware resources, determining where to allocate them to achieve the desired long-distance entanglement.It installs new rules received from the Network Management module and uninstalls expired rules.A rule consists of three parts: priority, condition, and action.Rules are sorted by priority from high to low.The condition of a rule determines whether the state of a given memory fits the rule.If the state fits the rule, the action of the rule will allocate the memory to an application or instantiated entanglement protocol.As an example, consider a rule manager containing two rules and one memory.The two rules have the same condition (e.g. the memory must be in the raw state) and different priorities and action (e.g. the action of the rule with high priority allocates the memory to an instance of the entanglement generation protocol; the action of the rule with low priority does nothing).The rule manager first accesses the rule with high priority.Then, the rule manager retrieves the state of the memory from the memory manager.If the state of the memory satisfies the condition of rule (e.g.memory in raw state), the action of the rule is executed (e.g. the rule creates an instance of the generation protocol).If the condition is not met, the rule manager accesses the rule with lower priority to check whether the memory fits the rule.

Network Management
The Network Management module enables applications to reserve network resources.This reservation-based approach is inspired by the architecture proposed in a recent IETF quantum internet working group draft [40].Reservations are necessary to enable better coordination and to conserve the extremely limited quantum memories in emerging quantum network architectures.
To create entanglement between two nodes, the application makes a reservation request consisting of the following 6 elements: This module has two duties: reservation and routing.Reservation is responsible for fulfilling reserving the local resources.Routing provides a path of entanglement distribution to satisfy the end-to-end reservation.The reservation and routing protocols are designed to satisfy these duties.Figure 6 shows the stack structure of the Network Manager.
Upon receiving a reservation request from an application 1 ○, the Network Manager pushes it to the reservation instance which reserves appropriate resources (if available) and pushes the request to the routing instance.The routing instance determines the next hop based on its forwarding table (details of this table are given below) and pushes it to the Network Manager, which sends the message to the next hop.We use the length of quantum channels to calculate the shortest path, which provides a static forwarding table for the routing protocol on every node.This method can be updated to use a wide variety of routing protocols including the ones used in classical networks, such as OSPF [42].
Upon receiving a message from a neighboring node 2 ○, the Network Manager pops it to the routing instance, which then pops it to the reservation.If the reservation instance approves the request, it attaches local information (e.g., the identity of the node) and pushes it back to the routing instance to send the request to the next hop.If the message is rejected or it reaches the Responder, the decision of the Resource Manager will be sent back on the reverse path.If the reservation returns approved, all nodes prepare their local rules to match the reservation.When the result arrives at the Initiator, the reservation instance pops it to the Network Manager, which then pops it to the Application.A benefit of this stack structure is that it is easily expanded.For example, an authentication protocol could be placed at the top of the reservation protocol to improve the security of a network while the rest of the protocols are inherited.For more details about the design of the reservation protocol, see Appendix D.

Applications
The role of the Application module is to consume entanglement.Quantum network applications are heterogeneous (with varying requirements for throughput, fidelity, etc.), so in this work we create an abstraction of a single application with random requests.These requests randomly choose a Responder node (with the Initiator assumed to be the host node) as well as a target fidelity for entanglement.Also assigned randomly are the number of memories and the duration of the reservation.If a request fails, only the Responder and fidelity are kept; the other parameters are randomly reassigned, and the updated request is sent after waiting for one second.We record the results of simulations using this application description in §5.

THREE SIMULATION USE CASES
This section highlights three representative examples of simulations performed with SeQUeNCe.The intent of these use cases is not to focus on extensive quantum network performance evaluations, work that is far beyond the scope of a single research paper or single research group.Instead, these and many other examples are part of the open-source release of SeQUeNCe to help the research community start using the tool.In addition, this paper makes several interesting observations that include quantifying the impact of quantum memory parameters, the adverse effect of classical channel delays on quantum channel throughput, and the impact of memory distribution policy on memory utilization and overall network performance.

Simulation Setup
Our use cases share the following simulation setup.The topology is modeled after the Chicago metropolitan quantum network, which consists of 9 nodes located at 5 sites as depicted in Figure 7.The simulated topology augments the actual topology by adding three quantum links to provide richer connectivity.In addition, a BSM node required by the generation protocol (see §4.The channel delay is modeled as the propagation delay on the optical fiber (see §4.1.1).The classical channel delay was obtained by performing round-trip time (RTT) measurements between the 5 sites, as shown in Table 1.The one-way classical channel delay was calculated by halving and averaging the two-directional RTTs between sites, and one-way delays within a site were set to 0.25 ms.Each of the 9 nodes in our network is equipped with quantum memories and supports all protocols described in §4.Nodes are therefore able to assume the role of a quantum router.The default hardware parameters in our setup are shown in Table 2.These values represent properties of state-of-the-art hardware components.
In the course of simulations, applications running on all nodes request quantum network resources repeatedly for 1,000 seconds of simulation time, and performance metrics such as entanglement throughput and memory utilization are recorded.The application requests are random, choosing F дat e = 0.99 Swap success probability §4.2.3 p swap = 0.64 a random Responder, random target entanglement fidelity between 0.8 and 1, duration of the reservation between 10 and 20 seconds, and a start time at 1 to 2 seconds after the present time.These requests reserve a number of memories between 10 and half of the available memory capacity in the initiator node.As described in §4.5, these random requests model the heterogeneous requirements of quantum network applications.

Comparison of Quantum Memory Parameters
The attributes of quantum memories greatly affect network performance.As Equation 1shows, fidelity of entanglement increases with increasing atom-cavity cooperativity of the quantum memory.Accordingly, we evaluated the network performance for different combinations of cooperativities and efficiencies.We assumed that the memory frequency is 2 KHz and the target fidelity is between 0.8 and 1.
Experimental cooperativity C for Er emitters coupled to an optical cavity is in the range of 50 to 500 [22,47].Memory efficiencies are not yet perfect and can vary significantly depending on the photonic coupling scheme adopted [29,47,69].Therefore, we simulated quantum memories with cooperativity C = {50, 100, 500} and efficiency e = {0.01,0.10, 0.50, 0.75}.Figure 8 shows the average throughput per flow for each of the simulated values of cooperativity C and efficiency e.We observe the following.First, performance generally improves with increasing efficiency.This is because a memory with the same cooperativity will generate entanglement with higher probability, reducing the number of entanglement generation protocol failures.Second, the improvement of cooperativity does not provide as much increase in throughput as the improvement of efficiency because for the range of simulated cooperativity the fidelity is already high (>0.9).This use case illustrates how to use SeQUeNCe to explore the effect of hardware parameters.This particular example is valuable for experimentalists building network prototypes because it identifies the threshold hardware metrics to target useful network throughput.

Impact of Classical Channel Delay
Quantum routers rely on classical messages to determine the state of quantum memories, even if manipulating quantum states does not inherently require classical messages.The delay of classical channels thus affects the latency of quantum network protocols.Next, we compare the quantum network performance in two scenarios: (1) using the measured RTT delays in the Chicago topology and (2) using projected delays of dedicated classical channels that try to avoid unnecessary queuing and processing delays.These projected delays were calculated by adding propagation delay (speed of light in the fiber for the given distance), a transmission delay of 8 µs, and a processing delay of 4 µs.The transmission delay corresponds to sending a 1,000-byte control packet over a 1 Gbps link, and the processing delay represents the time to process the packet [52].We assume each packet has the highest priority, and we ignore queuing delays.Under these assumptions, the delay for a typical classical channel in our setup reduces from milliseconds to microseconds.
To evaluate the effect of this delay reduction, we analyze the performance of the network by recording the network flow throughputs for different memory frequencies.We set the memory efficiency to e = 0.75 and the cooperativity to C = 500, a combination that achieves the best performance (see §5.2).Our simulation results are shown in Figure 9.We observe that the scenario with low classical channel delay gains more benefit at higher memory frequencies.For example, the average throughput improves by more than a factor of 10 for 20 kHz memories.Another interesting observation is that the increase of frequency from 2 kHz to 20 kHz does not significantly improve the performance of networks with long classical channel delays.The longer delay imposes a limit on the speed at which states can be manipulated by control protocols, rendering the throughput gain from higher memory frequencies insignificant.Thus, we conclude that quantum networks should use low-latency classical control messages to utilize quantum hardware efficiently.

Two Memory Distribution Policies
The two previous simulations allocate memory arrays of the same size to each node.However, quantum routers have different workloads depending on their location, connectivity, and application requests.For example, in the Chicago network the StarLight node will experience a heavier workload because it is a router with degree 4 connectivity, whereas Argonne-3 will experience a lower workload as an end host.The memory utilization history for the Argonne-3 and Star-Light nodes in a scenario where each of the 9 network nodes uses a memory array of size 50 is shown in Figures 10a  and 10b, respectively.Not surprisingly, the memory usage rate in the Argonne-3 node is low whereas the memory usage rate in the StarLight node often approaches 100%.Clearly, given a fixed budget of memory arrays, the overall network throughput can be improved by redistributing some of the memories between the nodes.Here we repeat the previous simulation after redistributing the memories according to the anticipated load.This was achieved by considering all possible routes in the network and counting the incidence of network nodes over all routes.Our RSVP protocol requires double the memory in intermediate nodes compared with the Initiator and Responder nodes.Therefore, when we consider node incidence on a route, intermediate nodes carry twice the weight.The weighted assignment of memory arrays using this algorithm for a fixed memory budget of size 450 (the same memory budget that was used for the even distribution policy) on the Chicago network is shown in Table 3.
Figures 10c and 10d show the usage rate of memories in the Argonne-3 and StarLight nodes with the new weighted distribution of quantum memories.Compared with distributing memories evenly, distributing memories by weight increases the average usage rate at Argonne-3 from 17.4% to 56.0% and at StarLight from 53.3% to 56.6%, leading to a more even use of this limited resource while allowing the service of more requests.The percentage of time when the memory arrays in the StarLight node are more than 90% utilized decreased from 43.5% to 24.4%, reducing the occurrence of rejected application requests due to insufficient memory at the highly connected StartLight router node.
We repeated simulations for both memory allocation policies ten times with different random seeds and recorded the aggregate network throughput and completed number of requests.The results are shown in Figure 11.We observe that the weighted memory distribution policy improved the aggregate network throughput by 6.8% and the number of completed requests by 69.1% on average.Given a fixed budget of memories, the capacity of a quantum network can thus be improved by adjusting the memory distribution policy.

RELATED WORK
Besides SeQUeNCe, there are two other quantum network simulators with ambition to comprehensively model the behavior of full-stack quantum networks.QuISP [37] has been introduced as an open source package in mid-2020, and NetSquid [19] recently became available upon request.QuISP [37] supports various entanglement purification protocols, link tomography, and entanglement swapping.Published simulations [37] focus on faithful error modeling but restrict the studied scenarios to point-to-point communication with and without repeater nodes over distances of up to 50 km.Implementation of higher layers including routing and more complex network topologies are planned for future work.According to the NetSquid [63] project website, it generates and processes quantum information using nitrogen-vacancy centers in diamond.In comparison, Se-QUeNCe uses single rear-earth ion memories, functionality that not available in NetSquid.Work published by the Net-Squid team [37] focuses on development and analysis of physical and link layer protocols, and evaluations focus on simulations of point-to-point communication between two nodes in the lab (2 m) and two cities (25 km).
All three simulators are quickly evolving and features are added on a daily basis, making comparisons quickly obsolete.The biggest differences can be found in architectural assumptions.For example, QuISP uses RuleSets that are distributed to nodes along a path at connection setup time.NetSquid proposes to use a 5-layer quantum network stack with Physical, Link, Network, Transmission, and Application layers.SeQUeNCe follows a modularized design with cross-module communication to allow maximum flexibility.
Recently introduced, QuNetSim [21] is a simulator capable of smaller-scale simulations of 5 to 10 nodes that also uses a network layering framework inspired by the OSI model.However, the simulator focuses only on the upper layers, leaving the physical layer unspecified.QuNetSim also does not allow simulating repeater nodes and the associated protocols that are required for long-distance communication.Another simulator, SQUANCH [4], is notable for its agentbased modeling, allowing natural parallelization by running each agent on its own process.Because the simulator does not attempt to model interactions of protocols or details at the physical layer, the simulator is suitable for demonstrations of concepts such as teleportation [7] or superdense coding [9].SimulaQron [20] does not aim to simulate quantum networks but it facilitates development network applications.It uses the classical-quantum combiner interface [49] with sockets that mimic information transmission over simulated quantum channels.
Many additional simulation tools exist that can be used to perform numeric studies of individual quantum network algorithms and protocols [16,30,39,44,46].Many additional tools are listed at the website of the Quantum Open Source Foundation [28].

CONCLUSION
In this paper we introduced SeQUeNCe, a customizable discreteevent quantum network simulator.We introduced a modularized design for the simulator that closely matches an abstracted quantum network architecture, and we implemented a high-performance simulation kernel that allows simulating transmission and tracking of photon pulses and control messages with picosecond accuracy.We also implemented a comprehensive suite of quantum network protocols, including translation of the algorithmic descriptions into fully functional protocol state machines.
Our planned next steps include support for additional protocols to allow more comprehensive performance evaluations, as well as parallelization of the tool for use on multinode, multicore supercomputers.By releasing SeQUeNCe as open source software, we aim to generate community interest in using and extending the simulator, as well as allow comparisons of experimental and simulation results obtained by other teams.

APPENDICES A BARRETT-KOK PROTOCOL
The Barrett-Kok generation protocol [3] is defined as follows: (1) Excite each quantum memory.is established.Otherwise, the scheme has failed.If the detection from each round is observed in the same (different) detector, the final state is |Ψ + ⟩ (|Ψ − ⟩).Then the protocol ends.
The SeQUeNCe implementation of the Barrett-Kok protocol is instantiated on each quantum node and paired by the Resource Management module.The state machines of the protocol instances at the quantum nodes and at the BSM are shown in Figure 12.We now describe the classical message exchange between a pair of nodes using the Barrett-Kok protocol in SeQUeNCe.A designated member of the pair will start communication with a NEGOTIATE message (shown as "negotiate parameters" in Figure 12).The protocol instance on the other node responds with an offer, and the Barrett-Kok protocol can begin.The NEGOTIATE message and its response ensure that the two memories emit photons simultaneously.The two quantum nodes then schedule the excite operations on their respective memories and wait for a measurement result via the MR (measurement result) message from the the BSM node.If an improper result is received, the protocol ends with a failure, and each instance reports its failure to its respective Resource Manager.Otherwise, the protocol instance applies an X-gate and proceeds to round 2, repeating the process of round 1.If both rounds are completed successfully, the two memories are confirmed to be entangled, an entanglement result is returned to the Resource Manager.Regardless of whether the protocol succeeds or fails, the protocol instance destroys itself and releases the quantum memories back to the Resource Manager.The protocol instance at the node executing the BSM is not created or destroyed by a top-level resource manager; it is always present.It waits in an idle start state for any photon detection  event and then notifies adjacent quantum nodes of the entanglement result with a MR message.Note that the lifetime of entanglement starts at the first excite operation.

B BBPSSW PURIFICATION PROTOCOL
The BBPSSW [8] protocol is a purification protocol that uses two pairs of qubits A 1 B 1 and A 2 B 2 and assumes these pairs of qubits have the same fidelity F > 0.5.The protocol consists of the following steps: (1) apply a local CNOT operations The instances of the modeled BBPSSW protocol are created and paired by their respective Resource Managers.When two of these instances are initialized properly, they start the procedure of purification.Figure 13 shows the state diagram for the BBPSSW protocol model.Based on the fidelity of the two given memories, the protocol instances determine the probability of success p suc and randomly determine the success of purification with this probability (but do not update the state of the memories).Then, the two BBPSSW instances send messages to each other to mimic the transmission of measurement results and wait for the message from the other side.When a protocol instance receives a message, the predetermined result of purification is used to update the state of the quantum memory, and the measured memory loses its entangled state.If the predetermined result indicates the success of purification, the target memory keeps its entanglement state and improves fidelity.Otherwise, the target memory also loses its entanglement.

C ENTANGLEMENT SWAPPING
Figure 14 shows the state machines for the entanglement protocol at both end and intermediate nodes.The intermediate node uses the probability of success and random number to determine whether swapping succeeds and sends a message to the paired end nodes.Then, the intermediate finishes its work and releases resources.The end nodes start and wait for the message from the intermediate.If the message shows the swapping succeeded, the protocol instance updates the identity of the entangled memory and fidelity.Otherwise, the entanglement state is removed.The updated memory is then released to the Resource Manager.

Start
Determine the swapping result

Send result message
Reset  A reservation protocol instance creates three rules to provide service.The first rule defines the conditions and actions for entanglement generation.If the state of reserved memory is raw, the memory is allocated to an instance of the generation protocol.The second rule defines conditions and actions for entanglement purification.If two reserved memories have same fidelity of entanglement and the current fidelity is lower than the target fidelity, the two memories are allocated to an instance of the purification protocol.The third rule defines conditions and actions for entanglement swapping.If the two reserved memories are entangled with memories on specific nodes and the fidelity of entanglement is larger than the target fidelity, the two memories are allocated to an instance of the entanglement swapping protocol.

Figure 1 :
Figure 1: Modularized design of SeQUeNCe closely matching an abstract quantum network architecture.Simulation Kernel is the heart of SeQUeNCe and enables discrete-event simulation.Simulation time advances in

4. 1 . 1
Quantum and Classical Channels.Quantum channels in photonic networks use standard telecommunication fiber to transmit quantum information.Our model of a quantum channel has two functions: schedule and transmit.The schedule function is used to determine the earliest available transmission time for the transmit function.The transmit function sends a photon to the other end of the channel.We model the propagation delay as L/c * , where L denotes the length of fiber and c * denotes the speed of light in the fiber.

4. 2 . 1
Barrett-Kok  Entanglement Generation Protocol.The Barrett-Kok entanglement generation protocol[3] utilizes matter qubits and linear optics.Compared with the DLCZ entanglement generation protocol[53], this protocol can tolerate the most significant hardware errors such as detector loss and spontaneous emission.

Figure 3 :
Figure 3: Barrett-Kok generation protocol.Quantum node and BSM node are defined in §4.1.4.

Figure 3 1 √ 2 (
Figure 3 shows the setup of the Barrett-Kok entanglement generation protocol, where two quantum memories are connected to a beam splitter (BS) by optical channels.The quantum memories are prepared in the |+⟩ = 1 √ 2 (| ↑⟩ + | ↓⟩) state; the 50:50 BS is used to erase the photon source information; and the single photon detectors D + and D − are used to detect emitted photons.Quantum nodes synchronize the times to excite the memories, guaranteeing that the emitted photons from both sides arrive at the BS simultaneously.The protocol involves two rounds.The first round generates entanglement between two qubits, and the second round verifies the entangled state.The protocol produces a pair of entangled memories with maximal entanglement state |Ψ + ⟩ or |Ψ − ⟩.For more details on the operation of the protocol as well as our implementation, see Appendix A.

4. 2 . 3 Figure 4 :
Figure 4: Two short-distance entangled pairs are consumed to distribute long-distance entanglement by the swapping protocol.The success probability and degradation of swapping F d are defined by the operations performed at the intermediate node.The degradation comes from imperfect gate operations.Given two pairs of entangled memory with fidelity F 1 and F 2 , the fidelity F of new entanglement after swapping is[1]

•
Initiator: the initiator of the entanglement connection that is sending a reservation request (classical message) towards the Responder • Responder: the other end of the connection setup process (and future entanglement connection), where the message sent by the Initiator terminates • Fidelity: the target fidelity of distributed entanglement • Memory size: the memory provided by the Initiator to distribute entanglement and requested of the Responder • Start time: the time from when the resources need to be available for use by the application • End time: the time when the resources can be released

2 . 1 )Figure 7 :
Figure 7: Chicago metropolitan quantum network topology.Solid lines represent existing quantum links.Dashed lines represent augmented quantum links added to improve connectivity.The channel delay is modeled as the propagation delay on the optical fiber (see §4.1.1).The classical channel delay was obtained by performing round-trip time (RTT) measurements between the 5 sites, as shown in Table1.The one-way classical channel delay was calculated by halving and averaging the two-directional RTTs between sites, and one-way delays within a site were set to 0.25 ms.Each of the 9 nodes in our network is equipped with quantum memories and supports all protocols described in §4.Nodes are therefore able to assume the role of a quantum router.The default hardware parameters in our setup are shown in Table 2.These values represent properties of state-of-the-art hardware components.In the course of simulations, applications running on all nodes request quantum network resources repeatedly for 1,000 seconds of simulation time, and performance metrics such as entanglement throughput and memory utilization are recorded.The application requests are random, choosing

Figure 8 :
Figure 8: Average per flow throughput for various combinations of memory efficiency and atom-cavity cooperativity.

Figure 9 :
Figure 9: Average per flow network throughput achieved for different quantum memory frequencies.

Figure 10 :Figure 11 :
Figure 10: Memory utilization at Argonne-3 and Star-Light nodes.Utilization is shown for even distribution of memory capacities among all nodes (top) and for weighted distribution based on anticipated load (bottom).

Figure 12 :
Figure 12: State machine of entanglement generation.

Figure 15 :
Figure 15: State machine of reservation protocol.

Table 1 :
RTT delays between all pairs of network sites.Rows represent the sender, and columns represent the receiver.

Table 3 :
Memory array size distributed by usage.
Expect a photon detection event in either D + or D − during a time window t wait .If both detectors are (not) clicked, the quantum state of system is |ee⟩ (| ↑↑⟩).The scheme has then failed, and the qubits must be newly prepared before reattempting the entangling procedure.If only one detector is triggered, the quantum state still cannot be determined as a maximal state; state |ee⟩ can also produce the same phenomenon if one photon is lost.Therefore, the current quantum state is |↑e ⟩+ |e ↑⟩+ |ee ⟩ Expect a photon detection event in either D + or D − within a time t wait window.If only one detector is triggered, the maximally entangled state |↓↑⟩+ |↑↓⟩ √ 2 Figure15shows the state machine of the reservation protocol.A protocol instance starts upon arrival of a request message.The protocol instance checks whether sufficient local memory is available from the start time to the end time of the request.If sufficient memory is available, the instance will attach its local information and forward the message to the next hop in the path until the message arrives at the Responder.Every quantum router in the path holds the quantum memory resources until it receives an APPROVE message.When the request is approved by the Responder, this APPROVE message is created and sent back to confirm the success of reservation.Once a protocol instance confirms reservation with an APPROVE message, the corresponding local rules are created and scheduled.If the protocol instance of any node on the path (Responder included) rejects the request, a REJECT message is sent back to the previous hop until it arrives at the Initiator.All reservations from the request are canceled.When the protocol instance on the Initiator receives the result of the request, it sends the result to the Application module.