20 #include "ns3/acoustic-modem-energy-model-helper.h"
21 #include "ns3/acoustic-modem-energy-model.h"
22 #include "ns3/basic-energy-source-helper.h"
23 #include "ns3/constant-position-mobility-model.h"
26 #include "ns3/packet.h"
27 #include "ns3/simple-device-energy-model.h"
28 #include "ns3/simulator.h"
30 #include "ns3/uan-channel.h"
31 #include "ns3/uan-header-common.h"
32 #include "ns3/uan-helper.h"
33 #include "ns3/uan-net-device.h"
34 #include "ns3/uan-noise-model-default.h"
35 #include "ns3/uan-phy.h"
36 #include "ns3/uan-prop-model-ideal.h"
74 void DoRun()
override;
85 :
TestCase(
"Acoustic Modem energy model test case"),
106 dev->Send(pkt, dev->GetBroadcast(), 0);
129 m_node = CreateObject<Node>();
134 channel->SetPropagationModel(CreateObject<UanPropModelIdeal>());
142 uint32_t datarate = devNode->GetPhy()->GetMode(0).GetDataRateBps();
148 eh.
Set(
"BasicEnergySourceInitialEnergyJ",
DoubleValue(10000000.0));
153 mobility->SetPosition(Vector(0, 0, -500));
171 eh.
Set(
"BasicEnergySourceInitialEnergyJ",
DoubleValue(10000000.0));
176 mobility2->SetPosition(Vector(0, 0, 0));
193 double consumed1 = src1->GetInitialEnergy() - src1->GetRemainingEnergy();
195 packetDuration * receivedPackets +
197 (
m_simTime - packetDuration * receivedPackets);
202 double consumed2 = src2->GetInitialEnergy() - src2->GetRemainingEnergy();
210 Simulator::Destroy();
233 void DoRun()
override;
242 :
TestCase(
"Acoustic Modem energy depletion test case"),
268 dev->Send(pkt, dev->GetBroadcast(), 0);
270 Simulator::Schedule(
Seconds(10),
280 m_node = CreateObject<Node>();
285 channel->SetPropagationModel(CreateObject<UanPropModelIdeal>());
299 mobility->SetPosition(Vector(0, 0, 0));
316 Simulator::Destroy();
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
Holds a vector of ns3::DeviceEnergyModel pointers.
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< EnergySource > source) const
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Holds a vector of ns3::EnergySource pointers.
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.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration 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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
Send one packet.
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