A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
energy-model-with-harvesting-example.cc File Reference
#include "ns3/core-module.h"
#include "ns3/energy-module.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/network-module.h"
#include "ns3/wifi-radio-energy-model-helper.h"
#include "ns3/yans-wifi-helper.h"
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
+ Include dependency graph for energy-model-with-harvesting-example.cc:

Go to the source code of this file.

Functions

static void GenerateTraffic (Ptr< Socket > socket, uint32_t pktSize, Ptr< Node > n, uint32_t pktCount, Time pktInterval)
 
void HarvestedPower (double oldValue, double harvestedPower)
 Trace function for the power harvested by the energy harvester.
 
static std::string PrintReceivedPacket (Address &from)
 Print a received packet.
 
void ReceivePacket (Ptr< Socket > socket)
 
void RemainingEnergy (double oldValue, double remainingEnergy)
 Trace function for remaining energy at node.
 
void TotalEnergy (double oldValue, double totalEnergy)
 Trace function for total energy consumption at node.
 
void TotalEnergyHarvested (double oldValue, double totalEnergyHarvested)
 Trace function for the total energy harvested by the node.
 

Detailed Description

Usage

$ ./ns3 run "energy-model-with-harvesting-example [Program Options]"

Program Options

--phyMode
Wifi Phy mode [DsssRate1Mbps]
--Prss
Intended primary RSS (dBm) [-80]
--PacketSize
size of application packet sent [200]
--numPackets
Total number of packets to send [10000]
--startTime
Simulation start time [0]
--distanceToRx
X-Axis distance between nodes [100]
--verbose
Turn on all device log components [false]

Definition in file energy-model-with-harvesting-example.cc.

Function Documentation

◆ GenerateTraffic()

static void GenerateTraffic ( Ptr< Socket socket,
uint32_t  pktSize,
Ptr< Node n,
uint32_t  pktCount,
Time  pktInterval 
)
static
Parameters
socketPointer to socket.
pktSizePacket size.
nPointer to node.
pktCountNumber of packets to generate.
pktIntervalPacket sending interval.

Traffic generator.

Definition at line 113 of file energy-model-with-harvesting-example.cc.

References GenerateTraffic(), pktSize, and ns3::Simulator::Schedule().

Referenced by GenerateTraffic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HarvestedPower()

void HarvestedPower ( double  oldValue,
double  harvestedPower 
)

Trace function for the power harvested by the energy harvester.

Parameters
oldValueOld value
harvestedPowerNew value

Definition at line 169 of file energy-model-with-harvesting-example.cc.

References ns3::Simulator::Now(), and NS_LOG_UNCOND.

+ Here is the call graph for this function:

◆ PrintReceivedPacket()

static std::string PrintReceivedPacket ( Address from)
inlinestatic

Print a received packet.

Parameters
fromsender address
Returns
a string with the details of the packet: dst {IP, port}, time.

Definition at line 73 of file energy-model-with-harvesting-example.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Time::GetSeconds(), and ns3::Simulator::Now().

Referenced by ReceivePacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReceivePacket()

void ReceivePacket ( Ptr< Socket socket)
Parameters
socketPointer to socket.

Packet receiving sink.

Definition at line 90 of file energy-model-with-harvesting-example.cc.

References NS_LOG_UNCOND, and PrintReceivedPacket().

+ Here is the call graph for this function:

◆ RemainingEnergy()

void RemainingEnergy ( double  oldValue,
double  remainingEnergy 
)

Trace function for remaining energy at node.

Parameters
oldValueOld value
remainingEnergyNew value

Definition at line 143 of file energy-model-with-harvesting-example.cc.

References ns3::Simulator::Now(), and NS_LOG_UNCOND.

+ Here is the call graph for this function:

◆ TotalEnergy()

void TotalEnergy ( double  oldValue,
double  totalEnergy 
)

Trace function for total energy consumption at node.

Parameters
oldValueOld value
totalEnergyNew value

Definition at line 156 of file energy-model-with-harvesting-example.cc.

References ns3::Simulator::Now(), and NS_LOG_UNCOND.

+ Here is the call graph for this function:

◆ TotalEnergyHarvested()

void TotalEnergyHarvested ( double  oldValue,
double  totalEnergyHarvested 
)

Trace function for the total energy harvested by the node.

Parameters
oldValueOld value
totalEnergyHarvestedNew value

Definition at line 182 of file energy-model-with-harvesting-example.cc.

References ns3::Simulator::Now(), and NS_LOG_UNCOND.

+ Here is the call graph for this function: