A Discrete-Event Network Simulator
API
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ns3::ChannelCoordinator Class Reference

ChannelCoordinator deals with channel coordination in data plane (see 1609.4 chapter 5.2) More...

#include "channel-coordinator.h"

+ Inheritance diagram for ns3::ChannelCoordinator:

Public Member Functions

 ChannelCoordinator ()
 
virtual ~ChannelCoordinator ()
 
Time GetCchInterval (void) const
 
Time GetGuardInterval (void) const
 
Time GetIntervalTime (Time duration=Seconds(0.0)) const
 
Time GetRemainTime (Time duration=Seconds(0.0)) const
 
Time GetSchInterval (void) const
 
Time GetSyncInterval (void) const
 
bool IsCchInterval (Time duration=Seconds(0.0)) const
 
bool IsGuardInterval (Time duration=Seconds(0.0)) const
 
bool IsSchInterval (Time duration=Seconds(0.0)) const
 
bool IsValidConfig (void) const
 
Time NeedTimeToCchInterval (Time duration=Seconds(0.0)) const
 
Time NeedTimeToGuardInterval (Time duration=Seconds(0.0)) const
 
Time NeedTimeToSchInterval (Time duration=Seconds(0.0)) const
 
void RegisterListener (Ptr< ChannelCoordinationListener > listener)
 
void SetCchInterval (Time cchi)
 
void SetGuardInterval (Time guardi)
 
void SetSchInterval (Time schi)
 
void UnregisterAllListeners (void)
 Remove all listeners. More...
 
void UnregisterListener (Ptr< ChannelCoordinationListener > listener)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static Time GetDefaultCchInterval (void)
 
static Time GetDefaultGuardInterval (void)
 
static Time GetDefaultSchInterval (void)
 
static Time GetDefaultSyncInterval (void)
 
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Types

typedef std::vector< Ptr< ChannelCoordinationListener > > Listeners
 Listeners typdef. More...
 
typedef std::vector< Ptr< ChannelCoordinationListener > >::iterator ListenersI
 Listeners iterator typedef. More...
 

Private Member Functions

virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
Time GetCchSlot (void) const
 
Time GetSchSlot (void) const
 
void NotifyCchSlot (void)
 notify listeners of a CCH slot start More...
 
void NotifyGuardSlot (void)
 notify listeners of a guard slot start More...
 
void NotifySchSlot (void)
 notify listeners of a SCH slot start More...
 
void StartChannelCoordination (void)
 start to make channel coordination events More...
 
void StopChannelCoordination (void)
 stop channel coordination events More...
 

Private Attributes

Time m_cchi
 CchInterval. More...
 
EventId m_coordination
 coordination event More...
 
Time m_gi
 GuardInterval. More...
 
uint32_t m_guardCount
 guard count More...
 
Listeners m_listeners
 listeners More...
 
Time m_schi
 SchInterval. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

ChannelCoordinator deals with channel coordination in data plane (see 1609.4 chapter 5.2)


<---------— --—SYNCI--------------—> <----------------—SYNCI---------------—> CCHI SCHI CCHI SCHI |..************|..************|..************|..************| GI GI GI GI

The relation among CCHI(CCH Interval), SCHI(SCH Interval), GI(Guard Interval), SYNCI(Sync Interval):

  1. they are all time durations, gegerally default CCHI is 50ms, default SCHI is 50ms, default GI is 4ms, default SYNCI is 100ms.
  2. Every UTC second shall be an integer number of sync interval, and the beginning of a sync interval shall align with beginning of UTC second;
  3. SYNCI is the sum of CCHI and SCHI. GI is the sum of SyncTolerance and MaxSwitchTime defined for multi-channel synchronization (see 1609.4 chapter 6.2). And since all devices the in simulation could be supposed to synchronize by "perfect GPS", here the synchronization mechanism defined in the standard will be not implemented.
  4. Although the real channel switch time of wifi PHY layer is very fast, and the "ChannelSwitchDelay" of YansWifiPhy is 250 microseconds, here in 4ms guard interval WAVE devices cannot transmit packets while may receive packets.

Config Paths

ns3::ChannelCoordinator is accessible through the following paths with Config::Set and Config::Connect:

Attributes

No TraceSources are defined for this type.
Size of this type is 112 bytes (on a 64-bit architecture).

Definition at line 71 of file channel-coordinator.h.

Member Typedef Documentation

◆ Listeners

Listeners typdef.

Definition at line 244 of file channel-coordinator.h.

◆ ListenersI

typedef std::vector<Ptr<ChannelCoordinationListener> >::iterator ns3::ChannelCoordinator::ListenersI
private

Listeners iterator typedef.

Definition at line 246 of file channel-coordinator.h.

Constructor & Destructor Documentation

◆ ChannelCoordinator()

ns3::ChannelCoordinator::ChannelCoordinator ( )

Definition at line 61 of file channel-coordinator.cc.

References NS_LOG_FUNCTION.

◆ ~ChannelCoordinator()

ns3::ChannelCoordinator::~ChannelCoordinator ( )
virtual

Definition at line 67 of file channel-coordinator.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ DoDispose()

void ns3::ChannelCoordinator::DoDispose ( void  )
privatevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 80 of file channel-coordinator.cc.

References NS_LOG_FUNCTION, StopChannelCoordination(), and UnregisterAllListeners().

◆ DoInitialize()

void ns3::ChannelCoordinator::DoInitialize ( void  )
privatevirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 73 of file channel-coordinator.cc.

References NS_LOG_FUNCTION, and StartChannelCoordination().

◆ GetCchInterval()

Time ns3::ChannelCoordinator::GetCchInterval ( void  ) const

◆ GetCchSlot()

Time ns3::ChannelCoordinator::GetCchSlot ( void  ) const
private
Returns
CCH channel access time which is SchInterval - GuardInterval, default 46ms

Definition at line 180 of file channel-coordinator.cc.

References m_cchi, m_gi, and NS_LOG_FUNCTION.

Referenced by NotifyCchSlot().

◆ GetDefaultCchInterval()

Time ns3::ChannelCoordinator::GetDefaultCchInterval ( void  )
static
Returns
the default control channel interval for multi-channel operation (50 milliseconds).

Definition at line 88 of file channel-coordinator.cc.

References ns3::MilliSeconds(), and NS_LOG_FUNCTION_NOARGS.

Referenced by GetDefaultSyncInterval(), and GetTypeId().

◆ GetDefaultGuardInterval()

Time ns3::ChannelCoordinator::GetDefaultGuardInterval ( void  )
static
Returns
the default guard channel interval for multi-channel operation (4 milliseconds).

Definition at line 113 of file channel-coordinator.cc.

References ns3::MilliSeconds(), and NS_LOG_FUNCTION_NOARGS.

Referenced by GetTypeId().

◆ GetDefaultSchInterval()

Time ns3::ChannelCoordinator::GetDefaultSchInterval ( void  )
static
Returns
the default service channel interval for multi-channel operation (50 milliseconds).

Definition at line 97 of file channel-coordinator.cc.

References ns3::MilliSeconds(), and NS_LOG_FUNCTION_NOARGS.

Referenced by GetDefaultSyncInterval(), and GetTypeId().

◆ GetDefaultSyncInterval()

Time ns3::ChannelCoordinator::GetDefaultSyncInterval ( void  )
static
Returns
the default sync interval for multi-channel operation (100 milliseconds).

Definition at line 106 of file channel-coordinator.cc.

References GetDefaultCchInterval(), GetDefaultSchInterval(), and NS_LOG_FUNCTION_NOARGS.

◆ GetGuardInterval()

Time ns3::ChannelCoordinator::GetGuardInterval ( void  ) const

◆ GetIntervalTime()

Time ns3::ChannelCoordinator::GetIntervalTime ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
the time in a Sync Interval of future time for example: SyncInterval = 100ms; Now = 5s20ms; duration = 50ms; then GetIntervalTime (duration) = 70ms.

Definition at line 282 of file channel-coordinator.cc.

References ns3::Time::GetMilliSeconds(), GetSyncInterval(), ns3::MilliSeconds(), sample-rng-plot::n, ns3::Now(), and NS_LOG_FUNCTION.

Referenced by GetRemainTime(), IsCchInterval(), IsGuardInterval(), NeedTimeToCchInterval(), NeedTimeToGuardInterval(), and NeedTimeToSchInterval().

◆ GetRemainTime()

Time ns3::ChannelCoordinator::GetRemainTime ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
the remain time in a Sync Interval of future time for example: SyncInterval = 100ms; Now = 5s20ms; duration = 50ms; then GetRemainTime (duration) = 30ms.

Definition at line 292 of file channel-coordinator.cc.

References GetIntervalTime(), GetSyncInterval(), and NS_LOG_FUNCTION.

◆ GetSchInterval()

Time ns3::ChannelCoordinator::GetSchInterval ( void  ) const
Returns
the SCH interval for multi-channel operation.

Definition at line 145 of file channel-coordinator.cc.

References m_schi, and NS_LOG_FUNCTION.

Referenced by ChannelCoordinationTestCase::DoRun(), GetSyncInterval(), and IsValidConfig().

◆ GetSchSlot()

Time ns3::ChannelCoordinator::GetSchSlot ( void  ) const
private
Returns
SCH channel access time which is SchInterval - GuardInterval, default 46ms

Definition at line 173 of file channel-coordinator.cc.

References m_gi, m_schi, and NS_LOG_FUNCTION.

Referenced by NotifySchSlot().

◆ GetSyncInterval()

Time ns3::ChannelCoordinator::GetSyncInterval ( void  ) const

◆ GetTypeId()

TypeId ns3::ChannelCoordinator::GetTypeId ( void  )
static

◆ IsCchInterval()

bool ns3::ChannelCoordinator::IsCchInterval ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
whether future time is in CCH Interval

Definition at line 187 of file channel-coordinator.cc.

References GetIntervalTime(), m_cchi, and NS_LOG_FUNCTION.

Referenced by IsSchInterval(), NeedTimeToCchInterval(), NeedTimeToGuardInterval(), and ChannelCoordinationTestCase::TestIntervalAfter().

◆ IsGuardInterval()

bool ns3::ChannelCoordinator::IsGuardInterval ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
whether future time is in Guard Interval

Definition at line 202 of file channel-coordinator.cc.

References GetIntervalTime(), m_cchi, m_gi, and NS_LOG_FUNCTION.

Referenced by NeedTimeToGuardInterval(), and ChannelCoordinationTestCase::TestIntervalAfter().

◆ IsSchInterval()

bool ns3::ChannelCoordinator::IsSchInterval ( Time  duration = Seconds (0.0)) const

◆ IsValidConfig()

bool ns3::ChannelCoordinator::IsValidConfig ( void  ) const
Returns
whether current channel interval configuration is valid.

If users set the channel intervals different from default values here, it should be better to test whether the configuration is valid.

Definition at line 212 of file channel-coordinator.cc.

References GetCchInterval(), GetGuardInterval(), GetSchInterval(), GetSyncInterval(), NS_LOG_FUNCTION, and NS_LOG_WARN.

Referenced by ChannelCoordinationTestCase::DoRun(), and StartChannelCoordination().

◆ NeedTimeToCchInterval()

Time ns3::ChannelCoordinator::NeedTimeToCchInterval ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
the time to the next CCH interval. If current time is already in CCH interval, return 0;

Definition at line 243 of file channel-coordinator.cc.

References GetIntervalTime(), GetSyncInterval(), IsCchInterval(), ns3::MilliSeconds(), and NS_LOG_FUNCTION.

Referenced by ns3::DefaultChannelScheduler::AssignExtendedAccess(), and ns3::VsaManager::DoSendVsa().

◆ NeedTimeToGuardInterval()

Time ns3::ChannelCoordinator::NeedTimeToGuardInterval ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
the duration time to next Guard Interval; return 0 if current time is already in Guard Interval, ;

Definition at line 265 of file channel-coordinator.cc.

References GetCchInterval(), GetIntervalTime(), GetSyncInterval(), IsCchInterval(), IsGuardInterval(), ns3::MilliSeconds(), and NS_LOG_FUNCTION.

Referenced by ns3::WaveMacLow::StartTransmission().

◆ NeedTimeToSchInterval()

Time ns3::ChannelCoordinator::NeedTimeToSchInterval ( Time  duration = Seconds (0.0)) const
Parameters
durationthe future time after duration
Returns
the duration time to the next SCH interval. If current time is already in SCH interval, return 0;

Definition at line 254 of file channel-coordinator.cc.

References GetCchInterval(), GetIntervalTime(), IsSchInterval(), ns3::MilliSeconds(), and NS_LOG_FUNCTION.

Referenced by ns3::DefaultChannelScheduler::AssignContinuousAccess(), ns3::DefaultChannelScheduler::AssignExtendedAccess(), and ns3::VsaManager::DoSendVsa().

◆ NotifyCchSlot()

void ns3::ChannelCoordinator::NotifyCchSlot ( void  )
private

notify listeners of a CCH slot start

Definition at line 368 of file channel-coordinator.cc.

