A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
generic-battery-discharge-example.cc File Reference
#include <ns3/core-module.h>
#include <ns3/energy-module.h>
#include <ns3/gnuplot.h>
#include <fstream>
#include <sstream>
#include <string>
+ Include dependency graph for generic-battery-discharge-example.cc:

Go to the source code of this file.

Functions

std::ofstream battDischFile1 ("BattDischCurve1.plt")
 
std::ofstream battDischFile2 ("BattDischCurve2.plt")
 
std::ofstream battDischFile3 ("BattDischCurve3.plt")
 
std::ofstream battDischFile4 ("BattDischCurve4.plt")
 
std::ofstream battDischFile5 ("BattDischCurve5.plt")
 
void GraphBattery1 (Ptr< GenericBatteryModel > es)
 
void GraphBattery2 (Ptr< GenericBatteryModel > es)
 
void GraphBattery3 (Ptr< GenericBatteryModel > es)
 
void GraphBattery4 (Ptr< GenericBatteryModel > es)
 
void GraphBattery5 (Ptr< GenericBatteryModel > es)
 

Variables

Gnuplot2dDataset battDischDataset1
 
Gnuplot2dDataset battDischDataset2
 
Gnuplot2dDataset battDischDataset3
 
Gnuplot2dDataset battDischDataset4
 
Gnuplot2dDataset battDischDataset5
 
Gnuplot battDischPlot1 = Gnuplot("BattDisch1.eps")
 This example shows the use of batteries in ns-3.
 
Gnuplot battDischPlot2 = Gnuplot("BattDisch2.eps")
 
Gnuplot battDischPlot3 = Gnuplot("BattDisch3.eps")
 
Gnuplot battDischPlot4 = Gnuplot("BattDisch4.eps")
 
Gnuplot battDischPlot5 = Gnuplot("BattDisch5.eps")
 

Function Documentation

◆ battDischFile1()

std::ofstream battDischFile1 ( "BattDischCurve1.plt"  )

◆ battDischFile2()

std::ofstream battDischFile2 ( "BattDischCurve2.plt"  )

◆ battDischFile3()

std::ofstream battDischFile3 ( "BattDischCurve3.plt"  )

◆ battDischFile4()

std::ofstream battDischFile4 ( "BattDischCurve4.plt"  )

◆ battDischFile5()

std::ofstream battDischFile5 ( "BattDischCurve5.plt"  )

◆ GraphBattery1()

void GraphBattery1 ( Ptr< GenericBatteryModel es)

Definition at line 74 of file generic-battery-discharge-example.cc.

References ns3::Gnuplot2dDataset::Add(), battDischDataset1, ns3::Time::GetMinutes(), GraphBattery1(), ns3::Simulator::IsFinished(), ns3::Simulator::Now(), ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by GraphBattery1().

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

◆ GraphBattery2()

void GraphBattery2 ( Ptr< GenericBatteryModel es)

Definition at line 89 of file generic-battery-discharge-example.cc.

References ns3::Gnuplot2dDataset::Add(), battDischDataset2, ns3::Time::GetMinutes(), GraphBattery2(), ns3::Simulator::IsFinished(), ns3::Simulator::Now(), ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by GraphBattery2().

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

◆ GraphBattery3()

void GraphBattery3 ( Ptr< GenericBatteryModel es)

Definition at line 104 of file generic-battery-discharge-example.cc.

References ns3::Gnuplot2dDataset::Add(), battDischDataset3, GraphBattery3(), ns3::Simulator::IsFinished(), ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by GraphBattery3().

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

◆ GraphBattery4()

void GraphBattery4 ( Ptr< GenericBatteryModel es)

Definition at line 118 of file generic-battery-discharge-example.cc.

References ns3::Gnuplot2dDataset::Add(), battDischDataset4, ns3::Time::GetMinutes(), GraphBattery4(), ns3::Simulator::IsFinished(), ns3::Simulator::Now(), ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by GraphBattery4().

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

◆ GraphBattery5()

void GraphBattery5 ( Ptr< GenericBatteryModel es)

Definition at line 133 of file generic-battery-discharge-example.cc.

References ns3::Gnuplot2dDataset::Add(), battDischDataset5, ns3::Time::GetHours(), GraphBattery5(), ns3::Simulator::IsFinished(), ns3::Simulator::Now(), ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by GraphBattery5().

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

Variable Documentation

◆ battDischDataset1

Gnuplot2dDataset battDischDataset1

Definition at line 54 of file generic-battery-discharge-example.cc.

Referenced by GraphBattery1().

◆ battDischDataset2

Gnuplot2dDataset battDischDataset2

Definition at line 58 of file generic-battery-discharge-example.cc.

Referenced by GraphBattery2().

◆ battDischDataset3

Gnuplot2dDataset battDischDataset3

Definition at line 62 of file generic-battery-discharge-example.cc.

Referenced by GraphBattery3().

◆ battDischDataset4

Gnuplot2dDataset battDischDataset4

Definition at line 66 of file generic-battery-discharge-example.cc.

Referenced by GraphBattery4().

◆ battDischDataset5

Gnuplot2dDataset battDischDataset5

Definition at line 70 of file generic-battery-discharge-example.cc.

Referenced by GraphBattery5().

◆ battDischPlot1

Gnuplot battDischPlot1 = Gnuplot("BattDisch1.eps")

This example shows the use of batteries in ns-3.

5 batteries of different chemistries are discharged using a constant current. Batteries can be configured manually using the necessary parameters or using presets.

In this example, only the first battery uses parameters to form a NiMh battery. The rest of the batteries in this example use defined presets with already tested parameters.

Users can make their own battery presets by setting the necessary parameters as in the example in the first battery.

Plot files are produced as a result of this example. Graphs can be obtained from the plot using:

$> gnuplot <plotname>.plt

Definition at line 53 of file generic-battery-discharge-example.cc.

◆ battDischPlot2

Gnuplot battDischPlot2 = Gnuplot("BattDisch2.eps")

Definition at line 57 of file generic-battery-discharge-example.cc.

◆ battDischPlot3

Gnuplot battDischPlot3 = Gnuplot("BattDisch3.eps")

Definition at line 61 of file generic-battery-discharge-example.cc.

◆ battDischPlot4

Gnuplot battDischPlot4 = Gnuplot("BattDisch4.eps")

Definition at line 65 of file generic-battery-discharge-example.cc.

◆ battDischPlot5

Gnuplot battDischPlot5 = Gnuplot("BattDisch5.eps")

Definition at line 69 of file generic-battery-discharge-example.cc.