Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nilmtk.exceptions.MeasurementError: AC type 'apparent' not available. Available columns = [('power', 'active')] #67

Open
mmeism opened this issue Apr 11, 2022 · 3 comments

Comments

@mmeism
Copy link

mmeism commented Apr 11, 2022

I have converted the Refit dataset with the convert_refit function resulting in a refit.h5 file.
Now I have a problem when setting up an experiment with the refit.h5 file.

error code:
Traceback (most recent call last):
File "C:/Users/mime02/PycharmProjects/EnergyPredictionLSTM/Evaluation/NILMTK/NILMTK_con.py", line 168, in
api_res = API(refit)
File "C:\Users\mime02\Anaconda3\envs\nilm\lib\site-packages\nilmtk\api.py", line 46, in init
self.experiment()
File "C:\Users\mime02\Anaconda3\envs\nilm\lib\site-packages\nilmtk\api.py", line 105, in experiment
self.test_jointly(d)
File "C:\Users\mime02\Anaconda3\envs\nilm\lib\site-packages\nilmtk\api.py", line 250, in test_jointly
test_mains=next(test.buildings[building].elec.mains().load(physical_quantity='power', ac_type='apparent', sample_period=self.sample_period))
File "C:\Users\mime02\Anaconda3\envs\nilm\lib\site-packages\nilmtk\elecmeter.py", line 451, in load
last_node = self.get_source_node(**kwargs)
File "C:\Users\mime02\Anaconda3\envs\nilm\lib\site-packages\nilmtk\elecmeter.py", line 576, in get_source_node
loader_kwargs = self._convert_physical_quantity_and_ac_type_to_cols(**loader_kwargs)
File "C:\Users\mime02\Anaconda3\envs\nilm\lib\site-packages\nilmtk\elecmeter.py", line 560, in _convert_physical_quantity_and_ac_type_to_cols
raise MeasurementError(msg)
nilmtk.exceptions.MeasurementError: AC type 'apparent' not available. Available columns = [('power', 'active')].
Closing remaining open files:C:\Users\refit.h5

How can I fix this issue?
Hope you can help

My code is:

refit = {
'power': {
'mains': ['apparent', 'active'],
'appliance': ['apparent', 'active']
},
'sample_rate': 100,

'appliances': ['fridge'],
'methods': {
    "CombinatorialOptimisation": CO({}),
    "FHMM_EXACT": FHMMExact({'num_of_states': 2}),

    'WindowGRU': WindowGRU({'n_epochs': 1, 'batch_size': 32}),   
    'RNN': RNN({'n_epochs': 1, 'batch_size': 32}),       
    'DAE': DAE({'n_epochs': 1, 'batch_size': 32}),        
    'Seq2Point': Seq2Point({'n_epochs': 1, 'batch_size': 32}),      
    'Seq2Seq': Seq2Seq({'n_epochs': 1, 'batch_size': 32}),     
},
'train': {
    'datasets': {
        'Dataport': {
            'path': r'C:\Users\refit.h5',
            'buildings': {
                2: {
                    'start_time': '2013-10-10',
                    'end_time': '2013-10-20'
                },
            }

        }
    }
},
'test': {
    'datasets': {
        'Dataport': {
            'path': r'C:\Users\refit.h5',
            'buildings': {
                2: {
                    'start_time': '2013-11-01',
                    'end_time': '2013-11-11'
                },
            }
        }
    },
    'metrics': ['mae', 'rmse']
}

}

api_res = API(refit)

@HYuTing
Copy link

HYuTing commented Jan 10, 2023

Can I apply for the REFIT.h5 dataset? Thank you very much

@mrshekari
Copy link

Hi, @mmeism did you manage to solve the problem?

@CarlosCedeniio
Copy link

CarlosCedeniio commented Jun 13, 2024

Hi, to solve this change line 250 in nilmtk/api.py

from this
test_mains=next(test.buildings[building].elec.mains().load(physical_quantity='power', ac_type='apparent', sample_period=self.sample_period))

to:

test_mains=next(test.buildings[building].elec.mains().load(physical_quantity='power', ac_type=self.power['mains'], sample_period=self.sample_period))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants