20 #include "ns3/callback.h"
21 #include "ns3/constant-position-mobility-model.h"
23 #include "ns3/object-factory.h"
24 #include "ns3/pointer.h"
25 #include "ns3/simulator.h"
27 #include "ns3/uan-channel.h"
28 #include "ns3/uan-mac-aloha.h"
29 #include "ns3/uan-net-device.h"
30 #include "ns3/uan-phy-gen.h"
31 #include "ns3/uan-prop-model-ideal.h"
32 #include "ns3/uan-transducer-hd.h"
47 void DoRun()
override;
73 uint32_t DoOnePhyTest(
Time t1,
118 dev->SetTxModeIndex(mode);
119 dev->Send(pkt, dev->GetBroadcast(), 0);
135 mac->SetAddress(Mac8Address::Allocate());
139 dev->SetChannel(chan);
140 dev->SetTransducer(trans);
141 node->AddDevice(dev);
168 Simulator::Stop(
Seconds(20.0));
170 Simulator::Destroy();
181 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 10000, 4000, 2,
"TestMode");
188 m_phyFac.
Set(
"SupportedModes", UanModesListValue(mList));
195 "Should have received 34 bytes from 2 disjoint packets");
200 "Expected collision resulting in loss of both packets");
207 m_phyFac.
Set(
"SupportedModes", UanModesListValue(mList));
209 #ifdef UAN_PROP_BH_INSTALLED
216 "Should have received 34 bytes from 2 disjoint packets");
221 "Should have received 17 bytes from first arriving packet");
227 "Packets should collide, but received data");
231 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 10000, 4000, 2,
"TestMode00");
233 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 11000, 4000, 2,
"TestMode10");
235 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 15000, 4000, 2,
"TestMode20");
237 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 10000, 4000, 2,
"TestMode01");
239 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 11000, 4000, 2,
"TestMode11");
241 UanTxModeFactory::CreateMode(UanTxMode::FSK, 80, 80, 15000, 4000, 2,
"TestMode21");
248 m1.AppendMode(mode01);
249 m1.AppendMode(mode11);
250 m1.AppendMode(mode21);
254 m_phyFac.
Set(
"SupportedModesPhy1", UanModesListValue(m0));
260 "Expected no collision");
265 "Expected collision with both packets lost");
270 "Expected collision with only one packets lost");
275 "Expected no collision");
280 "Expected no collision");
290 double error = per->CalcPer(pkt, 9, UanPhyGen::GetDefaultModes()[0]);
293 #ifdef UAN_PROP_BH_INSTALLED
296 BellhopResp resp = propBh->GetResp(10000, 50, 50, 1000);
301 "Got BH Pathloss outside of tolerance");
306 "Got BH arrival outside of tolerance");
bool RxPacket(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive packet function.
Ptr< UanNetDevice > CreateNode(Vector pos, Ptr< UanChannel > chan)
Create node function.
void SendOnePacket(Ptr< UanNetDevice > dev, uint16_t mode)
Send one packet function.
uint32_t DoOnePhyTest(Time t1, Time t2, uint32_t r1, uint32_t r2, Ptr< UanPropModel > prop, uint16_t mode1=0, uint16_t mode2=0)
Do one Phy test function.
uint32_t m_bytesRx
byes received
ObjectFactory m_phyFac
Phy.
void DoRun() override
Implementation to actually run this TestCase.
bool DoPhyTests()
Phy test function.
a polymophic address class
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Container for UanTxModes.
void AppendMode(UanTxMode mode)
Add mode to this list.
Base class for UAN Phy models.
Abstraction of packet modulation information.
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time Seconds(double value)
Construct a Time in the indicated unit.
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
Send one packet.
const double m1
First component modulus, 232 - 209.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static UanTestSuite g_uanTestSuite
the test suite