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);
Simulation virtual time values and global simulation resolution.
Time GetIntervalTime(Time duration=Seconds(0.0)) const
#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...
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
bool IsCchInterval(Time duration=Seconds(0.0)) const
void NotifySchSlot(void)
notify listeners of a SCH slot start
EventId m_coordination
coordination event
Listeners m_listeners
listeners
Time GetSchSlot(void) 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.
bool IsValidConfig(void) const
Time NeedTimeToGuardInterval(Time duration=Seconds(0.0)) const
uint32_t m_guardCount
guard count
void SetCchInterval(Time cchi)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
bool IsGuardInterval(Time duration=Seconds(0.0)) const
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void NotifyGuardSlot(void)
notify listeners of a guard slot start
static Time GetDefaultGuardInterval(void)
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
void UnregisterAllListeners(void)
Remove all listeners.
AttributeValue implementation for Time.
static Time GetDefaultSchInterval(void)
void StartChannelCoordination(void)
start to make channel coordination events
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
Time GetCchSlot(void) const
void UnregisterListener(Ptr< ChannelCoordinationListener > listener)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetCchInterval(void) const
virtual void DoInitialize(void)
Initialize() implementation.
std::vector< Ptr< ChannelCoordinationListener > >::iterator ListenersI
Listeners iterator typedef.
Time GetSchInterval(void) const
static Time GetDefaultCchInterval(void)
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void NotifyCchSlot(void)
notify listeners of a CCH slot start
void StopChannelCoordination(void)
stop channel coordination events
virtual void DoDispose(void)
Destructor implementation.
virtual ~ChannelCoordinator()
bool IsSchInterval(Time duration=Seconds(0.0)) const
Time GetRemainTime(Time duration=Seconds(0.0)) const
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void SetSchInterval(Time schi)
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
static TypeId GetTypeId(void)
Get the type ID.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
A base class which provides memory management and object aggregation.
Time GetSyncInterval(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Time GetGuardInterval(void) const
void SetGuardInterval(Time guardi)
static Time GetDefaultSyncInterval(void)