INET Framework for OMNeT++/OMNEST
inet::power::CcEnergySinkBase Class Reference

#include <CcEnergySinkBase.h>

Inheritance diagram for inet::power::CcEnergySinkBase:
inet::power::EnergySinkBase inet::power::ICcEnergySink inet::power::IEnergySink inet::power::IEnergySink inet::power::CcEnergyStorageBase inet::power::SimpleCcBattery

Public Member Functions

virtual A getTotalCurrentGeneration () const override
 Returns the total current generation in the range [0, +infinity). More...
 
virtual void addEnergyGenerator (const IEnergyGenerator *energyGenerator) override
 Adds a new energy generator to the energy sink. More...
 
virtual void removeEnergyGenerator (const IEnergyGenerator *energyGenerator) override
 Removes a previously added energy generator from this energy sink. More...
 
- Public Member Functions inherited from inet::power::EnergySinkBase
virtual int getNumEnergyGenerators () const override
 Returns the number of energy generators in the range [0, +infinity). More...
 
virtual const IEnergyGeneratorgetEnergyGenerator (int index) const override
 Returns the energy generator for the provided index. More...
 
- Public Member Functions inherited from inet::power::IEnergySink
virtual ~IEnergySink ()
 

Protected Member Functions

virtual A computeTotalCurrentGeneration () const
 
virtual void updateTotalCurrentGeneration ()
 

Protected Attributes

A totalCurrentGeneration = A(NaN)
 
- Protected Attributes inherited from inet::power::EnergySinkBase
std::vector< const IEnergyGenerator * > energyGenerators
 

Additional Inherited Members

- Static Public Attributes inherited from inet::power::ICcEnergySink
static simsignal_t currentGenerationChangedSignal = cComponent::registerSignal("currentGenerationChanged")
 The signal that is used to publish current generation changes. More...
 

Member Function Documentation

void inet::power::CcEnergySinkBase::addEnergyGenerator ( const IEnergyGenerator energyGenerator)
overridevirtual

Adds a new energy generator to the energy sink.

The energyGenerator parameter must not be nullptr.

Reimplemented from inet::power::EnergySinkBase.

Reimplemented in inet::power::CcEnergyStorageBase.

Referenced by inet::power::CcEnergyStorageBase::addEnergyGenerator().

38 {
39  EnergySinkBase::addEnergyGenerator(energyGenerator);
40  auto module = const_cast<cModule *>(check_and_cast<const cModule *>(energyGenerator));
43 }
virtual void updateTotalCurrentGeneration()
Definition: CcEnergySinkBase.cc:32
virtual void addEnergyGenerator(const IEnergyGenerator *energyGenerator) override
Adds a new energy generator to the energy sink.
Definition: EnergySinkBase.cc:30
static simsignal_t currentGenerationChangedSignal
The signal that is used to publish current generation changes.
Definition: ICcEnergyGenerator.h:40
A inet::power::CcEnergySinkBase::computeTotalCurrentGeneration ( ) const
protectedvirtual

Referenced by inet::power::CcEnergyStorageBase::initialize(), and updateTotalCurrentGeneration().

25 {
27  for (auto energyGenerator : energyGenerators)
28  totalCurrentGeneration += check_and_cast<const ICcEnergyGenerator *>(energyGenerator)->getCurrentGeneration();
30 }
value< double, units::A > A
Definition: Units.h:1051
A totalCurrentGeneration
Definition: CcEnergySinkBase.h:32
std::vector< const IEnergyGenerator * > energyGenerators
Definition: EnergySinkBase.h:30
virtual A inet::power::CcEnergySinkBase::getTotalCurrentGeneration ( ) const
inlineoverridevirtual

Returns the total current generation in the range [0, +infinity).

Implements inet::power::ICcEnergySink.

Reimplemented in inet::power::SimpleCcBattery.

39 { return totalCurrentGeneration; }
A totalCurrentGeneration
Definition: CcEnergySinkBase.h:32
void inet::power::CcEnergySinkBase::removeEnergyGenerator ( const IEnergyGenerator energyGenerator)
overridevirtual

Removes a previously added energy generator from this energy sink.

This functions throws an exception if the generator is not found.

Reimplemented from inet::power::EnergySinkBase.

Reimplemented in inet::power::CcEnergyStorageBase.

Referenced by inet::power::CcEnergyStorageBase::removeEnergyGenerator().

46 {
48  auto module = const_cast<cModule *>(check_and_cast<const cModule *>(energyGenerator));
49  module->unsubscribe(ICcEnergyGenerator::currentGenerationChangedSignal, this);
51 }
virtual void updateTotalCurrentGeneration()
Definition: CcEnergySinkBase.cc:32
virtual void removeEnergyGenerator(const IEnergyGenerator *energyGenerator) override
Removes a previously added energy generator from this energy sink.
Definition: EnergySinkBase.cc:35
static simsignal_t currentGenerationChangedSignal
The signal that is used to publish current generation changes.
Definition: ICcEnergyGenerator.h:40
void inet::power::CcEnergySinkBase::updateTotalCurrentGeneration ( )
protectedvirtual

Member Data Documentation


The documentation for this class was generated from the following files: