Disaggregate
Disaggregate Smart Meter data

Device Class Reference

Class for representing "devices" (e.g. appliances like "dish washer", "lamp" etc) More...

#include <Device.h>

Collaboration diagram for Device:

List of all members.

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_tgetStartTimes (const AggregateData &) const
const std::list< Signature::SpikegetSalientSpikes () const
Functions used by the "LMS" approach
std::list< size_tfindAlignment (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()
PowerStateGraphgetPowerStateGraph ()

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

Detailed Description

Class for representing "devices" (e.g. appliances like "dish washer", "lamp" etc)

Definition at line 23 of file Device.h.


Constructor & Destructor Documentation

Device::Device ( const std::string  _name)

Definition at line 19 of file Device.cpp.

References name, powerStateGraph, and PowerStateGraph::setDeviceName().

Here is the call graph for this function:

Device::~Device ( ) [virtual]

Definition at line 24 of file Device.cpp.

References signatures.


Member Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

void Device::getPowerStatesAndSequence ( )

To be called once signatures have been loaded by loadSignatures()

Deprecated:
This is the function used by the "Histograms" design and not by the subsequent "Graph and Spikes" design.

Definition at line 111 of file Device.cpp.

References DATA_OUTPUT_PATH, updatePowerStates(), and updatePowerStateSequence().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

const list< Signature::Spike > Device::getSalientSpikes ( ) const
Returns:
a list of the most salient spikes to look for, taking into consideration all Signatures, in ascending temporal order.
Deprecated:
This is only used by the "histogram" design, not the subsequence "Graphs and Spikes" design iteration.

Definition at line 174 of file Device.cpp.

References Signature::Spike::compareIndexAsc(), and signatures.

Referenced by getStartTimes().

Here is the call graph for this function:

Here is the caller graph for this function:

const list< size_t > Device::getStartTimes ( const AggregateData aggregateData) const
Returns:
a list of UNIX times when the device starts
Deprecated:
We now use the disaggregation functions in PowerStateGraph

Parameters:
aggregateDataA 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().

Here is the call graph for this function:

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

Returns:
Parameters:
aggDataaggregate data array
aggDataSamplePeriodsample period of the aggregate data

Definition at line 315 of file Device.cpp.

References Array< T >::getSize().

Referenced by findAlignment().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
sigFilesVector of filenames (without path).
cropFrontAmount to crop from front (only makes sense for use with LMS mode)
cropBackAmount 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:


Member Data Documentation

std::string Device::name [private]

Definition at line 98 of file Device.h.

Referenced by Device(), findAlignment(), getName(), getStartTimes(), and updatePowerStateSequence().

Definition at line 106 of file Device.h.

Referenced by Device(), getPowerStateGraph(), and trainPowerStateGraph().

Definition at line 99 of file Device.h.

Referenced by updatePowerStates().

Definition at line 101 of file Device.h.

Referenced by updatePowerStateSequence().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends