ns-3 PLC model
 All Classes Functions Variables Enumerations
Public Member Functions | Static Public Member Functions | Friends
ns3::PLC_Channel Class Reference

#include <plc-channel.h>

List of all members.

Public Member Functions

 PLC_Channel ()
 PLC_Channel (Ptr< PLC_Graph > graph)
void SetGraph (Ptr< PLC_Graph > graph)
Ptr< PLC_GraphGetGraph (void)
uint32_t AddTxInterface (Ptr< PLC_TxInterface > txInterface)
uint32_t GetNTxInterfaces (void) const
Ptr< PLC_TxInterfaceGetTxInterface (uint32_t i) const
uint32_t AddRxInterface (Ptr< PLC_RxInterface > rxInterface)
uint32_t GetNRxInterfaces (void) const
Ptr< PLC_RxInterfaceGetRxInterface (uint32_t i) const
uint32_t AddDevice (Ptr< NetDevice >)
uint32_t GetNDevices (void) const
Ptr< NetDevice > GetDevice (uint32_t i) const
void InitTransmissionChannels (void)
void CalcTransmissionChannels (void)
Ptr< PLC_TransferBaseGetChannelTransferData (uint32_t txId, uint32_t rxId)
void TransmissionStart (Ptr< const Packet > p, uint32_t txId, Ptr< const SpectrumValue > txPsd, Time duration, Ptr< const PLC_TrxMetaInfo > metaInfo)
 Start transmitting a packet over the channel.
bool TransmissionEnd (uint32_t txId, Time propagation_delay)
 Indicates that the txInterface has finished transmitting over the channel.
void PropagationCompleteEvent (uint32_t txId)
 Indicates that the channel has finished propagating the current packet. The channel is released and becomes free.
Timeslot GetCurrentTimeslot (void)
Time GetRemainingSlotTime (Time t)
void ProcessTimeslotTasks (Timeslot timeslot)
void ScheduleNextTimeslotTasks (void)
void UpdateReceivePSDs (Timeslot timeslot, bool channel_changed=false)
void DeleteOutOfDatePSDs (Ptr< PLC_TxInterface > tx, Ptr< PLC_RxInterface > rx)
void Lock (void) const
void Unlock (void) const

Static Public Member Functions

static TypeId GetTypeId (void)

Friends

class PLC_Outlet

Detailed Description

Joins all PLC channel transfer functions By extending ns3::Channel this class provides an interface for attaching ns3::NetDevice instances to a PLC channel


Constructor & Destructor Documentation

Default constructor

Constructor

Parameters:
graphPLC_Graph instance to use

Member Function Documentation

uint32_t ns3::PLC_Channel::AddDevice ( Ptr< NetDevice >  dev)

Connect a NetDevice to this channel. This method must be implemented by subclasses. However, this implementation uses PLC_TxInterface and PLC_RxInterface to identify attached communication devices rather than ns3::NetDevice. Hence it is possible to distinguish between simple Tx devices (e.g. noise sources) and simplex Rx devices, which decreases the effort of channel computation

uint32_t ns3::PLC_Channel::AddRxInterface ( Ptr< PLC_RxInterface rxInterface)

Connect a RxInterface to this channel

uint32_t ns3::PLC_Channel::AddTxInterface ( Ptr< PLC_TxInterface txInterface)

Connect a TxInterface to this channel

Calculate transmission channels from every txInterface to every rxInterface

Deletes the cached (time variant) power spectral density from tx to rx. When they are needed the next time they have to be recalculated. Called by PLC_Outlet after impedance change

Ptr< PLC_TransferBase > ns3::PLC_Channel::GetChannelTransferData ( uint32_t  txId,
uint32_t  rxId 
)

Get the channel transfer data between TX-Interface with txId and RX-Interface with rxId

Get the current timeslot

Ptr< NetDevice > ns3::PLC_Channel::GetDevice ( uint32_t  i) const
Parameters:
iindex of NetDevice to retrieve
Returns:
one of the NetDevices connected to this channel.
Ptr<PLC_Graph> ns3::PLC_Channel::GetGraph ( void  ) [inline]
Returns:
The used PLC_Graph instance
uint32_t ns3::PLC_Channel::GetNDevices ( void  ) const
Returns:
the number of NetDevices connected to this Channel.

This method must be implemented by subclasses.

uint32_t ns3::PLC_Channel::GetNRxInterfaces ( void  ) const
Returns:
the number of RxInterface connected to this Channel.
uint32_t ns3::PLC_Channel::GetNTxInterfaces ( void  ) const
Returns:
the number of TxInterfaces connected to this Channel.

Calculate remaining time from t to next slot after t

Ptr< PLC_RxInterface > ns3::PLC_Channel::GetRxInterface ( uint32_t  i) const
Parameters:
iindex of RxInterface to retrieve
Returns:
one of the RxInterface connected to this channel.

This method must be implemented by subclasses.

Ptr< PLC_TxInterface > ns3::PLC_Channel::GetTxInterface ( uint32_t  i) const
Parameters:
iindex of TxInterface to retrieve
Returns:
one of the TxInterfaces connected to this channel.

Create PLC_Graph and init transmission channel data structures

void ns3::PLC_Channel::Lock ( void  ) const [inline]

Mutex lock and unlock

void ns3::PLC_Channel::ProcessTimeslotTasks ( Timeslot  timeslot)

Process periodic tasks, i.e. update receive power spectral densities of all active transmission when a new timeslot starts

Indicates that the channel has finished propagating the current packet. The channel is released and becomes free.

Calls the receive function of every active rx Interface that is attached to the channel.

While a transmission is active ProcessTimeslotTasks() has to be rescheduled for the next timeslot

void ns3::PLC_Channel::SetGraph ( Ptr< PLC_Graph graph)

Set PLC_Graph Has to be done before calling InitTransmissionChannels

Parameters:
graphPLC_Graph
bool ns3::PLC_Channel::TransmissionEnd ( uint32_t  txId,
Time  propagation_delay 
)

Indicates that the txInterface has finished transmitting over the channel.

The channel will stay busy until the packet has completely propagated to all net devices attached to the channel. The TransmitEnd function schedules the PropagationCompleteEvent which will free the channel for further transmissions. Stores the packet p as the m_currentPkt, the packet being currently transmitting.

Returns:
Returns true unless the source was detached before it completed its transmission.
void ns3::PLC_Channel::TransmissionStart ( Ptr< const Packet >  p,
uint32_t  txId,
Ptr< const SpectrumValue >  txPsd,
Time  duration,
Ptr< const PLC_TrxMetaInfo metaInfo 
)

Start transmitting a packet over the channel.

If the srcId belongs to a txInterface that is connected to the channel, packet transmission begins, and the channel becomes busy until the packet has completely reached all destinations.

Parameters:
pA reference to the packet that will be transmitted over the channel or NULL if txInterface is a noise source
srcIdThe device Id of the txInterface that wants to transmit on the channel.
stSpectrum Type of txPsd to emulate different modulations
void ns3::PLC_Channel::UpdateReceivePSDs ( Timeslot  timeslot,
bool  channel_changed = false 
)

Changes the receive PSDs of the rxInterfaces

Parameters:
timeslotCurrent timeslot (as parameter to avoid recalculation)

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations