Graph of the PLC network. More...
#include <plc-graph.h>
Public Member Functions | |
void | AddNode (Ptr< PLC_Node > node) |
void | SetChannel (Ptr< PLC_Channel > channel) |
Ptr< PLC_Channel > | GetChannel (void) |
Ptr< PLC_Channel > | GetChannel (void) const |
std::vector< Ptr < PLC_RxInterface > > | GetConnectedRxInterfaces () |
std::vector< PLC_RxInterface * > | GetConnectedRxInterfacePeekPtrs (void) |
void | CreatePLCGraph (void) |
Ptr< PLC_Node > | GetNodePtr (unsigned int id) |
PLC_Node * | GetNodePeekPtr (unsigned int id) |
std::vector< Ptr< PLC_Node > > | GetNodes (void) |
boost::UGraph * | GetGraphPtr (void) |
std::list< Ptr< PLC_Node > > | GetShortestPath (Ptr< PLC_Node > from, Ptr< PLC_Node > to) |
double | GetDistance (Ptr< PLC_Node > from, Ptr< PLC_Node > to) |
bool | BackboneBranchExists (PLC_BackboneBranchKey key) |
void | RegisterBackboneBranch (PLC_BackboneBranchKey bb_key, Ptr< PLC_BackboneBranch > bb_branch) |
Ptr< PLC_BackboneBranch > | GetBackboneBranch (PLC_BackboneBranchKey bb_key) |
bool | PathExists (Ptr< PLC_Node > from, Ptr< PLC_Node > to) |
void | Lock () |
void | Unlock () |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Protected Member Functions | |
virtual void | DoStart (void) |
virtual void | DoDispose (void) |
void | CalculateShortestPaths (void) |
Protected Attributes | |
boost::UGraph | m_graph |
PLC_Mutex | m_graph_mutex |
Ptr< PLC_Channel > | m_channel |
std::vector< Ptr< PLC_Node > > | m_nodes |
std::map< std::pair< unsigned int, unsigned int >, std::pair < double, std::list< Ptr < PLC_Node > > > > | m_shortest_paths |
std::map < PLC_BackboneBranchKey, Ptr < PLC_BackboneBranch > > | m_backbone_branches |
Friends | |
class | PLC_TxInterface |
Graph of the PLC network.
This class describes the PLC network topology as an undirected graph. Annotation: As the simulation has only graph and one channel instance the correspondent classes could be combined, but to have a logical seperation they are realized in different classes. It is currently not allowed to have cycles in the topology as the Dijkstra Algorithm for the shortest path calculation will fail! Although there should be no cycles in a real world power line network for the power transmission frequency, it is possible to (galvanically) recouple an HF signal over a redundant path to the network. TODO: segment graph to support cycles
void ns3::PLC_Graph::AddNode | ( | Ptr< PLC_Node > | node | ) |
Add a Node to the graph. All network nodes have to be added before calling CreateGraph
node | Node to be added |
bool ns3::PLC_Graph::BackboneBranchExists | ( | PLC_BackboneBranchKey | key | ) |
Proof if a backbone branch already exists (see plc-backbone.h for further information)
key |
void ns3::PLC_Graph::CreatePLCGraph | ( | void | ) |
Creates the PLC graph, i.e. the method performs a Dijkstra search to calculate the shortest paths between all network nodes (needed for the "line of sight" path of signal transmission over the PLC fading channel). It uses the boost graph library
Ptr< PLC_BackboneBranch > ns3::PLC_Graph::GetBackboneBranch | ( | PLC_BackboneBranchKey | bb_key | ) |
Get the backbone branch associated with or NULL if it does not exist
bb_key | Key |
Ptr<PLC_Channel> ns3::PLC_Graph::GetChannel | ( | void | ) | [inline] |
std::vector< Ptr< PLC_RxInterface > > ns3::PLC_Graph::GetConnectedRxInterfaces | ( | void | ) |
double ns3::PLC_Graph::GetDistance | ( | Ptr< PLC_Node > | from, |
Ptr< PLC_Node > | to | ||
) |
Returns the distance between and calculated by the Dijkstra algorithm with the sum of directed distances of the paths nodes as the cost function
from | First node |
to | Second node |
boost::UGraph* ns3::PLC_Graph::GetGraphPtr | ( | void | ) | [inline] |
Get the underlying boost graph. Used by the parallelized dijkstra and depth first search algorithms
Ptr< PLC_Node > ns3::PLC_Graph::GetNodePtr | ( | unsigned int | id | ) |
Get the node pointer associated with id
id |
std::list< Ptr< PLC_Node > > ns3::PLC_Graph::GetShortestPath | ( | Ptr< PLC_Node > | from, |
Ptr< PLC_Node > | to | ||
) |
Returns the shortest path between two nodes in form of a list of intermediate nodes An empty list indicates a direct connection between from and to. Note that an existing path between the nodes is mandatory!
from | First node |
to | Second node |
void ns3::PLC_Graph::Lock | ( | void | ) | [inline] |
Lock graph mutex for mutual exclusion
bool ns3::PLC_Graph::PathExists | ( | Ptr< PLC_Node > | from, |
Ptr< PLC_Node > | to | ||
) |
Proof if there is an existing path between and
from | First node |
to | Second nod |
void ns3::PLC_Graph::RegisterBackboneBranch | ( | PLC_BackboneBranchKey | bb_key, |
Ptr< PLC_BackboneBranch > | bb_branch | ||
) |
Register a backbone branch instance with
bb_key | Key |
bb_branch | Backbone branch |
void ns3::PLC_Graph::SetChannel | ( | Ptr< PLC_Channel > | channel | ) | [inline] |
Sets the channel instance to be used.
channel |
void ns3::PLC_Graph::Unlock | ( | void | ) | [inline] |
Unlock graph mutex