mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Add animated plot for satellite positions
This commit is contained in:
parent
d145337d6c
commit
f8804533cc
3 changed files with 67 additions and 1 deletions
41
examples/leo-circular-orbit-tracing-example.cc
Normal file
41
examples/leo-circular-orbit-tracing-example.cc
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/mobility-module.h"
|
||||
#include "ns3/leo-module.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LeoCircularOrbitTracingExample");
|
||||
|
||||
void CourseChange (std::string context, Ptr<const MobilityModel> position)
|
||||
{
|
||||
Vector pos = position->GetPosition ();
|
||||
Ptr<const Node> node = position->GetObject<Node> ();
|
||||
std::cout << Simulator::Now () << "," << node->GetId () << "," << pos.x << "," << pos.y << "," << pos.z << "," << position->GetVelocity ().GetLength() << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
NodeContainer c;
|
||||
c.Create (600);
|
||||
|
||||
MobilityHelper mobility;
|
||||
mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator",
|
||||
"NumOrbits", IntegerValue (6),
|
||||
"NumSatellites", IntegerValue (100));
|
||||
mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel",
|
||||
"Altitude", DoubleValue (1200.0),
|
||||
"Inclination", DoubleValue (80.0),
|
||||
"Precision", TimeValue (Minutes (1)));
|
||||
mobility.Install (c);
|
||||
|
||||
Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
|
||||
MakeCallback (&CourseChange));
|
||||
|
||||
std::cout << "Time,Satellite,x,y,z,Speed" << std::endl;
|
||||
|
||||
Simulator::Stop (Minutes (60.0));
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue