46 energySource->SetNode(node);
54 for (
auto i = c.
Begin(); i != c.
End(); i++)
58 return batteryContainer;
77 energySource->SetAttribute(
"InternalResistance",
79 energySource->SetAttribute(
"TypicalDischargeCurrent",
85 energySource->SetNode(node);
93 for (
auto i = c.
Begin(); i != c.
End(); i++)
96 batteryContainer.
Add(energySource);
98 return batteryContainer;
104 uint8_t parallel)
const
106 NS_ASSERT_MSG(series > 0,
"The value of cells in series must be > 0");
107 NS_ASSERT_MSG(parallel > 0,
"The value of cells in parallel must be > 0");
119 energySource->GetAttribute(
"FullVoltage", vFull);
120 energySource->GetAttribute(
"MaxCapacity", q);
122 energySource->GetAttribute(
"NominalVoltage", vNom);
123 energySource->GetAttribute(
"NominalCapacity", qNom);
125 energySource->GetAttribute(
"ExponentialVoltage", vExp);
126 energySource->GetAttribute(
"ExponentialCapacity", qExp);
128 energySource->GetAttribute(
"InternalResistance", r);
131 energySource->SetAttribute(
"FullVoltage",
DoubleValue(vFull.
Get() * series));
132 energySource->SetAttribute(
"MaxCapacity",
DoubleValue(q.
Get() * parallel));
134 energySource->SetAttribute(
"NominalVoltage",
DoubleValue(vNom.
Get() * series));
135 energySource->SetAttribute(
"NominalCapacity",
DoubleValue(qNom.
Get() * parallel));
137 energySource->SetAttribute(
"ExponentialVoltage",
DoubleValue(vExp.
Get() * series));
138 energySource->SetAttribute(
"ExponentialCapacity",
DoubleValue(qExp.
Get() * parallel));
140 energySource->SetAttribute(
"InternalResistance",
DoubleValue(r.
Get() * (series / parallel)));
146 uint8_t parallel)
const
148 NS_ASSERT_MSG(energySourceContainer.
GetN() > 0,
"This energy container is empty");
150 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'.
Holds a vector of ns3::EnergySource pointers.
uint32_t GetN() const
Get the number of Ptr<EnergySource> stored in this container.
Iterator Begin() const
Get an iterator which refers to the first EnergySource pointer in the container.
void Add(EnergySourceContainer container)
Iterator End() const
Get an iterator which refers to the last EnergySource pointer in the container.
Hold variables of type enum.
Ptr< EnergySource > DoInstall(Ptr< Node > node) const override
Child classes of EnergySourceHelper only have to implement this function, to create and aggregate an ...
void Set(std::string name, const AttributeValue &v) override
Sets one of the attributes of underlying EnergySource.
ObjectFactory m_batteryModel
The energy source (battery) used by this helper.
void SetCellPack(Ptr< 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...
~GenericBatteryModelHelper() override
Ptr< EnergySourceContainer > Install(NodeContainer c) const
This function installs energy sources in a group of nodes in a node container.
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.
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.