20 #include "ns3/simulator.h"
21 #include "ns3/wifi-phy.h"
69 static TypeId tid =
TypeId(
"ns3::DefaultChannelScheduler")
80 m_waitChannelNumber(0),
82 m_coordinationListener(nullptr)
125 std::vector<Ptr<WifiPhy>> phys = device->
GetPhys();
128 NS_LOG_WARN(
"The class is only in the context of single-PHY device, while there are more "
129 "than one PHY devices");
154 uint32_t sch = channelNumber;
191 uint32_t sch = channelNumber;
255 uint32_t sch = channelNumber;
272 if (remainExtends > extends)
321 Time extendedDuration =
356 NS_LOG_DEBUG(
"channel access is already assigned for other SCHs, thus cannot assign "
357 "default CCH access.");
362 if (
Now().GetMilliSeconds() != 0)
459 mac->MakeVirtualBusy(duration);
467 mac->MakeVirtualBusy(duration);
#define EXTENDED_CONTINUOUS
receive notifications about channel coordination events.
Time GetSyncInterval() const
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
bool IsSchInterval(Time duration=Seconds(0.0)) const
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
This class will assign channel access for requests from higher layers.
void DoDispose() override
Destructor implementation.
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
Ptr< WaveNetDevice > m_device
the device
void DoInitialize() override
Initialize() implementation.
CoordinationListener class.
CoordinationListener(DefaultChannelScheduler *scheduler)
Constructor.
DefaultChannelScheduler * m_scheduler
the scheduler
void NotifyCchSlotStart(Time duration) override
void NotifyGuardSlotStart(Time duration, bool cchi) override
void NotifySchSlotStart(Time duration) override
This class uses a simple mechanism to assign channel access with following features: (1) only in the ...
bool ReleaseAccess(uint32_t channelNumber) override
void DoDispose() override
Destructor implementation.
DefaultChannelScheduler()
EventId m_extendEvent
extend event
void NotifyGuardSlotStart(Time duration, bool cchi)
Notify guard slot start.
static TypeId GetTypeId()
Get the type ID.
void NotifyCchSlotStart(Time duration)
Notify CCH slot start.
void SwitchToNextChannel(uint32_t curChannelNumber, uint32_t nextChannelNumber)
bool AssignContinuousAccess(uint32_t channelNumber, bool immediate) override
Ptr< ChannelCoordinator > m_coordinator
channel coordinator
bool AssignDefaultCchAccess() override
This method will assign default CCH access for CCH.
EventId m_waitEvent
wait event
bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate) override
bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate) override
void NotifySchSlotStart(Time duration)
Notify SCH slot start.
void SetWaveNetDevice(Ptr< WaveNetDevice > device) override
ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const override
uint32_t m_channelNumber
when m_channelAccess is ContinuousAccess, m_channelNumber is continuous channel number; when m_channe...
ChannelAccess m_channelAccess
channel access
~DefaultChannelScheduler() override
uint32_t m_waitChannelNumber
wait channel number
uint32_t m_waitExtend
wait extend
void DoInitialize() override
Initialize() implementation.
Ptr< ChannelCoordinationListener > m_coordinationListener
coordination listener
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
void SetWifiPhy(Ptr< WifiPhy > phy)
Set the PHY.
void Suspend()
To support MAC extension for multiple channel operation, Suspend the activity in current MAC entity.
void Resume()
To support MAC extension for multiple channel operation, Resume the activity of suspended MAC entity.
void MakeVirtualBusy(Time duration)
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< WifiPhy > GetPhy(uint8_t index) const override
const std::vector< Ptr< WifiPhy > > & GetPhys() const override
Ptr< ChannelCoordinator > GetChannelCoordinator() const
Ptr< OcbWifiMac > GetMac(uint32_t channelNumber) const
void ResetWifiPhys()
Remove currently attached WifiPhy objects from this MAC.
Time GetChannelSwitchDelay() const
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
uint8_t GetChannelNumber() const
Return current channel number.
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ChannelAccess
ChannelAccess enumeration.