Bases: object
1 dimensional combinatorial optimisation NILM algorithm.
Attributes
model | (list of dicts) Each dict has these keys: states : list of ints (the power (Watts) used in different states) training_metadata : ElecMeter or MeterGroup object used for training this set of states. We need this information because we need the appliance type (and perhaps some other metadata) for each model. |
Disaggregate mains according to the model learnt previously.
Parameters: | mains : nilmtk.ElecMeter or nilmtk.MeterGroup output_datastore : instance of nilmtk.DataStore subclass
output_name : string, optional
resample_seconds : number, optional
**load_kwargs : key word arguments
|
---|
Bases: object
Provides a common interface to all disaggregation classes. See https://github.com/nilmtk/nilmtk/issues/271 for discussion.
Attributes
Each subclass should internally store models learned from training. |
Passes each chunk from mains generator to disaggregate_chunk() and passes the output to _write_disaggregated_chunk_to_datastore() Will have a default implementation in super class. Can be overridden for more simple in-memory disaggregation, or more complex out-of-core disaggregation.
Parameters: | mains : nilmtk.ElecMeter (single-phase) or nilmtk.MeterGroup (multi-phase) output_datastore : instance of nilmtk.DataStore or str of datastore location |
---|
Loads all of a DataFrame from disk.
Parameters: | chunk : pd.DataFrame (in NILMTK format) |
---|---|
Returns: | chunk : pd.DataFrame where each column represents a disaggregated appliance |
Saves learned model to file. Required to be overridden for learned models to persist.
Parameters: | filename : str path to file to save model to |
---|
Loads learned model from file. Required to be overridden for learned models to persist.
Parameters: | filename : str path to file to load model from |
---|
Trains the model given a metergroup containing a appliance meters (supervised) or a site meter (unsupervised). Will have a default implementation in super class. Can be overridden for simpler in-memory training, or more complex out-of-core training.
Parameters: | metergroup : a nilmtk.MeterGroup object |
---|
Signature is fine for site meter dataframes (unsupervised learning). Would need to be called for each appliance meter along with appliance identifier for supervised learning. Required to be overridden to provide out-of-core disaggregation.
Parameters: | chunk : pd.DataFrame where each column represents a disaggregated appliance identifier : tuple of (nilmtk.appliance, int) representing instance of that appliance for this chunk |
---|
Bases: object
Disaggregate mains according to the model learnt previously.
Parameters: | mains : nilmtk.ElecMeter or nilmtk.MeterGroup output_datastore : instance of nilmtk.DataStore subclass
output_name : string, optional
resample_seconds : number, optional
**load_kwargs : key word arguments
|
---|
Parameters: | list_pi : List of PI’s of individual learnt HMMs |
---|---|
Returns: | result : Combined Pi for the FHMM |
Parameters: | list_pi : List of PI’s of individual learnt HMMs |
---|---|
Returns: | result : Combined Pi for the FHMM |
Decodes the HMM state sequence
Bases: object
1 or 2 dimensional Hart 1985 algorithm.
Attributes
model | (dict) Each key is either the instance integer for an ElecMeter, or a tuple of instances for a MeterGroup. Each value is a sorted list of power in different states. |
Disaggregate mains according to the model learnt previously.
Parameters: | mains : nilmtk.ElecMeter or nilmtk.MeterGroup output_datastore : instance of nilmtk.DataStore subclass
output_name : string, optional
resample_seconds : number, optional
**load_kwargs : key word arguments
|
---|
Train using Hart85. Places the learnt model in model attribute.
Parameters: | metergroup : a nilmtk.MeterGroup object cols: nilmtk.Measurement, should be one of the following
buffer_size: int, optional
min_tolerance: int, optional
percent_tolerance: float, optional
large_transition: float, optional
|
---|
Bases: object
Attributes: * transitionList (list of tuples) * matchedPairs (dataframe containing matched pairs of transitions)
Hart 85, P 33. When searching the working buffer for pairs, the order in which entries are examined is very important. If an Appliance has on and off several times in succession, there can be many pairings between entries in the buffer. The algorithm must not allow an 0N transition to match an OFF which occurred at the end of a different cycle, so that only ON/OFF pairs which truly belong together are paired up. Otherwise the energy consumption of the appliance will be greatly overestimated. The most straightforward search procedures can make errors of this nature when faced with types of transition sequences.
Hart 85, P 32. For the two-state load monitor, a pair is defined as two entries which meet the following four conditions: (1) They are on the same leg, or are both 240 V, (2) They are both unmarked, (3) The earlier has a positive real power component, and (4) When added together, they result in a vector in which the absolute value of the real power component is less than 35 Watts (or 3.5% of the real power, if the transitions are over 1000 W) and the absolute value of the reactive power component is less than 35 VAR (or 3.5%).
... the correct way to search the buffer is to start by checking elements which are close together in the buffer, and gradually increase the distance. First, adjacent elements are checked for pairs which meet all four requirements above; if any are found they are processed and marked. Then elements two entries apart are checked, then three, and so on, until the first and last element are checked...