mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Add sat and gnd node helpers
This commit is contained in:
parent
6c154b6d60
commit
c2d69b4d03
11 changed files with 442 additions and 20 deletions
55
helper/satellite-node-helper.cc
Normal file
55
helper/satellite-node-helper.cc
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include "ns3/log.h"
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/waypoint-mobility-model.h"
|
||||
|
||||
#include "satellite-node-helper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
NS_LOG_COMPONENT_DEFINE ("LeoSatNodeHelper");
|
||||
|
||||
LeoSatNodeHelper::LeoSatNodeHelper ()
|
||||
{
|
||||
m_satNodeFactory.SetTypeId ("ns3::Node");
|
||||
}
|
||||
|
||||
LeoSatNodeHelper::~LeoSatNodeHelper ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LeoSatNodeHelper::SetAttribute (string name, const AttributeValue &value)
|
||||
{
|
||||
m_satNodeFactory.Set (name, value);
|
||||
}
|
||||
|
||||
NodeContainer
|
||||
LeoSatNodeHelper::Install (vector<string> &wpFiles)
|
||||
{
|
||||
NS_LOG_FUNCTION (wpFiles);
|
||||
|
||||
NodeContainer nodes;
|
||||
for (size_t i = 0; i < wpFiles.size (); i ++)
|
||||
{
|
||||
Ptr<WaypointMobilityModel> mob = CreateObject<WaypointMobilityModel> ();
|
||||
string fileName = wpFiles[i];
|
||||
m_fileStreamContainer.SetFile (fileName);
|
||||
Waypoint wp;
|
||||
while (m_fileStreamContainer.GetNextSample (wp))
|
||||
{
|
||||
mob->AddWaypoint (wp);
|
||||
NS_LOG_DEBUG ("Added waypoint " << wp);
|
||||
}
|
||||
Ptr<Node> node = m_satNodeFactory.Create<Node> ();
|
||||
node->AggregateObject (mob);
|
||||
|
||||
nodes.Add (node);
|
||||
NS_LOG_INFO ("Added satellite node " << node->GetId ());
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
}; // namespace ns3
|
Loading…
Add table
Add a link
Reference in a new issue