satellite-channel-estimation-error-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
27 #include "../model/satellite-channel-estimation-error-container.h"
28 #include "../utils/satellite-env-variables.h"
29 
30 #include "ns3/boolean.h"
31 #include "ns3/config.h"
32 #include "ns3/log.h"
33 #include "ns3/ptr.h"
34 #include "ns3/singleton.h"
35 #include "ns3/test.h"
36 
37 using namespace ns3;
38 
44 class SatFwdChannelEstimationErrorTestCase : public TestCase
45 {
46  public:
49 
50  private:
51  virtual void DoRun(void);
52 };
53 
55  : TestCase("Test FWD link SINR channel estimation error.")
56 {
57 }
58 
60 {
61 }
62 
63 void
65 {
66  // Set simulation output details
67  Singleton<SatEnvVariables>::Get()->DoInitialize();
68  Singleton<SatEnvVariables>::Get()->SetOutputVariables("test-sat-channel-estimation-error",
69  "fwd",
70  true);
71 
72  Ptr<SatChannelEstimationErrorContainer> ceError =
73  Create<SatFwdLinkChannelEstimationErrorContainer>();
74 
75  for (double in = -20.0; in < 20.0; in += 0.1)
76  {
77  double out = ceError->AddError(in);
78 
79  std::cout << "SINR in: " << in << ", SINR out: " << out << std::endl;
80  }
81 
82  Singleton<SatEnvVariables>::Get()->DoDispose();
83 }
84 
89 class SatRtnChannelEstimationErrorTestCase : public TestCase
90 {
91  public:
94 
95  private:
96  virtual void DoRun(void);
97 };
98 
100  : TestCase("Test RTN link SINR channel estimation error.")
101 {
102 }
103 
105 {
106 }
107 
108 void
110 {
111  // Set simulation output details
112  Singleton<SatEnvVariables>::Get()->DoInitialize();
113  Singleton<SatEnvVariables>::Get()->SetOutputVariables("test-sat-channel-estimation-error",
114  "rtn",
115  true);
116 
117  Ptr<SatChannelEstimationErrorContainer> ceError =
118  Create<SatFwdLinkChannelEstimationErrorContainer>();
119 
120  for (uint32_t wf = 3; wf <= 23; ++wf)
121  {
122  std::cout << "--- WF: " << wf << std::endl;
123  for (double in = -20.0; in < 20.0; in += 0.1)
124  {
125  double out = ceError->AddError(in);
126 
127  std::cout << "SINR in: " << in << ", SINR out: " << out << std::endl;
128  }
129  }
130  Singleton<SatEnvVariables>::Get()->DoDispose();
131 }
132 
137 class SatChannelEstimationErrorTestSuite : public TestSuite
138 {
139  public:
141 };
142 
144  : TestSuite("sat-channel-estimation-error-test", UNIT)
145 {
146  AddTestCase(new SatFwdChannelEstimationErrorTestCase, TestCase::QUICK);
147  AddTestCase(new SatRtnChannelEstimationErrorTestCase, TestCase::QUICK);
148 }
149 
150 // Do allocate an instance of this TestSuite
Test suite for satellite channel estimation error.
Test case for FWD link channel estimation error.
Test case for RTN link channel estimation error.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static SatChannelEstimationErrorTestSuite satChannelEstimationErrorTestSuite