23 #include "ns3/simple-device-energy-model.h"
24 #include "ns3/uan-net-device.h"
25 #include "ns3/simulator.h"
26 #include "ns3/packet.h"
28 #include "ns3/uan-helper.h"
29 #include "ns3/basic-energy-source-helper.h"
30 #include "ns3/acoustic-modem-energy-model-helper.h"
31 #include "ns3/acoustic-modem-energy-model.h"
32 #include "ns3/constant-position-mobility-model.h"
33 #include "ns3/uan-channel.h"
34 #include "ns3/uan-noise-model-default.h"
35 #include "ns3/uan-prop-model-ideal.h"
36 #include "ns3/uan-header-common.h"
37 #include "ns3/uan-phy.h"
63 :
TestCase (
"Acoustic Modem energy model test case"),
84 dev->
Send (pkt, dev->GetBroadcast (), 0);
107 m_node = CreateObject<Node> ();
112 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
113 channel->SetNoiseModel (noise);
120 uint32_t datarate = devNode->GetPhy ()->GetMode (0).GetDataRateBps ();
126 eh.
Set (
"BasicEnergySourceInitialEnergyJ",
DoubleValue (10000000.0));
131 mobility->SetPosition (
Vector (0,0,-500));
151 eh.
Set (
"BasicEnergySourceInitialEnergyJ",
DoubleValue (10000000.0));
156 mobility2->SetPosition (
Vector (0,0,0));
174 double consumed1 = src1->GetInitialEnergy () - src1->GetRemainingEnergy ();
179 "Incorrect gateway consumed energy!");
182 double consumed2 = src2->GetInitialEnergy () - src2->GetRemainingEnergy ();
187 "Incorrect node consumed energy!");
210 :
TestCase (
"Acoustic Modem energy depletion test case"),
236 dev->
Send (pkt, dev->GetBroadcast (), 0);
248 m_node = CreateObject<Node> ();
253 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
254 channel->SetNoiseModel (noise);
267 mobility->SetPosition (
Vector (0,0,0));
DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< EnergySource > source) const
AcousticModemEnergyTestCase()
bool RxPacket(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
smart pointer class similar to boost::intrusive_ptr
Holds a vector of ns3::EnergySource pointers.
#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...
uint32_t GetSize(void) const
Assign AcousticModemEnergyModel to uan devices.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Holds a vector of ns3::DeviceEnergyModel pointers.
a polymophic address class
WHOI micro-modem energy model.
Creates a BasicEnergySource object.
Ptr< NetDevice > GetDevice(uint32_t index) const
AcousticModemEnergyDepletionTestCase()
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
~AcousticModemEnergyTestCase()
void DoRun(void)
Implementation to actually run this TestCase.
void AggregateObject(Ptr< Object > other)
static void Destroy(void)
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
~AcousticModemEnergyDepletionTestCase()
EnergySourceContainer Install(Ptr< Node > node) const
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
void DoRun(void)
Implementation to actually run this TestCase.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Net device for UAN models.
static UanEnergyModelTestSuite g_uanEnergyModelTestSuite
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
void Set(std::string name, const AttributeValue &v)
void SendOnePacket(Ptr< Node > node)
void SetDepletionCallback(AcousticModemEnergyModel::AcousticModemEnergyDepletionCallback callback)
void SendOnePacket(Ptr< Node > node)
void DepletionHandler(void)
NetDeviceContainer Install(NodeContainer c) const
Hold an floating point type.
Ptr< T > GetObject(void) const
UanEnergyModelTestSuite()
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.