mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Fix position allocator
This commit is contained in:
parent
166a920fca
commit
95bc153b1b
5 changed files with 66 additions and 16 deletions
|
@ -19,24 +19,44 @@ void CourseChange (std::string context, Ptr<const MobilityModel> position)
|
||||||
outfile << Simulator::Now () << ":" << node->GetId () << ":" << pos.x << ":" << pos.y << ":" << pos.z << ":" << position->GetVelocity ().GetLength() << std::endl;
|
outfile << Simulator::Now () << ":" << node->GetId () << ":" << pos.x << ":" << pos.y << ":" << pos.z << ":" << position->GetVelocity ().GetLength() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Orbit {
|
||||||
|
public:
|
||||||
|
Orbit (double a, double i, double p, double s) : alt (a), inc (i), planes (p), sats (s) {}
|
||||||
|
double alt;
|
||||||
|
double inc;
|
||||||
|
uint16_t planes;
|
||||||
|
uint16_t sats;
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
for (double incl: { 70.0, 100.0 })
|
std::vector<Orbit> orbits = {
|
||||||
|
Orbit (1.150, 53.0, 32, 50),
|
||||||
|
Orbit (1.110, 53.8, 32, 50),
|
||||||
|
Orbit (1.130, 74.0, 8, 50),
|
||||||
|
Orbit (1.275, 81, 5, 75),
|
||||||
|
Orbit (1.325, 70, 6, 75),
|
||||||
|
};
|
||||||
|
NodeContainer satellites;
|
||||||
|
for (Orbit orb: orbits)
|
||||||
{
|
{
|
||||||
NodeContainer c;
|
NodeContainer c;
|
||||||
c.Create (600);
|
c.Create (orb.sats*orb.planes);
|
||||||
|
|
||||||
MobilityHelper mobility;
|
MobilityHelper mobility;
|
||||||
mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator",
|
mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator",
|
||||||
"NumOrbits", IntegerValue (6),
|
"NumOrbits", IntegerValue (orb.planes),
|
||||||
"NumSatellites", IntegerValue (100));
|
"NumSatellites", IntegerValue (orb.sats));
|
||||||
mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel",
|
mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel",
|
||||||
"Altitude", DoubleValue (1200.0),
|
"Altitude", DoubleValue (orb.alt),
|
||||||
"Inclination", DoubleValue (incl),
|
"Inclination", DoubleValue (orb.inc),
|
||||||
"Precision", TimeValue (Minutes (1)));
|
"Precision", TimeValue (Minutes (1)));
|
||||||
mobility.Install (c);
|
mobility.Install (c);
|
||||||
|
satellites.Add (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
|
Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
|
||||||
MakeCallback (&CourseChange));
|
MakeCallback (&CourseChange));
|
||||||
|
|
||||||
|
|
|
@ -21,28 +21,45 @@ EchoRx (std::string context, Ptr<const Packet> packet)
|
||||||
std::cout << context << "," << seqTs.GetSeq () << "," << seqTs.GetTs () << "," << Simulator::Now () - seqTs.GetTs () << std::endl;
|
std::cout << context << "," << seqTs.GetSeq () << "," << seqTs.GetTs () << "," << Simulator::Now () - seqTs.GetTs () << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Orbit {
|
||||||
|
public:
|
||||||
|
Orbit (double a, double i, double p, double s) : alt (a), inc (i), planes (p), sats (s) {}
|
||||||
|
double alt;
|
||||||
|
double inc;
|
||||||
|
uint16_t planes;
|
||||||
|
uint16_t sats;
|
||||||
|
};
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
std::vector<Orbit> orbits = {
|
||||||
|
Orbit (1.150, 53.0, 32, 50),
|
||||||
|
Orbit (1.110, 53.8, 32, 50),
|
||||||
|
Orbit (1.130, 74.0, 8, 50),
|
||||||
|
Orbit (1.275, 81, 5, 75),
|
||||||
|
Orbit (1.325, 70, 6, 75),
|
||||||
|
|
||||||
|
};
|
||||||
NodeContainer satellites;
|
NodeContainer satellites;
|
||||||
for (double incl: { 70.0, 100.0 })
|
for (Orbit orb: orbits)
|
||||||
{
|
{
|
||||||
NodeContainer c;
|
NodeContainer c;
|
||||||
c.Create (10*10);
|
c.Create (orb.sats*orb.planes);
|
||||||
|
|
||||||
MobilityHelper mobility;
|
MobilityHelper mobility;
|
||||||
mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator",
|
mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator",
|
||||||
"NumOrbits", IntegerValue (10),
|
"NumOrbits", IntegerValue (orb.planes),
|
||||||
"NumSatellites", IntegerValue (10));
|
"NumSatellites", IntegerValue (orb.sats));
|
||||||
mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel",
|
mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel",
|
||||||
"Altitude", DoubleValue (1200.0),
|
"Altitude", DoubleValue (orb.alt),
|
||||||
"Inclination", DoubleValue (incl),
|
"Inclination", DoubleValue (orb.inc),
|
||||||
"Precision", TimeValue (Minutes (1)));
|
"Precision", TimeValue (Minutes (1)));
|
||||||
mobility.Install (c);
|
mobility.Install (c);
|
||||||
satellites.Add (c);
|
satellites.Add (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
LeoGndNodeHelper ground;
|
LeoGndNodeHelper ground;
|
||||||
NodeContainer stations = ground.Install ("contrib/leo/data/ground-stations/airports-60.waypoints");
|
NodeContainer stations = ground.Install ("contrib/leo/data/ground-stations/usa.waypoints");
|
||||||
|
|
||||||
NetDeviceContainer islNet, utNet;
|
NetDeviceContainer islNet, utNet;
|
||||||
|
|
||||||
|
@ -70,6 +87,7 @@ int main (int argc, char *argv[])
|
||||||
aodv.Set ("NextHopWait", TimeValue (MilliSeconds (100)));
|
aodv.Set ("NextHopWait", TimeValue (MilliSeconds (100)));
|
||||||
aodv.Set ("NetDiameter", UintegerValue (1000));
|
aodv.Set ("NetDiameter", UintegerValue (1000));
|
||||||
aodv.Set ("PathDiscoveryTime", TimeValue (Seconds (1)));
|
aodv.Set ("PathDiscoveryTime", TimeValue (Seconds (1)));
|
||||||
|
|
||||||
InternetStackHelper stack;
|
InternetStackHelper stack;
|
||||||
stack.SetRoutingHelper (aodv);
|
stack.SetRoutingHelper (aodv);
|
||||||
stack.Install (satellites);
|
stack.Install (satellites);
|
||||||
|
@ -91,7 +109,7 @@ int main (int argc, char *argv[])
|
||||||
Address remote = stations.Get (1)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();//utIp.GetAddress (1, 0);
|
Address remote = stations.Get (1)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();//utIp.GetAddress (1, 0);
|
||||||
UdpClientHelper echoClient (remote, 9);
|
UdpClientHelper echoClient (remote, 9);
|
||||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (360));
|
echoClient.SetAttribute ("MaxPackets", UintegerValue (360));
|
||||||
echoClient.SetAttribute ("Interval", TimeValue (Minutes (1.0)));
|
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
|
||||||
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
||||||
clientApps.Add (echoClient.Install (stations.Get (3)));
|
clientApps.Add (echoClient.Install (stations.Get (3)));
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,7 @@ def build(bld):
|
||||||
obj = bld.create_ns3_program('leo-delay',
|
obj = bld.create_ns3_program('leo-delay',
|
||||||
['core', 'leo', 'mobility', 'aodv'])
|
['core', 'leo', 'mobility', 'aodv'])
|
||||||
obj.source = 'leo-delay-tracing-example.cc'
|
obj.source = 'leo-delay-tracing-example.cc'
|
||||||
|
|
||||||
|
obj = bld.create_ns3_program('leo-bulk-send',
|
||||||
|
['core', 'leo', 'mobility', 'aodv'])
|
||||||
|
obj.source = 'leo-bulk-send-example.cc'
|
||||||
|
|
|
@ -46,7 +46,7 @@ LeoCircularOrbitAllocator::AssignStreams (int64_t stream)
|
||||||
Vector
|
Vector
|
||||||
LeoCircularOrbitAllocator::GetNext () const
|
LeoCircularOrbitAllocator::GetNext () const
|
||||||
{
|
{
|
||||||
Vector next = Vector (M_PI * (m_lastOrbit / (double) m_numOrbits),
|
Vector next = Vector (2 * M_PI * (m_lastOrbit / (double) m_numOrbits),
|
||||||
2 * M_PI * (m_lastSatellite / (double) m_numSatellites),
|
2 * M_PI * (m_lastSatellite / (double) m_numSatellites),
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,11 @@ Converts pairs of format `name longitute latitude` to `ns3::Vector` format in IT
|
||||||
See `ns3::Vector::operator >>`
|
See `ns3::Vector::operator >>`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def isogeo():
|
||||||
|
for i in range(-60,60,5):
|
||||||
|
for j in range(-180,180,5):
|
||||||
|
yield "foo,%f,%f" % (i, j)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Stores the vector data
|
Stores the vector data
|
||||||
"""
|
"""
|
||||||
|
@ -29,6 +34,9 @@ class Vector:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(argv) > 1:
|
if len(argv) > 1:
|
||||||
|
if argv[1] == "-r":
|
||||||
|
f = isogeo()
|
||||||
|
else:
|
||||||
f = fileinput.input(argv[1])
|
f = fileinput.input(argv[1])
|
||||||
else:
|
else:
|
||||||
f = fileinput.input()
|
f = fileinput.input()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue