![]() |
Q2NS dev
ns-3 module
|
Duplex quantum channel with configurable delay, jitter, and transit maps. More...
#include <q2ns-qchannel.h>
Public Member Functions | |
| QChannel () | |
| Default constructor. | |
| void | SetDelay (ns3::Time d) |
| Set the same propagation delay in both directions. | |
| ns3::Time | GetDelay () const |
| Get the A->B propagation delay. | |
| void | SetJitter (ns3::Time j) |
| Set the same jitter in both directions. | |
| ns3::Time | GetJitter () const |
| Get the A->B jitter. | |
| void | SetQMap (ns3::Ptr< QMap > m) |
| Set the same transit QMap in both directions. | |
| ns3::Ptr< QMap > | GetQMap () const |
| Get the A->B transit QMap. | |
| void | SetDelayAB (ns3::Time d) |
| Set the one-way delay from A to B. | |
| ns3::Time | GetDelayAB () const |
| Get the one-way delay from A to B. | |
| void | SetDelayBA (ns3::Time d) |
| Set the one-way delay from B to A. | |
| ns3::Time | GetDelayBA () const |
| Get the one-way delay from B to A. | |
| void | SetJitterAB (ns3::Time j) |
| Set the one-way jitter from A to B. | |
| ns3::Time | GetJitterAB () const |
| Get the one-way jitter from A to B. | |
| void | SetJitterBA (ns3::Time j) |
| Set the one-way jitter from B to A. | |
| ns3::Time | GetJitterBA () const |
| Get the one-way jitter from B to A. | |
| void | SetQMapAB (ns3::Ptr< QMap > m) |
| Set the one-way transit QMap from A to B. | |
| ns3::Ptr< QMap > | GetQMapAB () const |
| Get the one-way transit QMap from A to B. | |
| void | SetQMapBA (ns3::Ptr< QMap > m) |
| Set the one-way transit QMap from B to A. | |
| ns3::Ptr< QMap > | GetQMapBA () const |
| Get the one-way transit QMap from B to A. | |
| void | Connect (ns3::Ptr< QNetDevice > a, ns3::Ptr< QNetDevice > b) |
| Connect two QNetDevice endpoints to this channel. | |
| std::size_t | GetNDevices () const override |
| Return the number of attached devices. | |
| ns3::Ptr< ns3::NetDevice > | GetDevice (std::size_t i) const override |
| Return an attached device by endpoint index. | |
| int64_t | AssignStreams (int64_t stream) |
| Assign RNG streams used by this channel. | |
Static Public Member Functions | |
| static ns3::TypeId | GetTypeId (void) |
| Get the ns-3 TypeId. | |
Protected Member Functions | |
| ~QChannel () override=default | |
| Protected destructor to prevent stack allocation. | |
Private Member Functions | |
| bool | SendFrom (QNetDevice *src, std::shared_ptr< Qubit > q) |
| Send a qubit from one endpoint to the opposite endpoint. | |
Private Attributes | |
| ns3::Ptr< QNetDevice > | aDev_ |
| Device attached to endpoint A. | |
| ns3::Ptr< QNetDevice > | bDev_ |
| Device attached to endpoint B. | |
| ns3::Time | delayAB_ {} |
| Propagation delay from A to B. | |
| ns3::Time | delayBA_ {} |
| Propagation delay from B to A. | |
| ns3::Time | jitterAB_ {ns3::Time(0.0)} |
| Jitter magnitude from A to B. | |
| ns3::Time | jitterBA_ {ns3::Time(0.0)} |
| Jitter magnitude from B to A. | |
| ns3::Ptr< ns3::UniformRandomVariable > | jitterRv_ |
| Jitter sampler. | |
| ns3::Ptr< QMap > | qmapAB_ |
| Transit QMap from A to B. Null means identity. | |
| ns3::Ptr< QMap > | qmapBA_ |
| Transit QMap from B to A. Null means identity. | |
| ns3::Ptr< ns3::UniformRandomVariable > | mapRv_ |
| QMap sampler. | |
| friend | QNetDevice |
Duplex quantum channel with configurable delay, jitter, and transit maps.
QChannel connects exactly two QNetDevice endpoints, referred to as A and B. Delay, jitter, and QMap configuration may be set symmetrically for both directions or independently for A->B and B->A.
On each transmission, the channel selects the direction-specific delay, applies an optional random jitter to that delay, samples the direction- specific QMap to obtain a per-transmission QMapInstance, and schedules delivery to the opposite endpoint.
The sampled QMapInstance is not applied immediately in the channel. Instead, it is delivered alongside the qubit and later executed at the receiving node after the qubit becomes local there.
Definition at line 53 of file q2ns-qchannel.h.
| q2ns::QChannel::QChannel | ( | ) |
Default constructor.
Definition at line 84 of file q2ns-qchannel.cc.
|
overrideprotecteddefault |
Protected destructor to prevent stack allocation.
| int64_t q2ns::QChannel::AssignStreams | ( | int64_t | stream | ) |
Assign RNG streams used by this channel.
Streams are assigned to the jitter and QMap sampling random variables.
| stream | Starting stream index. |
Definition at line 370 of file q2ns-qchannel.cc.
| void q2ns::QChannel::Connect | ( | ns3::Ptr< QNetDevice > | a, |
| ns3::Ptr< QNetDevice > | b | ||
| ) |
Connect two QNetDevice endpoints to this channel.
The provided devices become endpoints A and B. Each device is also updated to reference this channel.
| a | Endpoint A device. |
| b | Endpoint B device. |
Definition at line 256 of file q2ns-qchannel.cc.
| ns3::Time q2ns::QChannel::GetDelay | ( | ) | const |
Get the A->B propagation delay.
If the channel is configured asymmetrically, this returns the A->B delay. Use GetDelayBA() to query the opposite direction explicitly.
Definition at line 103 of file q2ns-qchannel.cc.
References delayAB_, and delayBA_.
Referenced by GetTypeId().
| ns3::Time q2ns::QChannel::GetDelayAB | ( | ) | const |
Get the one-way delay from A to B.
Definition at line 167 of file q2ns-qchannel.cc.
References delayAB_.
Referenced by GetTypeId().
| ns3::Time q2ns::QChannel::GetDelayBA | ( | ) | const |
Get the one-way delay from B to A.
Definition at line 184 of file q2ns-qchannel.cc.
References delayBA_.
Referenced by GetTypeId().
|
override |
Return an attached device by endpoint index.
| i | Endpoint index, where 0 selects A and 1 selects B. |
Definition at line 358 of file q2ns-qchannel.cc.
| ns3::Time q2ns::QChannel::GetJitter | ( | ) | const |
Get the A->B jitter.
If the channel is configured asymmetrically, this returns the A->B jitter. Use GetJitterBA() to query the opposite direction explicitly.
Definition at line 125 of file q2ns-qchannel.cc.
References jitterAB_, and jitterBA_.
Referenced by GetTypeId().
| ns3::Time q2ns::QChannel::GetJitterAB | ( | ) | const |
Get the one-way jitter from A to B.
Definition at line 201 of file q2ns-qchannel.cc.
References jitterAB_.
Referenced by GetTypeId().
| ns3::Time q2ns::QChannel::GetJitterBA | ( | ) | const |
Get the one-way jitter from B to A.
Definition at line 218 of file q2ns-qchannel.cc.
References jitterBA_.
Referenced by GetTypeId().
|
override |
Return the number of attached devices.
Definition at line 345 of file q2ns-qchannel.cc.
| ns3::Ptr< QMap > q2ns::QChannel::GetQMap | ( | ) | const |
Get the A->B transit QMap.
If the channel is configured asymmetrically, this returns the A->B map. Use GetQMapBA() to query the opposite direction explicitly.
Definition at line 146 of file q2ns-qchannel.cc.
References qmapAB_, and qmapBA_.
Referenced by GetTypeId().
| ns3::Ptr< QMap > q2ns::QChannel::GetQMapAB | ( | ) | const |
Get the one-way transit QMap from A to B.
Definition at line 234 of file q2ns-qchannel.cc.
References qmapAB_.
Referenced by GetTypeId().
| ns3::Ptr< QMap > q2ns::QChannel::GetQMapBA | ( | ) | const |
Get the one-way transit QMap from B to A.
Definition at line 250 of file q2ns-qchannel.cc.
References qmapBA_.
Referenced by GetTypeId().
|
static |
Get the ns-3 TypeId.
Definition at line 32 of file q2ns-qchannel.cc.
References GetDelay(), GetDelayAB(), GetDelayBA(), GetJitter(), GetJitterAB(), GetJitterBA(), GetQMap(), GetQMapAB(), GetQMapBA(), SetDelay(), SetDelayAB(), SetDelayBA(), SetJitter(), SetJitterAB(), SetJitterBA(), SetQMap(), SetQMapAB(), and SetQMapBA().
|
private |
Send a qubit from one endpoint to the opposite endpoint.
The source device must be one of the two attached endpoints. The direction- specific delay, jitter, and QMap are selected from that source endpoint. Delivery is scheduled after the resulting propagation delay.
| src | Source device. Must be either endpoint A or endpoint B. |
| q | Qubit to transmit. |
Definition at line 278 of file q2ns-qchannel.cc.
References aDev_, bDev_, delayAB_, delayBA_, q2ns::QMapContext::elapsedTime, jitterAB_, jitterBA_, jitterRv_, q2ns::Lost, mapRv_, qmapAB_, and qmapBA_.
| void q2ns::QChannel::SetDelay | ( | ns3::Time | d | ) |
Set the same propagation delay in both directions.
| d | Propagation delay. |
Definition at line 91 of file q2ns-qchannel.cc.
References delayAB_, and delayBA_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetDelayAB | ( | ns3::Time | d | ) |
Set the one-way delay from A to B.
| d | Propagation delay from A to B. |
Definition at line 156 of file q2ns-qchannel.cc.
References delayAB_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetDelayBA | ( | ns3::Time | d | ) |
Set the one-way delay from B to A.
| d | Propagation delay from B to A. |
Definition at line 173 of file q2ns-qchannel.cc.
References delayBA_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetJitter | ( | ns3::Time | j | ) |
Set the same jitter in both directions.
Jitter is sampled uniformly in [-jitter, +jitter] and added to the base delay on each transmission, with a minimum resulting delay of zero.
| j | Symmetric jitter magnitude. |
Definition at line 113 of file q2ns-qchannel.cc.
References jitterAB_, and jitterBA_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetJitterAB | ( | ns3::Time | j | ) |
Set the one-way jitter from A to B.
| j | Jitter magnitude from A to B. |
Definition at line 190 of file q2ns-qchannel.cc.
References jitterAB_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetJitterBA | ( | ns3::Time | j | ) |
Set the one-way jitter from B to A.
| j | Jitter magnitude from B to A. |
Definition at line 207 of file q2ns-qchannel.cc.
References jitterBA_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetQMap | ( | ns3::Ptr< QMap > | m | ) |
Set the same transit QMap in both directions.
A null map is treated as the identity map.
| m | Symmetric transit QMap. |
Definition at line 135 of file q2ns-qchannel.cc.
References qmapAB_, and qmapBA_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetQMapAB | ( | ns3::Ptr< QMap > | m | ) |
Set the one-way transit QMap from A to B.
| m | Transit QMap from A to B. |
Definition at line 224 of file q2ns-qchannel.cc.
References qmapAB_.
Referenced by GetTypeId().
| void q2ns::QChannel::SetQMapBA | ( | ns3::Ptr< QMap > | m | ) |
Set the one-way transit QMap from B to A.
| m | Transit QMap from B to A. |
Definition at line 240 of file q2ns-qchannel.cc.
References qmapBA_.
Referenced by GetTypeId().
|
private |
Device attached to endpoint A.
Definition at line 286 of file q2ns-qchannel.h.
Referenced by Connect(), GetDevice(), GetNDevices(), and SendFrom().
|
private |
Device attached to endpoint B.
Definition at line 287 of file q2ns-qchannel.h.
Referenced by Connect(), GetDevice(), GetNDevices(), and SendFrom().
|
private |
Propagation delay from A to B.
Definition at line 289 of file q2ns-qchannel.h.
Referenced by GetDelay(), GetDelayAB(), SendFrom(), SetDelay(), and SetDelayAB().
|
private |
Propagation delay from B to A.
Definition at line 290 of file q2ns-qchannel.h.
Referenced by GetDelay(), GetDelayBA(), SendFrom(), SetDelay(), and SetDelayBA().
|
private |
Jitter magnitude from A to B.
Definition at line 292 of file q2ns-qchannel.h.
Referenced by GetJitter(), GetJitterAB(), SendFrom(), SetJitter(), and SetJitterAB().
|
private |
Jitter magnitude from B to A.
Definition at line 293 of file q2ns-qchannel.h.
Referenced by GetJitter(), GetJitterBA(), SendFrom(), SetJitter(), and SetJitterBA().
|
private |
Jitter sampler.
Definition at line 294 of file q2ns-qchannel.h.
Referenced by AssignStreams(), QChannel(), and SendFrom().
|
private |
QMap sampler.
Definition at line 298 of file q2ns-qchannel.h.
Referenced by AssignStreams(), QChannel(), and SendFrom().
|
private |
Transit QMap from A to B. Null means identity.
Definition at line 296 of file q2ns-qchannel.h.
Referenced by GetQMap(), GetQMapAB(), SendFrom(), SetQMap(), and SetQMapAB().
|
private |
Transit QMap from B to A. Null means identity.
Definition at line 297 of file q2ns-qchannel.h.
Referenced by GetQMap(), GetQMapBA(), SendFrom(), SetQMap(), and SetQMapBA().
|
private |
Definition at line 300 of file q2ns-qchannel.h.