Appliances Support

Modelling appliances can become tedious, especially when working with different incompatible dataset.

We provide some support that aims at solving compatibility issues. When designing your dataset, you might be interested to read the following.

Appliances Dictionary

When simulating appliances, you can use the appliance dictionary: appliances_dict It stores the information of all appliances that you require for the simulation. You might want to make sure that the dict you use has all the properties required by the simulator.

Appliances Types

To ensure compatibility between the datasets, appliances all have a property defined in the dict appliances_dict['type']. You can check the possible types implemented at: appliance_type.

Appliances Excell Sheet

A spreadsheet modified from CREST is available for helping you designing appliances setting for you simulation. Instructions for creating can be directly found in the downloadable excell file.

Helper functions

Helpers for the appliances.

demod.utils.appliances.merge_appliance_dict(dic1, dic2)

Merges two appiance dictionaries together.

They must have the same keys, or the keys that are not in both will be dropped.

Parameters
  • dic1 (Dict[str, numpy.ndarray]) –

  • dic2 (Dict[str, numpy.ndarray]) –

Return type

Dict[str, numpy.ndarray]

demod.utils.appliances.remove_start(appliance_type)

Remove the first element to get the parent appliance type.

Parameters

appliance_type (str) – The type of the appliance to find in types_list

Returns

The new name (without the start) or False if there is no start to remove.

Return type

Union[bool, str]

demod.utils.appliances.find_closest_type(appliance_type, types_list)

Return the closest type in the list.

Check the parented types.

Parameters
  • appliance_type (str) – The type of the appliance to find in types_list

  • types_list (str) – List of appliances types

Returns

The closest parent type or False if no parent was found.

Return type

Union[bool, str]

demod.utils.appliances.get_ownership_from_dict(appliances_dict, ownership_dict)

Calculate the ownership of each appliance.

Based on the ownership dictionary, detect the ownership of the appliances. The appliance_dict['type'] is used to find the corresponding ownership.

When two appliances of the same type are given, it will try to check the ownership for a second appliance of that type, and so on for more.

If an appliance type is not found, it will check for a parent appliance, by removing the beggining of the appliance type. ex: chest_freezer is not found in ownership_dict, look for freezer instead.

The two preceeding instructions can be combined, example:

appliances_dict['type'] = ['hob', 'electric_hob']
ownership_dict = {'hob': 0.9 , 'hob_2': 0.1]
output = [0.9, 0.1]

In the future, other algorithms could be used, as example using correlations of ownership. (you don’t have a tv box if you have no tv)

Parameters
  • appliances_dict (Dict[str, numpy.ndarray]) – Dictonarry of the appliances.

  • ownership_dict (Dict[str, float]) – Mapping appliance_type to a probability.

Returns

The probability of ownership for each appliance.

Return type

np.array

demod.utils.appliances.assign_ownership_from_prob1_and_number(prob_1, number, algo='floor')

Assign the probability of owning multiple sample of appliances.

You can choose different assignement algorithms. (Only one is currently implemented)

‘floor’

p_0 = prob_1, n = number and \sum_{i}^{} p_i = n. which produces results like:

[prob_1, 1., 1., n - i - prob_1]
Parameters
  • prob_1 (float) – The probability of owning 1 of the appliance

  • number (float) – The average number of appliances owned by the hosehold

  • algo (str) – The algorithm name to use

Returns

A variable length list, where the element i in the list corresponds to the prob of owning a i-eth copy of the appliance.

Return type

List[float]

demod.utils.appliances.get_target_from_dict(appliances_dict, target_dict, default_key='target_switchons')

Calculate the targets of each appliance.

Based on the target_dict, find the target of the appliances from the app_dict. The appliance_dict['type'] is used to find the corresponding target. The target can be any kind of target (switchons, consumption, duration, …)

When two appliances of the same type are given, it will try to check the target for a second appliance of that type, and so on for more.

If an appliance type is not found, it will check for a parent appliance, by removing the beggining of the appliance type. ex: chest_freezer is not found in target_dict, look for freezer instead.

The two preceeding instructions can be combined, example:

appliances_dict['type'] = ['hob', 'electric_hob']
ownership_dict = {'hob': 0.9 , 'hob_2': 0.1}
output = [0.9, 0.1]
Parameters
  • appliances_dict (Dict[str, numpy.ndarray]) – Dictonary of the appliances.

  • target_dict (Dict[str, float]) – Mapping appliance_type to a number.

  • default_key (str) – The key that is used for the target value in the appliances_dict.

Returns

The target of each appliances.

Return type

np.array