Beispiel #1
0
def init_base_mc_objects(city):
    """
    Initialize all objects requires as input for mc runner object

    Parameters
    ----------
    city : object
        City object of pyCity_calc (should hold energy supply systems and
        demands

    Returns
    -------
    mc_run : object
        MC runner object of pyCity_calc
    """

    #  Generate german market instance (if not already included in environment)
    ger_market = gmarket.GermanMarket()

    #  Add GermanMarket object instance to city
    city.environment.prices = ger_market

    #  Generate annuity object instance
    annuity_obj = annu.EconomicCalculation()

    #  Generate energy balance object for city
    energy_balance = citeb.CityEBCalculator(city=city)

    city_eco_calc = citecon.CityAnnuityCalc(annuity_obj=annuity_obj,
                                            energy_balance=energy_balance)

    #  Hand over initial city object to mc_runner
    mc_run = mcrun.McRunner(city_eco_calc=city_eco_calc)

    return mc_run
    def test_get_dict_usable_pv_areas(self):
        #  Create extended environment of pycity_calc
        year = 2010
        timestep = 3600  # 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)

        use_pv_area_1 = 30

        extended_building = build_ex. \
            BuildingExtended(environment,
                             build_year=1962,
                             mod_year=2003,
                             build_type=0,
                             roof_usabl_pv_area=use_pv_area_1,
                             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)

        position = point.Point(0, 0)

        city_object.add_extended_building(extended_building=extended_building,
                                          position=position)

        use_pv_area_2 = 0

        extended_building2 = build_ex. \
            BuildingExtended(environment,
                             build_year=1962,
                             mod_year=2003,
                             build_type=0,
                             roof_usabl_pv_area=use_pv_area_2,
                             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)

        position2 = point.Point(0, 50)

        city_object.add_extended_building(extended_building=extended_building2,
                                          position=position2)

        dict_use_pv_area = pvareas.get_dict_usable_pv_areas(city=city_object)

        assert sorted(dict_use_pv_area.keys()) == [1001, 1002]

        assert dict_use_pv_area[1001] == use_pv_area_1
        assert dict_use_pv_area[1002] == use_pv_area_2
    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)
    def test_parse_city_to_ind(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)

        extended_building1 = 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)

        extended_building2 = 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)

        bes1 = BES.BES(environment=environment)
        bes2 = BES.BES(environment=environment)

        lower_activation_limit = 0.5
        chp_q_nom = 10000
        t_max = 86
        p_nominal = 4500
        eta_total = 0.87

        chp = chpsys.ChpExtended(environment=environment,
                                 p_nominal=p_nominal,
                                 q_nominal=chp_q_nom,
                                 eta_total=eta_total,
                                 t_max=t_max,
                                 lower_activation_limit=lower_activation_limit,
                                 thermal_operation_mode=True)

        # Create Boiler
        boi_q_nom = 10000
        eta = 0.9
        boiler = boi.BoilerExtended(environment, q_nominal=boi_q_nom, eta=eta)

        # Create thermal storage 1
        t_init = 55  # °C
        tes_kg_nom = 300  # kg
        t_max = 60  # °C
        t_min = 20  # °C
        cp = 4186  # J/kgK
        rho = 1000  # kg / m³
        tes1 = sto.thermalEnergyStorageExtended(environment=environment,
                                                t_init=t_init,
                                                c_p=cp,
                                                capacity=tes_kg_nom,
                                                t_max=t_max,
                                                t_min=t_min,
                                                rho=rho)

        # Create thermal storage 2
        t_init = 40  # °C
        tes_kg_nom_2 = 200  # kg
        t_max = 45  # °C
        t_min = 20  # °C
        cp = 4186  # J/kgK
        rho = 1000  # kg / m³
        tes2 = sto.thermalEnergyStorageExtended(environment=environment,
                                                t_init=t_init,
                                                c_p=cp,
                                                capacity=tes_kg_nom_2,
                                                t_max=t_max,
                                                t_min=t_min,
                                                rho=rho)

        #  Create HP
        hp_q_nom = 10000  # W
        tMax = 45  # °C
        hpType = 'aw'  # air water hp
        tSink = 45  # °C

        heatpump = hpsys.heatPumpSimple(environment=environment,
                                        q_nominal=hp_q_nom,
                                        t_max=tMax,
                                        hp_type=hpType,
                                        t_sink=tSink)

        # Create Electrical Heater
        eh_q_nom = 10000
        eheater = ehsys.ElectricalHeaterExtended(environment=environment,
                                                 q_nominal=eh_q_nom)

        # create the battery
        soc_init_ratio = 0.5
        bat_capacity_kwh = 20  # kWh
        battery = batt.BatteryExtended(environment, soc_init_ratio,
                                       bat_capacity_kwh)

        #  Create PV
        pv_area = 30
        pv_simple = PV.PV(environment, area=pv_area, eta=0.1275, beta=35)

        #  Add to bes1
        bes1.addMultipleDevices([chp, boiler, tes1])

        #  Add to bes2
        bes2.addMultipleDevices([heatpump, eheater, tes2, pv_simple, battery])

        #  Add bes1 to building1
        extended_building1.addEntity(entity=bes1)

        #  Add bes2 to bulding2
        extended_building2.addEntity(entity=bes2)

        #  Add buildings to city_object
        city_object.add_extended_building(extended_building1,
                                          position=point.Point(0, 0))
        city_object.add_extended_building(extended_building2,
                                          position=point.Point(50, 0))

        ind = parse_city_to_ind.parse_city_to_ind_dict(city=city_object)

        #  No LHN in ind
        assert ind['lhn'] == []

        ind[1001]['chp'] = chp_q_nom
        ind[1001]['boi'] = boi_q_nom
        ind[1001]['tes'] = tes_kg_nom
        ind[1001]['hp_aw'] = 0
        ind[1001]['hp_ww'] = 0
        ind[1001]['eh'] = 0
        ind[1001]['pv'] = 0
        ind[1001]['bat'] = 0

        ind[1002]['chp'] = 0
        ind[1002]['boi'] = 0
        ind[1002]['tes'] = tes_kg_nom_2
        ind[1002]['hp_aw'] = hp_q_nom
        ind[1002]['hp_ww'] = 0
        ind[1002]['eh'] = eh_q_nom
        ind[1002]['pv'] = pv_area
        ind[1002]['bat'] = bat_capacity_kwh

        #  Add LHN
        city_object.add_edge(1001, 1002, network_type='heating')

        ind = parse_city_to_ind.parse_city_to_ind_dict(city=city_object)

        #  No LHN in ind
        assert ind['lhn'] == [[1001, 1002]]

        ind[1001]['chp'] = chp_q_nom
        ind[1001]['boi'] = boi_q_nom
        ind[1001]['tes'] = tes_kg_nom
        ind[1001]['hp_aw'] = 0
        ind[1001]['hp_ww'] = 0
        ind[1001]['eh'] = 0
        ind[1001]['pv'] = 0
        ind[1001]['bat'] = 0
