NILM - use nilmtk to read iawe data collector data

Refer to the official notebook
provided by nilmtk combined with the API manual for an in-depth understanding.

breakpoint run

import sys
sys.path.append('G:/Code/')
from nilmtk import DataSet

iawe = DataSet(r'G:\Code\DataSet\IAWE\iawe.h5')
elec = iawe.buildings[1].elec
fridge = elec['fridge']
df = next(fridge.load())

View the current variable types
insert image description here
At this time, fridge is of ElecMeter type, and then call the load() method
to view the corresponding API manual
frige.load() returns a generator of DataFrames insert image description here
, you can see that df is a DataFrames at this time, look at the content:
insert image description here

How to return a power series?

To check how many columns the appliance frige has, how do you search in the API manual? First of all, the frige at this time is of ElecMeter type, so find the view manual
in the method defined by ElecMeter , call available_columns(), and return a list, the elements in the list are tuples and the tuples are in the form of ( , ).

insert image description here

print(fridge.available_columns())

The return at this time is,
insert image description here
for example, we now need to return a Series of apparent power, look up the manual

insert image description here
In the incoming parameter ac_type = "apparent"
that is

series = next(fridge.power_series(ac_type='apparent'))

insert image description here

How to specify a physical quantity and return the corresponding column?

Through available_columns(), you can know that the physical quantities include power, voltage, current, frequency, and power factor.
If you want to return power now, and include active, reactive, and apparent, how do you call it? According to the load method of ElecMeter, the parameters physical_quantity and ac_type need to be passed in
insert image description here
.

df = next(fridge.load(physical_quantity = 'power',ac_type = None))

insert image description here

How can I return the resampled data as needed?

From the timestamp above, we can see that the current sampling frequency is 1Hz. If the desired data is one data point per minute, how to read it?
The load() method provides the resample parameter
insert image description here
60s to take a data point, namely

df = next(fridge.load(physical_quantity = 'power',ac_type = None, sample_period=60))

insert image description here

Summarize:

1. frige is an ElecMeter type, so when you want to read frige data, you need to find a method under ElecMeter according to the manual. 2.
When you need to return data in the form of Series, call load_series(). If you want to extract power data, you can directly Call power_series()
3. When you need to return data in the form of DataFrame, call load().

Update at 22:26:50 on May 9, 2023: The link is in the comment area, and you need to go online scientifically.

Guess you like

Origin blog.csdn.net/aa2962985/article/details/121141974