20 #include "ns3/simulator.h"
43 .SetGroupName (
"Wave")
45 .AddAttribute (
"CchInterval",
"CCH Interval, default value is 50ms.",
49 .AddAttribute (
"SchInterval",
"SCH Interval, default value is 50ms.",
53 .AddAttribute (
"GuardInterval",
"Guard Interval, default value is 4ms.",
92 const static uint8_t DEFAULT_CCH_INTERVAL = 50;
101 const static uint8_t DEFAULT_SCH_INTERVAL = 50;
117 const static uint8_t SyncTolerance = 2;
118 const static uint8_t MaxChSwitchTime = 2;
119 const static uint8_t DEFAULT_GUARD_INTERVAL = SyncTolerance + MaxChSwitchTime;
208 return interval <
m_gi;
218 NS_LOG_WARN (
"the channel interval should not be zero");
224 NS_LOG_WARN (
"every UTC second shall be an integer number of SyncInterval");
229 NS_LOG_WARN (
"CCH Interval should be large than GuardInterval");
234 NS_LOG_WARN (
"SCH Interval should be large than GuardInterval");
285 Time future =
Now () + duration;
313 if ((*i) == listener)
336 NS_FATAL_ERROR (
"the coordination event order should start with the beginning of 1 second");
340 NS_FATAL_ERROR (
"the channel intervals configured for channel coordination events are invalid");
394 (*i)->NotifyGuardSlotStart (guardSlot, inCchi);
bool IsGuardInterval(Time duration=Seconds(0.0)) const
Simulation virtual time values and global simulation resolution.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
ChannelCoordinator deals with channel coordination in data plane (see 1609.4 chapter 5...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time GetRemainTime(Time duration=Seconds(0.0)) const
virtual ~ChannelCoordinationListener(void)
#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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void SetCchInterval(Time cchi)
#define NS_FATAL_ERROR(msg)
Fatal error handling.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
bool IsSchInterval(Time duration=Seconds(0.0)) const
bool IsValidConfig(void) const
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void NotifyGuardSlot(void)
Time NeedTimeToGuardInterval(Time duration=Seconds(0.0)) const
static Time GetDefaultGuardInterval(void)
void UnregisterAllListeners(void)
Remove all listeners.
AttributeValue implementation for Time.
static Time GetDefaultSchInterval(void)
void StartChannelCoordination(void)
start to make channel coordination events
Time GetGuardInterval(void) const
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
bool IsCchInterval(Time duration=Seconds(0.0)) const
void UnregisterListener(Ptr< ChannelCoordinationListener > listener)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetIntervalTime(Time duration=Seconds(0.0)) const
Time GetCchInterval(void) const
virtual void DoInitialize(void)
Initialize() implementation.
std::vector< Ptr< ChannelCoordinationListener > >::iterator ListenersI
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
static Time GetDefaultCchInterval(void)
Time GetSchInterval(void) const
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void StopChannelCoordination(void)
stop channel coordination events
virtual void DoDispose(void)
Destructor implementation.
Time GetCchSlot(void) const
virtual ~ChannelCoordinator()
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Time GetSchSlot(void) const
void SetSchInterval(Time schi)
Time GetSyncInterval(void) const
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
static TypeId GetTypeId(void)
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
A base class which provides memory management and object aggregation.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
a unique identifier for an interface.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
TypeId SetParent(TypeId tid)
void SetGuardInterval(Time guardi)
static Time GetDefaultSyncInterval(void)