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"
64 :
TestCase (
"Acoustic Modem energy model test case"),
85 dev->
Send (pkt, dev->GetBroadcast (), 0);
108 m_node = CreateObject<Node> ();
113 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
114 channel->SetNoiseModel (noise);
121 uint32_t datarate = devNode->GetPhy ()->GetMode (0).GetDataRateBps ();
127 eh.
Set (
"BasicEnergySourceInitialEnergyJ",
DoubleValue (10000000.0));
132 mobility->SetPosition (
Vector (0,0,-500));
152 eh.
Set (
"BasicEnergySourceInitialEnergyJ",
DoubleValue (10000000.0));
157 mobility2->SetPosition (
Vector (0,0,0));
175 double consumed1 = src1->GetInitialEnergy () - src1->GetRemainingEnergy ();
180 "Incorrect gateway consumed energy!");
183 double consumed2 = src2->GetInitialEnergy () - src2->GetRemainingEnergy ();
188 "Incorrect node consumed energy!");
211 :
TestCase (
"Acoustic Modem energy depletion test case"),
237 dev->
Send (pkt, dev->GetBroadcast (), 0);
249 m_node = CreateObject<Node> ();
254 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
255 channel->SetNoiseModel (noise);
268 mobility->SetPosition (
Vector (0,0,0));
UAN configuration helper.
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.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
#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...
static void Run(void)
Run the simulation until one of:
Unit test suite for underwater energy model.
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)
Schedule an event to expire at the relative time "time" is reached.
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)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr stored in this container.
~AcousticModemEnergyDepletionTestCase()
EnergySourceContainer Install(Ptr< Node > node) const
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
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
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
void Set(std::string name, const AttributeValue &v)
void SendOnePacket(Ptr< Node > node)
void SetDepletionCallback(AcousticModemEnergyModel::AcousticModemEnergyDepletionCallback callback)
Sets the callback to be invoked when energy is depleted.
void SendOnePacket(Ptr< Node > node)
void DepletionHandler(void)
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
Hold a 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.