mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 01:53: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/ground-node-helper.cc
Normal file
55
helper/ground-node-helper.cc
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <fstream>
|
||||
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/waypoint.h"
|
||||
|
||||
#include "ground-node-helper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
NS_LOG_COMPONENT_DEFINE ("LeoGndNodeHelper");
|
||||
|
||||
LeoGndNodeHelper::LeoGndNodeHelper ()
|
||||
{
|
||||
m_gndNodeFactory.SetTypeId ("ns3::Node");
|
||||
}
|
||||
|
||||
LeoGndNodeHelper::~LeoGndNodeHelper ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LeoGndNodeHelper::SetAttribute (string name, const AttributeValue &value)
|
||||
{
|
||||
m_gndNodeFactory.Set (name, value);
|
||||
}
|
||||
|
||||
NodeContainer
|
||||
LeoGndNodeHelper::Install (const std::string &wpFile)
|
||||
{
|
||||
NS_LOG_FUNCTION (wpFile);
|
||||
|
||||
NodeContainer nodes;
|
||||
ifstream waypoints;
|
||||
waypoints.open (wpFile, ifstream::in);
|
||||
Vector pos;
|
||||
while ((waypoints >> pos))
|
||||
{
|
||||
Ptr<ConstantPositionMobilityModel> mob = CreateObject<ConstantPositionMobilityModel> ();
|
||||
mob->SetPosition (pos);
|
||||
Ptr<Node> node = m_gndNodeFactory.Create<Node> ();
|
||||
node->AggregateObject (mob);
|
||||
nodes.Add (node);
|
||||
NS_LOG_INFO ("Added ground node at " << pos);
|
||||
}
|
||||
waypoints.close ();
|
||||
|
||||
NS_LOG_INFO ("Added " << nodes.GetN () << " ground nodes");
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
}; // namespace ns3
|
Loading…
Add table
Add a link
Reference in a new issue