21 #include "ns3/uan-net-device.h" 22 #include "ns3/uan-channel.h" 23 #include "ns3/uan-mac-aloha.h" 24 #include "ns3/uan-phy-gen.h" 25 #include "ns3/uan-transducer-hd.h" 26 #include "ns3/uan-prop-model-ideal.h" 27 #include "ns3/constant-position-mobility-model.h" 28 #include "ns3/simulator.h" 31 #include "ns3/object-factory.h" 32 #include "ns3/pointer.h" 33 #include "ns3/callback.h" 48 virtual void DoRun (
void);
73 uint32_t DoOnePhyTest (
Time t1,
Time t2, uint32_t r1, uint32_t r2,
Ptr<UanPropModel> prop, uint16_t mode1 = 0, uint16_t mode2 = 0);
131 mac->SetAddress (Mac8Address::Allocate ());
135 dev->SetChannel (chan);
136 dev->SetTransducer (trans);
137 node->AddDevice (dev);
166 Simulator::Stop (
Seconds (20.0));
168 Simulator::Destroy ();
179 UanTxMode mode = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 10000, 4000, 2,
"TestMode");
192 34,
"Should have received 34 bytes from 2 disjoint packets");
196 0,
"Expected collision resulting in loss of both packets");
206 #ifdef UAN_PROP_BH_INSTALLED 208 #endif // UAN_PROP_BH_INSTALLED 212 34,
"Should have received 34 bytes from 2 disjoint packets");
216 17,
"Should have received 17 bytes from first arriving packet");
220 0,
"Packets should collide, but received data");
223 UanTxMode mode00 = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 10000, 4000, 2,
"TestMode00");
224 UanTxMode mode10 = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 11000, 4000, 2,
"TestMode10");
225 UanTxMode mode20 = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 15000, 4000, 2,
"TestMode20");
226 UanTxMode mode01 = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 10000, 4000, 2,
"TestMode01");
227 UanTxMode mode11 = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 11000, 4000, 2,
"TestMode11");
228 UanTxMode mode21 = UanTxModeFactory::CreateMode (UanTxMode::FSK, 80, 80, 15000, 4000, 2,
"TestMode21");
235 m1.AppendMode (mode01);
236 m1.AppendMode (mode11);
237 m1.AppendMode (mode21);
246 34,
"Expected no collision");
249 0,
"Expected collision with both packets lost");
252 17,
"Expected collision with only one packets lost");
255 34,
"Expected no collision");
258 34,
"Expected no collision");
269 double error = per->
CalcPer (pkt, 9, UanPhyGen::GetDefaultModes ()[0]);
272 #ifdef UAN_PROP_BH_INSTALLED 275 BellhopResp resp = propBh->GetResp (10000, 50, 50, 1000);
281 #endif // UAN_PROP_BH_INSTALLED uint32_t m_bytesRx
byes received
void SendOnePacket(Ptr< UanNetDevice > dev, uint16_t mode)
Send one packet function.
Simulation virtual time values and global simulation resolution.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Smart pointer class similar to boost::intrusive_ptr.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void SetTxModeIndex(uint32_t txModeIndex)
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_UNUSED(x)
Mark a local variable as unused.
Container for UanTxModes.
const double m1
First component modulus, 232 - 209.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void DoRun(void)
Implementation to actually run this TestCase.
a polymophic address class
#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.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Abstraction of packet modulation information.
virtual Address GetBroadcast(void) const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Ptr< UanNetDevice > CreateNode(Vector pos, Ptr< UanChannel > chan)
Create node function.
#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...
bool RxPacket(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive 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.
ObjectFactory m_phyFac
Phy.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
static UanTestSuite g_uanTestSuite
the test suite
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the packet error probability based on SINR at the receiver and a tx mode.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
Base class for UAN Phy models.
Instantiate subclasses of ns3::Object.
bool DoPhyTests()
Phy test function.
Time Seconds(double value)
Construct a Time in the indicated unit.
void AppendMode(UanTxMode mode)
Add mode to this list.
AttributeValue implementation for UanModesList.