19#include "ns3/packet.h"
20#include "ns3/pointer.h"
21#include "ns3/simulator.h"
45 m_initRangOppNumber(0),
46 m_contentionRangingRetries(0),
47 m_rngReqFrameNumber(0),
50 m_rangingIntervalFound(false),
53 m_nrInvitedPollsRecvd(0),
56 m_nrRangingTransOpps(0),
57 m_isBackoffSet(false),
126 if (deleteParameters)
132 "Subscriber Station: Error while scanning: Already registered with a BS");
149 m_ss->GetPhy()->StartScanning(dlChannel,
150 m_ss->GetIntervalT20(),
186 "SS: Error while sending a ranging request: the ss state should be "
187 "SS_STATE_WAITING_REG_RANG_INTRVL or SS_STATE_WAITING_INV_RANG_INTRVL");
214 connection =
m_ss->GetBasicConnection();
218 connection =
m_ss->GetInitialRangingConnection();
230 m_ss->GetCurrentUcd().GetChannelEncodings().GetRangReqOppSize() /
231 m_ss->GetPhy()->GetPsPerSymbol(),
232 "SS: Error while sending a ranging request: the allocation size is not correct");
236 m_ss->SendBurst(uiuc, allocationSize, connection);
246 "SS: Can not start connection resolution: The SS state should be SS_STATE_WAITING_RNG_RSP "
247 "or SS_STATE_WAITING_REG_RANG_INTRVL or SS_STATE_ADJUSTING_PARAMETERS");
277 Time timeToAllocation;
278 uint16_t nrPsPerRangOpp =
m_ss->GetCurrentUcd().GetChannelEncodings().GetRangReqOppSize();
279 uint16_t oppSize =
m_ss->GetCurrentUcd().GetChannelEncodings().GetRangReqOppSize() /
280 m_ss->GetPhy()->GetPsPerSymbol();
287 Seconds(deferTOs * nrPsPerRangOpp *
m_ss->GetPhy()->GetPsDuration().GetSeconds());
288 timeToAllocation =
m_ss->GetTimeToAllocation(deferTime);
311 "be sure that CW has been set and BO is not already set");
322 std::min(uint8_t((
m_rangingCW * 2 + 1) - 1),
m_ss->GetCurrentUcd().GetRangingBackoffEnd());
329 (uint8_t)std::pow(2.0, (
double)
m_ss->GetCurrentUcd().GetRangingBackoffStart()) - 1;
337 if (cid ==
m_ss->GetInitialRangingConnection()->GetCid())
359 m_ss->SetPrimaryConnection(
361 m_ss->SetAreManagementConnectionsAllocated(
true);
379 "SS: Can not perform ranging: the ranging status should be "
380 "RANGING_STATUS_CONTINUE or RANGING_STATUS_ABORT or RANGING_STATUS_SUCCESS");
389 m_ss->SetBasicConnection(
nullptr);
390 m_ss->SetPrimaryConnection(
nullptr);
391 m_ss->SetAreManagementConnectionsAllocated(
false);
401 if (
m_ss->HasServiceFlows() && !
m_ss->GetAreServiceFlowsAllocated())
403 m_ss->GetServiceFlowManager()->InitiateServiceFlows();
433 bool successful =
true;
482 bool deleteUlParameters,
An identifier for simulation events.
bool IsPending() const
This method is syntactic sugar for !IsExpired().
Mac Management messages Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
void SetReqDlBurstProfile(uint8_t reqDlBurstProfile)
Set request DL burst profile field.
void SetRangingAnomalies(uint8_t rangingAnomalies)
Set ranging anomalies field.
void SetMacAddress(Mac48Address macAddress)
Set MAC address field.
This class implements the ranging response message described by "IEEE Standard forLocal and metropoli...
Mac48Address GetMacAddress() const
uint32_t GetTimingAdjust() const
Cid GetPrimaryCid() const
uint8_t GetPowerLevelAdjust() const
uint8_t GetRangStatus() const
uint32_t GetOffsetFreqAdjust() const
uint32_t GetDlFreqOverride() const
uint32_t GetFrameNumber() const
uint8_t GetInitRangOppNumber() const
void SetEirXPIrMax(uint16_t eir_x_p_ir_max)
Set EIRX IR maximum.
void AdjustRangingParameters(const RngRsp &rngrsp)
Adjust ranging parameters.
~SSLinkManager() override
uint8_t m_rangingBO
ranging BO
void SetBsEirp(uint16_t bs_eirp)
Set BS EIRP.
void IncrementNrInvitedPollsRecvd()
Increment NR invited polls received.
uint8_t m_initRangOppNumber
Initial Ranging opportunity (1–255) in which SS transmitted the RNG_REQ.
EventId m_dlMapSyncTimeoutEvent
DL map sync timeout event.
uint16_t m_nrRngReqsSent
number rang requests sent
void SetRangingIntervalFound(bool rangingIntervalFound)
Set ranging interval found.
uint16_t m_pTxIrMax
maximum transmit signal strength for initial ranging calculated by SS
uint16_t m_nrInvitedPollsRecvd
number invited polls received
void EndScanning(bool status, uint64_t frequency)
End scanning.
void SelectRandomBackoff()
Select random backoff.
static TypeId GetTypeId()
Get the type ID.
RngReq m_rngreq
rng request
Ptr< SubscriberStationNetDevice > m_ss
subscriber station device
uint8_t m_contentionRangingRetries
contention ranging retries
void ScheduleScanningRestart(Time interval, SubscriberStationNetDevice::EventType eventType, bool deleteUlParameters, EventId &eventId)
Schedule scanning request.
uint16_t m_nrRngRspsRecvd
number rang responses received
uint8_t m_nrRangingTransOpps
number ranging trans opps
void SendRangingRequest(uint8_t uiuc, uint16_t allocationSize)
Send ranging request.
bool IsUlChannelUsable()
Is UL channel usable.
void StartContentionResolution()
Start contention resolution.
void ResetRangingRequestCW()
Reset ranging request CW.
EventId m_waitForRngRspEvent
wait for rang response event
uint16_t m_eirXPIrMax
initial ranging maximum equivalent isotropic received power at BS
uint64_t m_frequency
frequency on which it is currently operating, i.e., where scanning was successful
void SetNrRangingTransOpps(uint8_t nrRangingTransOpps)
Set NR ranging trans opps.
uint16_t CalculateMaxIRSignalStrength()
Calculate maximum IR signal strength.
uint8_t m_rangingCW
ranging CW
void DoDispose() override
Destructor implementation.
uint32_t m_rngReqFrameNumber
frame number in which SS sent RNG_REQ message
void PerformBackoff()
Perform backoff.
uint16_t m_bsEirp
BS EIRP.
void DeleteUplinkParameters()
Delete uplink parameters.
bool m_isBackoffSet
is backoff set
void NegotiateBasicCapabilities()
Negotiate basic capabilities.
bool GetRangingIntervalFound() const
Get ranging interval found.
uint8_t m_dlChnlNr
indicates the channel/frequency currently the SS is scanning
void StartSynchronizing()
Start synchronizing.
void PerformRanging(Cid cid, RngRsp rngrsp)
Perform ranging.
void IncreaseRangingRequestCW()
Increase rnaging request CW.
WimaxNetDevice::RangingStatus m_rangingStatus
ranging status
EventId GetDlMapSyncTimeoutEvent()
Get DL map sync timeout event.
void StartScanning(SubscriberStationNetDevice::EventType type, bool deleteParameters)
Start scanning.
uint8_t m_rangingAnomalies
ranging anomalies
bool m_rangingIntervalFound
ranging interval found
SSLinkManager(Ptr< SubscriberStationNetDevice > ss)
Constructor.
uint16_t GetMinTransmitPowerLevel()
Get minimum transmit power level.
void SetRangingCW(uint8_t rangingCW)
Set ranging CW.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
EventType
EventType enumeration.
@ EVENT_DL_MAP_SYNC_TIMEOUT
@ SS_STATE_WAITING_REG_RANG_INTRVL
@ SS_STATE_ADJUSTING_PARAMETERS
@ SS_STATE_WAITING_INV_RANG_INTRVL
@ SS_STATE_WAITING_RNG_RSP
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class implements the UCD message as described by "IEEE Standard forLocal and metropolitan area n...
Hold together all WiMAX-related objects in a NetDevice.
RangingStatus
RangingStatus enumeration.
@ RANGING_STATUS_CONTINUE
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...