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