Add polar position allocator

This commit is contained in:
Tim Schubert 2020-08-23 22:10:21 +02:00
parent 70c70a19ce
commit ab7c9881f6
7 changed files with 147 additions and 12 deletions

View file

@ -30,24 +30,25 @@ LeoGndNodeHelper::SetAttribute (string name, const AttributeValue &value)
}
NodeContainer
LeoGndNodeHelper::Install (const std::string &wpFile)
LeoGndNodeHelper::Install (const std::string &file)
{
NS_LOG_FUNCTION (wpFile);
NS_LOG_FUNCTION (this << file);
NodeContainer nodes;
ifstream waypoints;
waypoints.open (wpFile, ifstream::in);
Vector pos;
while ((waypoints >> pos))
ifstream stream;
stream.open (file, ifstream::in);
LeoLatLong loc;
while ((stream >> loc))
{
Ptr<ConstantPositionMobilityModel> mob = CreateObject<ConstantPositionMobilityModel> ();
Vector pos = GetEarthPosition (loc);
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 ();
stream.close ();
NS_LOG_INFO ("Added " << nodes.GetN () << " ground nodes");