#include <plc-channel.h>
Public Member Functions | |
PLC_Channel () | |
PLC_Channel (Ptr< PLC_Graph > graph) | |
void | SetGraph (Ptr< PLC_Graph > graph) |
Ptr< PLC_Graph > | GetGraph (void) |
uint32_t | AddTxInterface (Ptr< PLC_TxInterface > txInterface) |
uint32_t | GetNTxInterfaces (void) const |
Ptr< PLC_TxInterface > | GetTxInterface (uint32_t i) const |
uint32_t | AddRxInterface (Ptr< PLC_RxInterface > rxInterface) |
uint32_t | GetNRxInterfaces (void) const |
Ptr< PLC_RxInterface > | GetRxInterface (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_TransferBase > | GetChannelTransferData (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 |
Joins all PLC channel transfer functions By extending ns3::Channel this class provides an interface for attaching ns3::NetDevice instances to a PLC channel
ns3::PLC_Channel::PLC_Channel | ( | void | ) |
Default constructor
ns3::PLC_Channel::PLC_Channel | ( | Ptr< PLC_Graph > | graph | ) |
Constructor
graph | PLC_Graph instance to use |
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
void ns3::PLC_Channel::CalcTransmissionChannels | ( | void | ) |
Calculate transmission channels from every txInterface to every rxInterface
void ns3::PLC_Channel::DeleteOutOfDatePSDs | ( | Ptr< PLC_TxInterface > | tx, |
Ptr< PLC_RxInterface > | rx | ||
) |
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
Timeslot ns3::PLC_Channel::GetCurrentTimeslot | ( | void | ) |
Get the current timeslot
Ptr< NetDevice > ns3::PLC_Channel::GetDevice | ( | uint32_t | i | ) | const |
i | index of NetDevice to retrieve |
Ptr<PLC_Graph> ns3::PLC_Channel::GetGraph | ( | void | ) | [inline] |
uint32_t ns3::PLC_Channel::GetNDevices | ( | void | ) | const |
This method must be implemented by subclasses.
uint32_t ns3::PLC_Channel::GetNRxInterfaces | ( | void | ) | const |
uint32_t ns3::PLC_Channel::GetNTxInterfaces | ( | void | ) | const |
Time ns3::PLC_Channel::GetRemainingSlotTime | ( | Time | t | ) |
Calculate remaining time from t to next slot after t
Ptr< PLC_RxInterface > ns3::PLC_Channel::GetRxInterface | ( | uint32_t | i | ) | const |
i | index of RxInterface to retrieve |
This method must be implemented by subclasses.
Ptr< PLC_TxInterface > ns3::PLC_Channel::GetTxInterface | ( | uint32_t | i | ) | const |
i | index of TxInterface to retrieve |
void ns3::PLC_Channel::InitTransmissionChannels | ( | void | ) |
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
void ns3::PLC_Channel::PropagationCompleteEvent | ( | uint32_t | txId | ) |
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.
void ns3::PLC_Channel::ScheduleNextTimeslotTasks | ( | void | ) |
While a transmission is active ProcessTimeslotTasks() has to be rescheduled for the next timeslot
void ns3::PLC_Channel::SetGraph | ( | Ptr< PLC_Graph > | 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.
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.
p | A reference to the packet that will be transmitted over the channel or NULL if txInterface is a noise source |
srcId | The device Id of the txInterface that wants to transmit on the channel. |
st | Spectrum 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
timeslot | Current timeslot (as parameter to avoid recalculation) |