Q2NS dev
ns-3 module
Loading...
Searching...
No Matches
q2nsviz-channel-loss-example.cc File Reference

Entanglement distribution with photon loss, receiver-side NACK, and retry. More...

#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/simulator.h"
#include "ns3/q2ns-netcontroller.h"
#include "ns3/q2ns-qgate.h"
#include "ns3/q2ns-qmap.h"
#include "ns3/q2ns-qnode.h"
#include "ns3/q2ns-qubit.h"
#include "ns3/q2nsviz-trace-writer.h"
#include "ns3/q2nsviz-trace.h"
#include <functional>
#include <iostream>
Include dependency graph for q2nsviz-channel-loss-example.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

static const uint16_t kCtrlPort = 9200
 
static const uint16_t kNotifyPort = 9201
 
static const int kMaxAttempts = 20
 

Detailed Description

Entanglement distribution with photon loss, receiver-side NACK, and retry.

Source generates a Bell pair and sends the flying qubit over a lossy channel. A classical notification packet is sent concurrently so Destination can arm a receive-timeout. On qubit arrival Destination sends an ACK, on timeout it sends a NACK.

Tunable parameters: –run RNG run index (default 1). –loss-prob Per-qubit loss probability [0,1] (default 0.8).

Timing model (illustrative): kSingleGate = 100 ns (single-qubit gate) kTwoQGate = 300 ns (two-qubit gate) kQDelay = 10 ns (quantum channel propagation, ~2 m fiber) kDstTimeout = 5 ns (scheduled from notification arrival; qubit arrives ~2.5 ns before the notify packet at 100 Mbps, so the timeout fires safely after a successful reception and before any retry)

Visualization output is written to examples/example_traces/q2nsviz-channel-loss-example.json and can be loaded in the q2nsviz viewer (src/q2ns/utils/q2nsviz-serve.sh).

Definition in file q2nsviz-channel-loss-example.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file q2nsviz-channel-loss-example.cc.

References q2ns::NetController::AssignStreams(), q2ns::NetController::CreateNode(), q2ns::NetController::InstallQuantumLink(), TraceWriter::Instance(), kCtrlPort, kNotifyPort, TraceWriter::Open(), q2ns::NetController::SetQStateBackend(), Trace(), TraceCreateChannel(), and TraceCreateNode().

Here is the call graph for this function:

Variable Documentation

◆ kCtrlPort

const uint16_t kCtrlPort = 9200
static

Definition at line 57 of file q2nsviz-channel-loss-example.cc.

Referenced by main().

◆ kMaxAttempts

const int kMaxAttempts = 20
static

Definition at line 59 of file q2nsviz-channel-loss-example.cc.

◆ kNotifyPort

const uint16_t kNotifyPort = 9201
static

Definition at line 58 of file q2nsviz-channel-loss-example.cc.

Referenced by main().