Exemple #1
0
    def __init__(self, environment, net_floor_area=None, occupancy=None):
        """
        Parameter
        ---------
        environment : Environment object
            Common to all other objects. Includes time and weather instances
        net_floor_area : float, optional
            Net floor area of apartment in m^2 (default: None)
        occupancy : object
            Occupancy object of pycity (default: None)
        """
        self.environment = environment
        self._kind = "apartment"
        self.net_floor_area = net_floor_area
        self.occupancy = occupancy

        # Create empty power curves
        self.power_el = ElecDemand.ElectricalDemand(environment,
                                                    method=0,
                                                    annualDemand=0)
        self.demandDomesticHotWater = DHW.DomesticHotWater(environment,
                                                           tFlow=0,
                                                           method=1,
                                                           dailyConsumption=0,
                                                           supplyTemperature=0)
        self.demandSpaceheating = SpaceHeat.SpaceHeating(environment,
                                                         method=1,
                                                         livingArea=0,
                                                         specificDemand=0)
        self.rooms = []
def run_test():
    #  Generate environment
    timer = pycity_base.classes.Timer.Timer()
    weather = pycity_base.classes.Weather.Weather(timer)
    prices = pycity_base.classes.Prices.Prices()

    environment = pycity_base.classes.Environment.Environment(
        timer, weather, prices)

    #  Generate heat demand object
    heat_demand = SpaceHeating.SpaceHeating(
        environment,
        method=1,  # Standard load profile
        livingArea=146,
        specificDemand=166)

    #  Generate electrical demand object
    el_demand = ElectricalDemand.ElectricalDemand(
        environment,
        method=1,
        # Standard load profile
        annualDemand=3000)

    #  Generate hot water demand object (based on Annex 42 profiles)
    dhw_annex42 = DomesticHotWater.DomesticHotWater(
        environment,
        tFlow=60,
        thermal=True,
        method=1,  # Annex 42
        dailyConsumption=70,
        supplyTemperature=25)

    #  Initialize apartment object
    apartment = Apartment.Apartment(environment)

    #  Add entities to apartment object
    entities = [heat_demand, el_demand, dhw_annex42]
    apartment.addMultipleEntities(entities)

    print('Get all power curves of apartment (for current horizon):')
    print(apartment.get_power_curves())
    print()

    print('Get space heating power curve for whole year:')
    print(apartment.get_space_heat_power_curve(current_values=True))
    print()

    print('Get electrical power curve for whole year:')
    print(sum(apartment.get_el_power_curve(current_values=True)))
    print()

    print('Get hot water power curve for whole year:')
    print(apartment.get_dhw_power_curve(current_values=True))
    print()

    print('Get water demand curve for whole year:')
    print(
        sum(apartment.get_water_demand_curve(current_values=True)) * 180 * 900)
    print()
Exemple #3
0
def run_test(do_plot=False):
    timer = pycity_base.classes.Timer.Timer()
    weather = pycity_base.classes.Weather.Weather(timer, useTRY=True)
    prices = pycity_base.classes.Prices.Prices()

    environment = pycity_base.classes.Environment.Environment(timer, weather,
                                                              prices)

    #  Use standardized thermal load profile
    #  #---------------------------------------
    hd_slp = SpaceHeating.SpaceHeating(environment,
                                       method=1,  # Standard load profile
                                       livingArea=150,
                                       specificDemand=100)

    results = hd_slp.get_power()

    print()
    print("Heat power curve: " + str(results))

    if do_plot:
        plt.plot(hd_slp.loadcurve, label="SLP", color="b")
        plt.show()

    #  Use simulated profile
    #  #---------------------------------------
    sim_th_load = SpaceHeating.SpaceHeating(environment, method=3,
                                            # Sim profile
                                            livingArea=150,
                                            specificDemand=100)

    sim_th_loadcurve = sim_th_load.loadcurve

    print('Thermal power load in W:', sim_th_loadcurve)

    if do_plot:
        plt.plot(sim_th_loadcurve, label="Simulated power curve", color="b")
        plt.show()

        plt.plot(sim_th_loadcurve, label="Simulated power curve")
        plt.plot(hd_slp.loadcurve, label="SLP")
        plt.legend()
        plt.show()
    def test_method0(self, create_environment):
        #  energy comparison array
        load_array = np.array([10, 10, 10, 10, 20, 20, 20, 20])

        #  Space heating object
        spaceheating = SpaceHeating.SpaceHeating(create_environment,
                                                 method=0,
                                                 loadcurve=load_array)

        #  Return load curve of space heating object
        space_heat_load_curve = spaceheating.get_power(currentValues=False)

        #  Compare arrays
        np.testing.assert_equal(space_heat_load_curve, load_array)
    def test_method3(self, create_environment):  # Modelica profile

        #  Generate space heating object
        spaceheating = SpaceHeating.SpaceHeating(create_environment,
                                                 method=3,
                                                 livingArea=100,
                                                 specificDemand=150)

        #  Get space heating load curve (in W) per timestep
        space_heat_load_curve = spaceheating.loadcurve

        #  Convert to energy demand values (in kWh)
        th_energy_demand_curve = space_heat_load_curve * \
                                 create_environment.timer.timeDiscretization / \
                                 (1000 * 3600)

        #  Check if sum of energy demand values is (almost) equal to input
        assert abs(np.sum(th_energy_demand_curve) -
                   150 * 100) <= 0.001 * 150 * 100
Exemple #6
0
def create_demands(create_environment):
    """
    Fixture to create space heating, dhw and electrical demands
    (for residential buildings; with standardized load profiles (SLP))

    Parameters
    ----------
    create_environment : object
        Environment object (as fixture of pytest)

    Returns
    -------
    create_demands : tuple (of np.arrays)
        Tuple with demand arrays (heat_demand, el_demand, dhw_demand)
    """
    #  Generate heating demand
    heat_demand = SpaceHeating.SpaceHeating(create_environment,
                                            method=1,  # Standard load profile
                                            livingArea=100,
                                            specificDemand=150)

    el_demand = ElectricalDemand.ElectricalDemand(create_environment,
                                                  method=1,
                                                  # Standard load profile
                                                  annualDemand=3000)

    daily_consumption = 70
    t_flow = 70
    supply_temp = 25
    dhw_annex42 = DomesticHotWater.DomesticHotWater(create_environment,
                                                    tFlow=t_flow,
                                                    thermal=True,
                                                    method=1,  # Annex 42
                                                    dailyConsumption=daily_consumption,
                                                    supplyTemperature=supply_temp)

    create_demands = (heat_demand, el_demand, dhw_annex42)

    return create_demands
#services generation
bakery=services.services(environment, 1, 'ba', 'excelcurves', [996,'ba'])
business=services.services(environment,1, 'bu', 'excelcurves', [995,'bu'])
shop=services.services(environment, 1, 'sh', 'excelcurves', [994,'sh'])

#co2capseq
co2capseq=co2capseq.co2capseq(environment, maxinput=10000000,maxelimination=0.8,rate=3 )

""" lines modified till here"""


#Buildings
#Standard demand profiles
#  Generate heat demand curve for space heating
heat_demand = SpaceHeating.SpaceHeating(environment,
                                        method=1,  # Standard load profile
                                        livingArea=146,
                                        specificDemand=166)

#  Generate electrical demand curve
el_demand = ElectricalDemand.ElectricalDemand(environment,
                                              method=1,  # Standard load profile
                                              annualDemand=3000)

#  Generate domestic hot water demand curve
dhw_annex42 = DomesticHotWater.DomesticHotWater(environment,
                                                tFlow=60,
                                                thermal=True,
                                                method=1,  # Annex 42
                                                dailyConsumption=70,
                                                supplyTemperature=25)
Exemple #8
0
def run_city_generator(gen_mo=0, input_name='test_city_mixed_buildings.txt',
                       output_name=None, use_el_slp=True,
                       gen_dhw_profile=False):
    """
    Function to generate and return city district object

    Parameters
    ----------
    gen_mo : int, optional
        Generation mode number:
        0 - Use data from input file (default)
    input_name : str, optional
        Name of input data file (default: 'test_city_only_buildings.txt')
    output_name : str, optional
        Name of output file (default: None)
        If output_name is None, no output file is generated.
        Else: Pickled output file is saved to output folder
    use_el_slp : bool, optional
        Boolean to define, how electrical load profile should be generated
        (default: True)
        True: Generate el. load profile via el. slp
        False: Use stochastic profile generator (
        only valid for residential buildings!)
    gen_dhw_profile : bool, optional
        Boolean to define, if domestic hot water profile should be generated
        (default: False)
        True: Generate dhw profile (valid for residential buildings!)
        False: Do not generate dhw profile

    Returns
    -------
    city_district : object
        CityDistrict object of PyCity
    """

    #  Generate timer, weather and price objects
    timer = pycity_base.classes.Timer.Timer()
    weather = pycity_base.classes.Weather.Weather(timer)
    prices = pycity_base.classes.Prices.Prices()

    #  Generate environment
    environment = pycity_base.classes.Environment.Environment(timer, weather,
                                                              prices)

    #  Generate city district object
    city_district = citydis.CityDistrict(environment)

    #  Current file path
    curr_path = os.path.dirname(os.path.abspath(__file__))

    #  Choose city district generation method
    if gen_mo == 0:  # Load data from file
        import_path = os.path.join(curr_path, 'input', input_name)
        city_dist_pandas_dataframe = pandas.read_csv(import_path, sep='\t')

        for index, row in city_dist_pandas_dataframe.iterrows():
            curr_name = row['name']  # Building name
            curr_x = row['x_coord / m']  # Building x coordinate in m
            curr_y = row['y_coord / m']  # Building y coordinate in m
            curr_area = row[
                'living_area / m2']
            #  Net floor area (respectively living area) in m2
            curr_th_spec_demand = row[
                'specific_th_demand / kWh/m2a']
            #  Spec. thermal energy demand in kWh/m2a
            curr_el_demand = row[
                'an_el_demand / kWh/a']
            #  Annual electric energy demand in kWh/a
            curr_th_slp = row['th_slp_profile_type']  # Thermal SLP type
            curr_el_slp = row['el_slp_profile_type']  # Electrical SLP type
            curr_total_nb_occupants = row[
                'total_nb_occupants']  # Total number of occupants in building

            #  Assert input values
            assert curr_area > 0
            assert curr_th_spec_demand > 0
            assert curr_el_demand > 0

            print('Processing building', curr_name)

            #  Check if number of occupants is nan
            #  (for non residential buildings)
            if math.isnan(curr_total_nb_occupants):
                curr_total_nb_occupants = None  # Replace nan with None
            else:  # If number of occupants is not nan, convert value
                   # to integer
                curr_total_nb_occupants = int(curr_total_nb_occupants)
                assert curr_total_nb_occupants >= 1
                assert curr_total_nb_occupants <= 5

            # Generate heat demand curve for space heating
            heat_demand = \
                SpaceHeating.SpaceHeating(environment,
                                          method=1,
                                          # Standard load profile
                                          livingArea=curr_area,
                                          specificDemand=curr_th_spec_demand,
                                          profile_type=curr_th_slp)

            if use_el_slp:  # Use el. SLP
                el_method = 1
                occupancy_profile = []  # Dummy value
            else:  # Stochastic profile generator
                   # (only for residential buildings)
                el_method = 2
                #  Generate stochastic occupancy profile
                occupancy_object = \
                    occu.Occupancy(environment,
                                   number_occupants=curr_total_nb_occupants)
                occupancy_profile = occupancy_object.occupancy

            # Generate electrical demand curve
            el_demand = \
                ElectricalDemand.ElectricalDemand(environment,
                                                  method=el_method,
                                                  annualDemand=curr_el_demand,
                                                  profileType=curr_el_slp,
                                                  singleFamilyHouse=True,
                                                  total_nb_occupants=curr_total_nb_occupants,
                                                  randomizeAppliances=True,
                                                  lightConfiguration=0,
                                                  occupancy=occupancy_profile)

            #  Generate apartment and add demand durves
            apartment = Apartment.Apartment(environment)
            apartment.addMultipleEntities([heat_demand, el_demand])

            if gen_dhw_profile:
                #  Generate domestic hot water demand curve
                dhw_annex42 = \
                    DomesticHotWater.DomesticHotWater(environment,
                                                      tFlow=60,
                                                      thermal=True,
                                                      method=1,
                                                      # Annex 42
                                                      dailyConsumption=70,
                                                      supplyTemperature=25)
                apartment.addEntity(dhw_annex42)

            # Generate heating curve
            heatingCurve = HeatingCurve.HeatingCurve(environment)

            #  Generate building and add apartment and heating curve
            building = Building.Building(environment)
            entities = [apartment, heatingCurve]
            building.addMultipleEntities(entities)

            #  Generate shapely point positions
            position = point.Point(curr_x, curr_y)

            #  Add buildings to city district
            city_district.addEntity(entity=building, position=position,
                                    name=curr_name)

            print('Added building', curr_name, ' to city district.')

    # Save results as pickled file
    if output_name is not None:
        output_path = os.path.join(curr_path, 'output', output_name)
        #  Pickle and dump city objects
        pickle.dump(city_district, open(output_path, 'wb'))
        print('Pickled and dumped city object')

    return city_district
Exemple #9
0
def run_validation(do_plot=False):
    location = (39.76, -104.86)

    altitude = 1609  # m, section 5.2.1.6.1, page 16
    timeZone = -7

    timer = pycity_base.classes.Timer.Timer(timeDiscretization=3600,
                                            timestepsHorizon=8760,
                                            timestepsUsedHorizon=8760,
                                            timestepsTotal=8760)
    prices = pycity_base.classes.Prices.Prices()

    #  Define src path
    ashrae_path = os.path.dirname(os.path.abspath(__file__))

    temp_name = 'weather_temperature.csv'
    beam_name = 'weather_beam.csv'
    diffuse_name = 'weather_diffuse.csv'
    weather_temp_path = os.path.join(ashrae_path, temp_name)
    weather_beam_path = os.path.join(ashrae_path, beam_name)
    weather_diffuse_path = os.path.join(ashrae_path, diffuse_name)

    weather = pycity_base.classes.Weather.Weather(
        timer,
        pathTemperature=weather_temp_path,
        pathDirectRadiation=weather_beam_path,
        pathDiffuseRadiation=weather_diffuse_path,
        timeDiscretization=3600,
        delimiter="\t",
        useTRY=False,
        location=location,
        altitude=altitude,
        timeZone=timeZone)

    prices = pycity_base.classes.Prices.Prices()

    environment = pycity_base.classes.Environment.Environment(
        timer, weather, prices)

    # beta: slope angle, gamma: surface azimuth angle
    # S, W, N, E, Roof
    beta = [90, 90, 90, 90, 0]
    gamma = [0, 90, 180, 270, 0]
    albedo = 0.2  # Ground reflectance, section 5.2.1.1.2, page 16

    internalGains = 200 * np.ones(
        timer.timestepsTotal)  # W, section 5.2.1.7, page 16

    # Data from ASHRAE 140 : 2011
    A_f = 48  # m2, section 5.2.1.3, page 16 (48 m2 floor area)
    #          low mass building, same section

    heightWalls = 2.7  # m, Figure 5.1, page 16
    volume = A_f * heightWalls

    # Material properties: Table 5.1
    # Floor touches the ground
    # No underfloor insulation

    # Opaque surfaces: Table 5.3, page 18
    solarAbsorptance = 0.6  # alpha
    infraredEmittance = 0.9  # epsilon

    # Index-Orientation: South, West, North, East, Roof, Floor
    A_windows = np.array([12, 0, 0, 0, 0, 0])
    length_SN = 8
    length_WE = 6
    A_walls_SN = length_SN * heightWalls  # South and North
    A_walls_WE = length_WE * heightWalls  # West and East
    A_walls = np.array(
        [A_walls_SN, A_walls_WE, A_walls_SN, A_walls_WE, A_f, A_f])
    A_walls = A_walls - A_windows
    U_walls = np.array([0.514, 0.514, 0.514, 0.514, 0.318, 0.039])  # air-air
    # U_walls = np.array([0.559, 0.559, 0.559, 0.559, 0.334, 0.040]) # surf-surf
    U_windows = np.array([3, 3, 3, 3, 3, 3])  # table 5.6, page 19

    g_gln = 0.789  # (solar heat gain coefficient) table 5.6, page 19

    # Computation of the specific heat capacity of each wall
    def specificHeatCapacity(d, d_iso, density, cp):
        """
        ISO 13786:2007 A.2
        Computation of (specific) heat capacity of each wall-type-surface

        Result is in J/m2K
        """
        d_t = min(0.5 * np.sum(d), d_iso, 0.1)
        sum_d_i = d[0]
        i = 0
        kappa = 0
        while sum_d_i <= d_t:
            kappa += d[i] * density[i] * cp[i]
            i += 1
            sum_d_i += d[i]
        else:
            sum_d_i -= d[i]
            d_part = d_t - sum_d_i
            kappa += d_part * density[i] * cp[i]

        return kappa

    # Data: Table 5.1, page 17
    # Exterior wall (South, West, East, North)
    d_extWall = np.array([0.012, 0.066, 0.009])
    rho_extWall = np.array([950, 12, 530])
    cp_extWall = np.array([840, 840, 900])
    c_extWall = specificHeatCapacity(d_extWall, 0.012, rho_extWall, cp_extWall)

    U_extWall = 0.514

    # Floor
    d_floor = np.array([0.025, 1.003])
    rho_floor = np.array([650, 0])
    cp_floor = np.array([1200, 0])
    c_floor = specificHeatCapacity(d_floor, 0.025, rho_floor, cp_floor)

    U_floor = 0.039

    # Roof
    d_roof = np.array([0.0100, 0.1118, 0.019])
    rho_roof = np.array([950, 12, 530])
    cp_roof = np.array([840, 840, 900])
    c_roof = specificHeatCapacity(d_roof, 0.01, rho_roof, cp_roof)

    U_roof = 0.318

    R_se_op = [0.034, 0.034, 0.034, 0.034, 0.034, 0]  # Table 5.1, page 17
    R_se_w = [0.0476, 0.0476, 0.0476, 0.0476, 0.0476, 0]  # Table 5.6, page 19

    months = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])
    monthsCum = np.cumsum(months)
    monthsCum0 = np.append(np.array([0]), monthsCum)
    T_aver_mon = []
    b_m = []  # Anpassungsfaktor ground p.44 ISO 13790

    for i in range(12):
        T_aver_mon = np.append(
            T_aver_mon,
            sum(environment.weather.tAmbient[monthsCum0[i] *
                                             24:monthsCum0[i + 1] * 24]) /
            months[i] / 24)
    T_i_year = 22.917
    # Heizperiode von Anfang Oktober bis Ende April
    for i in range(4):
        for k in range(months[i] * 24):
            b_m = np.append(b_m, (T_i_year - 9.71) / (20 - T_aver_mon[i]))
    for i in range(5):
        for k in range(months[4 + i] * 24):
            b_m = np.append(b_m, (T_i_year - 9.71) / (27 - T_aver_mon[4 + i]))
    for i in range(3):
        for k in range(months[9 + i] * 24):
            b_m = np.append(b_m, (T_i_year - 9.71) / (20 - T_aver_mon[9 + i]))

    # Abfangen von extrem großen/kleinen Korrekturfaktoren
    for i in range(8760):
        b_m[i] = np.minimum(b_m[i], 10)
        b_m[i] = np.maximum(b_m[i], -10)

    U_floor = 0.039

    U_floor_bm = np.multiply(U_floor, b_m)

    U_walls_ext_bm = [
        U_extWall, U_extWall, U_extWall, U_extWall, U_roof,
        np.mean(U_floor_bm[i])
    ]

    U_walls_ext_bm = []
    for i in range(8760):
        U_walls_ext_bm.append(
            np.array([
                U_extWall, U_extWall, U_extWall, U_extWall, U_roof,
                U_floor_bm[i]
            ]))  # air-air

    c = np.array([c_extWall, c_extWall, c_extWall, c_extWall, c_roof, c_floor])

    zoneParameters = zp.ZoneParameters(
        A_f=A_f,
        A_w=A_windows,
        U_w=U_windows,
        g_gln=g_gln,
        epsilon_w=infraredEmittance,
        R_se_w=R_se_w,
        A_op=A_walls,
        #                                   U_op=U_walls,
        U_op=U_walls_ext_bm,
        alpha_Sc=solarAbsorptance,
        R_se_op=R_se_op,
        epsilon_op=infraredEmittance,
        V=volume,
        samplingRate=timer.timeDiscretization,
        kappa_j=c,
        A_j=A_walls,
        simplifiedCapacity=False,
        albedo=albedo,
        beta=beta,
        gamma=gamma)

    # Ventilation
    ventilation = np.ones(
        timer.timestepsTotal) * 0.5  # section 5.2.1.6, page 16

    ventilationFactor = 0.822  # Adjustment factor, see Table 5.2, page 18
    ventilation = ventilation * ventilationFactor  # Final adjustment factor, see
    # Footnote at Table 5.2, page 18
    zoneParameters.updateVentilation(ventilationRate=ventilation,
                                     ventilationRateMinimum=0.41)

    # Set points (section 5.2.1.13.1.1, page 19)
    T_set_heating = np.ones(timer.timestepsTotal) * 20
    T_set_cooling = np.ones(timer.timestepsTotal) * 27

    # Initialize T_m
    T_m_init = 20

    spaceHeating = sh.SpaceHeating(environment,
                                   method=2,
                                   zoneParameters=zoneParameters,
                                   T_m_init=T_m_init,
                                   appliances=internalGains,
                                   TCoolingSet=T_set_cooling,
                                   THeatingSet=T_set_heating)

    # Retrieve results
    Q_HC = spaceHeating.loadcurve
    solarOpaque = spaceHeating.zoneInputs.solarOpaque
    solarWindow = spaceHeating.zoneInputs.solarWindow

    # Pass results to the plotting script
    from collections import namedtuple

    keys = [
        "heatingLoad", "coolingLoad", "heatingPeak", "heatingPeakTime",
        "coolingPeak", "coolingPeakTime", "solarGainsSouth", "solarGainsWest",
        "solarGainsNorth", "solarGainsEast", "solarGainsHorizontal",
        "solarGainsWindowSouth", "solarSouthMarch5", "solarSouthJuly27",
        "solarWestMarch5", "solarWestJuly27", "january4"
    ]
    Results = namedtuple("Results", keys)

    results = Results(
        heatingLoad=np.sum(Q_HC[Q_HC > 0]) / 1000000,  # in MWh
        coolingLoad=-np.sum(Q_HC[Q_HC < 0]) / 1000000,  # in MWh
        heatingPeak=np.max(Q_HC) / 1000,  # in kW
        heatingPeakTime=np.argmax(Q_HC),  # time step in hours
        coolingPeak=-np.min(Q_HC) / 1000,  # in kW
        coolingPeakTime=np.argmin(Q_HC),  # time step in hours
        solarGainsSouth=np.sum(solarOpaque[0]) / 1000,
        # in kWh per m2
        solarGainsWest=np.sum(solarOpaque[1]) / 1000,
        # in kWh per m2
        solarGainsNorth=np.sum(solarOpaque[2]) / 1000,
        # in kWh per m2
        solarGainsEast=np.sum(solarOpaque[3]) / 1000,
        # in kWh per m2
        solarGainsHorizontal=np.sum(solarOpaque[4]) / 1000,
        # in kWh per m2
        solarGainsWindowSouth=np.sum(solarWindow[0]) / 1000,
        # in kWh per m2
        solarSouthMarch5=solarOpaque[0][1513:1537],
        solarSouthJuly27=solarOpaque[0][4969:4993],
        solarWestMarch5=solarOpaque[1][1513:1537],
        solarWestJuly27=solarOpaque[1][4969:4993],
        january4=Q_HC[73:97] / 1000)

    # Function to convert hour_of_the_year into [month, day, hour]
    def transformTime(timestep):
        names = [
            "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
            "Oct", "Nov", "Dec"
        ]
        months = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])
        monthsCum = np.cumsum(months)
        day_of_year = int(timestep / 24) + 1
        hour = timestep % 24
        temp = monthsCum - day_of_year
        try:
            day = -np.max(temp[temp < 0])  # does not work in January, max([])
        except:
            day = day_of_year
        month = names[np.argmin(temp < 0)]
        return [month, day, hour]

    # print results
    print()
    print("Results Case 600")
    print("Heating load: " + str(round(results.heatingLoad, 3)))
    print("Reference: min: 4.296, max: 5.709, mean: 5.090")
    print()
    print("Cooling load: " + str(round(results.coolingLoad, 3)))
    print("Reference: min: 6.137, max: 7.964, mean: 6.832")
    print()
    print()
    print("Heating peak: " + str(round(results.heatingPeak, 3)))
    print("Reference: min: 3.437, max: 4.354, mean: 4.000")
    print("Heating peak time: " +
          str(transformTime(int(results.heatingPeakTime))))
    print("Reference: 04-Jan,5; 01-Jan,5; 01-Jan,2; 01-Jan,6")
    print()
    print()
    print("Cooling peak: " + str(round(results.coolingPeak, 3)))
    print("Reference: min: 5.965, max: 6.827, mean: 6.461")
    print("Cooling peak time: " +
          str(transformTime(int(results.coolingPeakTime))))
    print("Reference: 17-Oct,13; 01-Nov,14; 16-Oct,14")
    print()
    print()
    print("Solar gains North: " + str(round(results.solarGainsNorth)))
    print("Reference: min: 367, max: 457, mean: 429")
    print()
    print("Solar gains East: " + str(round(results.solarGainsEast)))
    print("Reference: min: 959, max: 1217, mean: 1080")
    print()
    print("Solar gains West: " + str(round(results.solarGainsWest)))
    print("Reference: min: 857, max: 1090, mean: 1018")
    print()
    print("Solar gains South: " + str(round(results.solarGainsSouth)))
    print("Reference: min: 1456, max: 1566, mean: 1490")
    print()
    print("Solar gains horizontal: " +
          str(round(results.solarGainsHorizontal)))
    print("Reference: min: 1797, max: 1832, mean: 1827")
    print()
    print()
    print("Solar gains windows (South): " +
          str(round(results.solarGainsWindowSouth)))
    print("Reference: min: 914, max: 1051, mean: 962")

    if do_plot:
        plotCase600.plotResults(results)

        plotCase600.plotWestSurface(results)
        plotCase600.plotSouthSurface(results)

        plotCase600.plotJanuary4(results)
def run_test():
    timer = pycity_base.classes.Timer.Timer()
    weather = pycity_base.classes.Weather.Weather(timer)
    prices = pycity_base.classes.Prices.Prices()

    environment = pycity_base.classes.Environment.Environment(
        timer, weather, prices)

    heat_demand = SpaceHeating.SpaceHeating(
        environment,
        method=1,  # Standard load profile
        livingArea=146,
        specificDemand=166)

    el_demand = ElectricalDemand.ElectricalDemand(
        environment,
        method=1,  # Standard load profile
        annualDemand=3000)

    dhw_annex42 = DomesticHotWater.DomesticHotWater(
        environment,
        tFlow=60,
        thermal=True,
        method=1,  # Annex 42
        dailyConsumption=70,
        supplyTemperature=25)

    apartment = Apartment.Apartment(environment)
    apartment.addEntity(heat_demand)
    apartment.addMultipleEntities([el_demand, dhw_annex42])

    #  Heatpump data path
    src_path = os.path.dirname(os.path.dirname(__file__))
    hp_data_path = os.path.join(src_path, 'inputs', 'heat_pumps.xlsx')
    heatpumpData = xlrd.open_workbook(hp_data_path)
    dimplex_LA12TU = heatpumpData.sheet_by_name("Dimplex_LA12TU")

    # Size of the worksheet
    number_rows = dimplex_LA12TU._dimnrows
    number_columns = dimplex_LA12TU._dimncols

    # Flow, ambient and max. temperatures
    tFlow = np.zeros(number_columns - 2)
    tAmbient = np.zeros(int((number_rows - 7) / 2))
    tMax = dimplex_LA12TU.cell_value(0, 1)

    firstRowCOP = number_rows - len(tAmbient)

    qNominal = np.empty((len(tAmbient), len(tFlow)))
    cop = np.empty((len(tAmbient), len(tFlow)))

    for i in range(number_columns - 2):
        tFlow[i] = dimplex_LA12TU.cell_value(3, 2 + i)

    for col in range(len(tFlow)):
        for row in range(len(tAmbient)):
            qNominal[row,
                     col] = dimplex_LA12TU.cell_value(int(4 + row),
                                                      int(2 + col))
            cop[row, col] = dimplex_LA12TU.cell_value(int(firstRowCOP + row),
                                                      int(2 + col))

    pNominal = qNominal / cop

    # Create HP
    lower_activation_limit = 0.5

    heatpump = HeatPump.Heatpump(environment, tAmbient, tFlow, qNominal,
                                 pNominal, cop, tMax, lower_activation_limit)

    bes = BES.BES(environment)
    bes.addDevice(heatpump)

    heatingCurve = HeatingCurve.HeatingCurve(environment)

    building = Building.Building(environment)
    entities = [apartment, bes, heatingCurve]
    building.addMultipleEntities(entities)

    print()
    print(building.get_power_curves())

    print()
    print(building.getHeatpumpNominals())

    print()
    print(building.flowTemperature)

    print(building.get_space_heating_power_curve())
    print(len(building.get_space_heating_power_curve()))

    print(building.get_electric_power_curve())
    print(len(building.get_electric_power_curve()))

    print(building.get_dhw_power_curve())
    print(len(building.get_dhw_power_curve()))
    def test_parse_ind_dict_to_city2(self):
        #  Generate city object
        #  Create extended environment of pycity_calc
        year = 2010
        timestep = 900  # Timestep in seconds
        location = (51.529086, 6.944689)  # (latitude, longitute) of Bottrop
        altitude = 55  # Altitude of Bottrop

        #  Generate timer object
        timer = time.TimerExtended(timestep=timestep, year=year)

        #  Generate weather object
        weather = Weather.Weather(timer,
                                  useTRY=True,
                                  location=location,
                                  altitude=altitude)

        #  Generate market object
        market = germarkt.GermanMarket()

        #  Generate co2 emissions object
        co2em = co2.Emissions(year=year)

        #  Generate environment
        environment = env.EnvironmentExtended(timer,
                                              weather,
                                              prices=market,
                                              location=location,
                                              co2em=co2em)

        #  Generate city object
        city_object = city.City(environment=environment)

        for i in range(7):
            extended_building = build_ex.BuildingExtended(
                environment,
                build_year=1990,
                mod_year=2003,
                build_type=0,
                roof_usabl_pv_area=30,
                net_floor_area=150,
                height_of_floors=3,
                nb_of_floors=2,
                neighbour_buildings=0,
                residential_layout=0,
                attic=0,
                cellar=1,
                construction_type='heavy',
                dormer=0)

            #  Create demands (with standardized load profiles (method=1))
            heat_demand = SpaceHeating.SpaceHeating(environment,
                                                    method=1,
                                                    profile_type='HEF',
                                                    livingArea=300,
                                                    specificDemand=100)

            el_demand = ElectricalDemand.ElectricalDemand(environment,
                                                          method=1,
                                                          annualDemand=3000,
                                                          profileType="H0")

            #  Create apartment
            apartment = Apartment.Apartment(environment)

            #  Add demands to apartment
            apartment.addMultipleEntities([heat_demand, el_demand])

            #  Add apartment to extended building
            extended_building.addEntity(entity=apartment)

            #  Add buildings to city_object
            city_object.add_extended_building(extended_building,
                                              position=point.Point(0, i * 10))

        addbes.add_bes_to_city(city=city_object)

        chp_size = 10000
        boi_size = 30000
        tes_size = 500
        pv_area = 30

        dict_b1 = {
            'chp': chp_size,
            'boi': boi_size,
            'tes': tes_size,
            'eh': 0,
            'hp_aw': 0,
            'hp_ww': 0,
            'pv': pv_area,
            'bat': 0
        }

        dict_b2 = {
            'chp': chp_size,
            'boi': boi_size,
            'tes': tes_size,
            'eh': 0,
            'hp_aw': 0,
            'hp_ww': 0,
            'pv': pv_area,
            'bat': 0
        }

        dict_no = {
            'chp': 0,
            'boi': 0,
            'tes': 0,
            'eh': 0,
            'hp_aw': 0,
            'hp_ww': 0,
            'pv': 0,
            'bat': 0
        }

        ind = {
            1001: dict_b1,
            1002: dict_no,
            1003: dict_b2,
            1004: copy.copy(dict_no),
            1005: copy.copy(dict_no),
            1006: copy.copy(dict_no),
            1007: copy.copy(dict_no),
            'lhn': [[1001, 1002], [1003, 1004, 1005, 1006, 1007]]
        }

        city_obj = parse_ind_to_city.parse_ind_dict_to_city(dict_ind=ind,
                                                            city=city_object)

        assert city_obj.nodes[1001]['entity'].bes.chp.qNominal == chp_size
        assert city_obj.nodes[1001]['entity'].bes.boiler.qNominal == boi_size
        assert city_obj.nodes[1001]['entity'].bes.tes.capacity == tes_size

        assert city_obj.nodes[1003]['entity'].bes.chp.qNominal == chp_size
        assert city_obj.nodes[1003]['entity'].bes.boiler.qNominal == boi_size
        assert city_obj.nodes[1003]['entity'].bes.tes.capacity == tes_size

        assert city_obj.edges[1001, 1002]['network_type'] == 'heating'
        assert city_obj.edges[1003, 1004]['network_type'] == 'heating'
        assert city_obj.edges[1004, 1005]['network_type'] == 'heating'
        assert city_obj.edges[1005, 1006]['network_type'] == 'heating'
        assert city_obj.edges[1006, 1007]['network_type'] == 'heating'

        checkeb.check_eb_requirements(city=city_obj)
Exemple #12
0
def run_test():

    #  Generate timer, weather and price objects
    timer = pycity_base.classes.Timer.Timer()
    weather = pycity_base.classes.Weather.Weather(timer)
    prices = pycity_base.classes.Prices.Prices()

    #  Generate environment
    environment = pycity_base.classes.Environment.Environment(
        timer, weather, prices)

    print("Network Specification")
    print(
        'Attributes of the connection mediums will be defined at initialization:'
    )
    networksDictionary = {}
    networksDictionary['Electricity'] = {
        'busVoltage': 1000,
        'diameter': 0.2,
        'spConductance': 1.68 * 10**-8
    }
    networksDictionary['Gas'] = {
        'diameter': 0.5,
        'gasDensity': 0.8,
        'darcyFactor': 0.03
    }
    networksDictionary['Heat'] = {'diameter': 0.5, 'spConductance': 0.591}
    networksDictionary['Water'] = {
        'diameter': 0.5,
        'waterDensity': 1000,
        'darcyFactor': 0.03
    }
    print()
    print("For example: networksDictionary['ElectricCable']=[0.2,1.68*10**-8]")
    print('Diameters of electric cables in the district: ',
          networksDictionary['Electricity']['diameter'], 'm')
    print('Specific conductance of electric cables in the district',
          networksDictionary['Electricity']['spConductance'], 'ohm.m')
    print()

    print("Generate city district object")
    cityDistrict = CityDistrict.CityDistrict(environment, networksDictionary)
    #  Empty dictionary for positions
    dict_pos = {}

    #  Generate shapely point positions
    dict_pos[0] = point.Point(0, 40)  #WT
    dict_pos[1] = point.Point(0, 35)  #P2G converter
    dict_pos[2] = point.Point(0, 30)  #P2G storage
    dict_pos[3] = point.Point(40, -20)  #PV
    dict_pos[4] = point.Point(45, -20)  #HE
    dict_pos[5] = point.Point(110, 30)  #Building1
    dict_pos[6] = point.Point(180, 60)  #Building2
    dict_pos[7] = point.Point(240, 30)  #Building3
    dict_pos[8] = point.Point(290, -30)  #Building4
    dict_pos[9] = point.Point(300, -300)  #Gas Source
    dict_pos[10] = point.Point(500, -300)  #Gas Source
    dict_pos[11] = point.Point(80, 30)  #CHP for district heating
    print()
    print("Points on the city district object:")
    for no in range(len(dict_pos)):
        print("Position number", no, "at location",
              str(dict_pos[no].x) + ',' + str(dict_pos[no].y))
    print()

    print("Generate PV farm within city district")
    pv = PV.PV(environment, 200, 0.15)
    print(pv)

    print('Add PV field to the city district position 3')
    nodePV = cityDistrict.addEntity(entity=pv, position=dict_pos[3])
    print()

    print('Generate Hydroelectric pump storage  within city district')
    capacity = 4 * 3600 * 1000  #4 kWh
    ffInit = 0.5
    etaCharge = 0.96
    etaDischarge = 0.95
    height = 20
    pump = HydroElectric.HydroElectric(environment, ffInit, capacity, height,
                                       etaCharge, etaDischarge)
    print(pump)

    print('Add HE to city district position 4')
    nodeHE = cityDistrict.addEntity(entity=pump, position=dict_pos[4])
    print()

    print(
        'Generate WindEnergyConverter city district from the type ENERCON E-126'
    )
    src_path = os.path.dirname(os.path.dirname(__file__))
    wind_data_path = os.path.join(src_path, 'inputs',
                                  'wind_energy_converters.xlsx')
    wecDatasheets = xlrd.open_workbook(wind_data_path)
    ENERCON_E_126 = wecDatasheets.sheet_by_name("ENERCON_E_126")
    hubHeight = ENERCON_E_126.cell_value(0, 1)
    mapWind = []
    mapPower = []
    counter = 0
    while ENERCON_E_126._dimnrows > 3 + counter:
        mapWind.append(ENERCON_E_126.cell_value(3 + counter, 0))
        mapPower.append(ENERCON_E_126.cell_value(3 + counter, 1))
        counter += 1

    mapWind = np.array(mapWind)
    mapPower = np.array(mapPower) * 1000

    wec = WT.WindEnergyConverter(environment, mapWind, mapPower, hubHeight)
    print(wec)

    print('Add Wind turbine field to city district position 0')
    nodeWT = cityDistrict.addEntity(entity=wec, position=dict_pos[0])
    print()

    print('Create a power to gas conversion with a storage unit')
    maxInput = 10000  #10 kW
    efficiency = 0.7

    #Create a storage unit
    ff = 0.6
    capacity = 20 * 1000 * 3600  #20kWh

    p2g = P2G.P2G(environment, maxInput, efficiency)
    storage = P2GStorage.P2GStorage(environment, ff, capacity)
    print(p2g)
    print(storage)

    print('Add power to gas storage converter to city district position 1')
    print('Add power to gas storage storage unit to city district position 2')
    nodeP2G = cityDistrict.addEntity(entity=p2g, position=dict_pos[1])
    nodeP2Gstor = cityDistrict.addEntity(entity=storage, position=dict_pos[2])
    print()

    #Create a CHP
    lower_activation_limit_DH = 0.2
    q_nominal_DH = 100000
    t_max_DH = 90
    p_nominal_DH = 60000
    omega_DH = 0.9
    dh_CHP = CHP.CHP(environment, p_nominal_DH, q_nominal_DH, omega_DH,
                     t_max_DH, lower_activation_limit_DH)

    print('Add CHP unit for district heating')
    nodeCHP = cityDistrict.addEntity(entity=dh_CHP, position=dict_pos[11])
    print()

    # Create CHPs to add to BESs 5 and 6
    lower_activation_limit = 0.5
    q_nominal = 10000
    t_max = 90
    p_nominal = 6000
    omega = 0.9
    heater_chp = CHP.CHP(environment, p_nominal, q_nominal, omega, t_max,
                         lower_activation_limit)

    # Create a Boiler add to BES 7
    lower_activation_limit = 0.5
    q_nominal = 10000
    t_max = 90
    eta = 0.9
    heater_boiler = Boiler.Boiler(environment, q_nominal, eta, t_max,
                                  lower_activation_limit)

    #Create a PV and Battery for BES 8
    pv_Roof = PV.PV(environment, 40, 0.15)
    battery = Battery.Battery(environment, 0.5, 4 * 3600 * 1000)

    print('Generate building objects within loop')
    #  #-------------------------------------------------------------------
    buildingnodes = []
    buildings = []
    for i in range(5, 9):

        #  Generate heat demand curve for space heating
        heat_demand = SpaceHeating.SpaceHeating(
            environment,
            method=1,  # Standard load profile
            livingArea=1460,
            specificDemand=166)

        #  Generate electrical demand curve
        el_demand = ElectricalDemand.ElectricalDemand(
            environment,
            method=1,  # Standard load profile
            annualDemand=30000)

        #  Generate domestic hot water demand curve
        dhw_annex42 = DomesticHotWater.DomesticHotWater(
            environment,
            tFlow=60,
            thermal=True,
            method=1,  # Annex 42
            dailyConsumption=700,
            supplyTemperature=25)

        #  Generate apartment and add demand durves
        apartment = Apartment.Apartment(environment)
        apartment.addEntity(heat_demand)
        apartment.addMultipleEntities([el_demand, dhw_annex42])

        bes = BES.BES(environment)

        if i in [5, 6]:
            bes.addDevice(heater_chp)

        elif i == 7:
            bes.addDevice(heater_boiler)

        elif i == 8:
            bes.addDevice(pv_Roof)
            bes.addDevice(battery)

        #  Generate heating curve
        heatingCurve = HeatingCurve.HeatingCurve(environment)

        #  Generate building and add apartment and heating curve
        building = Building.Building(environment, True)
        entities = [apartment, heatingCurve, bes]
        building.addMultipleEntities(entities)

        #  Add buildings to city district
        buildingnodes.append(
            cityDistrict.addEntity(entity=building, position=dict_pos[i]))
        buildings.append(building)

    print('Add them to the city district positons 5-8')
    nodeB5 = buildingnodes[0]
    nodeB6 = buildingnodes[1]
    nodeB7 = buildingnodes[2]
    nodeB8 = buildingnodes[3]
    print()

    print('Create a gas source object')
    districtGasSource = GasSource.GasSource(environment)
    print(districtGasSource)
    print('Add it to the city district position 9')
    nodeGS = cityDistrict.addEntity(entity=districtGasSource,
                                    position=dict_pos[9])
    print()

    print('Create a water source object')
    districtWaterSource = WaterSource.WaterSource(environment)
    print('Add it to the city district position 10')
    nodeWS = cityDistrict.addEntity(entity=districtWaterSource,
                                    position=dict_pos[10])
    print()

    print("Node and object information of the city objects")
    print(
        "-------------------------------------------------------------------")
    print('Number of building entities:',
          cityDistrict.get_nb_of_building_entities())
    print('Node id list of building entities:',
          cityDistrict.get_list_build_entity_node_ids())
    print()

    print('Number of PV farms:',
          cityDistrict.get_nb_of_entities(entity_name='pv'))
    print('Number of Wind farms:',
          cityDistrict.get_nb_of_entities(entity_name='windenergyconverter'))
    print('Number of Hydroelectric pump storage units:',
          cityDistrict.get_nb_of_entities(entity_name='heps'))
    print('Number of P2G converters:',
          cityDistrict.get_nb_of_entities(entity_name='p2gConverter'))
    print()

    print('Node information:')
    print('All nodes', cityDistrict.nodes())
    print('Nodelists_heating:', cityDistrict.nodelists_heating)
    print('Nodelists_electricty:', cityDistrict.nodelists_electricity)
    print('Nodelists_gas:', cityDistrict.nodelists_gas)
    print('Nodelists_water:', cityDistrict.nodelists_water)
    print()

    print('Power supply from uncontrollable (renewable) generators')

    print('PV power:')
    print(cityDistrict.getPVPower())
    print()

    print('Wind turbine power:')
    print(cityDistrict.getWindEnergyConverterPower())
    print()
    print('Please type enter')
    #input()

    print('Aggregation of demand at consumer ends')

    print('Return aggregated space heating power curve:')
    print(cityDistrict.get_aggr_space_h_power_curve())
    print()

    print('Return aggregated electrical power curve:')
    print(cityDistrict.get_aggr_el_power_curve())
    print()

    print('Return hot water power curve:')
    print(cityDistrict.get_aggr_dhw_power_curve())
    print()

    print('Return aggregated water demand curve:')
    print(cityDistrict.get_aggr_water_demand_power_curve())
    print()

    print('Please type enter')
    #input()

    print('Assigning schedules to controllable objects')
    print()

    np.random.seed(0)

    print('Power to gas conversion: how much electric power will be supplied')
    conversionSchedule = -np.random.randint(90001, size=192)
    print(conversionSchedule)
    print()
    print('Power to gas storage: how much gas power will be supplied')
    storageSchedule = conversionSchedule * 0.6
    print(storageSchedule)
    print()
    print(
        'Hydroelectric pump storage: how much electric power will be supplied')
    pumpSchedule = np.random.random_integers(-3000, 101, 192)
    print(pumpSchedule)
    print()
    print('District heating CHP: how much electric power will be supplied')
    chpDH_Schedule = np.array([0.5] * 192)
    print(chpDH_Schedule)
    print()
    print('District Gas Source: how much gas power will be supplied')
    gasSupplySchedule = np.random.random_integers(0, 100000, 192)
    print(gasSupplySchedule)
    print()
    print('District Water Source: how much water will be supplied')
    waterSupplySchedule = np.random.random_integers(0, 1000, 192)
    print(waterSupplySchedule)
    print()
    print('Same schedule is assigned to CHPs of the buildings')
    chpSchedule = np.array([0.0] * 192)
    print(chpSchedule)
    print()
    print('Schedule assigned to gas boilers of the buildings')
    boilerSchedule = np.array([0.6] * 192)
    print(boilerSchedule)
    print()
    print('Battery schedule assigned')
    batterySchedule = np.random.random_integers(-3000, 3001,
                                                timer.timestepsUsedHorizon)
    print(batterySchedule)
    print()

    for building in buildings:
        if buildings.index(building) < 2:
            building.bes.chp.setResults(chpSchedule)
        elif buildings.index(building) == 2:
            building.bes.boiler.setResults(boilerSchedule)
        elif buildings.index(building) == 3:
            building.bes.battery.setResults(batterySchedule)

    dh_CHP.setResults(chpDH_Schedule)
    pump.setResults(pumpSchedule)
    p2g.setResults(conversionSchedule)
    storage.setResults(storageSchedule)
    districtGasSource.setResults(gasSupplySchedule)
    districtWaterSource.setResults(waterSupplySchedule)
setback_mode = 18
dt = len(occupancy.occupancy) / timer.timestepsTotal
occupancy_reshaped = np.array([
    np.mean(occupancy.occupancy[dt * i:dt * (i + 1)])
    for i in range(timer.timestepsTotal)
])

T_set_heating = np.ones(timer.timestepsTotal) * setback_mode
T_set_heating[occupancy_reshaped > 0] += occupancy_reshaped[
    occupancy_reshaped > 0] * (heating_mode - setback_mode)
T_set_heating = np.minimum(T_set_heating, heating_mode)

# Initialize T_m
T_m_init = 20

spaceHeating = sh.SpaceHeating(environment,
                               method=2,
                               zoneParameters=zoneParameters,
                               T_m_init=T_m_init,
                               appliances=internalGains,
                               TCoolingSet=T_set_cooling,
                               THeatingSet=T_set_heating)

demand_spaceheating = spaceHeating.loadcurve

demands = {
    "electricity": demand_electricity,
    "domestic hot water": demand_hot_water,
    "space heating": demand_spaceheating
}
def run_test():

    #  Generate timer, weather and price objects
    timer = pycity_base.classes.Timer.Timer()
    weather = pycity_base.classes.Weather.Weather(timer)
    prices = pycity_base.classes.Prices.Prices()

    #  Generate environment
    environment = pycity_base.classes.Environment.Environment(timer, weather, prices)

    #  Generate city district object
    cityDistrict = CityDistrict.CityDistrict(environment)
    #  Annotations: To prevent some methods of subclasses uesgraph / nx.Graph
    #  from failing (e.g. '.subgraph()) environment is optional input
    #  parameter.

    #  Empty dictionary for positions
    dict_pos = {}

    #  Generate shapely point positions
    dict_pos[0] = point.Point(0, 0)
    dict_pos[1] = point.Point(0, 10)
    dict_pos[2] = point.Point(10, 0)
    dict_pos[3] = point.Point(10, 10)
    dict_pos[4] = point.Point(20, 20)
    dict_pos[5] = point.Point(30, 30)

    #  Generate building objects within loop
    #  #-------------------------------------------------------------------
    for i in range(4):

        #  Generate heat demand curve for space heating
        heat_demand = SpaceHeating.SpaceHeating(environment,
                                                method=1,  # Standard load profile
                                                livingArea=146,
                                                specificDemand=166)

        #  Generate electrical demand curve
        el_demand = ElectricalDemand.ElectricalDemand(environment,
                                                      method=1,  # Standard load profile
                                                      annualDemand=3000)

        #  Generate domestic hot water demand curve
        dhw_annex42 = DomesticHotWater.DomesticHotWater(environment,
                                                        tFlow=60,
                                                        thermal=True,
                                                        method=1,  # Annex 42
                                                        dailyConsumption=70,
                                                        supplyTemperature=25)

        #  Generate apartment and add demand durves
        apartment = Apartment.Apartment(environment)
        apartment.addEntity(heat_demand)
        apartment.addMultipleEntities([el_demand, dhw_annex42])

        #  Generate heating curve
        heatingCurve = HeatingCurve.HeatingCurve(environment)

        #  Generate building and add apartment and heating curve
        building = Building.Building(environment)
        entities = [apartment, heatingCurve]
        building.addMultipleEntities(entities)

        #  Add buildings to city district
        cityDistrict.addEntity(entity=building, position=dict_pos[i])

    #  Generate PV farms within city district within loop
    #  #-------------------------------------------------------------------
    for i in range(2):

        #  Generate PV field within city district
        pv = PV.PV(environment, 20, 0.15)

        #  Add PV fields to city district
        cityDistrict.addEntity(entity=pv, position=dict_pos[i+4])

    #  Add wind energy converter
    #  #-------------------------------------------------------------------
    # Create Wind Energy Converter (ENERCON E-126)
    src_path = os.path.dirname(os.path.dirname(__file__))
    wind_data_path = os.path.join(src_path, 'inputs',
                                  'wind_energy_converters.xlsx')
    wecDatasheets = xlrd.open_workbook(wind_data_path)
    ENERCON_E_126 = wecDatasheets.sheet_by_name("ENERCON_E_126")
    hubHeight = ENERCON_E_126.cell_value(0, 1)
    mapWind = []
    mapPower = []
    counter = 0
    while ENERCON_E_126._dimnrows > 3 + counter:
        mapWind.append(ENERCON_E_126.cell_value(3 + counter, 0))
        mapPower.append(ENERCON_E_126.cell_value(3 + counter, 1))
        counter += 1

    mapWind = np.array(mapWind)
    mapPower = np.array(mapPower) * 1000

    wec = Wind.WindEnergyConverter(environment=environment,
                                   velocity=mapWind,
                                   power=mapPower,
                                   hubHeight=hubHeight)

    cityDistrict.addEntity(entity=wec, position=point.Point(100, 100))

    #  Extract information of city object
    #  #-------------------------------------------------------------------

    print('Number of building entities:')
    print(cityDistrict.get_nb_of_building_entities())

    print('Node id list of building entities:')
    print(cityDistrict.get_list_build_entity_node_ids())

    print('Number of PV farms:')
    print(cityDistrict.get_nb_of_entities(entity_name='pv'))

    print('Node information:')
    print(cityDistrict.nodes(data=True))

    print('\n')

    print('Power curves of all building objects:')
    print(cityDistrict.get_power_curves())
    print()

    print('Flow temperatures:')
    print(cityDistrict.getFlowTemperatures())
    print()

    print('PV power:')
    print(cityDistrict.getPVPower())
    print()

    print('Return aggregated space heating power curve:')
    print(cityDistrict.get_aggr_space_h_power_curve())
    print()

    print('Return aggregated electrical power curve:')
    print(cityDistrict.get_aggr_el_power_curve())
    print()

    print('Return hot water power curve:')
    print(cityDistrict.get_aggr_dhw_power_curve())
    print()

    print('Get wind energy converter power:')
    print(cityDistrict.getWindEnergyConverterPower())
    print()

    print('Get list of nodes of type building:')
    print(cityDistrict.get_list_id_of_spec_node_type(node_type='building'))
    print()

    print('Get total number of occupants within city district:')
    print(cityDistrict.get_nb_occupants())