46 energySource->SetNode(node);
54 CreateObject<energy::EnergySourceContainer>();
55 for (
auto i = c.
Begin(); i != c.
End(); i++)
59 return batteryContainer;
76 energySource->SetAttribute(
"ExponentialCapacity",
79 energySource->SetAttribute(
"InternalResistance",
81 energySource->SetAttribute(
"TypicalDischargeCurrent",
83 energySource->SetAttribute(
"CutoffVoltage",
88 energySource->SetNode(node);
96 for (
auto i = c.
Begin(); i != c.
End(); i++)
99 batteryContainer.
Add(energySource);
101 return batteryContainer;
107 uint8_t parallel)
const
109 NS_ASSERT_MSG(series > 0,
"The value of cells in series must be > 0");
110 NS_ASSERT_MSG(parallel > 0,
"The value of cells in parallel must be > 0");
122 energySource->GetAttribute(
"FullVoltage", vFull);
123 energySource->GetAttribute(
"MaxCapacity", q);
125 energySource->GetAttribute(
"NominalVoltage", vNom);
126 energySource->GetAttribute(
"NominalCapacity", qNom);
128 energySource->GetAttribute(
"ExponentialVoltage", vExp);
129 energySource->GetAttribute(
"ExponentialCapacity", qExp);
131 energySource->GetAttribute(
"InternalResistance", r);
134 energySource->SetAttribute(
"FullVoltage",
DoubleValue(vFull.
Get() * series));
135 energySource->SetAttribute(
"MaxCapacity",
DoubleValue(q.
Get() * parallel));
137 energySource->SetAttribute(
"NominalVoltage",
DoubleValue(vNom.
Get() * series));
138 energySource->SetAttribute(
"NominalCapacity",
DoubleValue(qNom.
Get() * parallel));
140 energySource->SetAttribute(
"ExponentialVoltage",
DoubleValue(vExp.
Get() * series));
141 energySource->SetAttribute(
"ExponentialCapacity",
DoubleValue(qExp.
Get() * parallel));
143 energySource->SetAttribute(
"InternalResistance",
DoubleValue(r.
Get() * (series / parallel)));
149 uint8_t parallel)
const
151 NS_ASSERT_MSG(energySourceContainer.
GetN() > 0,
"This energy container is empty");
153 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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.