def main():
    house_param = load_config("config2R2C.yml")
    days_sim = house_param['timing']['days_sim']
    CF = house_param['ventilation']['CF']
    Rair_wall, Cwall, Rair_outdoor, Cair = calculateRCOne(house_param)
    print(days_sim)
    df_nen = nen5060_to_dataframe()
    df_irr = run_qsun(df_nen)
    print(df_irr.head())

    time_sim = df_irr.iloc[0:days_sim * 24, 0].values

    Qsolar = (df_irr.total_E * house_param['glass']['E'] +
              df_irr.total_SE * house_param['glass']['SE'] +
              df_irr.total_S * house_param['glass']['S'] +
              df_irr.total_SW * house_param['glass']['SW'] +
              df_irr.total_W * house_param['glass']['W'] +
              df_irr.total_NW * house_param['glass']['NW'] +
              df_irr.total_N * house_param['glass']['N'] +
              df_irr.total_NE * house_param['glass']['NE']).values
    Qsolar *= house_param['glass']['g_value']
    Qsolar_sim = Qsolar[0:days_sim * 24]

    Qint = internal_heat_gain(house_param['internal']['Q_day'],
                              house_param['internal']['delta_Q'],
                              house_param['internal']['t1'],
                              house_param['internal']['t2'])
    Qinternal_sim = Qint[0:days_sim * 24]

    Toutdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature
    T_outdoor_sim = Toutdoor[0:days_sim * 24]

    week_day_setpoint = thermostat_sp(house_param['setpoint']['t1'],
                                      house_param['setpoint']['t2'],
                                      house_param['setpoint']['Night_T_SP'],
                                      house_param['setpoint']['Day_T_SP'],
                                      house_param['setpoint']['Flex_T_SP_workday'],
                                      house_param['setpoint']['Wu_time'],
                                      house_param['setpoint']['Work_time'],
                                      house_param['setpoint']['back_home_from_work'])

    day_off_setpoint = thermostat_sp(house_param['setpoint']['t1'],
                                     house_param['setpoint']['t2'],
                                     house_param['setpoint']['Night_T_SP'],
                                     house_param['setpoint']['Day_T_SP'],
                                     house_param['setpoint']['Flex_T_SP_dayoff'],
                                     house_param['setpoint']['Wu_time'],
                                     house_param['setpoint']['shopping_time'],
                                     house_param['setpoint']['back_home'])

    SP = SP_profile(week_day_setpoint, day_off_setpoint)

    SP_sim = SP[0:days_sim * 24]

    g = GasBoiler(kp=5000, ki=0, kd=0, T_setpoint=19.9, T_node=15, T_amb=10, dead_band=1, P_max=10000, P_min=2000)
    # solve ODE
    data = house_buffervessel(T_outdoor_sim, Qinternal_sim, Qsolar_sim, SP_sim, time_sim,
                              CF, Rair_outdoor, Rair_wall, Cair, Cwall, g)

    # plot the results
    plt.figure(figsize=(15, 5))  # key-value pair: no spaces
    plt.plot(data[3], data[0], label='Tair')
    plt.plot(data[3], data[1], label='Twall')
    # plt.plot(time_sim, SP_sim, label='SP_Temperature')
    # plt.plot(time_sim,T_outdoor_sim,label='Toutdoor')
    plt.legend(loc='best')
    plt.show()
def main():
    house_param = load_config("config2R2C.yml")
    days_sim = house_param['timing']['days_sim']
    CF = house_param['ventilation']['CF']
    Rair_wall, Cwall, Rair_outdoor, Cair = calculateRCOne(house_param)
    print(days_sim)

    #Loading the radiator and buffervessel parameters
    #Heat transfer coefficient of the radiator and het capacity
    cpwater = house_param['radiator']['cpwater']
    rhowater = house_param['radiator']['rhowater']
    Urad = house_param['radiator']['Urad']
    Arad = house_param['radiator']['Arad']
    volumeRadiator = house_param['radiator']['volume_rad']
    UAradiator = Urad * Arad
    Crad = cpwater * volumeRadiator * rhowater

    #Heat capacity of the buffervessel
    volumeBuffervessel = house_param['radiator']['volume_buffervessel']
    Cbuffervessel = cpwater * volumeBuffervessel * rhowater

    df_nen = nen5060_to_dataframe()
    df_irr = run_qsun(df_nen)
    print(df_irr.head())

    time_sim = df_irr.iloc[0:days_sim * 24, 0].values

    Qsolar = (df_irr.total_E * house_param['glass']['E'] +
              df_irr.total_SE * house_param['glass']['SE'] +
              df_irr.total_S * house_param['glass']['S'] +
              df_irr.total_SW * house_param['glass']['SW'] +
              df_irr.total_W * house_param['glass']['W'] +
              df_irr.total_NW * house_param['glass']['NW'] +
              df_irr.total_N * house_param['glass']['N'] +
              df_irr.total_NE * house_param['glass']['NE']).values
    Qsolar *= house_param['glass']['g_value']
    Qsolar_sim = Qsolar[0:days_sim * 24]

    Qint = internal_heat_gain(house_param['internal']['Q_day'],
                              house_param['internal']['delta_Q'],
                              house_param['internal']['t1'],
                              house_param['internal']['t2'])
    Qinternal_sim = Qint[0:days_sim * 24]

    Toutdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature
    T_outdoor_sim = Toutdoor[0:days_sim * 24]

    week_day_setpoint = thermostat_sp(
        house_param['setpoint']['t1'], house_param['setpoint']['t2'],
        house_param['setpoint']['Night_T_SP'],
        house_param['setpoint']['Day_T_SP'],
        house_param['setpoint']['Flex_T_SP_workday'],
        house_param['setpoint']['Wu_time'],
        house_param['setpoint']['Work_time'],
        house_param['setpoint']['back_home_from_work'])

    day_off_setpoint = thermostat_sp(
        house_param['setpoint']['t1'], house_param['setpoint']['t2'],
        house_param['setpoint']['Night_T_SP'],
        house_param['setpoint']['Day_T_SP'],
        house_param['setpoint']['Flex_T_SP_dayoff'],
        house_param['setpoint']['Wu_time'],
        house_param['setpoint']['shopping_time'],
        house_param['setpoint']['back_home'])

    SP = SP_profile(week_day_setpoint, day_off_setpoint)

    SP_sim = SP[0:days_sim * 24]
    # solve ODE
    data = house_buffervessel(T_outdoor_sim, Qinternal_sim, Qsolar_sim, SP_sim,
                              time_sim, CF, Rair_outdoor, Rair_wall, Cair,
                              Cwall, UAradiator, Crad, Cbuffervessel, cpwater)

    # plot the results
    plt.figure(figsize=(15, 5))  # key-value pair: no spaces
    plt.plot(data[4], data[0], label='Tair')
    plt.plot(data[4], data[1], label='Twall')
    plt.plot(data[4], data[2], label='Treturn')
    plt.plot(data[4], data[3], label='Tbuffervessel')
    plt.plot(time_sim, SP_sim, label='SP_Temperature')
    plt.plot(time_sim, T_outdoor_sim, label='Toutdoor')
    plt.legend(loc='best')
    plt.show()
