mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Add test for latitude change
This commit is contained in:
parent
7df91546da
commit
cc2a8ae5e9
4 changed files with 42 additions and 52 deletions
|
@ -26,7 +26,7 @@ private:
|
|||
class LeoOrbitPositionTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LeoOrbitPositionTestCase () : TestCase ("Test position for 0 altitude and 0 inclination") {}
|
||||
LeoOrbitPositionTestCase () : TestCase ("Test position for 0 altitude and 1.0 inclination") {}
|
||||
virtual ~LeoOrbitPositionTestCase () {}
|
||||
private:
|
||||
virtual void DoRun (void)
|
||||
|
@ -35,36 +35,57 @@ private:
|
|||
mob->SetAttribute ("Altitude", DoubleValue (0.0));
|
||||
mob->SetAttribute ("Inclination", DoubleValue (1.0));
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (mob->GetPosition ().GetLength(), LEO_EARTH_RAD_M, "Unexpected position on earths surface for 1 deg inclination");
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL (mob->GetPosition ().GetLength(), LEO_EARTH_RAD_M, 0.1, "Unexpected position on earths surface for 1 deg inclination");
|
||||
}
|
||||
};
|
||||
|
||||
class LeoOrbitProgressTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LeoOrbitProgressTestCase () : TestCase ("Test position for 0 altitude and 1.0 inclination after 360 seconds") {}
|
||||
LeoOrbitProgressTestCase () : TestCase ("Test position shoudl not be the same after some time") {}
|
||||
virtual ~LeoOrbitProgressTestCase () {}
|
||||
private:
|
||||
void TestLengthPosition (double expl, double expx, Ptr<LeoCircularOrbitMobilityModel> mob)
|
||||
{
|
||||
Vector pos = mob->GetPosition ();
|
||||
NS_TEST_EXPECT_MSG_NE_INTERNAL (pos.x, expx, "Position not equal", __FILE__, __LINE__);
|
||||
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.GetLength (), expl, 0.001, "Position must be different", __FILE__, __LINE__);
|
||||
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.GetLength (), expl, 0.001, "Distance to earth should be the same", __FILE__, __LINE__);
|
||||
NS_TEST_EXPECT_MSG_NE_INTERNAL (pos.x, expx, "Position should not be equal", __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
virtual void DoRun (void)
|
||||
{
|
||||
Ptr<LeoCircularOrbitMobilityModel> mob = CreateObject<LeoCircularOrbitMobilityModel> ();
|
||||
mob->SetAttribute ("Altitude", DoubleValue (0.0));
|
||||
mob->SetAttribute ("Inclination", DoubleValue (1.0));
|
||||
mob->SetAttribute ("Inclination", DoubleValue (20.0));
|
||||
|
||||
Vector pos = mob->GetPosition ();
|
||||
Simulator::Schedule (Seconds (360.0), &LeoOrbitProgressTestCase::TestLengthPosition, this, LEO_EARTH_RAD_M, pos.x, mob);
|
||||
Simulator::Schedule (Seconds (100.0), &LeoOrbitProgressTestCase::TestLengthPosition, this, LEO_EARTH_RAD_M, pos.x, mob);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
};
|
||||
|
||||
class LeoOrbitLatitudeTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LeoOrbitLatitudeTestCase () : TestCase ("Test offset between neighboring satellites planes") {}
|
||||
virtual ~LeoOrbitLatitudeTestCase () {}
|
||||
private:
|
||||
virtual void DoRun (void)
|
||||
{
|
||||
Ptr<LeoCircularOrbitMobilityModel> mob = CreateObject<LeoCircularOrbitMobilityModel> ();
|
||||
mob->SetAttribute ("Altitude", DoubleValue (1000.0));
|
||||
mob->SetAttribute ("Inclination", DoubleValue (20.0));
|
||||
|
||||
Vector pos1 = mob->GetPosition ();
|
||||
|
||||
mob->SetPosition (Vector3D (20.0, 0, 0));
|
||||
Vector pos2 = mob->GetPosition ();
|
||||
|
||||
NS_TEST_ASSERT_MSG_NE (pos1.x, pos2.x, "Neighboring satellite should have different position");
|
||||
}
|
||||
};
|
||||
|
||||
class LeoOrbitOffsetTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
|
@ -79,7 +100,7 @@ private:
|
|||
|
||||
Vector pos1 = mob->GetPosition ();
|
||||
|
||||
mob->SetAttribute ("Offset", DoubleValue (20.0));
|
||||
mob->SetPosition (Vector3D (0, 20.0, 0));
|
||||
Vector pos2 = mob->GetPosition ();
|
||||
|
||||
NS_TEST_ASSERT_MSG_NE (pos1.x, pos2.x, "Neighboring satellite should have different position");
|
||||
|
@ -93,6 +114,7 @@ public:
|
|||
AddTestCase (new LeoOrbitSpeedTestCase, TestCase::QUICK);
|
||||
AddTestCase (new LeoOrbitPositionTestCase, TestCase::QUICK);
|
||||
AddTestCase (new LeoOrbitProgressTestCase, TestCase::QUICK);
|
||||
AddTestCase (new LeoOrbitLatitudeTestCase, TestCase::QUICK);
|
||||
AddTestCase (new LeoOrbitOffsetTestCase, TestCase::QUICK);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue