diff --git a/examples/leo-circular-orbit-tracing-example.cc b/examples/leo-circular-orbit-tracing-example.cc index e8801d6..28b092a 100644 --- a/examples/leo-circular-orbit-tracing-example.cc +++ b/examples/leo-circular-orbit-tracing-example.cc @@ -19,24 +19,44 @@ void CourseChange (std::string context, Ptr position) 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[]) { - for (double incl: { 70.0, 100.0 }) + std::vector 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; - c.Create (600); + c.Create (orb.sats*orb.planes); MobilityHelper mobility; mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator", - "NumOrbits", IntegerValue (6), - "NumSatellites", IntegerValue (100)); + "NumOrbits", IntegerValue (orb.planes), + "NumSatellites", IntegerValue (orb.sats)); mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel", - "Altitude", DoubleValue (1200.0), - "Inclination", DoubleValue (incl), + "Altitude", DoubleValue (orb.alt), + "Inclination", DoubleValue (orb.inc), "Precision", TimeValue (Minutes (1))); mobility.Install (c); + satellites.Add (c); } + Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange", MakeCallback (&CourseChange)); diff --git a/examples/leo-delay-tracing-example.cc b/examples/leo-delay-tracing-example.cc index fe23e0c..66cb3f9 100644 --- a/examples/leo-delay-tracing-example.cc +++ b/examples/leo-delay-tracing-example.cc @@ -21,28 +21,45 @@ EchoRx (std::string context, Ptr packet) 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[]) { + std::vector 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 (double incl: { 70.0, 100.0 }) + for (Orbit orb: orbits) { NodeContainer c; - c.Create (10*10); + c.Create (orb.sats*orb.planes); MobilityHelper mobility; mobility.SetPositionAllocator ("ns3::LeoCircularOrbitPostionAllocator", - "NumOrbits", IntegerValue (10), - "NumSatellites", IntegerValue (10)); + "NumOrbits", IntegerValue (orb.planes), + "NumSatellites", IntegerValue (orb.sats)); mobility.SetMobilityModel ("ns3::LeoCircularOrbitMobilityModel", - "Altitude", DoubleValue (1200.0), - "Inclination", DoubleValue (incl), + "Altitude", DoubleValue (orb.alt), + "Inclination", DoubleValue (orb.inc), "Precision", TimeValue (Minutes (1))); mobility.Install (c); satellites.Add (c); } 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; @@ -70,6 +87,7 @@ int main (int argc, char *argv[]) aodv.Set ("NextHopWait", TimeValue (MilliSeconds (100))); aodv.Set ("NetDiameter", UintegerValue (1000)); aodv.Set ("PathDiscoveryTime", TimeValue (Seconds (1))); + InternetStackHelper stack; stack.SetRoutingHelper (aodv); stack.Install (satellites); @@ -91,7 +109,7 @@ int main (int argc, char *argv[]) Address remote = stations.Get (1)->GetObject ()->GetAddress (1, 0).GetLocal ();//utIp.GetAddress (1, 0); UdpClientHelper echoClient (remote, 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (360)); - echoClient.SetAttribute ("Interval", TimeValue (Minutes (1.0))); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0))); echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); clientApps.Add (echoClient.Install (stations.Get (3))); diff --git a/examples/wscript b/examples/wscript index f07fd36..0c17481 100644 --- a/examples/wscript +++ b/examples/wscript @@ -11,3 +11,7 @@ def build(bld): obj = bld.create_ns3_program('leo-delay', ['core', 'leo', 'mobility', 'aodv']) 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' diff --git a/model/leo-circular-orbit-position-allocator.cc b/model/leo-circular-orbit-position-allocator.cc index 472df78..415d5e8 100644 --- a/model/leo-circular-orbit-position-allocator.cc +++ b/model/leo-circular-orbit-position-allocator.cc @@ -46,7 +46,7 @@ LeoCircularOrbitAllocator::AssignStreams (int64_t stream) Vector 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), 0); diff --git a/utils/geo2vec.py b/utils/geo2vec.py index 3d9bab8..7cf7a31 100755 --- a/utils/geo2vec.py +++ b/utils/geo2vec.py @@ -14,6 +14,11 @@ Converts pairs of format `name longitute latitude` to `ns3::Vector` format in IT 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 """ @@ -29,7 +34,10 @@ class Vector: if __name__ == "__main__": if len(argv) > 1: - f = fileinput.input(argv[1]) + if argv[1] == "-r": + f = isogeo() + else: + f = fileinput.input(argv[1]) else: f = fileinput.input()