ns3::NrLbtAccessManager class

Class that implements the generic LBT channel access manager algorithm.

Subclasses of NrLbtAccessManager implement different categories of the LBT algorithm. The categories of LBT algorithm according to 3GPP TR 38.889 V1.0.0 (2018-11), Section 8.2. are 1, 2, 3 and 4. Category 1 represents the switching gap from the reception to transmission, so it is not considered as a specific sub-type of LBT CAM algorithm. Cat. 2 means that LBT executes without a random back-off, i.e. the LBT procedure is done for a deterministic amount of time, e.g. 25 us. Cat. 3 means that there is a random back-off but the contention window (CW) is fixed; and Cat. 4 means that there is a random back-off and the CW is variable.

Derived classes

class NrCat2LbtAccessManager
Class that implements the Cat2 LBT channel access manager algorithm.
class NrCat3LbtAccessManager
Class that implements the Cat2 LBT channel access manager algorithm.
class NrCat4LbtAccessManager
Class that implements the Cat2 LBT channel access manager algorithm.

Public functions

auto AssignStreams(int64_t stream) -> int64_t
auto GetDeferTime() const -> const Time& virtual
Gets default defer time that is used by LBT algorithm.
auto GetEdThreshold() const -> double
Returns the ED threshold that is used in LBT algorithm and for energy detection.
auto GetMcot() const -> const Time&
Gets the MCOT of the transmission opportunity that will be granted to the user of LBT CAM, depends on the priority class.
auto GetSlotTime() const -> const Time&
Gets the duration of the slot that is configured to be used by LBT.
void RequestAccess() override
Function used by the user of the CAM to request the channel access.
void SetAccessGrantedCallback(const AccessGrantedCallback& cb) override
Sets the callback function that will be called to notify that the channel access is granted, once that LBT algorithm finishes successfully.
void SetDeferTime(const Time& deferTime)
void SetEdThreshold(double edThreshold)
Set the ED threshold to be used in LBT algorithm and energy detection in dBm.
void SetMcot(const Time& mcot)
Sets the duration of the transmission opportunity that will be granted to the user of LBT CAM, depends on the priority class.
void SetNrGnbMac(Ptr<NrGnbMac> mac) override
Set MAC instance for this channel access manager.
void SetNrSpectrumPhy(Ptr<NrSpectrumPhy> spectrumPhy) override
Set spectrum phy instance for this channel access manager.
void SetSlotTime(const Time& slotTime)
Sets the duration of the slot to be used by the LBT algorithm for.

Protected functions

auto GetBackoffSlots() -> uint32_t pure virtual
Get the random number of backoff slots to be used in the current execution of the LBT algorithm during the backoff process.
auto GetCurrentBackoffCount(void) const -> uint32_t
auto GetLastTxopStartTime() const -> Time
Gets the last TXOP start time.
auto GetLbtState() const -> LbtState
Gets the current LBT state.
void NotifyAccessGranted()
Notify the registered callbacks that the access is granted.
void RequestAccessAfterBackoff()
Function is called after backoff process is done to grant the access to the CAM user.
void RequestAccessAfterDefer() virtual
Function is called when defer period is finished to check if the it is necessary to ener to extended CCA.
void SetGrant() virtual
Function that does various things: notifies the user of the granted access, updates variables that are necessary for handling the next channel access request.
void SetLbtState(LbtState state)
Sets the LBT state.
void TransitionFromBusy()
Used when the LBT state machine returns from the BUSY state.
void TransitionToBusy(Time duration) virtual
Channel is busy for the given duration.

Protected variables

std::vector<AccessDeniedCallback> m_accessDeniedCb
The list of registered callback for the notification of access denied event.
std::vector<AccessGrantedCallback> m_accessGrantedCb
The list of registered callacks for the channel access grant notification.
uint32_t m_backoffCount
Counter for current backoff remaining.
Time m_backoffStartTime
The backoff start time.
TracedValue<uint32_t> m_currentBackoffSlots
The last value drawn for backoff.
Time m_deferTime
The defer time of LBT algorithm.
double m_edThreshold
ED threshold to be used for energy detection.
bool m_grantRequested
The indicator for tracking whether the channel access grant is requested.
Time m_lastBusyTime
The last time at which the channel was busy.
Time m_lastTxopStartTime
The last grant start time.
Time m_mcot
The maximum channel occupancy time.
Ptr<UniformRandomVariable> m_rng
The uniform random variable used to choose random value for the backoff counter.
Time m_slotTime
The duration of a single slot when listening the channel, that is considered by LBT algorithm.
LbtState m_state
LBT algorithm state.
EventId m_waitForBackoffEventId
The ID of the event that is triggered once that the backoff is over.
EventId m_waitForBusyEventId
The ID of the event that is triggered once that the channel busy state is over.
EventId m_waitForDeferEventId
The ID of event that is triggered when defer time is over.

Function documentation

int64_t ns3::NrLbtAccessManager::AssignStreams(int64_t stream)

Parameters
stream first stream index to use
Returns the number of stream indices assigned by this model

Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.

double ns3::NrLbtAccessManager::GetEdThreshold() const

Returns the ED threshold that is used in LBT algorithm and for energy detection.

Returns energy detection threshold value in dBm

const Time& ns3::NrLbtAccessManager::GetMcot() const

Gets the MCOT of the transmission opportunity that will be granted to the user of LBT CAM, depends on the priority class.

Returns the maximum channel occupancy time

const Time& ns3::NrLbtAccessManager::GetSlotTime() const

Gets the duration of the slot that is configured to be used by LBT.

Returns duration of the slot

void ns3::NrLbtAccessManager::SetAccessGrantedCallback(const AccessGrantedCallback& cb) override

Sets the callback function that will be called to notify that the channel access is granted, once that LBT algorithm finishes successfully.

Parameters
cb the callback function to be called when the channel access is granted

void ns3::NrLbtAccessManager::SetDeferTime(const Time& deferTime)

Parameters
deferTime defer time to be used by LBT algorithm

Sets the defautl defer time to be used by LBT aalgorithm

void ns3::NrLbtAccessManager::SetEdThreshold(double edThreshold)

Set the ED threshold to be used in LBT algorithm and energy detection in dBm.

Parameters
edThreshold energy detection threshold

void ns3::NrLbtAccessManager::SetMcot(const Time& mcot)

Sets the duration of the transmission opportunity that will be granted to the user of LBT CAM, depends on the priority class.

Parameters
mcot the maximum channel occupancy time

void ns3::NrLbtAccessManager::SetNrGnbMac(Ptr<NrGnbMac> mac) override

Set MAC instance for this channel access manager.

Parameters
mac gNB mac instance

void ns3::NrLbtAccessManager::SetNrSpectrumPhy(Ptr<NrSpectrumPhy> spectrumPhy) override

Set spectrum phy instance for this channel access manager.

Parameters
spectrumPhy specturm phy instance

void ns3::NrLbtAccessManager::SetSlotTime(const Time& slotTime)

Sets the duration of the slot to be used by the LBT algorithm for.

Parameters
slotTime duration of the slot

uint32_t ns3::NrLbtAccessManager::GetBackoffSlots() pure virtual protected

Get the random number of backoff slots to be used in the current execution of the LBT algorithm during the backoff process.

Returns the random number of backoff slots

uint32_t ns3::NrLbtAccessManager::GetCurrentBackoffCount(void) const protected

Gets the current value of the backoff counter. Used by LBT algoritm during the backoff procedure.

Time ns3::NrLbtAccessManager::GetLastTxopStartTime() const protected

Gets the last TXOP start time.

Returns the last TXOP start time

LbtState ns3::NrLbtAccessManager::GetLbtState() const protected

Gets the current LBT state.

Returns current LBT state

void ns3::NrLbtAccessManager::SetLbtState(LbtState state) protected

Sets the LBT state.

Parameters
state New state for LBT state machine

void ns3::NrLbtAccessManager::TransitionToBusy(Time duration) virtual protected

Channel is busy for the given duration.

Parameters
duration during which the channel is detected as busy