|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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"),
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"),
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 ();
DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< EnergySource > source) const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Acoustic Modem Energy Test Case.
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
AcousticModemEnergyTestCase()
virtual Address GetBroadcast(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool RxPacket(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive packet function.
UAN configuration helper.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void SetPosition(const Vector &position)
uint32_t m_bytesRx
bytes received
virtual void SetReceiveCallback(ReceiveCallback cb)=0
This class can be used to hold variables of floating point type such as 'double' or 'float'.
double m_simTime
simulation time
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
Send one packet.
~AcousticModemEnergyTestCase()
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
void Set(std::string name, const AttributeValue &v)
uint32_t m_sentPackets
number of sent packets
Holds a vector of ns3::EnergySource pointers.
~AcousticModemEnergyDepletionTestCase()
EnergySourceContainer Install(Ptr< Node > node) const
void SendOnePacket(Ptr< Node > node)
Send one packet function.
void DoRun(void)
Implementation to actually run this TestCase.
double m_simTime
Simulation time.
a polymophic address class
Creates a BasicEnergySource object.
void SetDepletionCallback(AcousticModemEnergyModel::AcousticModemEnergyDepletionCallback callback)
Sets the callback to be invoked when energy is depleted.
uint32_t m_packetSize
packet size
#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...
Net device for UAN models.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
#define NS_UNUSED(x)
Mark a local variable as unused.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
uint32_t m_callbackCount
callback count
AcousticModemEnergyDepletionTestCase()
Holds a vector of ns3::DeviceEnergyModel pointers.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
#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.
void SendOnePacket(Ptr< Node > node)
Send one packet function.
Assign AcousticModemEnergyModel to uan devices.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual double GetRemainingEnergy(void)=0
UanEnergyModelTestSuite()
Ptr< UanPhy > GetPhy(void) const
Get the Phy used by this device.
Acoustic Modem Energy Depletion Test Case.
Ptr< Node > m_gateway
the gateway
void DepletionHandler(void)
Depletion handler function.
WHOI micro-modem energy model.
uint32_t m_packetSize
packet size
void DoRun(void)
Implementation to actually run this TestCase.
static UanEnergyModelTestSuite g_uanEnergyModelTestSuite
Ptr< Node > m_node
the node
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
virtual double GetInitialEnergy(void) const =0
Unit test suite for underwater energy model.