Cooking Appliances

In this example, appliances with multiple preferences index and attributes are modelled.

To have a better understanding of RAMP features for modelling this category of appliances, two households are considered:

  1. A household with a fixed lunch habit of eating soup every day.

  2. A household with two lunch preferences: cooking soup or rice.

The number of user preferences can be specified through “user_preference” parameter when initializing a User instance.

# importing functions
from ramp import User, UseCase, get_day_type
import pandas as pd

Creating a user category

user_1 = User(
    user_name="Household with single lunch habit",
    num_users=1,
    user_preference=1,  # user_1 has only one lunch preference
)

user_2 = User(
    user_name="Household with different lunch habits",
    num_users=1,
    user_preference=2,  # user_2 has two lunch preferences
)

Defining the cycles for cooking soup and rice

For cooking soup it is assumed that the user needs 25 minutes divided into two parts:

cycle

power

time

Boiling Water

1200

5

Cooking soup

750

20

For cooking rice it is assumed that the user needs 15 minutes divided into two parts:

cycle

power

time

Boiling Water

1200

5

Cooking rice

600

10

# soup for lunch
soup_1 = user_1.add_appliance(
    name="soup for lunch",
    power=1200,
    func_time=25,
    func_cycle=25,
    thermal_p_var=0.2,
    fixed_cycle=1,
    window_1=[12 * 60, 15 * 60],
    p_11=1200,  # power of the first cycle
    t_11=5,  # time needed for the first cycle
    p_12=750,  # power of the second cycle
    t_12=20,  # time needed for the second cycle
    cw11=[12 * 60, 15 * 60],
)

The second user has two different preferences for lunch. Accordingly, we need to model these preferences and their characteristics as two different appliances.

Each preference needs to be specified with its associated cooking energy needs, such as the power, functioning time and the duty cycles of the cooking process.

More importantly, for each preference, the user needs to specify the index of preference by using the pref_index parameter. In this example, soup is the first preference of the user (pref_index = 1), and rice is the second one (pref_index = 2).

# soup for lunch
soup_2 = user_2.add_appliance(
    name="soup for lunch",
    power=1200,
    func_time=25,
    func_cycle=25,
    thermal_p_var=0.2,
    fixed_cycle=1,
    pref_index=1,  # the first preference
    window_1=[12 * 60, 15 * 60],
    p_11=1200,  # power of the first cycle
    t_11=5,  # time needed for the first cycle
    p_12=750,  # power of the second cycle
    t_12=20,  # time needed for the second cycle
    cw11=[12 * 60, 15 * 60],
)
# rice for lunch
rice_2 = user_2.add_appliance(
    name="rice for lunch",
    power=1200,
    func_time=15,
    func_cycle=15,
    thermal_p_var=0.2,
    pref_index=2,  # the second preference
    fixed_cycle=1,
    window_1=[12 * 60, 15 * 60],
    p_11=1200,  # power of the first cycle
    t_11=5,  # time needed for the first cycle
    p_12=600,  # power of the second cycle
    t_12=10,  # time needed for the second cycle
    cw11=[12 * 60, 15 * 60],
)
# you can have an overview of data inputs by usering User.export_to_dataframe method
user_lunch = UseCase(users=[user_1, user_2], date_start="2020-01-01")
user_lunch.export_to_dataframe().T
0 1 2
user_name Household with single lunch habit Household with different lunch habit Household with different lunch habit
num_users 1 1 1
user_preference 1 2 2
name soup for lunch soup for lunch rice for lunch
number 1 1 1
power 1200.0 1200.0 1200.0
num_windows 1 1 1
func_time 25 25 15
time_fraction_random_variability 0 0 0
func_cycle 25 25 15
fixed no no no
fixed_cycle 1 1 1
occasional_use 1 1 1
flat no no no
thermal_p_var 0.2 0.2 0.2
pref_index 0 1 2
wd_we_type 2 2 2
p_11 1200 1200 1200
t_11 5 5 5
cw11_start 720 720 720
cw11_end 900 900 900
p_12 750 750 600
t_12 20 20 10
cw12_start 0 0 0
cw12_end 0 0 0
r_c1 0 0 0
p_21 0 0 0
t_21 0 0 0
cw21_start 0 0 0
cw21_end 0 0 0
p_22 0 0 0
t_22 0 0 0
cw22_start 0 0 0
cw22_end 0 0 0
r_c2 0 0 0
p_31 0 0 0
t_31 0 0 0
cw31_start 0 0 0
cw31_end 0 0 0
p_32 0 0 0
t_32 0 0 0
cw32_start 0 0 0
cw32_end 0 0 0
r_c3 0 0 0
window_1_start 720 720 720
window_1_end 900 900 900
window_2_start 0 0 0
window_2_end 0 0 0
window_3_start 0 0 0
window_3_end 0 0 0
random_var_w 0 0 0

Generating a profile for some months

# number of days
n_days = 90

user_lunch.initialize(num_days=n_days)
# storing all the profiles for all the users
profiles = pd.DataFrame(
    index=pd.date_range(start="2020-01-01", periods=1440 * n_days, freq="T")
)

# here we need to use the

for user in user_lunch.users:
    # storing daily profiles for a user
    user_profiles = []
    for day_idx, day in enumerate(user_lunch.days):
        single_profile = user.generate_single_load_profile(
            prof_i=day_idx,  # the day to generate the profile
            day_type=get_day_type(day),
        )

        user_profiles.extend(single_profile)

    profiles[user.user_name] = user_profiles
You will simulate 90 day(s) from 2020-01-01 00:00:00 until 2020-03-31 00:00:00

Considering that the second user has the possibility of cooking rice for lunch, which has a less energy-intensive cooking cycle, we expect to see a higher energy consumption for the user that only eats soup, in most of the cases.

# daily energy consumption
profiles.resample("1d").sum().plot(title="daily energy consumption")
<Axes: title={'center': 'daily energy consumption'}>
../../_images/output_13_1.png