25 #include "ns3/simulator.h"
26 #include "ns3/double.h"
27 #include "ns3/config.h"
28 #include "ns3/string.h"
29 #include "ns3/basic-energy-harvester.h"
30 #include "ns3/basic-energy-source.h"
53 :
TestCase (
"Basic Energy Harvester test case")
83 source->ConnectEnergyHarvester (harvester);
95 &BasicEnergySource::UpdateEnergySource, source);
97 double timeDelta = 0.000000001;
103 double estRemainingEnergy = source->GetInitialEnergy ();
108 double remainingEnergy = source->GetRemainingEnergy ();
109 NS_LOG_DEBUG (
"Remaining energy is " << remainingEnergy);
110 NS_LOG_DEBUG (
"Estimated remaining energy is " << estRemainingEnergy);
111 NS_LOG_DEBUG (
"Difference is " << estRemainingEnergy - remainingEnergy);
113 Simulator::Destroy ();
117 "Incorrect Remaining energy!");
128 :
TestSuite (
"basic-energy-harvester", UNIT)
Simulation virtual time values and global simulation resolution.
static BasicEnergyHarvesterTestSuite g_basicEnergyHarvesterTestSuite
void SetHarvestedPowerUpdateInterval(Time updateInterval)
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
BasicEnergySource decreases/increases remaining energy stored in itself in linearly.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
BasicEnergyHarvesterTestCase()
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
void SetEnergySource(Ptr< EnergySource > source)
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
double GetPower(void) const
#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...
ObjectFactory m_energySource
BasicEnergyHarvesterTestSuite()
ObjectFactory m_energyHarvester
Instantiate subclasses of ns3::Object.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
~BasicEnergyHarvesterTestCase()
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
BasicEnergyHarvester increases remaining energy stored in an associated Energy Source.
void DoRun(void)
Implementation to actually run this TestCase.
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.