9#include "ns3/acoustic-modem-energy-model-helper.h"
10#include "ns3/acoustic-modem-energy-model.h"
11#include "ns3/basic-energy-source-helper.h"
12#include "ns3/constant-position-mobility-model.h"
15#include "ns3/packet.h"
16#include "ns3/simple-device-energy-model.h"
17#include "ns3/simulator.h"
19#include "ns3/uan-channel.h"
20#include "ns3/uan-header-common.h"
21#include "ns3/uan-helper.h"
22#include "ns3/uan-net-device.h"
23#include "ns3/uan-noise-model-default.h"
24#include "ns3/uan-phy.h"
25#include "ns3/uan-prop-model-ideal.h"
64 void DoRun()
override;
75 :
TestCase(
"Acoustic Modem energy model test case"),
96 dev->Send(pkt, dev->GetBroadcast(), 0);
125 channel->SetNoiseModel(noise);
132 uint32_t datarate = devNode->GetPhy()->GetMode(0).GetDataRateBps();
138 eh.
Set(
"BasicEnergySourceInitialEnergyJ",
DoubleValue(10000000.0));
143 mobility->SetPosition(Vector(0, 0, -500));
161 eh.
Set(
"BasicEnergySourceInitialEnergyJ",
DoubleValue(10000000.0));
166 mobility2->SetPosition(Vector(0, 0, 0));
183 double consumed1 = src1->GetInitialEnergy() - src1->GetRemainingEnergy();
185 packetDuration * receivedPackets +
187 (
m_simTime - packetDuration * receivedPackets);
192 double consumed2 = src2->GetInitialEnergy() - src2->GetRemainingEnergy();
223 void DoRun()
override;
232 :
TestCase(
"Acoustic Modem energy depletion test case"),
258 dev->Send(pkt, dev->GetBroadcast(), 0);
276 channel->SetNoiseModel(noise);
289 mobility->SetPosition(Vector(0, 0, 0));
Acoustic Modem Energy Depletion Test Case.
void DepletionHandler()
Depletion handler function.
uint32_t m_packetSize
packet size
void SendOnePacket(Ptr< Node > node)
Send one packet function.
AcousticModemEnergyDepletionTestCase()
uint32_t m_callbackCount
callback count
Ptr< Node > m_node
the node
void DoRun() override
Implementation to actually run this TestCase.
~AcousticModemEnergyDepletionTestCase() override
double m_simTime
Simulation time.
Acoustic Modem Energy Test Case.
Ptr< Node > m_gateway
the gateway
double m_simTime
simulation time
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_sentPackets
number of sent packets
void SendOnePacket(Ptr< Node > node)
Send one packet function.
bool RxPacket(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive packet function.
~AcousticModemEnergyTestCase() override
uint32_t m_packetSize
packet size
uint32_t m_bytesRx
bytes received
AcousticModemEnergyTestCase()
Unit test suite for underwater energy model.
UanEnergyModelTestSuite()
Assign AcousticModemEnergyModel to uan devices.
void SetDepletionCallback(AcousticModemEnergyModel::AcousticModemEnergyDepletionCallback callback)
Sets the callback to be invoked when energy is depleted.
WHOI micro-modem energy model.
a polymophic address class
Creates a BasicEnergySource object.
void Set(std::string name, const AttributeValue &v) override
energy::DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const
This class can be used to hold variables of floating point type such as 'double' or 'float'.
energy::EnergySourceContainer Install(Ptr< Node > node) const
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
UAN configuration helper.
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
Net device for UAN models.
Holds a vector of ns3::DeviceEnergyModel pointers.
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
Holds a vector of ns3::EnergySource pointers.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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.
#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.
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 UanEnergyModelTestSuite g_uanEnergyModelTestSuite