Disaggregate
Disaggregate Smart Meter data
|
Class for representing "devices" (e.g. appliances like "dish washer", "lamp" etc) More...
#include <Device.h>
Classes | |
struct | IndexAndDelta |
Public Member Functions | |
Constructors and destructors | |
Device (const std::string _name) | |
virtual | ~Device () |
General functions used by all disaggregation approaches | |
void | loadSignatures (const std::vector< std::string > &sigFiles, const size_t cropFront, const size_t cropBack) |
Load signature data files. | |
const std::string | getName () const |
Functions used by the "histogram" approach | |
void | getPowerStatesAndSequence () |
const std::list< size_t > | getStartTimes (const AggregateData &) const |
const std::list< Signature::Spike > | getSalientSpikes () const |
Functions used by the "LMS" approach | |
std::list< size_t > | findAlignment (const AggregateData &aggregateData) |
Functions used by the "graphs and spikes" approach | |
void | trainPowerStateGraph () |
Trains the powerStateGraph using signatures declared with loadSignatures(). To be called once signatures have been loaded by loadSignatures() | |
PowerStateGraph & | getPowerStateGraph () |
Private Member Functions | |
void | loadCurrentCostData (std::fstream &fs, Array< AggregateSample > *aggData) |
const double | LMS (const size_t agOffset, const Array< AggregateSample > &aggData, const Array< Sample_t > &sigArray, const size_t aggDataSamplePeriod) |
Least mean difference. | |
Private functions used by the "histogram" approach | |
void | updatePowerStates () |
Extract the power states from last signature and add them to this device's powerStates. | |
void | updatePowerStateSequence () |
Extract the power state sequence from last signature and add them to this device's powerStates. | |
Private Attributes | |
std::string | name |
PowerStates_t | powerStates |
std::vector< Signature * > | signatures |
PowerStateSequence | powerStateSequence |
PowerStateGraph | powerStateGraph |
Class for representing "devices" (e.g. appliances like "dish washer", "lamp" etc)
Device::Device | ( | const std::string | _name | ) |
Definition at line 19 of file Device.cpp.
References name, powerStateGraph, and PowerStateGraph::setDeviceName().
Device::~Device | ( | ) | [virtual] |
Definition at line 24 of file Device.cpp.
References signatures.
list< size_t > Device::findAlignment | ( | const AggregateData & | aggData | ) |
Definition at line 268 of file Device.cpp.
References AggregateData::getSamplePeriod(), Array< T >::getSize(), LMS(), name, and signatures.
Referenced by main().
const string Device::getName | ( | ) | const |
Definition at line 30 of file Device.cpp.
References name.
PowerStateGraph & Device::getPowerStateGraph | ( | ) |
Definition at line 100 of file Device.cpp.
References powerStateGraph.
Referenced by main().
void Device::getPowerStatesAndSequence | ( | ) |
To be called once signatures
have been loaded by loadSignatures()
Definition at line 111 of file Device.cpp.
References DATA_OUTPUT_PATH, updatePowerStates(), and updatePowerStateSequence().
Referenced by main().
const list< Signature::Spike > Device::getSalientSpikes | ( | ) | const |
Definition at line 174 of file Device.cpp.
References Signature::Spike::compareIndexAsc(), and signatures.
Referenced by getStartTimes().
const list< size_t > Device::getStartTimes | ( | const AggregateData & | aggregateData | ) | const |
aggregateData | A populated array of AggregateData |
Definition at line 214 of file Device.cpp.
References AggregateData::aggDelta(), Device::IndexAndDelta::delta, AggregateData::findNear(), getSalientSpikes(), Array< T >::getSize(), Device::IndexAndDelta::index, name, and AggregateData::secondsSinceFirstSample().
const double Device::LMS | ( | const size_t | aggOffset, |
const Array< AggregateSample > & | aggData, | ||
const Array< Sample_t > & | sigArray, | ||
const size_t | aggDataSamplePeriod | ||
) | [private] |
Least mean difference.
Know limitations: assumes SigArray has a sample period of 1
aggData | aggregate data array |
aggDataSamplePeriod | sample period of the aggregate data |
Definition at line 315 of file Device.cpp.
References Array< T >::getSize().
Referenced by findAlignment().
void Device::loadCurrentCostData | ( | std::fstream & | fs, |
Array< AggregateSample > * | aggData | ||
) | [private] |
void Device::loadSignatures | ( | const std::vector< std::string > & | sigFiles, |
const size_t | cropFront, | ||
const size_t | cropBack | ||
) |
Load signature data files.
sigFiles | Vector of filenames (without path). |
cropFront | Amount to crop from front (only makes sense for use with LMS mode) |
cropBack | Amount to crop from back (only makes sense for use with LMS mode) |
Definition at line 38 of file Device.cpp.
References Utils::fatalError(), Utils::fileExists(), SIG_DATA_PATH, and signatures.
Referenced by main().
void Device::trainPowerStateGraph | ( | ) |
Trains the powerStateGraph using signatures declared with loadSignatures(). To be called once signatures
have been loaded by loadSignatures()
Definition at line 73 of file Device.cpp.
References DATA_OUTPUT_PATH, PowerStateGraph::getEnergyConsumption(), J_PER_KWH, Statistic< T >::mean, Utils::openFile(), powerStateGraph, signatures, PowerStateGraph::update(), and PowerStateGraph::writeGraphViz().
Referenced by main().
void Device::updatePowerStates | ( | ) | [private] |
Extract the power states from last signature and add them to this device's powerStates.
This must be called after a new signature has been added to 'signatures'
Definition at line 131 of file Device.cpp.
References powerStates, and signatures.
Referenced by getPowerStatesAndSequence().
void Device::updatePowerStateSequence | ( | ) | [private] |
Extract the power state sequence from last signature and add them to this device's powerStates.
This must be called after a new signature has been added to 'signatures'
Definition at line 150 of file Device.cpp.
References name, powerStateSequence, and signatures.
Referenced by getPowerStatesAndSequence().
std::string Device::name [private] |
Definition at line 98 of file Device.h.
Referenced by Device(), findAlignment(), getName(), getStartTimes(), and updatePowerStateSequence().
PowerStateGraph Device::powerStateGraph [private] |
Definition at line 106 of file Device.h.
Referenced by Device(), getPowerStateGraph(), and trainPowerStateGraph().
PowerStates_t Device::powerStates [private] |
Definition at line 99 of file Device.h.
Referenced by updatePowerStates().
PowerStateSequence Device::powerStateSequence [private] |
Definition at line 101 of file Device.h.
Referenced by updatePowerStateSequence().
std::vector<Signature*> Device::signatures [private] |
Definition at line 100 of file Device.h.
Referenced by findAlignment(), getSalientSpikes(), loadSignatures(), trainPowerStateGraph(), updatePowerStates(), updatePowerStateSequence(), and ~Device().