References GetCchSlot(), m_coordination, m_listeners, NotifyGuardSlot(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by NotifyGuardSlot().

◆ NotifyGuardSlot()

void ns3::ChannelCoordinator::NotifyGuardSlot ( void  )
private

◆ NotifySchSlot()

void ns3::ChannelCoordinator::NotifySchSlot ( void  )
private

notify listeners of a SCH slot start

Definition at line 357 of file channel-coordinator.cc.

References GetSchSlot(), m_coordination, m_listeners, NotifyGuardSlot(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by NotifyGuardSlot().

◆ RegisterListener()

void ns3::ChannelCoordinator::RegisterListener ( Ptr< ChannelCoordinationListener listener)
Parameters
listenerthe new listener for channel coordination events.

Add the input listener to the list of objects to be notified of channel coordination events.

Definition at line 299 of file channel-coordinator.cc.

References m_listeners, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ChannelCoordinationTestCase::DoRun(), and ns3::DefaultChannelScheduler::SetWaveNetDevice().

◆ SetCchInterval()

void ns3::ChannelCoordinator::SetCchInterval ( Time  cchi)
Parameters
cchithe CCH interval for multi-channel operation.

Definition at line 124 of file channel-coordinator.cc.

References m_cchi, and NS_LOG_FUNCTION.

Referenced by ChannelCoordinationTestCase::DoRun().

◆ SetGuardInterval()

void ns3::ChannelCoordinator::SetGuardInterval ( Time  guardi)
Parameters
guardithe guard interval for multi-channel operation.

Definition at line 159 of file channel-coordinator.cc.

References m_gi, and NS_LOG_FUNCTION.

Referenced by ChannelCoordinationTestCase::DoRun().

◆ SetSchInterval()

void ns3::ChannelCoordinator::SetSchInterval ( Time  schi)
Parameters
schithe SCH interval for multi-channel operation.

Definition at line 138 of file channel-coordinator.cc.

References m_schi, and NS_LOG_FUNCTION.

Referenced by ChannelCoordinationTestCase::DoRun().

◆ StartChannelCoordination()

void ns3::ChannelCoordinator::StartChannelCoordination ( void  )
private

start to make channel coordination events

Definition at line 329 of file channel-coordinator.cc.

References ns3::Time::GetMilliSeconds(), IsValidConfig(), m_guardCount, NotifyGuardSlot(), ns3::Now(), NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by DoInitialize().

◆ StopChannelCoordination()

void ns3::ChannelCoordinator::StopChannelCoordination ( void  )
private

stop channel coordination events

Definition at line 347 of file channel-coordinator.cc.

References ns3::EventId::Cancel(), ns3::EventId::IsExpired(), m_coordination, and m_guardCount.

Referenced by DoDispose().

◆ UnregisterAllListeners()

void ns3::ChannelCoordinator::UnregisterAllListeners ( void  )

Remove all listeners.

Definition at line 322 of file channel-coordinator.cc.

References m_listeners, and NS_LOG_FUNCTION.

Referenced by DoDispose().

◆ UnregisterListener()

void ns3::ChannelCoordinator::UnregisterListener ( Ptr< ChannelCoordinationListener listener)
Parameters
listenerthe current attached listener

Remove the specified listener.

Definition at line 307 of file channel-coordinator.cc.

References m_listeners, NS_ASSERT, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_cchi

Time ns3::ChannelCoordinator::m_cchi
private

CchInterval.

Definition at line 239 of file channel-coordinator.h.

Referenced by GetCchInterval(), GetCchSlot(), GetTypeId(), IsCchInterval(), IsGuardInterval(), and SetCchInterval().

◆ m_coordination

EventId ns3::ChannelCoordinator::m_coordination
private

coordination event

Definition at line 250 of file channel-coordinator.h.

Referenced by NotifyCchSlot(), NotifyGuardSlot(), NotifySchSlot(), and StopChannelCoordination().

◆ m_gi

Time ns3::ChannelCoordinator::m_gi
private

GuardInterval.

Definition at line 241 of file channel-coordinator.h.

Referenced by GetCchSlot(), GetGuardInterval(), GetSchSlot(), GetTypeId(), IsGuardInterval(), and SetGuardInterval().

◆ m_guardCount

uint32_t ns3::ChannelCoordinator::m_guardCount
private

guard count

Definition at line 249 of file channel-coordinator.h.

Referenced by NotifyGuardSlot(), StartChannelCoordination(), and StopChannelCoordination().

◆ m_listeners

Listeners ns3::ChannelCoordinator::m_listeners
private

◆ m_schi

Time ns3::ChannelCoordinator::m_schi
private

SchInterval.

Definition at line 240 of file channel-coordinator.h.

Referenced by GetSchInterval(), GetSchSlot(), GetTypeId(), and SetSchInterval().


The documentation for this class was generated from the following files: