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" 87 :
TestCase (
"Acoustic Modem energy model test case"),
108 dev->
Send (pkt, dev->GetBroadcast (), 0);
112 Simulator::Schedule (
Seconds (10),
133 m_node = CreateObject<Node> ();
138 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
139 channel->SetNoiseModel (noise);
146 uint32_t datarate = devNode->
GetPhy ()->GetMode (0).GetDataRateBps ();
152 eh.
Set (
"BasicEnergySourceInitialEnergyJ",
DoubleValue (10000000.0));
157 mobility->SetPosition (Vector (0,0,-500));
177 eh.
Set (
"BasicEnergySourceInitialEnergyJ",
DoubleValue (10000000.0));
205 "Incorrect gateway consumed energy!");
213 "Incorrect node consumed energy!");
215 Simulator::Destroy ();
247 :
TestCase (
"Acoustic Modem energy depletion test case"),
273 dev->
Send (pkt, dev->GetBroadcast (), 0);
275 Simulator::Schedule (
Seconds (10),
285 m_node = CreateObject<Node> ();
290 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
291 channel->SetNoiseModel (noise);
304 mobility->SetPosition (Vector (0,0,0));
323 Simulator::Destroy ();
UAN configuration helper.
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::EnergySource pointers.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Acoustic Modem Energy Depletion Test Case.
~AcousticModemEnergyTestCase()
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void DoRun(void)
Implementation to actually run this TestCase.
Ptr< Node > m_node
the node
#define NS_UNUSED(x)
Mark a local variable as unused.
Assign AcousticModemEnergyModel to uan devices.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Holds a vector of ns3::DeviceEnergyModel pointers.
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
double m_simTime
simulation time
a polymophic address class
uint32_t m_callbackCount
callback count
void SendOnePacket(Ptr< Node > node)
Send one packet function.
virtual double GetInitialEnergy(void) const =0
virtual void SetReceiveCallback(ReceiveCallback cb)=0
WHOI micro-modem energy model.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#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.
Creates a BasicEnergySource object.
bool RxPacket(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive packet function.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Unit test suite for underwater energy model.
~AcousticModemEnergyDepletionTestCase()
Acoustic Modem Energy Test Case.
#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 m_packetSize
packet size
uint32_t m_sentPackets
number of sent packets
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void DepletionHandler(void)
Depletion handler function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SendOnePacket(Ptr< Node > node)
Send one packet function.
uint32_t m_packetSize
packet size
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
double m_simTime
Simulation time.
void SetPosition(const Vector &position)
Net device for UAN models.
virtual double GetRemainingEnergy(void)=0
AcousticModemEnergyTestCase()
EnergySourceContainer Install(Ptr< Node > node) const
UanEnergyModelTestSuite()
AcousticModemEnergyDepletionTestCase()
Time Seconds(double value)
Construct a Time in the indicated unit.
void Set(std::string name, const AttributeValue &v)
void DoRun(void)
Implementation to actually run this TestCase.
void SetDepletionCallback(AcousticModemEnergyModel::AcousticModemEnergyDepletionCallback callback)
Sets the callback to be invoked when energy is depleted.
uint32_t m_bytesRx
bytes received
Ptr< UanPhy > GetPhy(void) const
Get the Phy used by this device.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
static UanEnergyModelTestSuite g_uanEnergyModelTestSuite
Ptr< Node > m_gateway
the gateway
DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< EnergySource > source) const