Beispiel #5
0
def do_wm_comp(city, dhw_scale=True, eeg_pv_limit=False):
    #  Generate german market instance (if not already included in environment)
    ger_market = gmarket.GermanMarket()

    #  Add GermanMarket object instance to city
    city.environment.prices = ger_market

    #  Scenario 1: Add CHP dim. with single LHN
    #  #####################################################################

    city_scen_1 = copy.deepcopy(city)

    #  Connect all building nodes to local heating network
    dict_e_net_data = {
        1: {
            'type': 'heating',
            'method': 2,
            'nodelist': [1001, 1002, 1003, 1004, 1005, 1006, 1007]
        }
    }

    #  Add energy networks to city
    enetgen.add_energy_networks_to_city(city=city_scen_1,
                                        dict_data=dict_e_net_data)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1005, 1, 1)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_1,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 2: Add decentral CHPs
    #  #####################################################################

    city_scen_2 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 1, 1), (1002, 1, 1), (1003, 1, 1), (1004, 1, 1),
                 (1005, 1, 1), (1006, 1, 1), (1007, 1, 1)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_2,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 3: Boilers, only
    #  #####################################################################

    city_scen_3 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 0, 1), (1002, 0, 1), (1003, 0, 1), (1004, 0, 1),
                 (1005, 0, 1), (1006, 0, 1), (1007, 0, 1)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_3,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 4: Boilers and TES, only
    #  #####################################################################

    city_scen_4 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 0, 2), (1002, 0, 2), (1003, 0, 2), (1004, 0, 2),
                 (1005, 0, 2), (1006, 0, 2), (1007, 0, 2)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_4,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 5: Air/water heat pumps
    #  #####################################################################

    city_scen_5 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 2, 1), (1002, 2, 1), (1003, 2, 1), (1004, 2, 1),
                 (1005, 2, 1), (1006, 2, 1), (1007, 2, 1)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_5,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    city_scen_5.nodes[1006]['entity'].bes.electricalHeater.qNominal *= 5

    #  Scenario 6: Air/water heat pumps
    #  #####################################################################

    city_scen_6 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 2, 2), (1002, 2, 2), (1003, 2, 2), (1004, 2, 2),
                 (1005, 2, 2), (1006, 2, 2), (1007, 2, 2)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_6,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    city_scen_6.nodes[1006]['entity'].bes.electricalHeater.qNominal *= 5

    #  Scenario 7: Boilers with small PV
    #  #####################################################################

    city_scen_7 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 0, 1), (1002, 0, 1), (1003, 0, 1), (1004, 0, 1),
                 (1005, 0, 1), (1006, 0, 1), (1007, 0, 1), (1001, 3, 30),
                 (1002, 3, 30), (1003, 3, 30), (1004, 3, 30), (1005, 3, 30),
                 (1006, 3, 30), (1007, 3, 30)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_7,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 8: Boilers with medium PV
    #  #####################################################################

    city_scen_8 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 0, 1), (1002, 0, 1), (1003, 0, 1), (1004, 0, 1),
                 (1005, 0, 1), (1006, 0, 1), (1007, 0, 1), (1001, 3, 60),
                 (1002, 3, 60), (1003, 3, 60), (1004, 3, 60), (1005, 3, 60),
                 (1006, 3, 60), (1007, 3, 60)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_8,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 9: Boilers with large PV
    #  #####################################################################

    city_scen_9 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 0, 1), (1002, 0, 1), (1003, 0, 1), (1004, 0, 1),
                 (1005, 0, 1), (1006, 0, 1), (1007, 0, 1), (1001, 3, 80),
                 (1002, 3, 80), (1003, 3, 80), (1004, 3, 80), (1005, 3, 80),
                 (1006, 3, 80), (1007, 3, 80)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_9,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 10: Boilers with PV (over 10 kW peak)
    #  #####################################################################

    city_scen_10 = copy.deepcopy(city)

    #  Generate one feeder with CHP, boiler and TES
    list_esys = [(1001, 0, 1), (1002, 0, 1), (1003, 0, 1), (1004, 0, 1),
                 (1005, 0, 1), (1006, 0, 1), (1007, 0, 1), (1001, 3, 100),
                 (1002, 3, 100), (1003, 3, 100), (1004, 3, 100),
                 (1005, 3, 100), (1006, 3, 100), (1007, 3, 100)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_10,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 11: CHP with PV
    #  #####################################################################

    city_scen_11 = copy.deepcopy(city)

    #  Connect all building nodes to local heating network
    dict_e_net_data = {
        1: {
            'type': 'heating',
            'method': 2,
            'nodelist': [1001, 1002, 1003, 1004, 1005, 1006, 1007]
        }
    }

    #  Add energy networks to city
    enetgen.add_energy_networks_to_city(city=city_scen_11,
                                        dict_data=dict_e_net_data)

    #  Generate one feeder with CHP, boiler and TES (plus PV)
    list_esys = [(1005, 1, 1), (1001, 3, 60), (1002, 3, 60), (1003, 3, 60),
                 (1004, 3, 60), (1005, 3, 60), (1006, 3, 60), (1007, 3, 60)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_11,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 12: CHP with PV
    #  #####################################################################

    city_scen_12 = copy.deepcopy(city)

    #  Connect all building nodes to local heating network
    dict_e_net_data = {
        1: {
            'type': 'heating',
            'method': 2,
            'nodelist': [1001, 1002, 1003, 1004, 1005, 1006, 1007]
        }
    }

    #  Add energy networks to city
    enetgen.add_energy_networks_to_city(city=city_scen_12,
                                        dict_data=dict_e_net_data)

    #  Generate one feeder with CHP, boiler and TES (plus PV)
    list_esys = [(1005, 1, 1), (1001, 3, 80), (1002, 3, 80), (1003, 3, 80),
                 (1004, 3, 80), (1005, 3, 80), (1006, 3, 80), (1007, 3, 80)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_12,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  Scenario 13: Boilers with PV (over 10 kW peak)
    #  #####################################################################

    city_scen_13 = copy.deepcopy(city)

    #  Connect all building nodes to local heating network
    dict_e_net_data = {
        1: {
            'type': 'heating',
            'method': 2,
            'nodelist': [1001, 1002, 1003, 1004, 1005, 1006, 1007]
        }
    }

    #  Add energy networks to city
    enetgen.add_energy_networks_to_city(city=city_scen_13,
                                        dict_data=dict_e_net_data)

    #  Generate one feeder with CHP, boiler and TES (plus PV)
    list_esys = [(1005, 1, 1), (1001, 3, 100), (1002, 3, 100), (1003, 3, 100),
                 (1004, 3, 100), (1005, 3, 100), (1006, 3, 100),
                 (1007, 3, 100)]

    #  Generate energy systems
    esysgen.gen_esys_for_city(city=city_scen_13,
                              list_data=list_esys,
                              dhw_scale=dhw_scale)

    #  #####################################################################
    #  Generate object instances
    #  #####################################################################

    #  Generate annuity object instance
    annuity_obj1 = annu.EconomicCalculation()
    annuity_obj2 = annu.EconomicCalculation()
    annuity_obj3 = annu.EconomicCalculation()
    annuity_obj4 = annu.EconomicCalculation()
    annuity_obj5 = annu.EconomicCalculation()
    annuity_obj6 = annu.EconomicCalculation()
    annuity_obj7 = annu.EconomicCalculation()
    annuity_obj8 = annu.EconomicCalculation()
    annuity_obj9 = annu.EconomicCalculation()
    annuity_obj10 = annu.EconomicCalculation()
    annuity_obj11 = annu.EconomicCalculation()
    annuity_obj12 = annu.EconomicCalculation()
    annuity_obj13 = annu.EconomicCalculation()

    #  Generate energy balance object for city
    energy_balance1 = citeb.CityEBCalculator(city=city_scen_1)
    energy_balance2 = citeb.CityEBCalculator(city=city_scen_2)
    energy_balance3 = citeb.CityEBCalculator(city=city_scen_3)
    energy_balance4 = citeb.CityEBCalculator(city=city_scen_4)
    energy_balance5 = citeb.CityEBCalculator(city=city_scen_5)
    energy_balance6 = citeb.CityEBCalculator(city=city_scen_6)
    energy_balance7 = citeb.CityEBCalculator(city=city_scen_7)
    energy_balance8 = citeb.CityEBCalculator(city=city_scen_8)
    energy_balance9 = citeb.CityEBCalculator(city=city_scen_9)
    energy_balance10 = citeb.CityEBCalculator(city=city_scen_10)
    energy_balance11 = citeb.CityEBCalculator(city=city_scen_11)
    energy_balance12 = citeb.CityEBCalculator(city=city_scen_12)
    energy_balance13 = citeb.CityEBCalculator(city=city_scen_13)

    #  Generate city economic calculator instances
    city_eco_calc1 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj1,
                                             energy_balance=energy_balance1)
    city_eco_calc2 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj2,
                                             energy_balance=energy_balance2)
    city_eco_calc3 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj3,
                                             energy_balance=energy_balance3)
    city_eco_calc4 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj4,
                                             energy_balance=energy_balance4)
    city_eco_calc5 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj5,
                                             energy_balance=energy_balance5)
    city_eco_calc6 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj6,
                                             energy_balance=energy_balance6)
    city_eco_calc7 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj7,
                                             energy_balance=energy_balance7)
    city_eco_calc8 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj8,
                                             energy_balance=energy_balance8)
    city_eco_calc9 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj9,
                                             energy_balance=energy_balance9)
    city_eco_calc10 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj10,
                                              energy_balance=energy_balance10)
    city_eco_calc11 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj11,
                                              energy_balance=energy_balance11)
    city_eco_calc12 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj12,
                                              energy_balance=energy_balance12)
    city_eco_calc13 = citecon.CityAnnuityCalc(annuity_obj=annuity_obj13,
                                              energy_balance=energy_balance13)

    list_ann = []
    list_co2 = []

    #  Perform energy balance and annuity calculations for all scenarios
    (total_annuity_1, co2_1) = city_eco_calc1. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_1)
    list_co2.append(co2_1)

    (total_annuity_2, co2_2) = city_eco_calc2. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_2)
    list_co2.append(co2_2)

    (total_annuity_3, co2_3) = city_eco_calc3. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_3)
    list_co2.append(co2_3)

    (total_annuity_4, co2_4) = city_eco_calc4. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_4)
    list_co2.append(co2_4)

    (total_annuity_5, co2_5) = city_eco_calc5. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_5)
    list_co2.append(co2_5)

    (total_annuity_6, co2_6) = city_eco_calc6. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_6)
    list_co2.append(co2_6)

    (total_annuity_7, co2_7) = city_eco_calc7. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_7)
    list_co2.append(co2_7)

    (total_annuity_8, co2_8) = city_eco_calc8. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_8)
    list_co2.append(co2_8)

    (total_annuity_9, co2_9) = city_eco_calc9. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_9)
    list_co2.append(co2_9)

    (total_annuity_10, co2_10) = city_eco_calc10. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_10)
    list_co2.append(co2_10)

    (total_annuity_11, co2_11) = city_eco_calc11. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_11)
    list_co2.append(co2_11)

    (total_annuity_12, co2_12) = city_eco_calc12. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_12)
    list_co2.append(co2_12)

    (total_annuity_13, co2_13) = city_eco_calc13. \
        perform_overall_energy_balance_and_economic_calc(eeg_pv_limit=
                                                         eeg_pv_limit)
    list_ann.append(total_annuity_13)
    list_co2.append(co2_13)

    plt.plot([total_annuity_1], [co2_1], label='Scen. 1 (CHP/LHN)', marker='o')
    plt.plot([total_annuity_2], [co2_2],
             label='Scen. 2 (dec. CHP)',
             marker='o')
    plt.plot([total_annuity_3], [co2_3], label='Scen. 3 (BOI)', marker='o')
    plt.plot([total_annuity_4], [co2_4], label='Scen. 4 (BOI/TES)', marker='o')
    plt.plot([total_annuity_5], [co2_5], label='Scen. 5 (HP (aw))', marker='o')
    plt.plot([total_annuity_6], [co2_6], label='Scen. 6 (HP (ww))', marker='o')
    plt.plot([total_annuity_7], [co2_7],
             label='Scen. 7 (BOI/small PV)',
             marker='o')
    plt.plot([total_annuity_8], [co2_8],
             label='Scen. 8 (BOI/medium PV)',
             marker='o')
    plt.plot([total_annuity_9], [co2_9],
             label='Scen. 9 (BOI/large PV)',
             marker='o')
    plt.plot([total_annuity_10], [co2_10],
             label='Scen. 10 (BOI/PV>10 kWp)',
             marker='o')
    plt.plot([total_annuity_11], [co2_11],
             label='Scen. 11 (CHP/LHN/PV 60)',
             marker='*')
    plt.plot([total_annuity_12], [co2_12],
             label='Scen. 12 (CHP/LHN/PV 80)',
             marker='*')
    plt.plot([total_annuity_13], [co2_13],
             label='Scen. 13 (CHP/LHN/PV 100)',
             marker='*')
    plt.xlabel('Total annualized cost in Euro/a')
    plt.ylabel('Total CO2 emissions in kg/a')
    plt.legend()
    plt.tight_layout()
    plt.show()
    plt.close()

    hp_q_out = city_scen_5.nodes[1006]['entity'].bes.heatpump.totalQOutput
    hp_el_in = city_scen_5.nodes[1006]['entity'].bes.heatpump.array_el_power_in

    cop_array = np.zeros(len(hp_q_out))
    sum_not_zero = 0
    steps_not_zero = 0
    for i in range(len(cop_array)):
        if hp_el_in[i] > 0:
            cop_array[i] = hp_q_out[i] / hp_el_in[i]
            sum_not_zero += cop_array[i]
            steps_not_zero += 1

    cop_average = sum_not_zero / steps_not_zero
    print('COP average (AW): ', cop_average)

    fig = plt.figure()
    ax = fig.add_subplot(2, 1, 1)
    ax.plot(hp_q_out)
    ax.plot(hp_el_in)
    ax2 = fig.add_subplot(2, 1, 2)
    ax2.plot(cop_array)
    plt.show()
    plt.close()

    hp_q_out = city_scen_6.nodes[1006]['entity'].bes.heatpump.totalQOutput
    hp_el_in = city_scen_6.nodes[1006]['entity'].bes.heatpump.array_el_power_in

    cop_array = np.zeros(len(hp_q_out))
    sum_not_zero = 0
    steps_not_zero = 0
    for i in range(len(cop_array)):
        if hp_el_in[i] > 0:
            cop_array[i] = hp_q_out[i] / hp_el_in[i]
            sum_not_zero += cop_array[i]
            steps_not_zero += 1

    cop_average = sum_not_zero / steps_not_zero
    print('COP average (WW): ', cop_average)

    fig = plt.figure()
    ax = fig.add_subplot(2, 1, 1)
    ax.plot(hp_q_out)
    ax.plot(hp_el_in)
    ax2 = fig.add_subplot(2, 1, 2)
    ax2.plot(cop_array)
    plt.show()
    plt.close()