def main():
    house_param = load_config("Tussenwoning_alt.yaml")
    days_sim = house_param['timing']['days_sim']
    print('Simulation days:', days_sim)

    Rair_wall, Cwall, Rair_outdoor, Cair = calculateRC(house_param)

    # Loading the radiator and buffervessel parameters
    # Heat transfer coefficient of the radiator and het capacity
    cpwater = house_param['radiator']['cpwater']
    rhowater = house_param['radiator']['rhowater']
    Urad = house_param['radiator']['Urad']
    Arad = house_param['radiator']['Arad']
    volumeRadiator = house_param['radiator']['volume_rad']
    UAradiator = Urad * Arad
    Crad = cpwater * volumeRadiator * rhowater

    # Heat capacity of the buffervessel
    volumeBuffervessel = house_param['radiator']['volume_buffervessel']
    Cbuffervessel = cpwater * volumeBuffervessel * rhowater

    df_nen = nen5060_to_dataframe()

    Qsolar = np.zeros(365 * 24)
    for s in house_param['chains'][0]['Solar_irradiation']:
        descr = s['Designation']
        az = s['azimuth']
        tlt = s['tilt']
        print("Azimuth {0} and Tilt {1} for {2}".format(az, tlt, descr))
        df_irr = run_qsun_new(df_nen, az, tlt)
        Qsolar += (df_irr.total_irr).values
        time_sim = df_irr.iloc[0:days_sim * 24, 0].values

    CF = house_param['ventilation']['CF']
    Qsolar_sim = Qsolar[0:days_sim * 24]

    Q_internal = internal_heat_gain(house_param['internal']['Q_day'],
                                    house_param['internal']['delta_Q'],
                                    house_param['internal']['t1'],
                                    house_param['internal']['t2'])
    Qinternal_sim = Q_internal[0:days_sim * 24]

    Toutdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature
    T_outdoor_sim = Toutdoor[0:days_sim * 24]

    t_on = house_param['chains'][0]['Controller'][0]['Set_time'][0]
    t_off = house_param['chains'][0]['Controller'][0]['Set_time'][1]
    T_day = house_param['chains'][0]['Controller'][0]['Set_temp'][0]
    T_night = house_param['chains'][0]['Controller'][0]['Set_temp'][1]
    SP = simple_thermostat(t_on, t_off, T_day, T_night)
    SP_sim = SP[0:days_sim * 24]

    # solve ODE
    data = house_buffervessel(T_outdoor_sim, Qinternal_sim, Qsolar_sim, SP_sim,
                              time_sim, CF, Rair_outdoor, Rair_wall, Cair,
                              Cwall, UAradiator, Crad, Cbuffervessel, cpwater)

    # plot the results
    plt.figure(figsize=(15, 5))  # key-value pair: no spaces
    plt.plot(data[4], data[0], label='Tair')
    plt.plot(data[4], data[1], label='Twall')
    plt.plot(data[4], data[2], label='Treturn')
    plt.plot(data[4], data[3], label='Tbuffervessel')
    plt.plot(time_sim, SP_sim, label='SP_Temperature')
    plt.plot(time_sim, T_outdoor_sim, label='Toutdoor')
    plt.legend(loc='best')
    plt.show()
Exemple #4
0
def main(show=False):
    house_param = load_config(str(CONFIGDIR / "Tussenwoning2R2C_simple.yml"))
    days_sim = 365  # house_param['timing']['days_sim']
    num_nodes = 2
    CF = house_param['ventilation']['CF']

    Cair = house_param['thermal']['capacity'][0]
    Cwall = house_param['thermal']['capacity'][1]

    Rair_outdoor = 1.0 / house_param['thermal']['conductance'][0]
    Rair_wall = 1.0 / house_param['thermal']['conductance'][1]

    print(1.0 / Rair_outdoor, Cair, 1.0 / Rair_wall, Cwall)
    print(days_sim)

    c_matrix = make_c_inv_matrix(house_param['thermal']['capacity'])
    logger.info(f"C matrix: \n {c_matrix}")

    k_matrix = make_k_minus_matrix(house_param['thermal']['conductance'])
    logger.info(f"K matrix: \n {k_matrix}")

    #Loading the radiator and buffervessel parameters
    #Heat transfer coefficient of the radiator and het capacity
    cpwater = house_param['radiator']['cpwater']
    rhowater = house_param['radiator']['rhowater']
    Urad = house_param['radiator']['Urad']
    Arad = house_param['radiator']['Arad']
    volumeRadiator = house_param['radiator']['volume_rad']
    UAradiator = Urad * Arad
    Crad = cpwater * volumeRadiator * rhowater

    #Heat capacity of the buffervessel
    volumeBuffervessel = house_param['radiator']['volume_buffervessel']
    Cbuffervessel = cpwater * volumeBuffervessel * rhowater

    df_nen = nen5060_to_dataframe()
    """
    # old way: Qsolar as sum of transparent windows in 8 directions and horizontal
    df_irr = run_qsun(df_nen)
    print(df_irr.head())

    time_sim = df_irr.iloc[0:days_sim*24, 0].values

    Qsolar = (df_irr.total_E * house_param['glass']['E'] +
              df_irr.total_SE * house_param['glass']['SE'] +
              df_irr.total_S * house_param['glass']['S'] +
              df_irr.total_SW * house_param['glass']['SW'] +
              df_irr.total_W * house_param['glass']['W'] +
              df_irr.total_NW * house_param['glass']['NW'] +
              df_irr.total_N * house_param['glass']['N'] +
              df_irr.total_NE * house_param['glass']['NE']).values
    Qsolar *= house_param['glass']['g_value']
    Qsolar_sim = Qsolar[0:days_sim*24]
    """

    # new way: Qsolar2 as loop over transparent surfaces with:
    # effective area = area * ZTA
    # orientation in azimuth and tilt (inclination)
    # partition factor over nodes
    # inner loop over node divides energy of each window over nodes
    # result: array with num_nodes rows
    # containing 8760 values for heat delivered to each node
    time_secs = np.zeros(8760)
    Qsolar2 = np.zeros((num_nodes, 8760))  # num_nodes rows x 8760 cols
    for s in house_param['Solar_irradiation']:
        descr = s['Designation']
        az = s['Azimuth']
        tlt = s['Tilt']
        area = s['Effective Area']
        df_irr2 = run_qsun_new(df_nen, az, tlt, north_is_zero=True)
        area = s['Effective Area']
        partfactor = s['Node_partition']  # list of num_nodes elements 0<x<1
        logger.info(
            f"Window area {area} @ Azimuth {az} and Tilt {tlt} for {descr}, divided {partfactor[0]} {partfactor[1]}"
        )
        for n in range(num_nodes):
            Qsolar2[n, :] += (df_irr2.total_irr * area * partfactor[n]).values
        time_secs = df_irr2.iloc[:, 0].values  # 8760 rows 1D

    time_sim = time_secs[0:days_sim * 24]
    Qsolar2 *= house_param['glass']['g_value']
    Qsolar2_sum = np.sum(Qsolar2, axis=0)
    # logger.info(f"Testing if Qsolar == Qsolar2_sum")
    # np.testing.assert_allclose(Qsolar, Qsolar2_sum)
    # tested to be true!

    # Qsolar_sim = Qsolar[0:days_sim * 24]
    Qsolar_sim = Qsolar2_sum[0:days_sim * 24]

    Qint = internal_heat_gain(house_param['internal']['Q_day'],
                              house_param['internal']['delta_Q'],
                              house_param['internal']['t1'],
                              house_param['internal']['t2'])
    Qinternal_sim = Qint[0:days_sim * 24]

    Toutdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature
    T_outdoor_sim = Toutdoor[0:days_sim * 24]

    t_on = house_param['control']['set_time'][0]
    t_off = house_param['control']['set_time'][1]
    T_day = house_param['control']['set_temp'][0]
    T_night = house_param['control']['set_temp'][1]
    SP = simple_thermostat(t_on, t_off, T_day, T_night)

    SP_sim = SP[0:days_sim * 24]

    # solve ODE
    data = house_buffervessel(T_outdoor_sim, Qinternal_sim, Qsolar_sim, SP_sim,
                              time_sim, CF, Rair_outdoor, Rair_wall, Cair,
                              Cwall, UAradiator, Crad, Cbuffervessel, cpwater)

    # if show=True, plot the results
    if show:
        plt.figure(figsize=(15, 5))  # key-value pair: no spaces
        plt.plot(data[4], data[0], label='Tair')
        plt.plot(data[4], data[1], label='Twall')
        plt.plot(data[4], data[2], label='Treturn')
        plt.plot(data[4], data[3], label='Tbuffervessel')
        plt.plot(time_sim, SP_sim, label='SP_Temperature')
        plt.plot(time_sim, T_outdoor_sim, label='Toutdoor')
        plt.legend(loc='best')
        plt.show()

    return time_sim, SP_sim, T_outdoor_sim, data
Exemple #5
0
def main():
    # house_param = load_config("Tussenwoning_alt.yaml")
    house_param = load_config("Tussenwoning16april.yaml")
    chain = house_param['chains'][0]
    num_nodes = len(chain['links'])
    logger.info(f'Simulation nodes: {num_nodes}')
    num_sim = house_param['Duration']
    logger.info(f'Simulation points: {num_sim}')

    Rair_wall, Cwall, Rair_outdoor, Cair = calculateRC(house_param)

    #Loading the radiator and buffervessel parameters
    #Heat transfer coefficient of the radiator and het capacity
    cpwater = house_param['radiator']['cpwater']
    rhowater = house_param['radiator']['rhowater']
    Urad = house_param['radiator']['Urad']
    Arad = house_param['radiator']['Arad']
    volumeRadiator = house_param['radiator']['volume_rad']
    UAradiator = Urad * Arad
    Crad = cpwater * volumeRadiator * rhowater

    #Heat capacity of the buffervessel
    volumeBuffervessel = house_param['radiator']['volume_buffervessel']
    Cbuffervessel = cpwater * volumeBuffervessel * rhowater

    df_nen = nen5060_to_dataframe()

    Qsolar = np.zeros((8760, num_nodes))  # 8760 rows x 2 cols
    for s in house_param['chains'][0]['Solar_irradiation']:
        descr = s['Designation']
        az = s['Azimuth']
        tlt = s['Tilt']
        print("Azimuth {0} and Tilt {1} for {2}".format(az, tlt, descr))
        df_irr = run_qsun_new(df_nen, az, tlt, north_is_zero=True)
        area = s['Effective Area']
        partfactor = s['Node_partition']
        for n in range(num_nodes):
            Qsolar[:, n] += (df_irr.total_irr).values * area * partfactor[n]

        time_year = df_irr.iloc[:, 0].values  # 8760 rows 1D

    sources = house_param['chains'][0]['Sources']
    for src in sources:
        if src['name'] == 'Internal_load':
            # Q_internal = np.zeros(8760)  # 8760 rows x 1 cols
            Q_internal = internal_heat_gain(src['Set_load'][0],
                                            src['Set_load'][1],
                                            src['Set_time'][0],
                                            src['Set_time'][1])

    T_outdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature

    t_on = house_param['chains'][0]['Control']['Set_time'][0]
    t_off = house_param['chains'][0]['Control']['Set_time'][1]
    T_day = house_param['chains'][0]['Control']['Set_temp'][0]
    T_night = house_param['chains'][0]['Control']['Set_temp'][1]
    SP = simple_thermostat(t_on, t_off, T_day, T_night)

    num_sim = 8760
    time_sim = time_year[0:num_sim]  # 480 cols 1D
    Qsolar_sim = Qsolar[0:num_sim, :].T  # 2 rows x 480 cols
    Qinternal_sim = Q_internal[0:num_sim].flatten()  # 480 cols 1D
    T_outdoor_sim = T_outdoor[0:num_sim].flatten()  # 480 cols 1D
    SP_sim = SP[0:num_sim]  # 480 cols 1D

    # solve ODE
    data = house_buffervessel(T_outdoor_sim, Qinternal_sim, Qsolar_sim, SP_sim,
                              time_sim, Rair_outdoor, Rair_wall, Cair, Cwall,
                              UAradiator, Crad, Cbuffervessel, cpwater)

    # df_out = pd.DataFrame(data[4], columns=['Timestep'])
    df_out = pd.DataFrame({'Timestep': data[4]})
    df_out['Outdoor temperature'] = T_outdoor_sim
    for n in range(num_nodes):
        nodename = house_param['chains'][0]['links'][n]['Name']
        df_out["T_{}".format(n)] = data[0].tolist()
        df_out["Solar_{}".format(n)] = Qsolar_sim[n, :]
        if nodename == 'Internals':
            df_out["Internal_{}".format(n)] = Qinternal_sim
        df_out["Heating_{}".format(n)] = 0

    df_out['Treturn'] = data[2].tolist()
    df_out['Tbuffervessel'] = data[3]

    wb = Workbook()
    ws = wb.active
    ws.append(
        ['DESCRIPTION', 'Resultaten HAN Dynamic Model Heat Built Environment'])
    ws.append(['Chain number', 0])
    ws.append([
        'Designation', None, '2R-2C-1-zone', None, None, None, '2R-2C-1-zone'
    ])
    ws.append(['Node number', None, 0, None, None, None, 1])
    ws.append([
        'Designation', None, house_param['chains'][0]['links'][0]['Name'],
        None, None, None, house_param['chains'][0]['links'][1]['Name']
    ])
    for r in dataframe_to_rows(df_out, index=False):
        ws.append(r)
    # df_out.to_excel('tst.xlsx', index=False, startrow=10)
    wb.save('tst.xlsx')

    timeaxis = data[4] / 3600

    # plot the results
    # plt.figure(figsize=(15, 5))         # key-value pair: no spaces
    fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True, figsize=(
        15,
        8))  # 3 rijen en 1 kolom. x-axis will be shared among all subplots.
    ax1.plot(timeaxis, data[0], label='Tair')
    ax1.plot(timeaxis, data[1], label='Twall')
    ax1.plot(time_sim / 3600, SP_sim, label='SP_Temperature')
    ax1.set_ylabel('T ($\degree C$)')
    ax1.set_ylim(15, 40)

    ax2.plot(timeaxis, data[2], label='Treturn')
    ax2.plot(timeaxis, data[3], label='Tbuffervessel')
    ax2.set_ylabel('T ($\degree C$)')
    ax2.set_ylim(10, 90)

    ax3.plot(time_sim / 3600, T_outdoor_sim, label='Toutdoor')
    ax3.set_ylabel('T ($\degree C$)')
    ax3.set_ylim(-10, 30)
    ax1.set_title('Simulation2R2C_buffervessel_newyaml_with_xl')
    ax3.set_xlabel('time (h)')
    ax1.legend()
    ax2.legend()
    ax3.legend()
    plt.show()
Exemple #6
0
def main():
    house_param = load_config("config2R2C.yml")
    days_sim = house_param['timing']['days_sim']
    CF = house_param['ventilation']['CF']
    Rair_wall, Cwall, Rair_outdoor, Cair = calculateRCOne(house_param)
    print('Simulation days:', days_sim)

    df_nen = nen5060_to_dataframe()
    df_irr = run_qsun(df_nen)
    #df_weeks = read_week('NEN_data')
    print(df_irr.head())

    time_sim = df_irr.iloc[0:days_sim * 24, 0].values

    Qsolar = (df_irr.total_E * house_param['glass']['E'] +
              df_irr.total_SE * house_param['glass']['SE'] +
              df_irr.total_S * house_param['glass']['S'] +
              df_irr.total_SW * house_param['glass']['SW'] +
              df_irr.total_W * house_param['glass']['W'] +
              df_irr.total_NW * house_param['glass']['NW'] +
              df_irr.total_N * house_param['glass']['N'] +
              df_irr.total_NE * house_param['glass']['NE']).values
    Qsolar *= house_param['glass']['g_value']
    Qsolar_sim = Qsolar[0:days_sim * 24]

    #print(len(Qsolar_sim))

    Qint = internal_heat_gain(house_param['internal']['Q_day'],
                              house_param['internal']['delta_Q'],
                              house_param['internal']['t1'],
                              house_param['internal']['t2'])
    Qinternal_sim = Qint[0:days_sim * 24]

    Toutdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature
    T_outdoor_sim = Toutdoor[0:days_sim * 24]
    #plt.plot(T_outdoor_sim)

    week_day_setpoint = thermostat_sp(
        house_param['setpoint']['t1'], house_param['setpoint']['t2'],
        house_param['setpoint']['Night_T_SP'],
        house_param['setpoint']['Day_T_SP'],
        house_param['setpoint']['Flex_T_SP_workday'],
        house_param['setpoint']['Wu_time'],
        house_param['setpoint']['Work_time'],
        house_param['setpoint']['back_home_from_work'])

    day_off_setpoint = thermostat_sp(
        house_param['setpoint']['t1'], house_param['setpoint']['t2'],
        house_param['setpoint']['Night_T_SP'],
        house_param['setpoint']['Day_T_SP'],
        house_param['setpoint']['Flex_T_SP_dayoff'],
        house_param['setpoint']['Wu_time'],
        house_param['setpoint']['shopping_time'],
        house_param['setpoint']['back_home'])

    SP = SP_profile(week_day_setpoint, day_off_setpoint)

    #SP = temp_sp(house_param['setpoint']['t1'],
    #             house_param['setpoint']['t2'],
    #             house_param['setpoint']['Night_T_SP'],
    #             house_param['setpoint']['Day_T_SP'],
    #             house_param['setpoint']['Wu_time'],
    #             house_param['setpoint']['Work_time'],
    #             house_param['setpoint']['back_home'])

    SP_sim = SP[0:days_sim * 24]

    # addition NTA8800 house model

    # Controller value

    kp = house_param['controller']['kp']

    # solve ODE
    data = house(T_outdoor_sim, Qinternal_sim, Qsolar_sim, SP_sim, time_sim,
                 CF, Rair_outdoor, Rair_wall, Cair, Cwall, kp)

    # plot the results
    plt.figure(figsize=(15, 5))  # key-value pair: no spaces
    plt.plot(data[0], label='Tair')
    plt.plot(data[1], label='Twall')
    plt.plot(SP_sim, label='SP_Temperature')
    # plt.plot(T_outdoor_sim,label='Toutdoor')
    plt.legend(loc='best')
    plt.title("Simulation2R2C")
    plt.show()
    '''
def main():
    house_param = load_config("Tussenwoning_alt.yaml")
    days_sim = house_param['timing']['days_sim']
    print('Simulation days:', days_sim)

    Rair_wall, Cwall, Rair_outdoor, Cair = calculateRC(house_param)

    df_nen = nen5060_to_dataframe()

    Qsolar = np.zeros(365 * 24)
    for s in house_param['chains'][0]['Solar_irradiation']:
        descr = s['Designation']
        az = s['azimuth']
        tlt = s['tilt']
        print("Azimuth {0} and Tilt {1} for {2}".format(az, tlt, descr))
        df_irr = run_qsun_new(df_nen, az, tlt)
        Qsolar += (df_irr.total_irr).values
        time_sim = df_irr.iloc[0:days_sim * 24, 0].values

    CF = house_param['ventilation']['CF']
    Qsolar_sim = Qsolar[0:days_sim * 24]

    # Q_internal = np.zeros(days_sim*24)
    Q_internal = internal_heat_gain(house_param['internal']['Q_day'],
                                    house_param['internal']['delta_Q'],
                                    house_param['internal']['t1'],
                                    house_param['internal']['t2'])
    Q_internal_sim = Q_internal[0:days_sim * 24]
    #Q_internal = Q_internal.flatten()

    T_outdoor = df_nen.loc[:, 'temperatuur'].values / 10.0  # temperature
    T_outdoor_sim = T_outdoor[0:days_sim * 24]
    # plt.plot(T_outdoor_sim)

    t_on = house_param['chains'][0]['Controller'][0]['Set_time'][0]
    t_off = house_param['chains'][0]['Controller'][0]['Set_time'][1]
    T_day = house_param['chains'][0]['Controller'][0]['Set_temp'][0]
    T_night = house_param['chains'][0]['Controller'][0]['Set_temp'][1]
    SP = simple_thermostat(t_on, t_off, T_day, T_night)
    SP_sim = SP[0:days_sim * 24]

    # addition NTA8800 house model

    # Controller value

    kp = house_param['chains'][0]['Controller'][0]['kp']

    # solve ODE
    data = house(T_outdoor_sim, Q_internal_sim, Qsolar_sim, SP, time_sim, CF,
                 Rair_outdoor, Rair_wall, Cair, Cwall, kp)

    # plot the results
    plt.figure(figsize=(15, 5))  # key-value pair: no spaces
    plt.plot(data[0], label='Tair')
    plt.plot(data[1], label='Twall')
    plt.plot(SP_sim, label='SP_Temperature')
    plt.plot(T_outdoor_sim, label='Toutdoor')
    plt.legend(loc='best')
    plt.title("Simulation2R2C_newyaml")
    plt.show()
    '''