35 energySource->SetNode(node);
44 for (
auto i = c.
Begin(); i != c.
End(); i++)
48 return batteryContainer;
65 energySource->SetAttribute(
"ExponentialCapacity",
68 energySource->SetAttribute(
"InternalResistance",
70 energySource->SetAttribute(
"TypicalDischargeCurrent",
72 energySource->SetAttribute(
"CutoffVoltage",
77 energySource->SetNode(node);
85 for (
auto i = c.
Begin(); i != c.
End(); i++)
88 batteryContainer.
Add(energySource);
90 return batteryContainer;
96 uint8_t parallel)
const
98 NS_ASSERT_MSG(series > 0,
"The value of cells in series must be > 0");
99 NS_ASSERT_MSG(parallel > 0,
"The value of cells in parallel must be > 0");
111 energySource->GetAttribute(
"FullVoltage", vFull);
112 energySource->GetAttribute(
"MaxCapacity", q);
114 energySource->GetAttribute(
"NominalVoltage", vNom);
115 energySource->GetAttribute(
"NominalCapacity", qNom);
117 energySource->GetAttribute(
"ExponentialVoltage", vExp);
118 energySource->GetAttribute(
"ExponentialCapacity", qExp);
120 energySource->GetAttribute(
"InternalResistance", r);
123 energySource->SetAttribute(
"FullVoltage",
DoubleValue(vFull.
Get() * series));
124 energySource->SetAttribute(
"MaxCapacity",
DoubleValue(q.
Get() * parallel));
126 energySource->SetAttribute(
"NominalVoltage",
DoubleValue(vNom.
Get() * series));
127 energySource->SetAttribute(
"NominalCapacity",
DoubleValue(qNom.
Get() * parallel));
129 energySource->SetAttribute(
"ExponentialVoltage",
DoubleValue(vExp.
Get() * series));
130 energySource->SetAttribute(
"ExponentialCapacity",
DoubleValue(qExp.
Get() * parallel));
132 energySource->SetAttribute(
"InternalResistance",
DoubleValue(r.
Get() * (series / parallel)));
138 uint8_t parallel)
const
140 NS_ASSERT_MSG(energySourceContainer.
GetN() > 0,
"This energy container is empty");
142 for (
auto i = energySourceContainer.
Begin(); i != energySourceContainer.
End(); i++)
Hold a value for an Attribute.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
void Set(std::string name, const AttributeValue &v) override
Sets one of the attributes of underlying EnergySource.
void SetCellPack(Ptr< energy::EnergySource > energySource, uint8_t series, uint8_t parallel) const
This function takes an existing energy source and transform its values to form a group of connected i...
ObjectFactory m_batteryModel
The energy source (battery) used by this helper.
Ptr< energy::EnergySource > DoInstall(Ptr< Node > node) const override
Child classes of EnergySourceHelper only have to implement this function, to create and aggregate an ...
Ptr< energy::EnergySourceContainer > Install(NodeContainer c) const
This function installs energy sources in a group of nodes in a node container.
~GenericBatteryModelHelper() override
GenericBatteryModelHelper()
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::EnergySource pointers.
Iterator Begin() const
Get an iterator which refers to the first EnergySource pointer in the container.
uint32_t GetN() const
Get the number of Ptr<EnergySource> stored in this container.
void Add(EnergySourceContainer container)
Iterator End() const
Get an iterator which refers to the last EnergySource pointer in the container.
Energy source base class.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
static BatteryPresets g_batteryPreset[]
Contains the values that form the battery presents available in this module.
BatteryModel
Battery models that described the parameters of the the battery presets.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Every class exported by the ns3 library is enclosed in the ns3 namespace.