示例#1
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Project Drawdown extrapolated Biochar data, based on Lal 2005 and Woolf et al 2010 methods. Alpha Scenario':
                THISDIR.joinpath(
                    'tam',
                    'tam_Project_Drawdown_extrapolated_Biochar_data_based_on_Lal_2005_and_Woolf_et_al_2010_method_144eca81.csv'
                ),
            },
            'Conservative Cases': {
                'Project Drawdown extrapolated Biochar data, based on Lal 2005 and Woolf et al 2010 methods. Beta Scenario':
                THISDIR.joinpath(
                    'tam',
                    'tam_Project_Drawdown_extrapolated_Biochar_data_based_on_Lal_2005_and_Woolf_et_al_2010_method_2a78e935.csv'
                ),
            },
            'Maximum Cases': {
                'Project Drawdown extrapolated Biochar data, based on Lal 2005 and Woolf et al 2010 methods. MSTP Scenario':
                THISDIR.joinpath(
                    'tam',
                    'tam_Project_Drawdown_extrapolated_Biochar_data_based_on_Lal_2005_and_Woolf_et_al_2010_method_a5bf52aa.csv'
                ),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {}
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Linear, low growth',
                'include':
                True,
                'filename':
                THISDIR.joinpath('ca_pds_data',
                                 'custom_pds_ad_Linear_low_growth.csv')
            },
            {
                'name':
                'High Growth, 2nd Poly, based on International Biochar Initiative (2015)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_High_Growth_2nd_Poly_based_on_International_Biochar_Initiative_2015.csv'
                )
            },
            {
                'name':
                'Linear, high growth',
                'include':
                True,
                'filename':
                THISDIR.joinpath('ca_pds_data',
                                 'custom_pds_ad_Linear_high_growth.csv')
            },
            {
                'name':
                'Linear, max growth',
                'include':
                True,
                'filename':
                THISDIR.joinpath('ca_pds_data',
                                 'custom_pds_ad_Linear_max_growth.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(
            [7457.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#2
0
  def __init__(self, scenario=None):
    if scenario is None:
      scenario = list(scenarios.keys())[0]
    self.scenario = scenario
    self.ac = scenarios[scenario]

    # TAM
    tamconfig_list = [
      ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['trend', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param')
    self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=rrs.tam_ref_data_sources,
      tam_pds_data_sources=rrs.tam_pds_data_sources)
    ref_tam_per_region=self.tm.ref_tam_per_region()
    pds_tam_per_region=self.tm.pds_tam_per_region()

    adconfig_list = [
      ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param')
    ad_data_sources = {
      'Baseline Cases': {
          'Based on: IEA ETP 2016 6DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_6DS.csv'),
          'Based on: AMPERE 2014 GEM E3 Reference': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_Reference.csv'),
          'Based on: AMPERE 2014 IMAGE TIMER Reference': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_Reference.csv'),
          'Based on: AMPERE 2014 MESSAGE MACRO Reference': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_Reference.csv'),
      },
      'Conservative Cases': {
          'Based on: IEA ETP 2016 4DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_4DS.csv'),
          'Based on: Greenpeace 2015 Reference': THISDIR.joinpath('ad', 'ad_based_on_Greenpeace_2015_Reference.csv'),
          'Based on: AMPERE 2014 GEM E3 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_550.csv'),
          'Based on: AMPERE 2014 IMAGE TIMER 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_550.csv'),
          'Based on: AMPERE 2014 MESSAGE MACRO 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_550.csv'),
      },
      'Ambitious Cases': {
          'Based on: IEA ETP 2016 2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_2DS.csv'),
          'Based on: Greenpeace 2015 Energy Revolution': THISDIR.joinpath('ad', 'ad_based_on_Greenpeace_2015_Energy_Revolution.csv'),
          'Based on: AMPERE 2014 GEM E3 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_450.csv'),
          'Based on: AMPERE 2014 IMAGE TIMER 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_450.csv'),
          'Based on: AMPERE 2014 MESSAGE MACRO 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_450.csv'),
      },
      '100% RES2050 Case': {
          'Based on: Greenpeace 2015 Advanced Revolution': THISDIR.joinpath('ad', 'ad_based_on_Greenpeace_2015_Advanced_Revolution.csv'),
      },
    }
    self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources,
        adconfig=adconfig)

    ref_adoption_data_per_region = None

    if False:
      # One may wonder why this is here. This file was code generated.
      # This 'if False' allows subsequent conditions to all be elif.
      pass
    elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
      pds_adoption_data_per_region = self.ad.adoption_data_per_region()
      pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
      pds_adoption_is_single_source = self.ad.adoption_is_single_source()

    ht_ref_adoption_initial = pd.Series(
      [55.98669999999999, 53.60529999999999, 0.1568, 1.6597, 0.10709999999999999,
       0.4578, 0.0, 0.26949999999999996, 41.1474, 9.5102],
       index=dd.REGIONS)
    ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
    ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
    ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
    ht_pds_adoption_initial = ht_ref_adoption_initial
    ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage)
    ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions))
    ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050]
    ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
    ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
    self.ht = helpertables.HelperTables(ac=self.ac,
        ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
        pds_adoption_data_per_region=pds_adoption_data_per_region,
        ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region,
        pds_adoption_trend_per_region=pds_adoption_trend_per_region,
        pds_adoption_is_single_source=pds_adoption_is_single_source)

    self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

    self.ua = unitadoption.UnitAdoption(ac=self.ac,
        ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region,
        soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
        soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
        bug_cfunits_double_count=True)
    soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
    soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
    conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
    soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

    self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
        ref_learning_increase_mult=2, conv_learning_increase_mult=2,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_tot_iunits=conv_ref_tot_iunits,
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT)

    self.oc = operatingcost.OperatingCost(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
        soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
        soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
        conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
        single_iunit_purchase_year=2017,
        soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
        conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
        conversion_factor=rrs.TERAWATT_TO_KILOWATT)

    self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

    self.c2 = co2calcs.CO2Calcs(ac=self.ac,
        ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
        soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
        soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
        soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(),
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(),
        soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(),
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
        conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        fuel_in_liters=False)

    self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'],
        soln_avg_annual_use=self.ac.soln_avg_annual_use,
        conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#3
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TLA
        self.ae = aez.AEZ(solution_name=self.name, cohort=2020,
                regimes=dd.THERMAL_MOISTURE_REGIMES8)
        if self.ac.use_custom_tla:
            self.c_tla = tla.CustomTLA(filename=THISDIR.joinpath('custom_tla_data.csv'))
            custom_world_vals = self.c_tla.get_world_values()
        else:
            custom_world_vals = None
        self.tla_per_region = tla.tla_per_region(self.ae.get_land_distribution(),
            custom_world_values=custom_world_vals)

        adconfig_list = [
            ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
             'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
            ['trend', self.ac.soln_pds_adoption_prognostication_trend, 'Medium',
             'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
             'Medium', 'Medium', 'Medium'],
            ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'NOTE',
             'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE',
             'NOTE', 'NOTE', 'NOTE'],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
        adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0],
            dtype=np.object).set_index('param')
        ad_data_sources = {
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources,
            main_includes_regional=True,
            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_columns = ['Year'] + dd.REGIONS

        # Current commitments made under Bonn Challenge (taken on 16/12/2019)
        bonn_mha = 149.012768

        # % current commitments are projects in temperate thermal moisture regime
        temperate_percent = 0.198187597540394

        # % current commitments in temperate thermal moisture regime available are
        # for intact forest restoration
        intact_percent = 0.4423

        # Calculated by subtracting the total degraded land suitable for tropical
        # forest restoration (304 Mha) and boreal (46 Mha) from the WRI estimates
        # of 500 Mha as the potential global area for forest restoration
        # TODO: the spatial-aez work in late 2019 provided direct data input of temperate
        #       forest area, distinct from boreal and tropical, which could be used here.
        title = 'Percent of Degraded Land Suitable for Intact Temperate Forest Restoration'
        intact_mha = self.ac.lookup_vma(vma_title=title)
        if intact_mha is None:
            intact_mha = VMAs[title].avg_high_low(key='mean')

        # Max land Expected total land commited under Bonn Challenge and NY Declaration 
        max_land = 350.0

        # Mha of current commitments in temperate thermal moisture regime
        committed_mha = bonn_mha * temperate_percent

        # Mha of total degraded land available for new commitments in
        # temperate thermal moisture regime, from New York Declaration
        nydf_new_mha = (max_land - bonn_mha) * temperate_percent

        # WRI prediction for max available land area
        wri_new_mha = intact_mha - committed_mha

        # DATA SOURCE 1, using NYDF land area
        ds1_future_commit = 1.0
        ds1_2030 = (committed_mha * intact_percent) + (nydf_new_mha * ds1_future_commit)

        # future land area with WRI prediction plus 44.23% and 100% commitment
        future_mha_44p = (committed_mha * intact_percent) + (wri_new_mha * 0.4423)
        future_mha_100p = (committed_mha * intact_percent) + (wri_new_mha * 1.0)

        ca_pds_data_sources = [
            {'name': 'Optimistic-Achieve Commitment in 15 years w/ 100% intact, (Charlotte Wheeler, 2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060).  In this '
                    'scenario, NYDF prediction for max area available for temperate forest '
                    'restoration, 100% new commitment for intact forest and year 2030 was '
                    'considered when the commitments will be realized.'),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2030, ds1_2030, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2031, ds1_2030, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Optimistic-Achieve Commitment in 15 years w/ 100% intact, WRI estimates (Charlotte Wheeler, 2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 100% new commitment for intact forest and year 2030 was '
                    'considered when the commitments will be realized. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2030, future_mha_100p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2031, future_mha_100p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 15 years w/ 44.2% intact, (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 44.23% new commitment for intact forest and year 2030 was '
                    'considered when the commitments will be realized. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2030, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2031, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 15 years w/ 44.2% intact with continued growth post-2030, (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 44.23% new commitment for intact forest and year 2030 was '
                    'considered when the commitments will be realized, with continued growth '
                    'in post 2030.'),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2030, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 30 years w/ 100% intact, (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 100% new commitment for intact forest and year 2045 was '
                    'considered when the commitments will be realized. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2045, future_mha_100p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2046, future_mha_100p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 30 years w/ 44.2% intact, (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 44.23% new commitment for intact forest and year 2045 was '
                    'considered when the commitments will be realized. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2045, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2046, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 30 years w/ 44.2% intact with continued growth, (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 44.23% new commitment for intact forest and year 2045 was '
                    'considered when the commitments will be realized, with continued growth '
                    'in post 2045. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2045, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 45 years w/ 100% intact (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 100% new commitment for intact forest and year 2060 was '
                    'considered when the commitments will be realized. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2060, future_mha_100p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
            {'name': 'Conservative-Achieve Commitment in 45 years w/ 44.2% intact (Charlotte Wheeler,2016)', 'include': True,
                'description': (
                    'The adoption scenarios are calculated using the linear trendline based '
                    'on: (1) Current commitments to date, (2) Potential future commitments, (3) '
                    'The proportion of committee land restored to intact forest (100% or 44.23%), '
                    'and (4) The year commitments are realised (2030, 2045 or 2060). In this '
                    'scenario, WRI prediction for max area available for temperate forest '
                    'restoration, 44.23% new commitment for intact forest and year 2060 was '
                    'considered when the commitments will be realized. '),
                'maximum': intact_mha,
                'datapoints': pd.DataFrame([
                    [2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    [2060, future_mha_44p, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                    ], columns=ca_pds_columns).set_index('Year')},
        ]
        self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0, low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region()
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region()
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(
            list(self.ac.ref_base_adoption.values()), index=dd.REGIONS)
        ht_ref_adoption_final = self.tla_per_region.loc[2050] * (ht_ref_adoption_initial /
            self.tla_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(ac=self.ac,
            ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=self.tla_per_region, pds_adoption_limits=self.tla_per_region,
            use_first_pds_datapoint_main=True,
            adoption_base_year=2018,
            copy_pds_to_ref=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(ac=self.ac,
            ref_total_adoption_units=self.tla_per_region,
            pds_total_adoption_units=self.tla_per_region,
            electricity_unit_factor=1000000.0,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

        self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
            ref_learning_increase_mult=2, conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_first_cost_uses_tot_units=True,
            fc_convert_iunit_factor=land.MHA_TO_HA)

        self.oc = operatingcost.OperatingCost(ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
            conversion_factor=land.MHA_TO_HA)

        self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.direct_ch4_co2_emissions_saved_land(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2eq_emissions_saved=self.ua.direct_co2eq_emissions_saved_land(),
            soln_pds_direct_co2_emissions_saved=self.ua.direct_co2_emissions_saved_land(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.direct_n2o_co2_emissions_saved_land(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.direct_ch4_co2_emissions_saved_land(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            annual_land_area_harvested=self.ua.soln_pds_annual_land_area_harvested(),
            regime_distribution=self.ae.get_land_distribution(),
            regimes=dd.THERMAL_MOISTURE_REGIMES8)
示例#4
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        self.tm = tam.TAM(
            tamconfig=tamconfig,
            tam_ref_data_sources=rrs.energy_tam_2_ref_data_sources,
            tam_pds_data_sources=rrs.energy_tam_2_pds_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'Based on IEA, WEO-2018, Current Policies Scenario (CPS)':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IEA_WEO2018_Current_Policies_Scenario_CPS.csv'
                ),
                'Based on: IEA ETP 2017 Ref Tech':
                THISDIR.joinpath('ad',
                                 'ad_based_on_IEA_ETP_2017_Ref_Tech.csv'),
                'Based on: Grantham Institute and Carbon Tracker (2017), Nationally Determined Contributions (NDC) Scenario, PVEV medium scenario':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_Grantham_Institute_and_Carbon_Tracker_2017_Nationally_Determined_Contributions__30307e8e.csv'
                ),
                'Based on IEEJ Outlook - 2019, Ref Scenario':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_IEEJ_Outlook_2019_Ref_Scenario.csv'),
            },
            'Conservative Cases': {
                'Based on IEA, WEO-2018, New Policies Scenario (NPS)':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IEA_WEO2018_New_Policies_Scenario_NPS.csv'),
                'Based on Equinor (2018), Reform Scenario':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_Equinor_2018_Reform_Scenario.csv'),
                'Based on IEEJ Outlook - 2019, Advanced Tech Scenario':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IEEJ_Outlook_2019_Advanced_Tech_Scenario.csv'
                ),
            },
            'Ambitious Cases': {
                'Based on IEA, WEO-2018, SDS Scenario':
                THISDIR.joinpath('ad',
                                 'ad_based_on_IEA_WEO2018_SDS_Scenario.csv'),
                'Based on: IEA ETP 2017 2DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_2DS.csv'),
                'Based on: IEA ETP 2017 B2DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_B2DS.csv'),
                'Based on: Grantham Institute and Carbon Tracker (2017), Strong PVEV medium scenario':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_Grantham_Institute_and_Carbon_Tracker_2017_Strong_PVEV_medium_scenario.csv'
                ),
            },
            '100% RES2050 Case': {
                'Based on: LUT/EWG (2019) -100% RES':
                THISDIR.joinpath('ad', 'ad_based_on_LUTEWG_2019_100_RES.csv'),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            use_first_pds_datapoint_main=False,
            adoption_base_year=2018,
            copy_pds_to_ref=True,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(
            ac=self.ac, grid_emissions_version=2)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=rrs.TERAWATT_TO_KILOWATT)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#5
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Drawdown Custom projection 1':
                THISDIR.joinpath('tam',
                                 'tam_Drawdown_Custom_projection_1.csv'),
                'Drawdown Custom Projection 2':
                THISDIR.joinpath('tam',
                                 'tam_Drawdown_Custom_Projection_2.csv'),
            },
        }
        tam_pds_data_sources = {
            'Conservative Cases': {
                'Drawdown TAM: Drawdown Integration Assumptions (Water Saving Home /Plausible Scenario Reduces Demand for Municipal Water Pumping), 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Drawdown_Integration_Assumptions_Water_Saving_Home_Plausible_Scenario_Reduc_f47a5b4e.csv'
                ),
            },
            'Ambitious Cases': {
                'Drawdown TAM: Drawdown Integration Assumptions (Water Saving Home /Drawdown Scenario Reduces Demand for Municipal Water Pumping), 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Drawdown_Integration_Assumptions_Water_Saving_Home_Drawdown_Scenario_Reduce_a7c36895.csv'
                ),
                'Drawdown TAM: Drawdown Integration Assumptions (Water Saving Home /Optimum Scenario Reduces Demand for Municipal Water Pumping), 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Drawdown_Integration_Assumptions_Water_Saving_Home_Optimum_Scenario_Reduces_2beea6a5.csv'
                ),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_pds_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {}
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Low Linear Growth in the Annual Adoption',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Low_Linear_Growth_in_the_Annual_Adoption.csv'
                )
            },
            {
                'name':
                'Medium Linear Growth in the Annual Adoption',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Medium_Linear_Growth_in_the_Annual_Adoption.csv'
                )
            },
            {
                'name':
                'High Linear Growth in the Annual Adoption',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_High_Linear_Growth_in_the_Annual_Adoption.csv'
                )
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(
            [65804.4675187948, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#6
0
  def __init__(self, scenario=None):
    if scenario is None:
      scenario = list(scenarios.keys())[0]
    self.scenario = scenario
    self.ac = scenarios[scenario]

    # TAM
    tamconfig_list = [
      ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['trend', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param')
    tam_ref_data_sources = {
      'Baseline Cases': {
          'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building  Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'),
          'IEA 6DS (2016), Residential & Commercial Water Heating': THISDIR.joinpath('tam', 'tam_IEA_6DS_2016_Residential_Commercial_Water_Heating.csv'),
          'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'),
      },
      'Conservative Cases': {
          'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'),
          'IEA 4DS (2016), Residential & Commercial Water Heating': THISDIR.joinpath('tam', 'tam_IEA_4DS_2016_Residential_Commercial_Water_Heating.csv'),
      },
      'Region: OECD90': {
        'Baseline Cases': {
          'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building  Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'),
          'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'),
          'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'),
        },
      },
      'Region: Eastern Europe': {
        'Baseline Cases': {
          'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building  Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'),
          'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'),
          'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'),
        },
      },
      'Region: Asia (Sans Japan)': {
        'Baseline Cases': {
          'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building  Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'),
          'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'),
          'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'),
        },
      },
    }
    tam_pds_data_sources = {
      'Baseline Cases': {
          'Drawdown TAM: PDS1 - post-Low-Flow': THISDIR.joinpath('tam', 'tam_pds_Drawdown_TAM_PDS1_postLowFlow.csv'),
      },
      'Conservative Cases': {
          'Drawdown TAM: PDS2 - post-Low-Flow': THISDIR.joinpath('tam', 'tam_pds_Drawdown_TAM_PDS2_postLowFlow.csv'),
      },
      'Ambitious Cases': {
          'Drawdown TAM: PDS3 - post-Low-Flow': THISDIR.joinpath('tam', 'tam_pds_Drawdown_TAM_PDS3_postLowFlow.csv'),
      },
    }
    self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources,
      tam_pds_data_sources=tam_pds_data_sources)
    ref_tam_per_region=self.tm.ref_tam_per_region()
    pds_tam_per_region=self.tm.pds_tam_per_region()

    adconfig_list = [
      ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param')
    ad_data_sources = {
      'Conservative Cases': {
          'IEA (2012) Technology Roadmap Solar Heating and Cooling - Cons': THISDIR.joinpath('ad', 'ad_IEA_2012_Technology_Roadmap_Solar_Heating_and_Cooling_Cons.csv'),
      },
      'Ambitious Cases': {
          'Solar Heat Worldwide http://www.iea-shc.org/solar-heat-worldwide': THISDIR.joinpath('ad', 'ad_Solar_Heat_Worldwide_httpwww_ieashc_orgsolarheatworldwide.csv'),
      },
    }
    self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources,
        adconfig=adconfig)

    # Custom PDS Data
    ca_pds_data_sources = [
      {'name': 'Conservative, based on IEA 2012', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_based_on_IEA_2012.csv')},
      {'name': 'Aggressive, High Growth, early', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth_early.csv')},
      {'name': 'Aggressive, High Growth, based on IEA', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth_based_on_IEA.csv')},
      {'name': 'Aggressive, High Growth, late', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth_late.csv')},
      {'name': 'Aggressive, V. High Growth, late', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_V__High_Growth_late.csv')},
      {'name': 'Aggressive, V. High Growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_V__High_Growth.csv')},
      {'name': 'Conservative Growth, late', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_Growth_late.csv')},
      {'name': 'Conservative Growth, early', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_Growth_early.csv')},
      {'name': 'Low Growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Low_Growth.csv')},
    ]
    self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources,
        soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=pds_tam_per_region)

    ref_adoption_data_per_region = None

    if False:
      # One may wonder why this is here. This file was code generated.
      # This 'if False' allows subsequent conditions to all be elif.
      pass
    elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
      pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region()
      pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region()
      pds_adoption_is_single_source = None
    elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
      pds_adoption_data_per_region = self.ad.adoption_data_per_region()
      pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
      pds_adoption_is_single_source = self.ad.adoption_is_single_source()

    ht_ref_adoption_initial = pd.Series(
      [335.463, 56.493, 2.374, 240.305, 9.948,
       9.113, 231.838, 6.4350000000000005, 23.777, 17.233],
       index=dd.REGIONS)
    ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
    ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
    ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
    ht_pds_adoption_initial = ht_ref_adoption_initial
    ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage)
    ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions))
    ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050]
    ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
    ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
    self.ht = helpertables.HelperTables(ac=self.ac,
        ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
        pds_adoption_data_per_region=pds_adoption_data_per_region,
        ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region,
        pds_adoption_trend_per_region=pds_adoption_trend_per_region,
        pds_adoption_is_single_source=pds_adoption_is_single_source)

    self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

    self.ua = unitadoption.UnitAdoption(ac=self.ac,
        ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region,
        soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
        soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
        repeated_cost_for_iunits=False,
        bug_cfunits_double_count=False)
    soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
    soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
    conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
    soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

    self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
        ref_learning_increase_mult=2, conv_learning_increase_mult=2,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_tot_iunits=conv_ref_tot_iunits,
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        fc_convert_iunit_factor=1000000000.0)

    self.oc = operatingcost.OperatingCost(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
        soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
        soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
        conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
        single_iunit_purchase_year=2017,
        soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
        conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
        conversion_factor=1000000000.0)

    self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

    self.c2 = co2calcs.CO2Calcs(ac=self.ac,
        ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
        soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
        soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
        soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(),
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(),
        soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(),
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
        conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        fuel_in_liters=False)

    self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'],
        soln_avg_annual_use=self.ac.soln_avg_annual_use,
        conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#7
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'IEA (2016), "Energy Technology Perspectives - 6DS", IEA/OECD':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2016_Energy_Technology_Perspectives_6DS_IEAOECD.csv'
                ),
                'ICCT (2012) "Global Transport Roadmap Model", http://www.theicct.org/global-transportation-roadmap-model':
                THISDIR.joinpath(
                    'tam',
                    'tam_ICCT_2012_Global_Transport_Roadmap_Model_httpwww_theicct_orgglobaltransportationroadmapmodel.csv'
                ),
            },
            'Conservative Cases': {
                'IEA (2016), "Energy Technology Perspectives - 4DS", IEA/OECD':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2016_Energy_Technology_Perspectives_4DS_IEAOECD.csv'
                ),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {}
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'PDS1 - Projecting HSR Travel based on announced Track building plans',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS1_Projecting_HSR_Travel_based_on_announced_Track_building_plans.csv'
                )
            },
            {
                'name':
                'PDS2 - Projecting HSR Travel based on announced Track building plans',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS2_Projecting_HSR_Travel_based_on_announced_Track_building_plans.csv'
                )
            },
            {
                'name':
                'PDS3 - Projecting HSR Travel based on announced Track building plans',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS3_Projecting_HSR_Travel_based_on_announced_Track_building_plans.csv'
                )
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series([
            614.0, 202.18263170296004, 2.738, 409.376, 0.0, 0.0, 386.3, 0.0,
            107.5006306909091, 0.7167517029599999
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#8
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TLA
        self.ae = aez.AEZ(solution_name=self.name,
                          cohort=2020,
                          regimes=dd.THERMAL_MOISTURE_REGIMES8)
        if self.ac.use_custom_tla and self.ac.custom_tla_fixed_value is not None:
            self.c_tla = tla.CustomTLA(
                fixed_value=self.ac.custom_tla_fixed_value)
            custom_world_vals = self.c_tla.get_world_values()
        elif self.ac.use_custom_tla:
            self.c_tla = tla.CustomTLA(
                filename=THISDIR.joinpath('custom_tla_data.csv'))
            custom_world_vals = self.c_tla.get_world_values()
        else:
            custom_world_vals = None
        self.tla_per_region = tla.tla_per_region(
            self.ae.get_land_distribution(),
            custom_world_values=custom_world_vals)

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE',
                'NOTE'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {}
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            main_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_columns = ['Year'] + dd.REGIONS
        tla_world_2050 = self.tla_per_region.loc[2050, 'World']
        ad_2018 = self.ac.ref_base_adoption['World']

        # Data Source 4-5
        # Zomer et al. 2014; Zomer, R. J., Trabucco, A., Coe, R., Place, F.,
        # Van Noordwijk, M., & Xu, J. C. (2014). Trees on farms: an update and
        # reanalysis of agroforestry’s global extent and socio-ecological characteristics.
        # World Agroforestry Center Working Paper, 179.
        ds5_adoption = ad_2018
        for y in range(2015, 2049):
            ds5_adoption = ds5_adoption * (1 + 0.0128)
        # In Excel, the 2018 adoption is used as 2014 and the 2048 adoption is used as 2050.
        ds5_ad_2050 = ds5_adoption

        # Data Source 6-9
        # Thomson et al. 2018; Thomson, A., Misselbrook, T., Moxley, J., Buys, G.,
        # Evans, C., Malcolm, H., ... & Reinsch, S. (2018). Quantifying the impact
        # of future land use scenarios to 2050 and beyond. Final report.
        ds6_cropland_percent = 0.05
        global_cropland = 1411.0
        remaining_cropland = global_cropland - ad_2018
        ds6_ad_2018 = 248.0  # No idea why ds6 uses a different adoption in 2018
        ds6_ad_2050 = (remaining_cropland * ds6_cropland_percent) + ds6_ad_2018
        ds7_cropland_percent = 0.1
        ds7_ad_2050 = (remaining_cropland * ds7_cropland_percent) + ad_2018
        ds8_cropland_percent = 0.2
        ds8_ad_2050 = (remaining_cropland * ds8_cropland_percent) + ad_2018
        ds9_cropland_percent = 0.39
        ds9_ad_2050 = (remaining_cropland * ds9_cropland_percent) + ad_2018

        ca_pds_data_sources = [
            {
                'name':
                'Medium, linear growth',
                'include':
                False,
                'description':
                ('Due to the unavailability of any historical data or future prognostication, '
                 'we have assumed a 75% adoption of the solution under this scenario. '
                 ),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [
                        2050, 0.75 * tla_world_2050, 0., 0., 0., 0., 0., 0.,
                        0., 0., 0.
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'High, linear growth',
                'include':
                False,
                'description':
                ('Due to the unavailability of any historical data or future prognostication, '
                 'we have assumed a 90% adoption of the solution under this scenario. '
                 ),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [
                        2050, 0.9 * tla_world_2050, 0., 0., 0., 0., 0., 0., 0.,
                        0., 0.
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Max, linear growth',
                'include':
                True,
                'description':
                ('Due to the unavailability of any historical data or future prognostication, '
                 'we have assumed a 100% adoption of the solution under this scenario. '
                 ),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [
                        2050, 1.0 * tla_world_2050, 0., 0., 0., 0., 0., 0., 0.,
                        0., 0.
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                '0.64% annual adoption increase based on Zomer 2014 global increase rates of <20% tree cover on cropland',
                'include':
                True,
                'description':
                ('Linear projection based on current global increase rates of tree cover '
                 'greater than 10% on cropland, as calculated based on Zomer et al. (2014) '
                 'data. Percent of agricultural land under >10% and >20% tree cover in 2000 '
                 "and 2010 was calculated (see 'Zomer2014-CurrentAdoption' sheet). We "
                 'compared this to total global cropland (1473 Mha according to GAEZ zones) '
                 'and calculated a global increase in 10-20% tree cover on cropland of 6.4% '
                 'from 2000 - 2010, which was converted to an annual increase rate of 0.64 % '
                 'for this scenario. '),
                'maximum':
                tla_world_2050,
                'growth_initial':
                pd.DataFrame(
                    [[2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.]],
                    columns=ca_pds_columns).set_index('Year'),
                'growth_rate':
                0.0064
            },
            {
                'name':
                '1.28% annual adoption increase based on Zomer 2014 global increase rates of <10% tree cover on cropland',
                'include':
                True,
                'description':
                ('Linear projection based on current global increase rates of tree cover '
                 'greater than 10% on cropland, as calculated based on Zomer et al. (2014) '
                 'data. Percent of agricultural land under >10% and >20% tree cover in 2000 '
                 "and 2010 was calculated (see 'Zomer2014-CurrentAdoption' sheet). We "
                 'compared this to total global cropland (1473 Mha according to GAEZ zones) '
                 'and calculated a global increase in 10-20% tree cover on cropland of 6.4% '
                 'from 2000 - 2010, which was doubled and converted to an annual increase '
                 'rate of 1.28 % for this scenario. '),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [2050, ds5_ad_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Low conversion of remaining cropland by 2050 (5% - UK medium ambition scenario)',
                'include':
                True,
                'description':
                ('Linear projection based on the projected rate of 5% conversion of remaining '
                 'cropland by 2050 as reported by Thomson et al. (2018) for UK projections of '
                 'future land-use change. Total remaining global cropland in 2014 is '
                 'estimated at 1225 Mha, which was calculated based on the difference between '
                 'total current cropland of 1473 Mha and the total global area already under '
                 'tree intercropping. '),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ds6_ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [2050, ds6_ad_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Medium conversion of remaining cropland by 2050 (10% - UK medium ambition scenario)',
                'include':
                True,
                'description':
                ('Linear projection based on the projected rate of 10% conversion of '
                 'remaining cropland by 2050 as reported by Thomson et al. (2018) for UK '
                 'projections of future land-use change. Total remaining global cropland in '
                 '2014 is estimated at 1225 Mha, which was calculated based on the difference '
                 'between total current cropland of 1473 Mha and the total global area '
                 'already under tree intercropping. '),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [2050, ds7_ad_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'High conversion of remaining cropland by 2050 (20%)',
                'include':
                True,
                'description':
                ('Linear projection estimating a medium current adoption rate of 20% of tree '
                 'intercropping on remaining global cropland. Total remaining global cropland '
                 'in 2014 is estimated at 1225 Mha, which was calculated based on the '
                 'difference between total current cropland of 1473 Mha and the total global '
                 'area already under tree intercropping. '),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [2050, ds8_ad_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Very high conversion of remaining cropland by 2050 (39% - current adoption in EU)',
                'include':
                True,
                'description':
                ('Linear projection based on current adoption rate of tree intercropping on '
                 'cropland in the EU, which is 39% as reported in den Herder et al. (2017). '
                 'This rate was applied to all current remaining global cropland by 2050. '
                 'Total remaining global cropland in 2014 is estimated at 1225 Mha, which was '
                 'calculated based on the difference between total current cropland of 1473 '
                 'Mha and the total global area already under tree intercropping. '
                 ),
                'maximum':
                tla_world_2050,
                'datapoints':
                pd.DataFrame([
                    [2018, ad_2018, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                    [2050, ds9_ad_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        for s in self.pds_ca.scenarios.values():
            df = s['df']
            df.loc[2012, 'World'] = 254.91717271225
            df.loc[2013, 'World'] = 256.900453733641
            df.loc[2014, 'World'] = 259.672330723017
            df.loc[2015, 'World'] = 261.743911973822
            df.loc[2016, 'World'] = 263.820565911005
            df.loc[2017, 'World'] = 265.901052727049
            df.loc[2018, 'World'] = 267.984718062521

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                '[Type Scenario 1 Name Here (REF CASE)...]',
                'include':
                True,
                'description':
                ('[PLEASE DESCRIBE IN DETAIL  THE METHODOLOGY YOU USED IN THIS ANALYSIS. BE '
                 'SURE TO INCLUDE ANY ADDITIONAL EQUATIONS YOU UTILIZED] '),
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        if self.ac.soln_ref_adoption_basis == 'Custom':
            ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region(
            )
        else:
            ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = self.tla_per_region.loc[2050] * (
            ht_ref_adoption_initial / self.tla_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        use_first_pds_datapoint_main = False
        if (self.ac.name == 'PDS-100p2050-Optimum'
                or self.ac.name == 'PDS-100p2050-Optimum-Jan2019'
                or self.ac.name == 'PDS-97p2050-Drawdown-Jan2019'):
            use_first_pds_datapoint_main = True
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=self.tla_per_region,
            pds_adoption_limits=self.tla_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            use_first_pds_datapoint_main=use_first_pds_datapoint_main,
            adoption_base_year=2018,
            copy_pds_to_ref=False,
            copy_ref_datapoint=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=self.tla_per_region,
            pds_total_adoption_units=self.tla_per_region,
            electricity_unit_factor=1000000.0,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_first_cost_uses_tot_units=True,
            fc_convert_iunit_factor=land.MHA_TO_HA)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=land.MHA_TO_HA)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2eq_emissions_saved=self.ua.
            direct_co2eq_emissions_saved_land(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            direct_co2_emissions_saved_land(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            direct_n2o_co2_emissions_saved_land(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            annual_land_area_harvested=self.ua.
            soln_pds_annual_land_area_harvested(),
            regime_distribution=self.ae.get_land_distribution(),
            regimes=dd.THERMAL_MOISTURE_REGIMES8)
示例#9
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Conservative Cases': {
                'Based on Smith et al (2014) 3rd IMO GHG Study - from Fig 82, 83 on P138, P139 (Max range) combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_based_on_Smith_et_al_2014_3rd_IMO_GHG_Study_from_Fig_82_83_on_P138_P139_Max_range_combin_1bc1c897.csv'
                ),
                'Based on Buhaug et al, (2009) 2nd IMO GHG Study - Table 7.4-7.6 pg 94-95 (Max Values) combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_based_on_Buhaug_et_al_2009_2nd_IMO_GHG_Study_Table_7_47_6_pg_9495_Max_Values_combined_wi_6529c612.csv'
                ),
                'Based on  RACE Project (2013) Current Transport Demand and Global Transport Outlook. Report D5.1, Table 30 pg 126, EU FP7 314753 (Max range) Table 30 pg 126 combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_based_on_RACE_Project_2013_Current_Transport_Demand_and_Global_Transport_Outlook__Report_b60b435c.csv'
                ),
            },
            'Ambitious Cases': {
                'Based on Smith et al (2014) 3rd IMO GHG Study - from Fig 82, 83 on P138, P139 (Min range) combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_based_on_Smith_et_al_2014_3rd_IMO_GHG_Study_from_Fig_82_83_on_P138_P139_Min_range_combin_c6961745.csv'
                ),
                'Based on Buhaug et al, (2009) 2nd IMO GHG Study - Table 7.4-7.6 pg 94-95 (Min Values) combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_based_on_Buhaug_et_al_2009_2nd_IMO_GHG_Study_Table_7_47_6_pg_9495_Min_Values_combined_wi_6f2a6b89.csv'
                ),
                'Based on  RACE Project (2013) Current Transport Demand and Global Transport Outlook. Report D5.1, Table 30 pg 126, EU FP7 314753 (Min range) Table 30 pg 126 combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_based_on_RACE_Project_2013_Current_Transport_Demand_and_Global_Transport_Outlook__Report_40df86b5.csv'
                ),
            },
            'Maximum Cases': {
                'OPRF (2008) Study On Worlds Changing Maritime Industry Pg 30 Appdx 1 combined with UNCTAD 2018 International Maritime Data to 2018':
                THISDIR.joinpath(
                    'tam',
                    'tam_OPRF_2008_Study_On_Worlds_Changing_Maritime_Industry_Pg_30_Appdx_1_combined_with_UNCTAD__8deff703.csv'
                ),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {}
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'PDS1 - Drawdown Team Calculations based on Projections from Smith et al (2014) - 3rd GHG Report of the IMO - Mean of projected EEOI values',
                'include':
                True,
                'description':
                ('We take the mean estimates of EEOI (Energy Efficiency Operations Index in '
                 'gCO2/ton-nmile) as projected by  several studies referenced in the 3rd GHG '
                 'IMO Study (Smith et al, 2014), interpolate for missing years and convert '
                 'them to Estimated ton-nautical mile adoptions assuming that an efficient '
                 'ship is one that adopts a fixed set of 17 technologies and slow steaming, '
                 'and a conventional (non-efficient) ship is one that has average efficiency '
                 'in 2014. '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS1_Drawdown_Team_Calculations_based_on_Projections_from_Smith_et_al_2014_3rd_GHG_Repor_3eb1a907.csv'
                )
            },
            {
                'name':
                'PDS2 - Drawdown Team Calculations based on Projections from Smith et al (2014) - 3rd GHG Report of the IMO - 1 StDev more Ambitious than mean in EEOI terms',
                'include':
                True,
                'description':
                ('We take (1 standard deviation below the mean of) the estimates of EEOI '
                 '(Energy Efficiency Operations Index in gCO2/ton-nmile) as projected by '
                 'several studies referenced in the 3rd GHG IMO Study (Smith et al, 2014), '
                 'interpolate for missing years and convert them to Estimated ton-nautical '
                 'mile adoptions assuming that an efficient ship is one that adopts a fixed '
                 'set of 17 technologies and slow steaming, and a conventional (non- '
                 'efficient) ship is one that has average efficiency in 2014. '
                 ),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS2_Drawdown_Team_Calculations_based_on_Projections_from_Smith_et_al_2014_3rd_GHG_Repor_e1bf2fbd.csv'
                )
            },
            {
                'name':
                'PDS3 - Drawdown Team Calculations based on Projections from Smith et al (2014) - 3rd GHG Report of the IMO - most ambitious values from all scenarios',
                'include':
                True,
                'description':
                ('We take the lowest estimates of EEOI (Energy Efficiency Operations Index in '
                 'gCO2/ton-nmile) as projected by  several studies referenced in the 3rd GHG '
                 'IMO Study (Smith et al, 2014), interpolate for missing years and convert '
                 'them to Estimated ton-nautical mile adoptions assuming that an efficient '
                 'ship is one that adopts a fixed set of 17 technologies and slow steaming, '
                 'and a conventional (non-efficient) ship is one that has average efficiency '
                 'in 2014. '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS3_Drawdown_Team_Calculations_based_on_Projections_from_Smith_et_al_2014_3rd_GHG_Repor_40d75a6d.csv'
                )
            },
            {
                'name':
                'Drawdown Book Edition 1 Scenario 1',
                'include':
                False,
                'description':
                ('We take the mean estimates of EEOI (Energy Efficiency Operations Index in '
                 'gCO2/ton-nmile) as projected by  several studies referenced in the 3rd GHG '
                 'IMO Study (Smith et al, 2014), interpolate for missing years and convert '
                 'them to Estimated ton-nautical mile adoptions assuming that an efficient '
                 'ship is one that adopts a fixed set of 17 technologies and slow steaming, '
                 'and a conventional (non-efficient) ship is one that has average efficiency '
                 'in 2008. This scenario follows the same process as PDS 1 above, but uses '
                 'the inputs from the model of the Drawdown Book edition 1, hence gets '
                 'different results. '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_1.csv')
            },
            {
                'name':
                'Drawdown Book Edition 1 Scenario 2',
                'include':
                False,
                'description':
                ('We take (1 standard deviation below the mean of) the estimates of EEOI '
                 '(Energy Efficiency Operations Index in gCO2/ton-nmile) as projected by '
                 'several studies referenced in the 3rd GHG IMO Study (Smith et al, 2014), '
                 'interpolate for missing years and convert them to Estimated ton-nautical '
                 'mile adoptions assuming that an efficient ship is one that adopts a fixed '
                 'set of 17 technologies and slow steaming, and a conventional (non- '
                 'efficient) ship is one that has average efficiency in 2008. This scenario '
                 'follows the same process as PDS 1 above, but uses the inputs from the model '
                 'of the Drawdown Book edition 1, hence gets different results. '
                 ),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_2.csv')
            },
            {
                'name':
                'Drawdown Book Edition 1 Scenario 3',
                'include':
                False,
                'description':
                ('We take the lowest estimates of EEOI (Energy Efficiency Operations Index in '
                 'gCO2/ton-nmile) as projected by  several studies referenced in the 3rd GHG '
                 'IMO Study (Smith et al, 2014), interpolate for missing years and convert '
                 'them to Estimated ton-nautical mile adoptions assuming that an efficient '
                 'ship is one that adopts a fixed set of 17 technologies and slow steaming, '
                 'and a conventional (non-efficient) ship is one that has average efficiency '
                 'in 2008. This scenario follows the same process as PDS 1 above, but uses '
                 'the inputs from the model of the Drawdown Book edition 1, hence gets '
                 'different results. '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_3.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=self.ac.soln_pds_adoption_custom_high_sd_mult,
            low_sd_mult=self.ac.soln_pds_adoption_custom_low_sd_mult,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2018])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            use_first_pds_datapoint_main=False,
            copy_pds_to_ref=True,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(
            ac=self.ac, grid_emissions_version=3)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#10
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TLA
        self.ae = aez.AEZ(solution_name=self.name,
                          cohort=2020,
                          regimes=dd.THERMAL_MOISTURE_REGIMES8)
        self.tla_per_region = tla.tla_per_region(
            self.ae.get_land_distribution())

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE',
                'NOTE'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Raw Data for ALL LAND TYPES': {
                'FAOSTAT (Sum of all Regions)':
                THISDIR.joinpath('ad', 'ad_FAOSTAT_Sum_of_all_Regions.csv'),
                'Prestele baseline and Topdown (moderate growth) projection':
                THISDIR.joinpath(
                    'ad',
                    'ad_Prestele_baseline_and_Topdown_moderate_growth_projection.csv'
                ),
                'Prestele baseline and BottoUp: (maximum)':
                THISDIR.joinpath(
                    'ad', 'ad_Prestele_baseline_and_BottoUp_maximum.csv'),
            },
            'Region: OECD90': {
                'Raw Data for ALL LAND TYPES': {
                    'FAOSTAT':
                    THISDIR.joinpath('ad', 'ad_FAOSTAT.csv'),
                    'Prestele baseline and Topdown (moderate growth) projection':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Prestele_baseline_and_Topdown_moderate_growth_projection.csv'
                    ),
                    'Prestele baseline and BottoUp: (maximum)':
                    THISDIR.joinpath(
                        'ad', 'ad_Prestele_baseline_and_BottoUp_maximum.csv'),
                },
            },
            'Region: Eastern Europe': {
                'Raw Data for ALL LAND TYPES': {
                    'FAOSTAT':
                    THISDIR.joinpath('ad', 'ad_FAOSTAT.csv'),
                    'Prestele baseline and Topdown (moderate growth) projection':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Prestele_baseline_and_Topdown_moderate_growth_projection.csv'
                    ),
                    'Prestele baseline and BottoUp: (maximum)':
                    THISDIR.joinpath(
                        'ad', 'ad_Prestele_baseline_and_BottoUp_maximum.csv'),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Raw Data for ALL LAND TYPES': {
                    'FAOSTAT':
                    THISDIR.joinpath('ad', 'ad_FAOSTAT.csv'),
                    'Prestele baseline and Topdown (moderate growth) projection':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Prestele_baseline_and_Topdown_moderate_growth_projection.csv'
                    ),
                    'Prestele baseline and BottoUp: (maximum)':
                    THISDIR.joinpath(
                        'ad', 'ad_Prestele_baseline_and_BottoUp_maximum.csv'),
                },
            },
            'Region: Middle East and Africa': {
                'Raw Data for ALL LAND TYPES': {
                    'FAOSTAT':
                    THISDIR.joinpath('ad', 'ad_FAOSTAT.csv'),
                    'Prestele baseline and Topdown (moderate growth) projection':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Prestele_baseline_and_Topdown_moderate_growth_projection.csv'
                    ),
                    'Prestele baseline and BottoUp: (maximum)':
                    THISDIR.joinpath(
                        'ad', 'ad_Prestele_baseline_and_BottoUp_maximum.csv'),
                },
            },
            'Region: Latin America': {
                'Raw Data for ALL LAND TYPES': {
                    'FAOSTAT':
                    THISDIR.joinpath('ad', 'ad_FAOSTAT.csv'),
                    'Prestele baseline and Topdown (moderate growth) projection':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Prestele_baseline_and_Topdown_moderate_growth_projection.csv'
                    ),
                    'Prestele baseline and BottoUp: (maximum)':
                    THISDIR.joinpath(
                        'ad', 'ad_Prestele_baseline_and_BottoUp_maximum.csv'),
                },
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            main_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_columns = ['Year'] + dd.REGIONS
        tla_2050 = self.tla_per_region.loc[2050]
        ad_2018 = pd.Series(self.ac.ref_base_adoption)

        # % smallholder area, based on updates to smallholder area VMA sheet
        # (34.1% was estimated in Book Ed1)
        smallholder_land = 0.315909724971454
        large_farm_land = 1.0 - smallholder_land
        max_cons_ag_large_farm_tla = self.tla_per_region.loc[
            2050] * large_farm_land
        max_cons_ag_large_farm_tla[dd.SPECIAL_COUNTRIES] = 0.0
        ad_2080 = 1.5 * pd.Series(self.ac.ref_base_adoption)

        # Maximum technical potential adoption area available for CA out of the 685 Mha based
        # on percentage in Prestele et al 2018 (81.4%, bottom up, likely maximum future area)
        # Values used in 2017 Project Drawdown book publication.
        prestele_pct_book = pd.Series(
            [0., 0.3952, 0.1662, 0.1632, 0.1422, 0.7332, 0., 0., 0., 0.],
            index=dd.REGIONS)
        prestele_mult = 0.814
        prestele_ad_book = self.tla_per_region.loc[
            2050] * prestele_mult * prestele_pct_book

        # Data Source 1
        # Source: Refer sheet "PD regional CA annual adoption"
        if 'BookVersion' in self.ac.name:
            pct = pd.Series(
                [0., 0.3952, 0.1662, 0.1632, 0.1422, 0.7332, 0., 0., 0., 0.],
                index=dd.REGIONS)
        else:
            pct = pd.Series([
                0., 0.465683756524670, 0.169344179047277, 0.194261406995049,
                0.141859451675443, 0.712235299292505, 0., 0., 0., 0.
            ],
                            index=dd.REGIONS)
        ds1_poss_adopt_2050 = max_cons_ag_large_farm_tla * pct
        ds1_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds1_datapoints.loc[2018] = ad_2018
        ds1_datapoints.loc[2030] = (1.0 * ds1_poss_adopt_2050)
        ds1_datapoints.loc[2050] = (1.0 * ds1_poss_adopt_2050)
        ds1_datapoints.loc[2080] = ad_2080
        ds1_datapoints['World'] = 0.0
        ds1_datapoints['World'] = ds1_datapoints.sum(axis=1)

        # Data Source 2
        # Source: Refer sheet "PD regional CA annual adoption"
        if 'BookVersion' in self.ac.name:
            pct = pd.Series(
                [0., 0.7208, 0.4918, 0.4888, 0.4678, 1.0, 0., 0., 0., 0.],
                index=dd.REGIONS)
        else:
            pct = pd.Series([
                0., 0.791283756524669, 0.494944179047277, 0.519861406995050,
                0.467459451675442, 1.037835299292510, 0., 0., 0., 0.
            ],
                            index=dd.REGIONS)
        ds2_poss_adopt_2050 = max_cons_ag_large_farm_tla * pct
        ds2_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds2_datapoints.loc[2018] = ad_2018
        ds2_datapoints.loc[2030] = (1.0 * ds2_poss_adopt_2050)
        ds2_datapoints.loc[2050] = (1.0 * ds2_poss_adopt_2050)
        ds2_datapoints.loc[2080] = ad_2080
        ds2_datapoints['World'] = 0.0
        ds2_datapoints['World'] = ds2_datapoints.sum(axis=1)

        # Data Source 3
        # Source: Refer sheet "PD regional CA annual adoption"
        ds3_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds3_datapoints.loc[2018] = ad_2018
        ds3_datapoints.loc[2030] = (0.8 * max_cons_ag_large_farm_tla)
        ds3_datapoints.loc[2050] = (1.0 * max_cons_ag_large_farm_tla)
        ds3_datapoints.loc[2080] = ad_2080
        ds3_datapoints['World'] = 0.0
        ds3_datapoints['World'] = ds3_datapoints.sum(axis=1)

        # Data Source 4
        # Source: Refer sheet "PD regional CA annual adoption"
        ds4_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds4_datapoints.loc[2018] = ad_2018
        ds4_datapoints.loc[2030] = (0.8 * ds2_poss_adopt_2050)
        ds4_datapoints.loc[2050] = (0.6 * ds2_poss_adopt_2050)
        ds4_datapoints.loc[2080] = ad_2080
        ds4_datapoints['World'] = 0.0
        ds4_datapoints['World'] = ds4_datapoints.sum(axis=1)

        # Data Source 5
        # Source: Refer sheet "PD regional CA annual adoption"
        ds5_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds5_datapoints.loc[2018] = ad_2018
        ds5_datapoints.loc[2030] = (0.8 * ds1_poss_adopt_2050)
        ds5_datapoints.loc[2050] = (0.6 * ds1_poss_adopt_2050)
        ds5_datapoints.loc[2080] = ad_2080
        ds5_datapoints['World'] = 0.0
        ds5_datapoints['World'] = ds5_datapoints.sum(axis=1)

        # Data Source 6
        # Source: see PresteleAdoptionCalc sheet
        if 'BookVersion' in self.ac.name:
            ds6_prestele_poss_adopt_2050 = prestele_ad_book
        else:
            pct = pd.Series([
                0., 0.740285597497468, 0.61878404520945, 0.581170964964222,
                0.0900760503108076, 0.803736844958406, 0., 0., 0., 0.
            ],
                            index=dd.REGIONS)
            ds6_prestele_poss_adopt_2050 = self.tla_per_region.loc[
                2050] * prestele_mult * pct
        ds6_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds6_datapoints.loc[2018] = ad_2018
        ds6_datapoints.loc[2030] = (0.8 * ds6_prestele_poss_adopt_2050)
        ds6_datapoints.loc[2050] = (0.6 * ds6_prestele_poss_adopt_2050)
        ds6_datapoints.loc[2080] = ad_2080
        ds6_datapoints['World'] = 0.0
        ds6_datapoints['World'] = ds6_datapoints.sum(axis=1)

        # Data Source 7
        # Source: see PresteleAdoptionCalc sheet
        if 'BookVersion' in self.ac.name:
            ds7_prestele_poss_adopt_2050 = prestele_ad_book
        else:
            pct = pd.Series(
                [0., 1.0, 1.0, 1.0, 0.320741884451365, 1.0, 0., 0., 0., 0.],
                index=dd.REGIONS)
            ds7_prestele_poss_adopt_2050 = self.tla_per_region.loc[
                2050] * prestele_mult * pct
        ds7_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds7_datapoints.loc[2018] = ad_2018
        ds7_datapoints.loc[2030] = (0.8 * ds7_prestele_poss_adopt_2050)
        ds7_datapoints.loc[2050] = (0.6 * ds7_prestele_poss_adopt_2050)
        ds7_datapoints.loc[2080] = ad_2080
        ds7_datapoints['World'] = 0.0
        ds7_datapoints['World'] = ds7_datapoints.sum(axis=1)

        # Data Source 8
        # Source: see PresteleAdoptionCalc sheet
        if 'BookVersion' in self.ac.name:
            ds8_prestele_poss_adopt_2050 = prestele_ad_book
        else:
            pct = pd.Series([
                0., 0.46568375652467, 0.169344179047277, 0.194261406995049,
                0.141859451675443, 0.712235299292505, 0., 0., 0., 0.
            ],
                            index=dd.REGIONS)
            ds8_prestele_poss_adopt_2050 = self.tla_per_region.loc[
                2050] * prestele_mult * pct
        ds8_datapoints = pd.DataFrame(columns=ca_pds_columns).set_index('Year')
        ds8_datapoints.loc[2018] = ad_2018
        ds8_datapoints.loc[2050] = (1.0 * ds8_prestele_poss_adopt_2050)
        ds8_datapoints['World'] = 0.0
        ds8_datapoints['World'] = ds8_datapoints.sum(axis=1)

        ca_pds_data_sources = [
            {
                'name':
                'Low,High Early Adoption, Polynomial Trend',
                'include':
                False,
                'description':
                ('An annual growth rate of 0.36% was used to forecast regional adoption. '
                 'Regional adoption of CA in the year 2050 was calculated and their '
                 'percentage to the total arable land area was estimated, and are used as '
                 'assumptions 1-5, below. It is also assumed that 100% of the projected '
                 'adoption will be achieved by 2030. As, it is a bridge solution to RA, the '
                 'area under CA will decline post 2030 and will remains to only 80% of the '
                 'estimated adoption by 2050. '),
                'datapoints':
                ds1_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name':
                'High,High Early Adoption, Polynomial Trend',
                'include':
                False,
                'description':
                ('Adoption of CA was reported maximum in Brazil, across the globe. Thus, its '
                 'annual growth rate of 1.24% was used to forecast regional adoption. '
                 'Regional adoption of CA in the year 2050 was calculated and their '
                 'percentage to the total arable land area was estimated, and are used as '
                 'assumptions 1-5, below. It is also assumed that 100% of the projected '
                 'adoption will be achieved by 2030. As, it is a bridge solution to RA, the '
                 'area under CA will decline post 2030 and will remains to only 80% of the '
                 'estimated adoption by 2050. '),
                'datapoints':
                ds2_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name':
                'Max, Polynomial Trend',
                'include':
                False,
                'description':
                ('A 100% regional adoption was assumed in this scenario. '),
                'datapoints':
                ds3_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name':
                'High, Early Adoption, Polynomial Trend',
                'include':
                False,
                'description':
                ('Adoption of CA was reported maximum in Brazil, across the globe. Thus, its '
                 'annual growth rate of 1.24% was used to forecast regional adoption. '
                 'Regional adoption of CA in the year 2050 was calculated and their '
                 'percentage to the total arable land area was estimated, and are used as '
                 'assumptions 1-5, below. It is also assumed that 80% of the projected '
                 'adoption will be achieved by 2030. As, it is a bridge solution to RA, the '
                 'area under CA will decline post 2030 and will remains to only 60% of the '
                 'estimated adoption by 2050. '),
                'datapoints':
                ds4_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name':
                'Low, Early Adoption, Polynomial Trend',
                'include':
                False,
                'description':
                ('An annual growth rate of 0.36% was used to forecast regional adoption. '
                 'Regional adoption of CA in the year 2050 was calculated and their '
                 'percentage to the total arable land area was estimated, and are used as '
                 'assumptions 1-5, below. It is also assumed that 80% of the projected '
                 'adoption will be achieved by 2030. As, it is a bridge solution to RA, the '
                 'area under CA will decline post 2030 and will remains to only 60% of the '
                 'estimated adoption by 2050. '),
                'datapoints':
                ds5_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name':
                'Moderate CA Adoption rates based on Prestele Topdown map, polynomial',
                'include':
                False,
                'description':
                ('Regional adoption of CA in the year 2050 was calculated and their '
                 'percentage to the total arable land area was estimated, and are used as '
                 'assumptions 1-5, below. It is also assumed that 80% of the projected '
                 'adoption will be achieved by 2030. It is a bridge solution to RA so the '
                 'area under CA will decline post 2030 and will remain to only 60% of the '
                 'estimated adoption by 2050. SEI added current and projected adoption and '
                 'max potential adoption (assumption 10)  based on Prestele et al 2018. after '
                 'applying Prestele regional percent adoption by TopDown projection '
                 '(intermediate adoption rate to 2050), to country -level data available in '
                 'their supplementary materials, then summing by PDrawdown regions (which '
                 'differ from Prestele regions). The % of regional Drawdown TLA projected by '
                 '2050 using Prestele projections (not mean of data) was calculated and used '
                 'in Revised growth assumptions 1-5. '),
                'datapoints':
                ds6_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name':
                'Likely max CA based on Prestele BottomUp Map, polynominal',
                'include':
                False,
                'description':
                ('Regional adoption of CA in the year 2050 was calculated and their '
                 'percentage to the total arable land area was estimated, and are used as '
                 'assumptions 1-5, below. It is also assumed that 80% of the projected '
                 'adoption will be achieved by 2030. It is a bridge solution to RA so the '
                 'area under CA will decline post 2030 and will remain to only 60% of the '
                 'estimated adoption by 2050. SEI added current and projected adoption and '
                 'max potential adoption (assumption 10)  based on Prestele et al 2018. after '
                 'applying Prestele regional percent adoption by BOTTOM UP projection (forced '
                 'to 2050), to country -level data available in their supplementary '
                 'materials, then summing by PDrawdown regions (which differ from Prestele '
                 'regions). The % of regional Drawdown TLA projected by 2050 using Prestele '
                 'projections (not mean of data) was calculated OR if the bottom up '
                 'projection result in extent larger than Drawdown regional TLA, then 100% '
                 'was used in Revised growth assumptions 1-5. '),
                'datapoints':
                ds7_datapoints,
                'datapoints_degree':
                3
            },
            {
                'name': 'Baseline scenario',
                'include': True,
                'description': ('tis is the average of scenarios 1-7 '),
                'datapoints': ds8_datapoints,
                'maximum': max_cons_ag_large_farm_tla['World']
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        for s in self.pds_ca.scenarios.values():
            df = s['df']
            df.loc[2014] = [
                108.926170040128000, 43.700575542980000, 9.040960261572450,
                8.934730992728910, 1.113417893008100, 46.136485349838400, 0.0,
                0.0, 0.0, 0.0
            ]
            df.loc[2015] = [
                118.522634649202000, 47.190416175021700, 10.277201842542000,
                10.390765035686000, 1.355692262948170, 49.308559333003700, 0.0,
                0.0, 0.0, 0.0
            ]
            df.loc[2016] = [
                128.231557482326000, 50.685767480789800, 11.580017143547000,
                11.936077959964700, 1.613327416836600, 52.416367481188000, 0.0,
                0.0, 0.0, 0.0
            ]
            df.loc[2017] = [
                138.054065103220000, 54.187020002847500, 12.949707603363100,
                13.570892429945200, 1.886419963055470, 55.460025104009000, 0.0,
                0.0, 0.0, 0.0
            ]
            df.loc[2018] = [
                147.991284075603000, 57.694564283758300, 14.386574660765900,
                15.295431110007600, 2.175066509986860, 58.439647511084400, 0.0,
                0.0, 0.0, 0.0
            ]

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                '[Type Scenario 1 Name Here (REF CASE)...]',
                'include':
                True,
                'description':
                ('[PLEASE DESCRIBE IN DETAIL  THE METHODOLOGY YOU USED IN THIS ANALYSIS. BE '
                 'SURE TO INCLUDE ANY ADDITIONAL EQUATIONS YOU UTILIZED] '),
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        if self.ac.soln_ref_adoption_basis == 'Custom':
            ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region(
            )
        else:
            ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = self.tla_per_region.loc[2050] * (
            ht_ref_adoption_initial / self.tla_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=self.tla_per_region,
            pds_adoption_limits=self.tla_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            use_first_pds_datapoint_main=False,
            adoption_base_year=2018,
            copy_pds_to_ref=False,
            copy_ref_datapoint=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=self.tla_per_region,
            pds_total_adoption_units=self.tla_per_region,
            electricity_unit_factor=1000000.0,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_first_cost_uses_tot_units=True,
            fc_convert_iunit_factor=land.MHA_TO_HA)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=land.MHA_TO_HA)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2eq_emissions_saved=self.ua.
            direct_co2eq_emissions_saved_land(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            direct_co2_emissions_saved_land(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            direct_n2o_co2_emissions_saved_land(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            annual_land_area_harvested=self.ua.
            soln_pds_annual_land_area_harvested(),
            regime_distribution=self.ae.get_land_distribution(),
            regimes=dd.THERMAL_MOISTURE_REGIMES8)
示例#11
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Low', 'Low', 'Medium', 'Medium', 'Low', 'Medium',
                'Medium', 'Low', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Organic Fraction of MSW - From Waste TAM':
                THISDIR.joinpath(
                    'tam', 'tam_Organic_Fraction_of_MSW_From_Waste_TAM.csv'),
            },
            'Region: OECD90': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: Eastern Europe': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: Latin America': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
            'Region: EU': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                    'European Commission DG Environment - Arcadis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_European_Commission_DG_Environment_Arcadis.csv'),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'Organic Fraction of MSW - Waste TAM':
                    THISDIR.joinpath(
                        'tam', 'tam_Organic_Fraction_of_MSW_Waste_TAM.csv'),
                },
            },
        }
        tam_pds_data_sources = {
            'Baseline Cases': {
                'Drawdown TAM: Organic Fraction of MSW - Waste TAM':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Organic_Fraction_of_MSW_Waste_TAM.csv'
                ),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_pds_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'Calculated based on What a Waste and USA as PDS Benchmark (See Adoption Factoring)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Calculated_based_on_What_a_Waste_and_USA_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                ),
            },
            'Conservative Cases': {
                'IPCC, 2006 Calculated':
                THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
            },
            'Ambitious Cases': {
                'Calculated based on What a Waste and EU as PDS Benchmark (See Adoption Factoring)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Calculated_based_on_What_a_Waste_and_EU_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                ),
            },
            'Region: OECD90': {
                'Baseline Cases': {
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
                'Conservative Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                },
                'Ambitious Cases': {
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW).1':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW_1.csv'
                    ),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Baseline Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                },
                'Conservative Cases': {
                    'Calculated based on What a Waste and USA as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_USA_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
                'Ambitious Cases': {
                    'Calculated based on What a Waste and EU as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_EU_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                    'Calculated based on What a Waste and USA as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_USA_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
                'Ambitious Cases': {
                    'Calculated based on What a Waste and EU as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_EU_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'Song, L. et al. Study on the Current Situation of Municipal Solid Waste Composting in China and Development Trend. 2012':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Song_L__et_al__Study_on_the_Current_Situation_of_Municipal_Solid_Waste_Composting_in_Chi_f57570b9.csv'
                    ),
                },
                'Conservative Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'Kharvel, R. Sustainable Solid Waste Management in Inidia. SEAS, Columbia Thesis. 2012':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Kharvel_R__Sustainable_Solid_Waste_Management_in_Inidia__SEAS_Columbia_Thesis__2012.csv'
                    ),
                },
            },
            'Region: EU': {
                'Baseline Cases': {
                    'EUROSTAT, 2016. http://ec.europa.eu/eurostat/statistics-explained/index.php/Municipal_waste_statistics':
                    THISDIR.joinpath(
                        'ad',
                        'ad_EUROSTAT_2016__httpec_europa_eueurostatstatisticsexplainedindex_phpMunicipal_waste_statistics.csv'
                    ),
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'EPA, MSW trends, 2012 https://www.epa.gov/sites/production/files/2015-09/documents/2012_msw_fs.pdf':
                    THISDIR.joinpath(
                        'ad',
                        'ad_EPA_MSW_trends_2012_httpswww_epa_govsitesproductionfiles201509documents2012_msw_fs_pdf.csv'
                    ),
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            main_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Drawdown Customized Scenario 1',
                'include':
                True,
                'description':
                ('This scenario uses mainly the high growth prognostication from existing '
                 'sources, (See Adoption Data sheet for the Mean+1 SD projection). The '
                 'adoption is limited for later years by feedstocks however. This is a result '
                 'of integration with other solutions in Project Drawdown. '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_1.csv')
            },
            {
                'name':
                'Drawdown Customized Scenario 2',
                'include':
                True,
                'description':
                ('This scenario uses mainly the high growth prognostication from existing '
                 'sources until 2029, (See Adoption Data sheet for the Mean+1 SD projection) '
                 'then is optimized to approach 98% of the organic feedstock by 2060 (using '
                 'integrated data across all Materials and Food solutions in Project '
                 "Drawdown's Solution Set). "),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_2.csv')
            },
            {
                'name':
                'Drawdown Customized Scenario 3',
                'include':
                True,
                'description':
                ('This scenario considers the total current USA portion of solid waste as '
                 'calculated by taking the reliable EPA data from 2014 and dividing it by the '
                 "2014 TAM derived from the multiple TAM sources on 'TAM Data.'  This USA "
                 'percentage is considered the "optimistic and plausible ceiling" for '
                 'adoption of composting of MSW and for each region, the current 2014 % '
                 'adoption of compost of organic MSW is taken as the base and a linear '
                 'increase in adoption is forecast until it reaches the USA percentage in '
                 '2050.  The resulting percentages for each year are multiplied against the '
                 'TAM (Organic fraction MSW) to derive a schedule of forecast values of MMT '
                 'of  Composted MSW for each Drawdown region and summed for the World.  This '
                 'provides another projection which is more conservative than the EU ceiling '
                 'scenario. '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_3.csv')
            },
            {
                'name':
                'Drawdown Customized Scenario 4',
                'include':
                True,
                'description':
                ('This scenario considers the total current EU portion of solid waste as '
                 'calculated by taking the reliable Eurostat data from 2014 and dividing it '
                 "by the 2014 TAM derived from the multiple TAM sources on 'TAM Data.'  This "
                 'EU percentage is considered the "optimistic and plausible ceiling" for '
                 'adoption of composting of MSW and for each region the current 2014 % '
                 'adoption of compost of organic MSW is taken as the base and a linear '
                 'increase in adoption is forecast until it reaches the EU percentage in '
                 '2050.  The resulting percentages for each year are multiplied against the '
                 'TAM (Organic fraction MSW) to derive a schedule of forecast values of MMT '
                 'of  Composted MSW for each Drawdown region and summed for the World. '
                 ),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_4.csv')
            },
            {
                'name':
                'PDS 1 Post Integration Aug 2019',
                'include':
                True,
                'description':
                ('[PLEASE DESCRIBE IN DETAIL  THE METHODOLOGY YOU USED IN THIS ANALYSIS. BE '
                 'SURE TO INCLUDE ANY ADDITIONAL EQUATIONS YOU UTILIZED] '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS_1_Post_Integration_Aug_2019.csv')
            },
            {
                'name':
                'PDS 2 Post Integration Aug 2019',
                'include':
                True,
                'description':
                ('[PLEASE DESCRIBE IN DETAIL  THE METHODOLOGY YOU USED IN THIS ANALYSIS. BE '
                 'SURE TO INCLUDE ANY ADDITIONAL EQUATIONS YOU UTILIZED] '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS_2_Post_Integration_Aug_2019.csv')
            },
            {
                'name':
                'PDS 3 Post Integration Aug 2019',
                'include':
                True,
                'description':
                ('[PLEASE DESCRIBE IN DETAIL  THE METHODOLOGY YOU USED IN THIS ANALYSIS. BE '
                 'SURE TO INCLUDE ANY ADDITIONAL EQUATIONS YOU UTILIZED] '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS_3_Post_Integration_Aug_2019.csv')
            },
            {
                'name':
                'PDS1-US Growth Path, May2020',
                'include':
                True,
                'description':
                ('All regions follow the growth path of the US starting with their 2016 '
                 'adoption % rate '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS1US_Growth_Path_May2020.csv')
            },
            {
                'name':
                'PDS2-EU Growth Path, May 2020',
                'include':
                True,
                'description':
                ('All regions follow the EU growth path starting with their 2016 adoption '
                 'percent '),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS2EU_Growth_Path_May_2020.csv')
            },
            {
                'name':
                'PDS3-Austria Growth Path, May 2020',
                'include':
                True,
                'description':
                ('OECD follows EU pledge (met by Austria in 2008) to reduce to 35% the amount '
                 'of organic matter in landfills in 20 years (65% increase in diversion to '
                 'composting from current level). All other regions increase at the same '
                 "rate. Bounded by OECD max in 2036 (73%), which is the same as Austria's "
                 'current composting rate. - Note that not all organic matter can be '
                 'composted as some will end up processed by AD, even in the optimum scenario '
                 ),
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS3Austria_Growth_Path_May_2020.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=self.ac.soln_pds_adoption_custom_high_sd_mult,
            low_sd_mult=self.ac.soln_pds_adoption_custom_low_sd_mult,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2016])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2016] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2016] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            use_first_pds_datapoint_main=False,
            copy_pds_to_ref=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#12
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        self.tm = tam.TAM(
            tamconfig=tamconfig,
            tam_ref_data_sources=rrs.energy_tam_2_ref_data_sources,
            tam_pds_data_sources=rrs.energy_tam_2_pds_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'Based on IEA, WEO-2018, Current Policies Scenario (CPS)':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IEA_WEO2018_Current_Policies_Scenario_CPS.csv'
                ),
                'Based on: IEA ETP 2017 Ref Tech':
                THISDIR.joinpath('ad',
                                 'ad_based_on_IEA_ETP_2017_Ref_Tech.csv'),
                'Based on Equinor (2018), Rivalry Scenario':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_Equinor_2018_Rivalry_Scenario.csv'),
                'Based on IEEJ Outlook - 2019, Ref Scenario':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_IEEJ_Outlook_2019_Ref_Scenario.csv'),
            },
            'Conservative Cases': {
                'Based on IEA, WEO-2018, New Policies Scenario (NPS)':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IEA_WEO2018_New_Policies_Scenario_NPS.csv'),
                'Based on Equinor (2018), Reform Scenario':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_Equinor_2018_Reform_Scenario.csv'),
                'Based on IEEJ Outlook - 2019, Advanced Tech Scenario':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IEEJ_Outlook_2019_Advanced_Tech_Scenario.csv'
                ),
            },
            'Ambitious Cases': {
                'Based on IEA, WEO-2018, SDS Scenario':
                THISDIR.joinpath('ad',
                                 'ad_based_on_IEA_WEO2018_SDS_Scenario.csv'),
                'Based on: IEA ETP 2017 B2DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_B2DS.csv'),
                'Based on IRENA. 2018) Roadmap-2050, REmap Case':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_IRENA__2018_Roadmap2050_REmap_Case.csv'),
                'Based on: IEA ETP 2017 2DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_2DS.csv'),
                'Based on Equinor (2018), Renewal Scenario':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_Equinor_2018_Renewal_Scenario.csv'),
            },
            '100% RES2050 Case': {
                'Based on average of: LUT/EWG 2019 100% RES, Ecofys 2018 1.5C and Greenpeace 2015 Advanced Revolution':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_average_of_LUTEWG_2019_100_RES_Ecofys_2018_1_5C_and_Greenpeace_2015_Advanced_Revolution.csv'
                ),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Legacy Book Scenario - High Ambitious, double growth by 2030 & 2050',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Legacy_Book_Scenario_High_Ambitious_double_growth_by_2030_2050.csv'
                )
            },
            {
                'name':
                'Legacy Book Scenario - Conservative Growth of 2.5% annum',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Legacy_Book_Scenario_Conservative_Growth_of_2_5_annum.csv'
                )
            },
            {
                'name':
                'Legacy Book Scenario. Low Ambitious Growth, 10% higher compared to REF case',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Legacy_Book_Scenario__Low_Ambitious_Growth_10_higher_compared_to_REF_case.csv'
                )
            },
            {
                'name':
                'Ambitious Cases (Legacy Book and February 2019 Update)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Ambitious_Cases_Legacy_Book_and_February_2019_Update.csv'
                )
            },
            {
                'name':
                'Conservative Cases (Legacy Book and February 2019 Update)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Conservative_Cases_Legacy_Book_and_February_2019_Update.csv'
                )
            },
            {
                'name':
                'Baseline Cases (Legacy Book and February 2019 Update)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Baseline_Cases_Legacy_Book_and_February_2019_Update.csv'
                )
            },
            {
                'name':
                '100% RE Cases',
                'include':
                True,
                'filename':
                THISDIR.joinpath('ca_pds_data',
                                 'custom_pds_ad_100_RE_Cases.csv')
            },
            {
                'name':
                'High growth  Scenario @ 1.6% per annum (Feb 2019 update)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_High_growth_Scenario_1_6_per_annum_Feb_2019_update.csv'
                )
            },
            {
                'name':
                'Medium Growth Scenario @ 1.33% per annum (Feb 2019 update)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Medium_Growth_Scenario_1_33_per_annum_Feb_2019_update.csv'
                )
            },
            {
                'name':
                'Low Growth Scenario @ 10.8% per annum (Feb 2019 update)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Low_Growth_Scenario_10_8_per_annum_Feb_2019_update.csv'
                )
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                '[Type Scenario 1 Name Here (REF CASE)...]',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv')
            },
            {
                'name':
                '[Type Scenario 2 Name Here (REF CASE)...]',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_2_Name_Here_REF_CASE_.csv')
            },
            {
                'name':
                '[Type Scenario 3 Name Here (REF CASE)...]',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_3_Name_Here_REF_CASE_.csv')
            },
            {
                'name':
                '[Type Scenario 4 Name Here (REF CASE)...]',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_4_Name_Here_REF_CASE_.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        if self.ac.soln_ref_adoption_basis == 'Custom':
            ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region(
            )
        else:
            ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            use_first_pds_datapoint_main=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source,
            adoption_base_year=2018,
            copy_pds_to_ref=True)

        self.ef = emissionsfactors.ElectricityGenOnGrid(
            ac=self.ac, grid_emissions_version=2)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=rrs.TERAWATT_TO_KILOWATT)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#13
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'IEA 2006 Lights Labours Lost for 2005 & GDP growth rate as future forecast, see IEA 2006 sheet':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2006_Lights_Labours_Lost_for_2005_GDP_growth_rate_as_future_forecast_see_IEA_2006_sheet.csv'
                ),
                'IEA 2006 Lights Labours Lost for 2030 (current policy) & GDP growth rate as past estimate/future forecast, see IEA 2006 sheet':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2006_Lights_Labours_Lost_for_2030_current_policy_GDP_growth_rate_as_past_estimatefut_0d9e2767.csv'
                ),
                'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                ),
            },
            'Conservative Cases': {
                'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                ),
                'EIA IEO energy; average efficacy estimated, interpolated':
                THISDIR.joinpath(
                    'tam',
                    'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated.csv'
                ),
                'EIA IEO electricity; average efficacy estimated, interpolated, 2nd order polynomial':
                THISDIR.joinpath(
                    'tam',
                    'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_order_polynomial.csv'
                ),
            },
            'Ambitious Cases': {
                'IEA 2006 Lights Labours Lost for 2030 (least life cycle cost scenario)& GDP growth rate as past estimate/future forecast, see IEA 2006 sheet':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2006_Lights_Labours_Lost_for_2030_least_life_cycle_cost_scenario_GDP_growth_rate_as__a7eda2ee.csv'
                ),
                'Floor space :Urge Vorsats et al. 2015; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                THISDIR.joinpath(
                    'tam',
                    'tam_Floor_space_Urge_Vorsats_et_al__2015_Average_illuminance_see_Lux_lm_per_m2_Average_opera_7fac112b.csv'
                ),
            },
            'Maximum Cases': {
                'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                THISDIR.joinpath(
                    'tam',
                    'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_05cb930f.csv'
                ),
            },
            'Region: OECD90': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Conservative Cases': {
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd order':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_order.csv'
                    ),
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd order':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_order.csv'
                    ),
                },
                'Maximum Cases': {
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_05cb930f.csv'
                    ),
                },
            },
            'Region: Eastern Europe': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                },
                'Maximum Cases': {
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data, 2nd order':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_7c1f094c.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                },
                'Conservative Cases': {
                    'EIA IEO electricity; average efficacy estimated, interpolated':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated.csv'
                    ),
                },
                'Ambitious Cases': {
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Maximum Cases': {
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_0f701d19.csv'
                    ),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                },
                'Conservative Cases': {
                    'EIA IEO electricity; average efficacy estimated, interpolated':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated.csv'
                    ),
                },
                'Ambitious Cases': {
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Maximum Cases': {
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_05cb930f.csv'
                    ),
                },
            },
            'Region: Latin America': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Conservative Cases': {
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                },
                'Maximum Cases': {
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_05cb930f.csv'
                    ),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Conservative Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                },
                'Ambitious Cases': {
                    'Floor space: Hong et al.; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_Hong_et_al__Average_illuminance_see_Lux_lm_per_m2_Average_operating_hours_ha_cd4d6751.csv'
                    ),
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data, 2nd poly (declines at the end)':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_14adb205.csv'
                    ),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'EIA IEO energy; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Conservative Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                },
                'Maximum Cases': {
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_05cb930f.csv'
                    ),
                },
            },
            'Region: EU': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_0f701d19.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Conservative Cases': {
                    'EIA IEO energy; average efficacy estimated, interpolated':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_energy_average_efficacy_estimated_interpolated.csv'
                    ),
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'IEA 2006 (Mlmh/capita and population data) and GDP growth':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2006_Mlmhcapita_and_population_data_and_GDP_growth.csv'
                    ),
                    'EIA IEO electricity; average efficacy estimated, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_IEO_electricity_average_efficacy_estimated_interpolated_2nd_poly.csv'
                    ),
                    'ETP2016 6 DS; average efficacy flat at 2014 level; interpolated, 2nd poly; see ETP2016 TAM sheet':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ETP2016_6_DS_average_efficacy_flat_at_2014_level_interpolated_2nd_poly_see_ETP2016_TAM_sheet.csv'
                    ),
                },
                'Conservative Cases': {
                    'US DOE/ Navigant 2014 , No LED scenario, interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_US_DOE_Navigant_2014_No_LED_scenario_interpolated_2nd_poly.csv'
                    ),
                    'US DOE /Navigant 2012 (2010 US lighting market characterization), interpolated, 2nd poly':
                    THISDIR.joinpath(
                        'tam',
                        'tam_US_DOE_Navigant_2012_2010_US_lighting_market_characterization_interpolated_2nd_poly.csv'
                    ),
                    'US EIA Annual energy outlook 2015':
                    THISDIR.joinpath(
                        'tam', 'tam_US_EIA_Annual_energy_outlook_2015.csv'),
                },
                'Ambitious Cases': {
                    'Floor space: EIA AEO 2016; Average illuminance see Lux (lm per m2); Average operating hours (h/a)':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_EIA_AEO_2016_Average_illuminance_see_Lux_lm_per_m2_Average_operating_hours_ha.csv'
                    ),
                    'Floor space: IEA floor space data; Average illuminance see Lux (lm per m2); Average operating hours (h/a); interpolated data':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Floor_space_IEA_floor_space_data_Average_illuminance_see_Lux_lm_per_m2_Average_operating_05cb930f.csv'
                    ),
                },
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Low', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'US DOE 2015 SSL R&D Plan (original source: P. Smallwood, in Strategies in Light Conference, Las Vegas, February 2015), estimates 3% installed base penetration in 2014, 33% in 2020 and 88% in 2030. not sector specific but for all general lighting. Used as a proxy for commercial lighting. Interpolated, linear':
                THISDIR.joinpath(
                    'ad',
                    'ad_US_DOE_2015_SSL_RD_Plan_original_source_P__Smallwood_in_Strategies_in_Light_Conference_L_7315fa9a.csv'
                ),
                'US DOE 2013 (MYPP) http://apps1.eere.energy.gov/buildings/publications/pdfs/ssl/ssl_mypp2013_web.pdf':
                THISDIR.joinpath(
                    'ad',
                    'ad_US_DOE_2013_MYPP_httpapps1_eere_energy_govbuildingspublicationspdfssslssl_mypp2013_web_pdf.csv'
                ),
                'Navigant / US DOE 2015: http://energy.gov/sites/prod/files/2015/07/f24/led-adoption-report_2015.pdf':
                THISDIR.joinpath(
                    'ad',
                    'ad_Navigant_US_DOE_2015_httpenergy_govsitesprodfiles201507f24ledadoptionreport_2015_pdf.csv'
                ),
            },
            'Conservative Cases': {
                'Bergesen et al. HighLED scenario (currently likely)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                ),
                'Bergesen et al. Likely LED (currently conservative)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                ),
            },
            'Region: OECD90': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: Eastern Europe': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: Latin America': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: EU': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'Bergesen et al. HighLED scenario (currently likely)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__HighLED_scenario_currently_likely.csv'
                    ),
                },
                'Conservative Cases': {
                    'Bergesen et al. Likely LED (currently conservative)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Bergesen_et_al__Likely_LED_currently_conservative.csv'
                    ),
                },
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()
        elif self.ac.soln_pds_adoption_basis == 'Linear':
            pds_adoption_data_per_region = None
            pds_adoption_trend_per_region = None
            pds_adoption_is_single_source = None

        ht_ref_adoption_initial = pd.Series([
            2.0559386403033844, 1.203539561682151, 0.17104652142368798,
            0.5420894798241899, 0.15340928478053964, 0.12392820164125475,
            0.3234205780581264, 0.07626534974849451, 0.3954239644503743,
            0.8447244056291314
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            repeated_cost_for_iunits=False,
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1000000000000.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1000000000000.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#14
0
  def __init__(self, scenario=None):
    if scenario is None:
      scenario = list(scenarios.keys())[0]
    self.scenario = scenario
    self.ac = scenarios[scenario]

    # TAM
    tamconfig_list = [
      ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['trend', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param')
    tam_ref_data_sources = {
      'Baseline Cases': {
          'Drawdown Calculations - High Projection Based on Data from Gschrey, B., & Schwarz, W. (2009). Projections of global emissions of fluorinated greenhouse gases in 2050. Öko-Recherche.': THISDIR.joinpath('tam', 'tam_Drawdown_Calculations_High_Projection_based_on_Data_from_Gschrey_B__Schwarz_W__2009__Pro_3a9477d3.csv'),
      },
      'Conservative Cases': {
          'Drawdown Calculations - Medium Projection Based on Data from Gschrey, B., & Schwarz, W. (2009). Projections of global emissions of fluorinated greenhouse gases in 2050. Öko-Recherche.': THISDIR.joinpath('tam', 'tam_Drawdown_Calculations_Medium_Projection_based_on_Data_from_Gschrey_B__Schwarz_W__2009__P_557e4efd.csv'),
      },
      'Ambitious Cases': {
          'Drawdown Calculations - Low Projection Based on Data from Gschrey, B., & Schwarz, W. (2009). Projections of global emissions of fluorinated greenhouse gases in 2050. Öko-Recherche.': THISDIR.joinpath('tam', 'tam_Drawdown_Calculations_Low_Projection_based_on_Data_from_Gschrey_B__Schwarz_W__2009__Proj_5ee67131.csv'),
      },
    }
    self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources,
      tam_pds_data_sources=tam_ref_data_sources)
    ref_tam_per_region=self.tm.ref_tam_per_region()
    pds_tam_per_region=self.tm.pds_tam_per_region()

    adconfig_list = [
      ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param')
    ad_data_sources = {
    }
    self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources,
        adconfig=adconfig)

    # Custom PDS Data
    ca_pds_data_sources = [
      {'name': 'PDS1 - Projected Based on Published and Estimated Rates of Refrigerant Recovery and Destruction (With HFC Sectors Summed)', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS1_Projected_based_on_Published_and_Estimated_Rates_of_Refrigerant_Recovery_and_Destru_80b1ed21.csv')},
      {'name': 'PDS2 - Projected Based on Published and Estimated Rates of Refrigerant Recovery and Destruction (With Averages for HFC Banks used)', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS2_Projected_based_on_Published_and_Estimated_Rates_of_Refrigerant_Recovery_and_Destru_ee48c99e.csv')},
      {'name': 'PDS3 - Same as PDS2 (Maximum Adoption Obtained)', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS3_Same_as_PDS2_Maximum_Adoption_Obtained.csv')},
      {'name': 'Drawdown Book Edition 1 Scenario 1', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_1.csv')},
      {'name': 'Drawdown Book Edition 1 Scenario 2 and Scenario 3', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_2_and_Scenario_3.csv')},
    ]
    self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources,
        soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=pds_tam_per_region)

    ref_adoption_data_per_region = None

    if False:
      # One may wonder why this is here. This file was code generated.
      # This 'if False' allows subsequent conditions to all be elif.
      pass
    elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
      pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region()
      pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region()
      pds_adoption_is_single_source = None
    elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
      pds_adoption_data_per_region = self.ad.adoption_data_per_region()
      pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
      pds_adoption_is_single_source = self.ad.adoption_is_single_source()

    ht_ref_adoption_initial = pd.Series(
      [29.609913664850783, 0.0, 0.0, 0.0, 0.0,
       0.0, 0.0, 0.0, 0.0, 0.0],
       index=dd.REGIONS)
    ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
    ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
    ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
    ht_pds_adoption_initial = ht_ref_adoption_initial
    ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage)
    ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions))
    ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050]
    ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
    ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
    self.ht = helpertables.HelperTables(ac=self.ac,
        ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
        pds_adoption_data_per_region=pds_adoption_data_per_region,
        ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region,
        pds_adoption_trend_per_region=pds_adoption_trend_per_region,
        pds_adoption_is_single_source=pds_adoption_is_single_source)

    self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

    self.ua = unitadoption.UnitAdoption(ac=self.ac,
        ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region,
        soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
        soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
        bug_cfunits_double_count=False)
    soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
    soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
    conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
    soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

    self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
        ref_learning_increase_mult=2, conv_learning_increase_mult=2,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_tot_iunits=conv_ref_tot_iunits,
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        fc_convert_iunit_factor=1.0)

    self.oc = operatingcost.OperatingCost(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
        soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
        soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
        conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
        single_iunit_purchase_year=2017,
        soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
        conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
        conversion_factor=1.0)

    self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

    self.c2 = co2calcs.CO2Calcs(ac=self.ac,
        ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
        soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
        soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
        soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(),
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(),
        soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(),
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
        conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        fuel_in_liters=False)

    self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'],
        soln_avg_annual_use=self.ac.soln_avg_annual_use,
        conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#15
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TLA
        self.ae = aez.AEZ(solution_name=self.name,
                          cohort=2020,
                          regimes=dd.THERMAL_MOISTURE_REGIMES8)
        if self.ac.use_custom_tla:
            self.c_tla = tla.CustomTLA(
                filename=THISDIR.joinpath('custom_tla_data.csv'))
            custom_world_vals = self.c_tla.get_world_values()
        else:
            custom_world_vals = None
        self.tla_per_region = tla.tla_per_region(
            self.ae.get_land_distribution(),
            custom_world_values=custom_world_vals)

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE',
                'NOTE'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {}
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            main_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_columns = ['Year'] + dd.REGIONS
        tla_2050 = self.tla_per_region.loc[2050]
        total_grazing_area = 2700.0

        ds1_percentages = pd.Series([
            0.0, 0.413624302911244, 0.0, 0.070550343761321, 0.138183856774756,
            0.845901090636972, 0.0, 0.0, 0.0, 0.0
        ],
                                    index=dd.REGIONS)
        ds1_2050 = tla_2050 * ds1_percentages
        ds1_2050['World'] = ds1_2050.sum()

        ds2_percentages = pd.Series([
            0.0, 0.596920577658838, 0.0, 0.0836983623713848, 0.178254518319696,
            0.933216308519849, 0.0, 0.0, 0.0, 0.0
        ],
                                    index=dd.REGIONS)
        ds2_2050 = tla_2050 * ds2_percentages
        ds2_2050['World'] = ds2_2050.sum()

        ds3_percentages = pd.Series([
            0.494785212286615, 0.494785212286615, 0.0, 0.0743985443301198,
            0.153620863162148, 0.853238399576085, 0.0, 0.0, 0.0, 0.0
        ],
                                    index=dd.REGIONS)
        ds3_2050 = tla_2050 * ds3_percentages

        # Data source 4 is described as scenario 1 with 70% adoption by 2030, but in actual
        # implementation it does not make the World be a sum of the regions. Instead, it
        # makes the World use the percentage of the OECD90 region.
        ds4_percentages = pd.Series([
            0.413624302911244, 0.413624302911244, 0.0, 0.070550343761321,
            0.138183856774756, 0.845901090636972, 0.0, 0.0, 0.0, 0.0
        ],
                                    index=dd.REGIONS)
        ds4_2050 = tla_2050 * ds4_percentages

        # Data source 5 is described as scenario 2 with 70% adoption by 2030, but in actual
        # implementation it does not make the World be a sum of the regions. Instead, it
        # makes the World use the percentage of the OECD90 region.
        ds5_percentages = pd.Series([
            0.596920577658838, 0.596920577658838, 0.0, 0.0836983623713848,
            0.178254518319696, 0.933216308519849, 0.0, 0.0, 0.0, 0.0
        ],
                                    index=dd.REGIONS)
        ds5_2050 = tla_2050 * ds5_percentages

        # SOURCE: Organic World 2009 Table 47, Organic World 2019 and FAOStat.
        # Region, Organic grazing area 2009 Mha, Organic grazing area 2009 %,
        #     Organic grazing area 2019 Mha, Organic grazing area 2019 %
        # Africa,        0.03,  0%,    0.08, 0%
        # Asia,          0.6,   0%,    1,    0%
        # EU,            2.1,   3%,    5.7,  8%
        # Latin America, 0.006, 0%,    4.9,  3%
        # N. America,    1.1,   0%,    1.4,  0%
        # Oceania,       11.7,  8%,    34.9, 24%
        # Global Total,  15.5,  0.50%, 48,   2%
        ds7_mha_2009 = 15.5
        ds7_mha_2019 = 48
        ds7_growth_rate = (ds7_mha_2019 - ds7_mha_2009) / (2019 - 2009)
        # Note that Excel says the ref_base_adoption is for 2018, when computing a growth
        # projection it uses it as 2014. We do the same here, bug-for-bug compatibility.
        ds7_2050 = self.ac.ref_base_adoption['World'] + (ds7_growth_rate *
                                                         (2050 - 2014))

        # Costa Rica proposes a 20-40% increase in 20 years; increase managed grazing
        # area by 1-2% per year (Navarro 2015).
        ds8_2050 = 0.4 * total_grazing_area

        # Brazil INDC proposes to restore 15 Mha of degraded grassland, (20% of national
        # grazing area), (Federative Republic of Brazil 2015)
        ds9_2050 = 0.2 * total_grazing_area

        # Sá (2016) projects an increase in restoration of degraded pasture in Latin America
        # from 10Mha in 2015 to 20Mha in 2020. That’s 11% of 177.4 Mha grazing land for
        # South America (FAOstat 2019)
        ds10_2050 = 0.11 * total_grazing_area

        ca_pds_data_sources = [
            {
                'name':
                'Low Growth, Linear Trend',
                'include':
                True,
                # The adoption of managed grazing is projected based on weighted "average, medium,
                # and high" growth rates, calculated based on the available country specifc area
                # under managed grazing and the region specific total grazing area (Using Henderson
                # et al 2015 estimates). This scenario builds the future projection based on the
                # low growth rate.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2050] + ds1_2050.tolist(),
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'High Growth, Linear Trend',
                'include':
                True,
                # The adoption of managed grazing is projected based on weighted "average, medium,
                # and high" growth rates, calculated based on the available country specifc area
                # under managed grazing and the region specific total grazing area (Using Henderson
                # et al 2015 estimates). This scenario builds the future projection based on the
                # high growth rate.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2050] + ds2_2050.tolist(),
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Medium Growth, Linear Trend',
                'include':
                True,
                # The adoption of managed grazing is projected based on weighted "average, medium,
                # and high" growth rates, calculated based on the available country specifc area
                # under managed grazing and the region specific total grazing area (Using Henderson
                # et al 2015 estimates). This scenario builds the future projection based on the
                # medium growth rate.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2050] + ds3_2050.tolist(),
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Low High Early Growth, Linear Trend',
                'include':
                True,
                # This is scenario 1 with 70% adoption by 2030.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2030] + (0.7 * ds4_2050).tolist(),
                    [2050] + ds4_2050.tolist(),
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'High High Early Growth, Linear Trend',
                'include':
                True,
                # This is scenario 2 with 70% adoption by 2030.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2030] + (0.7 * ds5_2050).tolist(),
                    [2050] + ds5_2050.tolist(),
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Medium High Early Growth, Linear Trend',
                'include':
                True,
                # This is scenario 3 with 70% adoption by 2030.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2030] + (0.7 * ds3_2050).tolist(),
                    [2050] + ds3_2050.tolist(),
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Linear growth, based on Organic Grazing Historic Growth',
                'include':
                True,
                # The future adoption of managed grazing is projected based on the organic
                # grazing historic growth rate using the linear trend.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [2050] +
                    [ds7_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Future commitments, max growth',
                'include':
                True,
                # Future adoption of managed grazing is projected based on the country/regional
                # commitments as given in the table below. It is assumed that the country/regional
                # level trends will be adopted at the global level. This scenario is based on the
                # high end commitments given for the Costa Rica.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [
                        2050, ds8_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Future Commitments, moderate growth',
                'include':
                True,
                # Future adoption of managed grazing is projected based on the country/regional
                # commitments as given in the table below. It is assumed that the country/regional
                # level trends will be adopted at the global level. This scenario is based on the
                # high end commitments given for the Brazil.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [
                        2050, ds9_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Future Commitments, low growth',
                'include':
                True,
                # Future adoption of managed grazing is projected based on the country/regional
                # commitments as given in the table below. It is assumed that the country/regional
                # level trends will be adopted at the global level. This scenario is based on the
                # high end commitments given for the Latin America.
                'datapoints':
                pd.DataFrame([
                    [2018] + list(self.ac.ref_base_adoption.values()),
                    [
                        2050, ds10_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        for s in self.pds_ca.scenarios.values():
            df = s['df']
            for y in range(2012, 2019):
                df.loc[y] = [
                    71.6320447618946, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0
                ]

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = self.tla_per_region.loc[2050] * (
            ht_ref_adoption_initial / self.tla_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=self.tla_per_region,
            pds_adoption_limits=self.tla_per_region,
            use_first_pds_datapoint_main=True,
            adoption_base_year=2018,
            copy_pds_to_ref=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=self.tla_per_region,
            pds_total_adoption_units=self.tla_per_region,
            electricity_unit_factor=1000000.0,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_first_cost_uses_tot_units=True,
            fc_convert_iunit_factor=land.MHA_TO_HA)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=land.MHA_TO_HA)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2eq_emissions_saved=self.ua.
            direct_co2eq_emissions_saved_land(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            direct_co2_emissions_saved_land(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            direct_n2o_co2_emissions_saved_land(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            annual_land_area_harvested=self.ua.
            soln_pds_annual_land_area_harvested(),
            regime_distribution=self.ae.get_land_distribution(),
            regimes=dd.THERMAL_MOISTURE_REGIMES8)
示例#16
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'ETP 2016, URBAN 6 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_6_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ICCT, 2012, "Global Transportation Roadmap Model" + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ICCT_2012_Global_Transportation_Roadmap_Model_Nonmotorized_Travel_Adjustment.csv'
                ),
            },
            'Conservative Cases': {
                'ETP 2016, URBAN 4 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_4_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ITDP/UC Davis 2014 Global High Shift Baseline':
                THISDIR.joinpath(
                    'tam',
                    'tam_ITDPUC_Davis_2014_Global_High_Shift_Baseline.csv'),
            },
            'Ambitious Cases': {
                'ETP 2016, URBAN 2 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_2_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ITDP/UC Davis 2014 Global High Shift HighShift':
                THISDIR.joinpath(
                    'tam',
                    'tam_ITDPUC_Davis_2014_Global_High_Shift_HighShift.csv'),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'ITDP/UCD (2015) A Global High Shift Cycling Scenario - Baseline Scenario':
                THISDIR.joinpath(
                    'ad',
                    'ad_ITDPUCD_2015_A_Global_High_Shift_Cycling_Scenario_Baseline_Scenario.csv'
                ),
            },
            'Ambitious Cases': {
                'ITDP/UCD (2015) A Global High Shift Cycling Scenario - High Shift Scenario':
                THISDIR.joinpath(
                    'ad',
                    'ad_ITDPUCD_2015_A_Global_High_Shift_Cycling_Scenario_High_Shift_Scenario.csv'
                ),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'PDS2 - Density remains Constant and is the key driver of walking in cities.',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS2_Density_remains_Constant_and_is_the_key_driver_of_walking_in_cities_.csv'
                )
            },
            {
                'name':
                'PDS2 - Increasing Urban Density with Density Driving Urban Walking (Book Ed.1)',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS2_Increasing_Urban_Density_with_Density_Driving_Urban_Walking_Book_Ed_1.csv'
                )
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                'Custom REF Scenario 1: Fixed Passenger-km Annual after 2014',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Custom_REF_Scenario_1_Fixed_Passengerkm_Annual_after_2014.csv'
                )
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()
        elif self.ac.soln_pds_adoption_basis == 'Linear':
            pds_adoption_data_per_region = None
            pds_adoption_trend_per_region = None
            pds_adoption_is_single_source = None

        ht_ref_adoption_initial = pd.Series([
            1523.491464812742, 205.85584501120192, 57.71269810953001, 0.0, 0.0,
            0.0, 310.14334483044007, 180.29053359808, 0.0, 0.0
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#17
0
  def __init__(self, scenario=None):
    if scenario is None:
      scenario = list(scenarios.keys())[0]
    self.scenario = scenario
    self.ac = scenarios[scenario]

    # TAM
    tamconfig_list = [
      ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['trend', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param')
    tam_ref_data_sources = {
      'Baseline Cases': {
          'Based on: IEA ETP 2016 6DS': THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2016_6DS.csv'),
          'Based on Airbus (2015) Global Market Forecast 2016-2035 with projections extended': THISDIR.joinpath('tam', 'tam_based_on_Airbus_2015_Global_Market_Forecast_20162035_with_projections_extended.csv'),
      },
      'Conservative Cases': {
          'Based on Boeing (2017) Current Market Outlook 2017-2036': THISDIR.joinpath('tam', 'tam_based_on_Boeing_2017_Current_Market_Outlook_20172036.csv'),
      },
      'Ambitious Cases': {
          'Based on: IEA ETP 2016 2DS': THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2016_2DS.csv'),
      },
    }
    self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources,
      tam_pds_data_sources=tam_ref_data_sources)
    ref_tam_per_region=self.tm.ref_tam_per_region()
    pds_tam_per_region=self.tm.pds_tam_per_region()

    # Custom PDS Data
    ca_pds_data_sources = [
      {'name': 'PDS1 - Bass diffusion Adoption Curve - 16% Adoption in 2050', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS1_Bass_diffusion_Adoption_Curve_16_Adoption_in_2050.csv')},
      {'name': 'PDS2 - Bass diffusion Adoption Curve - 30% Adoption in 2050', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS2_Bass_diffusion_Adoption_Curve_30_Adoption_in_2050.csv')},
      {'name': 'PDS3 - Bass diffusion Adoption Curve - 50% Adoption in 2050', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS3_Bass_diffusion_Adoption_Curve_50_Adoption_in_2050.csv')},
    ]
    self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources,
        soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=pds_tam_per_region)

    # Custom REF Data
    ca_ref_data_sources = [
      {'name': 'Book Ed.1 Reference Scenario', 'include': False,
          'filename': THISDIR.joinpath('ca_ref_data', 'custom_ref_ad_Book_Ed_1_Reference_Scenario.csv')},
    ]
    self.ref_ca = customadoption.CustomAdoption(data_sources=ca_ref_data_sources,
        soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=ref_tam_per_region)

    ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

    if False:
      # One may wonder why this is here. This file was code generated.
      # This 'if False' allows subsequent conditions to all be elif.
      pass
    elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
      pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region()
      pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region()
      pds_adoption_is_single_source = None

    ht_ref_adoption_initial = pd.Series(
      [198505316569.03406, 0.0, 0.0, 0.0, 0.0,
       0.0, 0.0, 0.0, 0.0, 0.0],
       index=dd.REGIONS)
    ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
    ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
    ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
    ht_pds_adoption_initial = ht_ref_adoption_initial
    ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage)
    ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions))
    ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050]
    ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
    ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
    self.ht = helpertables.HelperTables(ac=self.ac,
        ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
        pds_adoption_data_per_region=pds_adoption_data_per_region,
        ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region,
        ref_adoption_data_per_region=ref_adoption_data_per_region,
        pds_adoption_trend_per_region=pds_adoption_trend_per_region,
        pds_adoption_is_single_source=pds_adoption_is_single_source)

    self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

    self.ua = unitadoption.UnitAdoption(ac=self.ac,
        ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region,
        soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
        soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
        bug_cfunits_double_count=False)
    soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
    soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
    conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
    soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

    self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
        ref_learning_increase_mult=2, conv_learning_increase_mult=2,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_tot_iunits=conv_ref_tot_iunits,
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        fc_convert_iunit_factor=1.0)

    self.oc = operatingcost.OperatingCost(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
        soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
        soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
        conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
        single_iunit_purchase_year=2017,
        soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
        conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
        conversion_factor=1.0)

    self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

    self.c2 = co2calcs.CO2Calcs(ac=self.ac,
        ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
        soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
        soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
        soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(),
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(),
        soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(),
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
        conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        fuel_in_liters=False)

    self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'],
        soln_avg_annual_use=self.ac.soln_avg_annual_use,
        conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#18
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Project Drawdown - Based on Data from Several Sources. (See HVFAC Links Sheet and HVFAC Material Availability Models)':
                THISDIR.joinpath(
                    'tam',
                    'tam_Project_Drawdown_based_on_Data_from_Several_Sources__See_HVFAC_Links_Sheet_and_HVFAC_Mat_2961774c.csv'
                ),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Adoption Based on Fly Ash Availability Analysis/ PDS 1',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Adoption_based_on_Fly_Ash_Availability_Analysis_PDS_1.csv'
                )
            },
            {
                'name':
                'Adoption Based on Fly Ash Availability Analysis/ PDS 2',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Adoption_based_on_Fly_Ash_Availability_Analysis_PDS_2.csv'
                )
            },
            {
                'name':
                'Adoption Based on Fly Ash Availability Analysis/ PDS 3',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Adoption_based_on_Fly_Ash_Availability_Analysis_PDS_3.csv'
                )
            },
            {
                'name':
                'Drawdown Book Edition 1 PDS 1, 2 and 3',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_PDS_1_2_and_3.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                'REF Custom Adoption Based on Fly Ash Availability Analysis',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_REF_Custom_Adoption_based_on_Fly_Ash_Availability_Analysis.csv'
                )
            },
            {
                'name':
                'Drawdown Book Edition 1 Scenario REF Adoption',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Drawdown_Book_Edition_1_Scenario_REF_Adoption.csv'
                )
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None

        ht_ref_adoption_initial = pd.Series(
            [222.22222222222223, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            repeated_cost_for_iunits=True,
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#19
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Low', 'Low', 'Medium', 'Medium', 'Low', 'Medium',
                'Medium', 'Low', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'What a Waste Solid Waste Management Static':
                THISDIR.joinpath(
                    'tam',
                    'tam_What_a_Waste_Solid_Waste_Management_Static.csv'),
                'What a Waste Solid Waste Management Dynamic':
                THISDIR.joinpath(
                    'tam',
                    'tam_What_a_Waste_Solid_Waste_Management_Dynamic.csv'),
                'What a Waste Solid Waste Management Dynamic Organic Fraction':
                THISDIR.joinpath(
                    'tam',
                    'tam_What_a_Waste_Solid_Waste_Management_Dynamic_Organic_Fraction.csv'
                ),
            },
            'Conservative Cases': {
                'Bahor et al (2009) DOI: 10.1177/0734242X09350485 - interpolated and organic fraction from What a  Waste applied':
                THISDIR.joinpath(
                    'tam',
                    'tam_Bahor_et_al_2009_DOI_10_11770734242X09350485_interpolated_and_organic_fraction_from_What_95c7eead.csv'
                ),
                'IPCC, 2006 - Calculated based on bottom up analysis':
                THISDIR.joinpath(
                    'tam',
                    'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                ),
                'IPCC, 2006 - Calculated based on top down analysis':
                THISDIR.joinpath(
                    'tam',
                    'tam_IPCC_2006_Calculated_based_on_top_down_analysis.csv'),
            },
            'Ambitious Cases': {
                'Hoornweg et al 2015':
                THISDIR.joinpath('tam', 'tam_Hoornweg_et_al_2015.csv'),
            },
            'Region: OECD90': {
                'Baseline Cases': {
                    'What a Waste Solid Waste Management Static':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Static.csv'),
                    'What a Waste Solid Waste Management Dynamic':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic.csv'),
                    'Hoornweg et al 2015':
                    THISDIR.joinpath('tam', 'tam_Hoornweg_et_al_2015.csv'),
                },
                'Conservative Cases': {
                    'Bahor et al (2009) DOI: 10.1177/0734242X09350485 - interpolated and organic fraction from What a  Waste applied':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Bahor_et_al_2009_DOI_10_11770734242X09350485_interpolated_and_organic_fraction_from_What_95c7eead.csv'
                    ),
                    'OECD Data. http://www.eea.europa.eu/data-and-maps/figures/municipal-waste-generation-within-the-oecd-area':
                    THISDIR.joinpath(
                        'tam',
                        'tam_OECD_Data__httpwww_eea_europa_eudataandmapsfiguresmunicipalwastegenerationwithintheoecdarea.csv'
                    ),
                },
                'Ambitious Cases': {
                    'What a Waste Solid Waste Management Dynamic Organic Fraction':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic_Organic_Fraction.csv'
                    ),
                    'IPCC, 2006 - Calculated based on bottom up analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                    ),
                    'IPCC, 2006 - Calculated based on top down analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_top_down_analysis.csv'
                    ),
                },
            },
            'Region: Eastern Europe': {
                'Baseline Cases': {
                    'What a Waste Solid Waste Management Static':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Static.csv'),
                    'What a Waste Solid Waste Management Dynamic Organic Fraction':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic_Organic_Fraction.csv'
                    ),
                    'Bahor et al (2009) DOI: 10.1177/0734242X09350485 - interpolated and organic fraction from What a  Waste applied':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Bahor_et_al_2009_DOI_10_11770734242X09350485_interpolated_and_organic_fraction_from_What_95c7eead.csv'
                    ),
                },
                'Conservative Cases': {
                    'What a Waste Solid Waste Management Dynamic':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic.csv'),
                },
                'Ambitious Cases': {
                    'Hoornweg et al 2015':
                    THISDIR.joinpath('tam', 'tam_Hoornweg_et_al_2015.csv'),
                    'IPCC, 2006 - Calculated based on bottom up analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                    ),
                    'IPCC, 2006 - Calculated based on top down analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_top_down_analysis.csv'
                    ),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'What a Waste Solid Waste Management Static':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Static.csv'),
                    'Bahor et al (2009) DOI: 10.1177/0734242X09350485 - interpolated and organic fraction from What a  Waste applied':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Bahor_et_al_2009_DOI_10_11770734242X09350485_interpolated_and_organic_fraction_from_What_95c7eead.csv'
                    ),
                    'Hoornweg et al 2015':
                    THISDIR.joinpath('tam', 'tam_Hoornweg_et_al_2015.csv'),
                },
                'Conservative Cases': {
                    'IPCC, 2006 - Calculated based on top down analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_top_down_analysis.csv'
                    ),
                    'IPCC, 2006 - Calculated based on bottom up analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                    ),
                    'Bahor et al (2009) DOI: 10.1177/0734242X09350485 - interpolated and organic fraction from What a  Waste applied.1':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Bahor_et_al_2009_DOI_10_11770734242X09350485_interpolated_and_organic_fraction_from_What_35ed52f6.csv'
                    ),
                },
                'Ambitious Cases': {
                    'What a Waste Solid Waste Management Dynamic':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic.csv'),
                },
            },
            'Region: Latin America': {
                'Baseline Cases': {
                    'What a Waste Solid Waste Management Static':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Static.csv'),
                    'What a Waste Solid Waste Management Dynamic':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic.csv'),
                    'Bahor et al (2009) DOI: 10.1177/0734242X09350485 - interpolated and organic fraction from What a  Waste applied':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Bahor_et_al_2009_DOI_10_11770734242X09350485_interpolated_and_organic_fraction_from_What_95c7eead.csv'
                    ),
                },
                'Conservative Cases': {
                    'What a Waste Solid Waste Management Dynamic Organic Fraction':
                    THISDIR.joinpath(
                        'tam',
                        'tam_What_a_Waste_Solid_Waste_Management_Dynamic_Organic_Fraction.csv'
                    ),
                },
                'Ambitious Cases': {
                    'IPCC, 2006 - Calculated based on top down analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_top_down_analysis.csv'
                    ),
                    'IPCC, 2006 - Calculated based on bottom up analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                    ),
                    'Hoornweg et al 2015':
                    THISDIR.joinpath('tam', 'tam_Hoornweg_et_al_2015.csv'),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'World Bank': THISDIR.joinpath('tam',
                                                   'tam_World_Bank.csv'),
                },
                'Conservative Cases': {
                    'What a Waste':
                    THISDIR.joinpath('tam', 'tam_What_a_Waste.csv'),
                    'IPCC, 2006 - Calculated based on bottom up analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                    ),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'Kumar, Sunil. Municipal Solid Waste Management in India: Present Practices and Future Challenge. Clean Development Mechanism, United Nations Framework Convention on Climate Change':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Kumar_Sunil__Municipal_Solid_Waste_Management_in_India_Present_Practices_and_Future_Chal_a1d3f433.csv'
                    ),
                    'IPCC, 2006 - Calculated based on bottom up analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_bottom_up_analysis.csv'
                    ),
                    'IPCC, 2006 - Calculated based on top down analysis':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IPCC_2006_Calculated_based_on_top_down_analysis.csv'
                    ),
                },
                'Maximum Cases': {
                    'CPCB, Satus of MSW India, 2000':
                    THISDIR.joinpath('tam',
                                     'tam_CPCB_Satus_of_MSW_India_2000.csv'),
                },
            },
            'Region: EU': {
                'Baseline Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('tam', 'tam_IPCC_2006_Calculated.csv'),
                },
                'Maximum Cases': {
                    'EUROSTAT, Municipal Solid Waste Statistics, 2016':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EUROSTAT_Municipal_Solid_Waste_Statistics_2016.csv'
                    ),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'EPA, Municipal Solid Waste Generation, Recycling, and Disposal in the United States: Facts and Figures for 2012':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EPA_Municipal_Solid_Waste_Generation_Recycling_and_Disposal_in_the_United_States_Facts_a_7fa2141a.csv'
                    ),
                },
                'Ambitious Cases': {
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'tam',
                        'tam_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
                'Maximum Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('tam', 'tam_IPCC_2006_Calculated.csv'),
                },
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          world_includes_regional=True,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'Calculated based on What a Waste and USA as PDS Benchmark (See Adoption Factoring)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Calculated_based_on_What_a_Waste_and_USA_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                ),
            },
            'Conservative Cases': {
                'IPCC, 2006 Calculated':
                THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
            },
            'Ambitious Cases': {
                'Calculated based on What a Waste and EU as PDS Benchmark (See Adoption Factoring)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Calculated_based_on_What_a_Waste_and_EU_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                ),
            },
            'Region: OECD90': {
                'Baseline Cases': {
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
                'Conservative Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                },
                'Ambitious Cases': {
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW).1':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW_1.csv'
                    ),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Baseline Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                },
                'Conservative Cases': {
                    'Calculated based on What a Waste and USA as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_USA_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
                'Ambitious Cases': {
                    'Calculated based on What a Waste and EU as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_EU_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                    'Calculated based on What a Waste and USA as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_USA_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
                'Ambitious Cases': {
                    'Calculated based on What a Waste and EU as PDS Benchmark (See Adoption Factoring)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Calculated_based_on_What_a_Waste_and_EU_as_PDS_Benchmark_See_Adoption_Factoring.csv'
                    ),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'Song, L. et al. Study on the Current Situation of Municipal Solid Waste Composting in China and Development Trend. 2012':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Song_L__et_al__Study_on_the_Current_Situation_of_Municipal_Solid_Waste_Composting_in_Chi_f57570b9.csv'
                    ),
                },
                'Conservative Cases': {
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'Kharvel, R. Sustainable Solid Waste Management in Inidia. SEAS, Columbia Thesis. 2012':
                    THISDIR.joinpath(
                        'ad',
                        'ad_Kharvel_R__Sustainable_Solid_Waste_Management_in_Inidia__SEAS_Columbia_Thesis__2012.csv'
                    ),
                },
            },
            'Region: EU': {
                'Baseline Cases': {
                    'EUROSTAT, 2016. http://ec.europa.eu/eurostat/statistics-explained/index.php/Municipal_waste_statistics':
                    THISDIR.joinpath(
                        'ad',
                        'ad_EUROSTAT_2016__httpec_europa_eueurostatstatisticsexplainedindex_phpMunicipal_waste_statistics.csv'
                    ),
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'EPA, MSW trends, 2012 https://www.epa.gov/sites/production/files/2015-09/documents/2012_msw_fs.pdf':
                    THISDIR.joinpath(
                        'ad',
                        'ad_EPA_MSW_trends_2012_httpswww_epa_govsitesproductionfiles201509documents2012_msw_fs_pdf.csv'
                    ),
                    'IPCC, 2006 Calculated':
                    THISDIR.joinpath('ad', 'ad_IPCC_2006_Calculated.csv'),
                    'OECD.stat (http://stats.oecd.org/Index.aspx?DataSetCode=MUNW)':
                    THISDIR.joinpath(
                        'ad',
                        'ad_OECD_stat_httpstats_oecd_orgIndex_aspxDataSetCodeMUNW.csv'
                    ),
                },
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            world_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Drawdown Customized Scenario 1',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_1.csv')
            },
            {
                'name':
                'Drawdown Customized Scenario 2',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_2.csv')
            },
            {
                'name':
                'Drawdown Customized Scenario 3',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_3.csv')
            },
            {
                'name':
                'Drawdown Customized Scenario 4',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Customized_Scenario_4.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(
            [120.0, 69.02, 4.13, 13.0, 5.66, 14.0, 2.75, 7.29, 36.8, 20.84],
            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#20
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TLA
        self.ae = aez.AEZ(solution_name=self.name,
                          cohort=2020,
                          regimes=dd.THERMAL_MOISTURE_REGIMES8)
        if self.ac.use_custom_tla:
            self.c_tla = tla.CustomTLA(
                filename=THISDIR.joinpath('custom_tla_data.csv'))
            custom_world_vals = self.c_tla.get_world_values()
        else:
            custom_world_vals = None
        self.tla_per_region = tla.tla_per_region(
            self.ae.get_land_distribution(),
            custom_world_values=custom_world_vals)

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE',
                'NOTE'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Raw Data for ALL LAND TYPES': {
                'FAO 2015': THISDIR.joinpath('ad', 'ad_FAO_2015.csv'),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            main_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_columns = ['Year'] + dd.REGIONS
        adoption_2014 = self.ac.ref_base_adoption['World']
        tla_2050 = self.tla_per_region.loc[2050, 'World']
        tla_afforestation = 717.972721643776
        tla_bamboo = 363.757256176669
        tla_perennial_bioenergy = 264.89533875
        tla_all_biomass = tla_afforestation + tla_bamboo + tla_perennial_bioenergy
        ds6_percent_afforestation = tla_afforestation / tla_all_biomass
        ds6_percent_adoption_2050 = (
            1614 * ds6_percent_afforestation) / tla_all_biomass
        ds6_adoption_2050 = ds6_percent_adoption_2050 * tla_2050
        ds7_percent_adoption_2050 = 1614 / tla_all_biomass
        ds7_adoption_2050 = ds7_percent_adoption_2050 * tla_2050

        ca_pds_data_sources = [
            {
                'name':
                'Regional linear trend',
                'include':
                True,
                'least_sq':
                True,
                # Future forest plantation area is projected based on country level data available
                # for the year 1990, 2000, 2005, and 2010 from the FAO's Forest Resource Assessment
                # report from 2015.
                #
                # Country level data about planted forest area from 1990 - 2014 was aggregated at
                # the regional level (for details see hidden ""HistoricAndProjectedData"" sheet).
                # This data was then used to project future adoption using a linear trend.
                'datapoints':
                pd.DataFrame([
                    [
                        1990, np.nan, 96.8914, 44.1631, 106.1562, 16.5338,
                        14.9281, 0.0, 0.0, 0.0, 0.0
                    ],
                    [
                        2000, np.nan, 97.2555, 44.2605, 107.5489, 16.7251,
                        15.2771, 0.0, 0.0, 0.0, 0.0
                    ],
                    [
                        2005, np.nan, 97.6355, 44.3794, 109.8028, 16.9607,
                        15.6649, 0.0, 0.0, 0.0, 0.0
                    ],
                    [
                        2010, np.nan, 97.8700, 44.4540, 111.5210, 17.1760,
                        16.0730, 0.0, 0.0, 0.0, 0.0
                    ],
                    [
                        2014, np.nan, 98.1783330003811, 44.5558196042818,
                        113.7890763825080, 17.4259450169749, 16.5131623025461,
                        0.0, 0.0, 0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Regional max linear trend',
                'include':
                True,
                # "Future forest plantation area is projected based on country level data available
                # for the year 1990, 2000, 2005, and 2010 from the FAO's Forest Resource Assessment
                # report from 2015. Country level data about planted forest area from 1990 - 2014
                # was aggregated at the regional level, and used to determine regional annual growth
                # rates. For details about the calculations of regional rates see hidden
                # ""HistoricAndProjectedData"" sheet).
                #
                # In this scenario, regional future adoption of forest plantations is projected
                # based on the maximum historical regional growth rate reported in the respective
                # region (between 1990 - 2014). For each region, future adoption projected based
                # on the maximum linear regional trend between any two given time periods.
                'datapoints':
                pd.DataFrame([
                    [
                        2010, np.nan, 97.8700, 44.4540, 111.5210, 17.1760,
                        16.0730, 0.0, 0.0, 0.0, 0.0
                    ],
                    [
                        2014, np.nan, 98.1783330003811, 44.5558196042818,
                        113.7890763825080, 17.4259450169749, 16.5131623025461,
                        0.0, 0.0, 0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                '50% of the max historical annual afforestation rate across the regions',
                'include':
                True,
                # Future forest plantation area is projected based on country level data available
                # for the year 1990, 2000, 2005, and 2010 from the FAO's Forest Resource Assessment
                # report from 2015. Country level data about planted forest area from 1990 - 2014
                # was aggregated at the regional level, and used to determine regional annual growth
                # rates. For details about the calculations of regional rates see hidden
                # "HistoricAndProjectedData" sheet).
                #
                # In this scenario, regional future adoption of forest plantations is projected
                # based on the maximum historical regional growth rate across all regions (between
                # 1990 - 2014), which occurred in Asia (0.57 Mha annual increase between 2010 -2014).
                # For the ASIA region this same rate (0.57 Mha annual increase) is used for
                # projecting the future adoption of forest plantation. For all other regions half
                # of this growth rate is applied (0.29 Mha annual increase).
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_50_of_the_max_historical_annual_afforestation_rate_across_the_regions.csv'
                )
            },
            {
                'name':
                '100% of the max historical annual afforestation rate across the regions',
                'include':
                True,
                # Future forest plantation area is projected based on country level data available
                # for the year 1990, 2000, 2005, and 2010 from the FAO's Forest Resource Assessment
                # report from 2015. Country level data about planted forest area from 1990 - 2014
                # was aggregated at the regional level, and used to determine regional annual growth
                # rates. For details about the calculations of regional rates see hidden
                # "HistoricAndProjectedData" sheet).
                #
                # In this scenario, regional future adoption of forest plantations is projected
                # based on the maximum historical regional growth rate across all regions (between
                # 1990 - 2014), which occurred in Asia (0.57 Mha increase between 2010 -2014).
                # To project future adoption of forest plantations, this rate was applied to all
                # regions, including Asia (0.57 Mha annual increase).
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_100_of_the_max_historical_annual_afforestation_rate_across_the_regions.csv'
                )
            },
            {
                'name':
                '200% increase for Asia and 100% for the other regions',
                'include':
                True,
                # Future forest plantation area is projected based on country level data available
                # for the year 1990, 2000, 2005, and 2010 from the FAO's Forest Resource Assessment
                # report from 2015. Country level data about planted forest area from 1990 - 2014
                # was aggregated at the regional level, and used to determine regional annual growth
                # rates. For details about the calculations of regional rates see hidden
                # "HistoricAndProjectedData" sheet).
                #
                # In this scenario, regional future adoption of forest plantations is projected
                # based on the maximum historical regional growth rate across all regions (between
                # 1990 - 2014), which occurred in Asia (0.57 Mha increase between 2010 -2014).
                # To project future adoption of forest plantations, this rate was applied to all
                # regions (0.57 Mha annual increase) except for Asia region where the rate was
                # doubled (1.14 Mha annual increase).
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_200_increase_for_Asia_and_100_for_the_other_regions.csv'
                )
            },
            {
                'name':
                'Conservative growth projection based on Kreidenweis et al. (2016)',
                'include':
                True,
                # This projection of future adoption of afforestation is based on Kreidenweis
                # et al. (2016)'s ""global afforestation"" scenario, which assumes 1614 Mha total
                # afforested area by 2050.
                # We calculated the proportion of this projection based on the percent of
                # afforestation to the total TLA set for the biomass crops as per 2019 land
                # allocation model. This proportion was applied to TLA set for this solution
                # allocated on forest AEZs.
                'datapoints':
                pd.DataFrame([
                    [
                        2014, adoption_2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                    [
                        2050, ds6_adoption_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year'),
                'maximum':
                tla_bamboo
            },
            {
                'name':
                'High growth projection based on Kreidenweis et al. (2016)',
                'include':
                True,
                # "This projection of future adoption of afforestation is based on Kreidenweis
                # et al. (2016)'s ""global afforestation"" scenario, which assumes 1614 Mha total
                # afforested area by 2050.
                # We calculated the proportion of this projection based on the percent of
                # afforestation to the total TLA set for the biomass crops as per 2019 land
                # allocation model.  This proportion was applied to TLA set for this solution
                # allocated on forest AEZs.
                'datapoints':
                pd.DataFrame([
                    [
                        2014, adoption_2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                    [
                        2050, ds7_adoption_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Linear projections based on  Evans (2009) publication',
                'include':
                True,
                # Projections of future adoption of forest plantations are based on the total
                # predicted area of planted forest in 2030 (344.5 Mha), as reported by Evans (2009),
                # see Table 5.5. The predictions are made according to two scenarios (Scenario 2:
                # "Business as Usual" and Scenario 3: "Higher Productivity") described in
                # Table 5.2 of the publication.
                'datapoints':
                pd.DataFrame([
                    [
                        2014, 294.140179643776, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                    [
                        2030, 344.500000000000, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=0.5,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        # Manual adjustment made in spreadsheet for Drawdown 2020.
        for s in self.pds_ca.scenarios.values():
            df = s['df']
            df.loc[2014] = [
                290.462336306692, 98.1783330003811, 44.5558196042818,
                113.789076382508, 17.4259450169749, 16.5131623025461, 0.0, 0.0,
                0.0, 0.0
            ]
            df.loc[2015] = [
                291.336550416405, 98.2542011640878, 44.5812227272287,
                114.378174359749, 17.4918608321974, 16.6310913331414, 0.0, 0.0,
                0.0, 0.0
            ]
            df.loc[2016] = [
                292.240912741787, 98.3317866108997, 44.6073285492058,
                114.988603296961, 17.5600505509306, 16.7531437337891, 0.0, 0.0,
                0.0, 0.0
            ]
            df.loc[2017] = [
                293.175447683892, 98.4110924492030, 44.6341380907823,
                115.620380827999, 17.6305154458053, 16.8793208701027, 0.0, 0.0,
                0.0, 0.0
            ]
            df.loc[2018] = [
                294.140179643776, 98.4921217873836, 44.6616523725276,
                116.273524586716, 17.7032567894526, 17.0096241076960, 0.0, 0.0,
                0.0, 0.0
            ]

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                '[Type Scenario 1 Name Here (REF CASE)...]',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        if self.ac.soln_ref_adoption_basis == 'Custom':
            ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region(
            )
        else:
            ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = self.tla_per_region.loc[2050] * (
            ht_ref_adoption_initial / self.tla_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=self.tla_per_region,
            pds_adoption_limits=self.tla_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            use_first_pds_datapoint_main=False,
            adoption_base_year=2018,
            copy_pds_to_ref=False,
            copy_ref_datapoint=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=self.tla_per_region,
            pds_total_adoption_units=self.tla_per_region,
            electricity_unit_factor=1000000.0,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_first_cost_uses_tot_units=True,
            fc_convert_iunit_factor=land.MHA_TO_HA)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=land.MHA_TO_HA)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2eq_emissions_saved=self.ua.
            direct_co2eq_emissions_saved_land(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            direct_co2_emissions_saved_land(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            direct_n2o_co2_emissions_saved_land(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            annual_land_area_harvested=self.ua.
            soln_pds_annual_land_area_harvested(),
            regime_distribution=self.ae.get_land_distribution(),
            regimes=dd.THERMAL_MOISTURE_REGIMES8)
def test_ElectricityGenOnGrid_conv_ref_grid_CO2eq_per_KWh_v2():
    ac = advanced_controls.AdvancedControls(emissions_grid_source="ipcc_only",
                                            emissions_grid_range="mean")
    eg = ef.ElectricityGenOnGrid(ac=ac, grid_emissions_version=2)
    table = eg.conv_ref_grid_CO2eq_per_KWh()
    assert table.loc[2033, 'World'] == pytest.approx(0.474310926)
示例#22
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'ETP 2016, URBAN 6 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_6_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ICCT, 2012, "Global Transportation Roadmap Model" + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ICCT_2012_Global_Transportation_Roadmap_Model_Nonmotorized_Travel_Adjustment.csv'
                ),
            },
            'Conservative Cases': {
                'ETP 2016, URBAN 4 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_4_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ITDP/UC Davis 2014 Global High Shift Baseline':
                THISDIR.joinpath(
                    'tam',
                    'tam_ITDPUC_Davis_2014_Global_High_Shift_Baseline.csv'),
            },
            'Ambitious Cases': {
                'ETP 2016, URBAN 2 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_2_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ITDP/UC Davis 2014 Global High Shift HighShift':
                THISDIR.joinpath(
                    'tam',
                    'tam_ITDPUC_Davis_2014_Global_High_Shift_HighShift.csv'),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                '(OPT2) Drawdown Team projections based on a weighted average of Several Sources',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_OPT2_Drawdown_Team_projections_based_on_a_weighted_average_of_Several_Sources.csv'
                )
            },
            {
                'name':
                '(OPT3) Drawdown Theoretical linear growth until 10% urban transport adoption in 2050',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_OPT3_Drawdown_Theoretical_linear_growth_until_10_urban_transport_adoption_in_2050.csv'
                )
            },
            {
                'name':
                'Drawdown Book Edition 1 Scenario 1',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_1.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                'Drawdown Book Ed.1 Reference Scenario',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Drawdown_Book_Ed_1_Reference_Scenario.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None

        ht_ref_adoption_initial = pd.Series([
            856.0, 233.98839923734755, 3.173527202810714, 859.4513386529659,
            48.52296834532601, 157.5563510884852, 311.3487952155772,
            185.19183304641325, 138.07360106730914, 13.301055629175583
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            repeated_cost_for_iunits=False,
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#23
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Based on: IEA ETP 2014 6DS':
                THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2014_6DS.csv'),
            },
            'Conservative Cases': {
                'Based on: IEA ETP 2014 4DS':
                THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2014_4DS.csv'),
            },
            'Ambitious Cases': {
                'Based on: IEA ETP 2014 2DS':
                THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2014_2DS.csv'),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'PDS1 - Based on ICCT+RMI Freight Work Adoption estimates',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS1_based_on_ICCTRMI_Freight_Work_Adoption_estimates.csv'
                )
            },
            {
                'name':
                'PDS2 - Based on an ICCT Truck Sales extrapolation',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS2_based_on_an_ICCT_Truck_Sales_extrapolation.csv'
                )
            },
            {
                'name':
                'PDS3 - Based on IEA Freight Work - 100% Adoption of Trucks by 2035',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_PDS3_based_on_IEA_Freight_Work_100_Adoption_of_Trucks_by_2035.csv'
                )
            },
            {
                'name':
                'Book Ed.1 Scenario 1',
                'include':
                False,
                'filename':
                THISDIR.joinpath('ca_pds_data',
                                 'custom_pds_ad_Book_Ed_1_Scenario_1.csv')
            },
            {
                'name':
                'Book Ed.1 Scenario 3',
                'include':
                False,
                'filename':
                THISDIR.joinpath('ca_pds_data',
                                 'custom_pds_ad_Book_Ed_1_Scenario_3.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                'Drawdown Book Reference Scenario',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Drawdown_Book_Reference_Scenario.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None

        ht_ref_adoption_initial = pd.Series(
            [600621.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            repeated_cost_for_iunits=False,
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#24
0
  def __init__(self, scenario=None):
    if scenario is None:
      scenario = list(scenarios.keys())[0]
    self.scenario = scenario
    self.ac = scenarios[scenario]

    # TLA
    self.ae = aez.AEZ(solution_name=self.name)
    self.tla_per_region = tla.tla_per_region(self.ae.get_land_distribution())

    # Custom PDS Data
    ca_pds_data_sources = [
      {'name': 'Low growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Low_growth.csv')},
      {'name': 'High growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_High_growth.csv')},
      {'name': 'Aggressive High Growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth.csv')},
      {'name': 'Aggressive Max Growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_Max_Growth.csv')},
      {'name': 'Aggressive Max Early Growth', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_Max_Early_Growth.csv')},
    ]
    self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources,
        soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=self.tla_per_region)


    if False:
      # One may wonder why this is here. This file was code generated.
      # This 'if False' allows subsequent conditions to all be elif.
      pass
    elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
      pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region()
      pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region()
      pds_adoption_is_single_source = None

    ht_ref_adoption_initial = pd.Series(
      [44.322353, 0.0, 0.0, 0.0, 0.0,
       0.0, 0.0, 0.0, 0.0, 0.0],
       index=dd.REGIONS)
    ht_ref_adoption_final = self.tla_per_region.loc[2050] * (ht_ref_adoption_initial / self.tla_per_region.loc[2014])
    ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
    ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
    ht_pds_adoption_initial = ht_ref_adoption_initial
    ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage)
    ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions))
    ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[2050]
    ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
    ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
    self.ht = helpertables.HelperTables(ac=self.ac,
        ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
        pds_adoption_data_per_region=pds_adoption_data_per_region,
        ref_adoption_limits=self.tla_per_region, pds_adoption_limits=self.tla_per_region,
        pds_adoption_trend_per_region=pds_adoption_trend_per_region,
        pds_adoption_is_single_source=pds_adoption_is_single_source)

    self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

    self.ua = unitadoption.UnitAdoption(ac=self.ac,
        ref_total_adoption_units=self.tla_per_region, pds_total_adoption_units=self.tla_per_region,
        electricity_unit_factor=1000000.0,
        soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
        soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
        bug_cfunits_double_count=True)
    soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
    soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
    conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
    soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

    self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
        ref_learning_increase_mult=2, conv_learning_increase_mult=2,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_tot_iunits=conv_ref_tot_iunits,
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_first_cost_uses_tot_units=True,
        fc_convert_iunit_factor=land.MHA_TO_HA)

    self.oc = operatingcost.OperatingCost(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
        soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
        soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
        conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
        single_iunit_purchase_year=2017,
        soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
        conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
        conversion_factor=land.MHA_TO_HA)

    self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.direct_ch4_co2_emissions_saved_land(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

    self.c2 = co2calcs.CO2Calcs(ac=self.ac,
        ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
        soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
        soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
        soln_pds_direct_co2eq_emissions_saved=self.ua.direct_co2eq_emissions_saved_land(),
        soln_pds_direct_co2_emissions_saved=self.ua.direct_co2_emissions_saved_land(),
        soln_pds_direct_n2o_co2_emissions_saved=self.ua.direct_n2o_co2_emissions_saved_land(),
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.direct_ch4_co2_emissions_saved_land(),
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
        conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        annual_land_area_harvested=self.ua.soln_pds_annual_land_area_harvested(),
        regime_distribution=self.ae.get_land_distribution())
示例#25
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=rrs.tam_ref_data_sources,
                          tam_pds_data_sources=rrs.tam_pds_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'Based on: IEA ETP 2016 6DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_6DS.csv'),
                'Based on: AMPERE 2014 MESSAGE MACRO Reference':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_AMPERE_2014_MESSAGE_MACRO_Reference.csv'),
            },
            'Conservative Cases': {
                'Based on: IEA ETP 2016 4DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_4DS.csv'),
                'Based on: Greenpeace 2015 Reference':
                THISDIR.joinpath('ad',
                                 'ad_based_on_Greenpeace_2015_Reference.csv'),
                'Based on: AMPERE 2014 MESSAGE MACRO 550':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_550.csv'),
            },
            'Ambitious Cases': {
                'Based on: IEA ETP 2016 2DS':
                THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_2DS.csv'),
                'Based on: Greenpeace 2015 Energy Revolution':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_Greenpeace_2015_Energy_Revolution.csv'),
                'Based on: AMPERE 2014 MESSAGE MACRO 450':
                THISDIR.joinpath(
                    'ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_450.csv'),
            },
            '100% RES2050 Case': {
                'Based on: Greenpeace 2015 Advanced Revolution':
                THISDIR.joinpath(
                    'ad',
                    'ad_based_on_Greenpeace_2015_Advanced_Revolution.csv'),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'High Ambitious, double growth by 2030 & 2050',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_High_Ambitious_double_growth_by_2030_2050.csv'
                )
            },
            {
                'name':
                'Conservative Growth of 2.5% annum',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Conservative_Growth_of_2_5_annum.csv')
            },
            {
                'name':
                'Low Ambitious Growth, 10% higher compared to REF case',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Low_Ambitious_Growth_10_higher_compared_to_REF_case.csv'
                )
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series([
            547.672, 69.035, 38.758, 403.057, 17.967, 18.856, 383.689, 4.014,
            23.027, 3.148
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=rrs.TERAWATT_TO_KILOWATT)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#26
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '2nd Poly', '2nd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Based on: IEA ETP 2016 6DS':
                THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2016_6DS.csv'),
            },
            'Conservative Cases': {
                'Based on: IEA ETP 2016 4DS':
                THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2016_4DS.csv'),
            },
            'Ambitious Cases': {
                'Based on: IEA ETP 2016 2DS':
                THISDIR.joinpath('tam', 'tam_based_on_IEA_ETP_2016_2DS.csv'),
            },
        }
        tam_pds_data_sources = {
            'Ambitious Cases': {
                'Drawdown TAM: Drawdown Integrated TAM - PDS1':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Drawdown_Integrated_TAM_PDS1.csv'),
                'Drawdown TAM: Drawdown Integrated TAM - PDS2':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Drawdown_Integrated_TAM_PDS2.csv'),
            },
            'Maximum Cases': {
                'Drawdown TAM: Drawdown Integrated TAM - PDS3':
                THISDIR.joinpath(
                    'tam',
                    'tam_pds_Drawdown_TAM_Drawdown_Integrated_TAM_PDS3.csv'),
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_pds_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Low', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'No Standards Case (David Siap, 2016, based on US Federal Rulemakings, 2016)':
                THISDIR.joinpath(
                    'ad',
                    'ad_No_Standards_Case_David_Siap_2016_based_on_US_Federal_Rulemakings_2016.csv'
                ),
            },
            'Conservative Cases': {
                'Standards Case (David Siap, 2016, based on US Federal Rulemakings, 2016)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Standards_Case_David_Siap_2016_based_on_US_Federal_Rulemakings_2016.csv'
                ),
            },
            'Ambitious Cases': {
                'Aggressive Standards Case (David Siap, 2016, based on US Federal Rulemakings, 2016)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Aggressive_Standards_Case_David_Siap_2016_based_on_US_Federal_Rulemakings_2016.csv'
                ),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        sconfig_list = [['region', 'base_year', 'last_year'],
                        ['World', 2014, 2050], ['OECD90', 2014, 2050],
                        ['Eastern Europe', 2014, 2050],
                        ['Asia (Sans Japan)', 2014, 2050],
                        ['Middle East and Africa', 2014, 2050],
                        ['Latin America', 2014, 2050], ['China', 2014, 2050],
                        ['India', 2014, 2050], ['EU', 2014, 2050],
                        ['USA', 2014, 2050]]
        sconfig = pd.DataFrame(sconfig_list[1:],
                               columns=sconfig_list[0],
                               dtype=np.object).set_index('region')
        sconfig['pds_tam_2050'] = pds_tam_per_region.loc[[2050]].T
        sc_regions, sc_percentages = zip(*self.ac.pds_base_adoption)
        sconfig['base_adoption'] = pd.Series(list(sc_percentages),
                                             index=list(sc_regions))
        sconfig['base_percent'] = sconfig[
            'base_adoption'] / pds_tam_per_region.loc[2014]
        sc_regions, sc_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        sconfig['last_percent'] = pd.Series(list(sc_percentages),
                                            index=list(sc_regions))
        if self.ac.pds_adoption_s_curve_innovation is not None:
            sc_regions, sc_percentages = zip(
                *self.ac.pds_adoption_s_curve_innovation)
            sconfig['innovation'] = pd.Series(list(sc_percentages),
                                              index=list(sc_regions))
        if self.ac.pds_adoption_s_curve_imitation is not None:
            sc_regions, sc_percentages = zip(
                *self.ac.pds_adoption_s_curve_imitation)
            sconfig['imitation'] = pd.Series(list(sc_percentages),
                                             index=list(sc_regions))
        self.sc = s_curve.SCurve(transition_period=16, sconfig=sconfig)

        ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Logistic S-Curve':
            pds_adoption_data_per_region = None
            pds_adoption_trend_per_region = self.sc.logistic_adoption()
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Bass Diffusion S-Curve':
            pds_adoption_data_per_region = None
            pds_adoption_trend_per_region = self.sc.bass_diffusion_adoption()
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(
            [2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=(1.0, 1000000000.0))

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#27
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Low',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'Calculated  from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                THISDIR.joinpath(
                    'tam',
                    'tam_Calculated_from_2_sources_World_Bank_2015_The_State_of_the_global_Clean_and_Improved_Coo_bef286f6.csv'
                ),
                'Calculated  from 2 sources - REN21 (2015) Renewables 2015 - Global Status Report, http://www.ren21.net/wp-content/uploads/2015/07/REN12-GSR2015_Onlinebook_low1.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                THISDIR.joinpath(
                    'tam',
                    'tam_Calculated_from_2_sources_REN21_2015_Renewables_2015_Global_Status_Report_httpwww_ren21__ee9a59ea.csv'
                ),
                'Drawdown Summation: Regional Sum':
                THISDIR.joinpath('tam',
                                 'tam_Drawdown_Summation_Regional_Sum.csv'),
            },
            'Conservative Cases': {
                'IEA (2013)': THISDIR.joinpath('tam', 'tam_IEA_2013.csv'),
            },
            'Region: Asia (Sans Japan)': {
                'Baseline Cases': {
                    'Calculated  from summing India and China from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_summing_India_and_China_from_2_sources_World_Bank_2015_The_State_of_the__778b8aac.csv'
                    ),
                    'Calculated  from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_World_Bank_2015_The_State_of_the_global_Clean_and_Improved_Coo_bef286f6.csv'
                    ),
                    'Calculated  from 2 sources - REN21 (2015) Renewables 2015 - Global Status Report, http://www.ren21.net/wp-content/uploads/2015/07/REN12-GSR2015_Onlinebook_low1.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_REN21_2015_Renewables_2015_Global_Status_Report_httpwww_ren21__ee9a59ea.csv'
                    ),
                },
                'Conservative Cases': {
                    'Based on IEA (2013) World Energy Outlook':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_IEA_2013_World_Energy_Outlook.csv'),
                },
            },
            'Region: Middle East and Africa': {
                'Baseline Cases': {
                    'Based on Ibitoye, F. I. (2013). The millennium development goals and household energy requirements in Nigeria. SpringerPlus, 2(1), 529.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_Ibitoye_F__I__2013__The_millennium_development_goals_and_household_energy_requi_26c73895.csv'
                    ),
                    'Calculated  from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_World_Bank_2015_The_State_of_the_global_Clean_and_Improved_Coo_bef286f6.csv'
                    ),
                    'Calculated  from 2 sources - REN21 (2015) Renewables 2015 - Global Status Report, http://www.ren21.net/wp-content/uploads/2015/07/REN12-GSR2015_Onlinebook_low1.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_REN21_2015_Renewables_2015_Global_Status_Report_httpwww_ren21__ee9a59ea.csv'
                    ),
                },
                'Conservative Cases': {
                    'Based on IEA (2013) World Energy Outlook':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_IEA_2013_World_Energy_Outlook.csv'),
                },
            },
            'Region: Latin America': {
                'Baseline Cases': {
                    'Calculated  from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_World_Bank_2015_The_State_of_the_global_Clean_and_Improved_Coo_bef286f6.csv'
                    ),
                    'Calculated  from 2 sources - REN21 (2015) Renewables 2015 - Global Status Report, http://www.ren21.net/wp-content/uploads/2015/07/REN12-GSR2015_Onlinebook_low1.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_REN21_2015_Renewables_2015_Global_Status_Report_httpwww_ren21__ee9a59ea.csv'
                    ),
                },
                'Conservative Cases': {
                    'Based on IEA (2013) World Energy Outlook':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_IEA_2013_World_Energy_Outlook.csv'),
                },
            },
            'Region: China': {
                'Baseline Cases': {
                    'Calculated  from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_World_Bank_2015_The_State_of_the_global_Clean_and_Improved_Coo_bef286f6.csv'
                    ),
                    'Calculated  from 2 sources - REN21 (2015) Renewables 2015 - Global Status Report, http://www.ren21.net/wp-content/uploads/2015/07/REN12-GSR2015_Onlinebook_low1.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_REN21_2015_Renewables_2015_Global_Status_Report_httpwww_ren21__ee9a59ea.csv'
                    ),
                },
                'Conservative Cases': {
                    'Based on Yuan, Y., & Zhao, I. (2013). Energy in Rural Areas of Northern China. Journal of Applied Sciences, 13(9), 1449-1454.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_Yuan_Y__Zhao_I__2013__Energy_in_Rural_Areas_of_Northern_China__Journal_of_Appli_91a28afa.csv'
                    ),
                },
                'Ambitious Cases': {
                    'Based on IEA (2013) World Energy Outlook':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_IEA_2013_World_Energy_Outlook.csv'),
                    'Based on Mainali, B., Pachauri, S., & Nagai, Y. (2012). Analyzing cooking fuel and stove choices in China till 2030. Journal of Renewable and Sustainable Energy, 4(3), 031805.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_Mainali_B__Pachauri_S__Nagai_Y__2012__Analyzing_cooking_fuel_and_stove_choices__e3f8fc59.csv'
                    ),
                },
            },
            'Region: India': {
                'Baseline Cases': {
                    'Based on Nakagami, H., Murakoshi, C., & Iwafune, Y. (2008). International comparison of household energy consumption and its indicator. Proceedings of the 2008 ACEEE Summer Study on Energy Efficiency in Buildings, 214-224.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_Nakagami_H__Murakoshi_C__Iwafune_Y__2008__International_comparison_of_household_58b0d8c2.csv'
                    ),
                    'Calculated  from 2 sources - World Bank (2015) The State of the global Clean and Improved Cooking Sector, https://openknowledge.worldbank.org/bitstream/handle/10986/21878/96499.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_World_Bank_2015_The_State_of_the_global_Clean_and_Improved_Coo_bef286f6.csv'
                    ),
                    'Calculated  from 2 sources - REN21 (2015) Renewables 2015 - Global Status Report, http://www.ren21.net/wp-content/uploads/2015/07/REN12-GSR2015_Onlinebook_low1.pdf AND Daioglou, V., Van Ruijven, B. J., & Van Vuuren, D. P. (2012). Model projections for household energy use in developing countries. Energy, 37(1), 601-615.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Calculated_from_2_sources_REN21_2015_Renewables_2015_Global_Status_Report_httpwww_ren21__ee9a59ea.csv'
                    ),
                },
                'Conservative Cases': {
                    'Based on IEA (2013) World Energy Outlook':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_IEA_2013_World_Energy_Outlook.csv'),
                },
                'Maximum Cases': {
                    'Based on Venkataraman, C., Sagar, A. D., Habib, G., Lam, N., & Smith, K. R. (2010). The Indian national initiative for advanced biomass cookstoves: the benefits of clean combustion. Energy for Sustainable Development, 14(2), 63-72.':
                    THISDIR.joinpath(
                        'tam',
                        'tam_based_on_Venkataraman_C__Sagar_A__D__Habib_G__Lam_N__Smith_K__R__2010__The_Indian_nation_114cfe53.csv'
                    ),
                },
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Baseline Cases': {
                'Project Drawdown Assumption of all Regions Growing to Asias Current Percent Adoption':
                THISDIR.joinpath(
                    'ad',
                    'ad_Project_Drawdown_Assumption_of_all_Regions_Growing_to_Asias_Current_Percent_Adoption.csv'
                ),
            },
            'Ambitious Cases': {
                'Project Drawdown Assumption of all Regions Growing to Chinas Current Percent Adoption':
                THISDIR.joinpath(
                    'ad',
                    'ad_Project_Drawdown_Assumption_of_all_Regions_Growing_to_Chinas_Current_Percent_Adoption.csv'
                ),
            },
            'Maximum Cases': {
                'Project Drawdown Assumption of all Regions Growing to 100 Percent Adoption':
                THISDIR.joinpath(
                    'ad',
                    'ad_Project_Drawdown_Assumption_of_all_Regions_Growing_to_100_Percent_Adoption.csv'
                ),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            adconfig=adconfig)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                'Drawdown Book Edition 1 REF Scenario',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Drawdown_Book_Edition_1_REF_Scenario.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series([
            86.0, 0.0, 0.0, 25.04194984517459, 5.337266131329677,
            36.925127117549664, 0.0, 0.0, 0.0, 0.0
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1000000000.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#28
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TAM
        tamconfig_list = [
            [
                'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'source_until_2014', self.ac.source_until_2014,
                self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'source_after_2014', self.ac.ref_source_post_2014,
                self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
                'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'
            ],
            [
                'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
                '3rd Poly', '3rd Poly'
            ],
            [
                'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'
            ],
            [
                'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ],
            [
                'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                1.0, 1.0
            ]
        ]
        tamconfig = pd.DataFrame(tamconfig_list[1:],
                                 columns=tamconfig_list[0],
                                 dtype=np.object).set_index('param')
        tam_ref_data_sources = {
            'Baseline Cases': {
                'ETP 2016, URBAN 6 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_6_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ICCT, 2012, "Global Transportation Roadmap Model" + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ICCT_2012_Global_Transportation_Roadmap_Model_Nonmotorized_Travel_Adjustment.csv'
                ),
            },
            'Conservative Cases': {
                'ETP 2016, URBAN 4 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_4_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - Baseline Scenario':
                THISDIR.joinpath(
                    'tam',
                    'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_Baseline_Scenario.csv'
                ),
            },
            'Ambitious Cases': {
                'ETP 2016, URBAN 2 DS + Non-motorized Travel Adjustment':
                THISDIR.joinpath(
                    'tam',
                    'tam_ETP_2016_URBAN_2_DS_Nonmotorized_Travel_Adjustment.csv'
                ),
                'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - HighShift Scenario':
                THISDIR.joinpath(
                    'tam',
                    'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_HighShift_Scenario.csv'
                ),
            },
            'Region: OECD90': {
                'Ambitious Cases': {
                    'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - High shift':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_High_shift.csv'
                    ),
                },
            },
            'Region: Eastern Europe': {
                'Ambitious Cases': {
                    'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - High shift':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_High_shift.csv'
                    ),
                },
            },
            'Region: Asia (Sans Japan)': {
                'Ambitious Cases': {
                    'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - High shift':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_High_shift.csv'
                    ),
                },
            },
            'Region: Middle East and Africa': {
                'Ambitious Cases': {
                    'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - High shift':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_High_shift.csv'
                    ),
                },
            },
            'Region: Latin America': {
                'Ambitious Cases': {
                    'ITDP - UC Davis (2015)  A Global High Shift Cycling Scenario Updated Report Data - High shift':
                    THISDIR.joinpath(
                        'tam',
                        'tam_ITDP_UC_Davis_2015_A_Global_High_Shift_Cycling_Scenario_Updated_Report_Data_High_shift.csv'
                    ),
                },
            },
        }
        self.tm = tam.TAM(tamconfig=tamconfig,
                          tam_ref_data_sources=tam_ref_data_sources,
                          tam_pds_data_sources=tam_ref_data_sources)
        ref_tam_per_region = self.tm.ref_tam_per_region()
        pds_tam_per_region = self.tm.pds_tam_per_region()

        # Custom PDS Data
        ca_pds_data_sources = [
            {
                'name':
                'Drawdown Book Edition 1 Scenario 1',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_1.csv')
            },
            {
                'name':
                'Drawdown Book Edition 1 Scenario 2',
                'include':
                True,
                'filename':
                THISDIR.joinpath(
                    'ca_pds_data',
                    'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_2.csv')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=pds_tam_per_region)

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                'Custom REF Adoption - Fixed Mass Transit Pass-km Annually',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Custom_REF_Adoption_Fixed_Mass_Transit_Passkm_Annually.csv'
                )
            },
            {
                'name':
                'Adoption Based on IEA 6DS',
                'include':
                False,
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Adoption_based_on_IEA_6DS.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=ref_tam_per_region)

        ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Linear':
            pds_adoption_data_per_region = None
            pds_adoption_trend_per_region = None
            pds_adoption_is_single_source = None

        ht_ref_adoption_initial = pd.Series([
            9607070620938.643, 2177533057697.923, 575975431282.0925,
            4506889445113.769, 1416146219920.7346, 1334877448730.5225, 0.0,
            0.0, 0.0, 0.0
        ],
                                            index=dd.REGIONS)
        ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (
            ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_regions, ht_percentages = zip(
            *self.ac.pds_adoption_final_percentage)
        ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages),
                                                     index=list(ht_regions))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=ref_tam_per_region,
            pds_adoption_limits=pds_tam_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=ref_tam_per_region,
            pds_total_adoption_units=pds_tam_per_region,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=True)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            fc_convert_iunit_factor=1.0)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=1.0)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            soln_pds_direct_co2_emissions_saved(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            soln_pds_direct_ch4_co2_emissions_saved(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            soln_pds_direct_n2o_co2_emissions_saved(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            fuel_in_liters=False)

        self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014,
                                                                      'World'],
                           soln_avg_annual_use=self.ac.soln_avg_annual_use,
                           conv_avg_annual_use=self.ac.conv_avg_annual_use)
示例#29
0
    def __init__(self, scenario=None):
        if scenario is None:
            scenario = list(scenarios.keys())[0]
        self.scenario = scenario
        self.ac = scenarios[scenario]

        # TLA
        self.ae = aez.AEZ(solution_name=self.name,
                          cohort=2020,
                          regimes=dd.THERMAL_MOISTURE_REGIMES8)
        self.tla_per_region = tla.tla_per_region(
            self.ae.get_land_distribution())

        adconfig_list = [
            [
                'param', 'World', 'OECD90', 'Eastern Europe',
                'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America',
                'China', 'India', 'EU', 'USA'
            ],
            [
                'trend', self.ac.soln_pds_adoption_prognostication_trend,
                'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
                'Medium', 'Medium', 'Medium'
            ],
            [
                'growth', self.ac.soln_pds_adoption_prognostication_growth,
                'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE',
                'NOTE'
            ],
            ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
            ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        ]
        adconfig = pd.DataFrame(adconfig_list[1:],
                                columns=adconfig_list[0],
                                dtype=np.object).set_index('param')
        ad_data_sources = {
            'Raw Data for ALL LAND TYPES': {
                'Project Drawdown 2018_Direct Seeded Rice Area (2nd Polynomial Growth)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Project_Drawdown_2018_Direct_Seeded_Rice_Area_2nd_Polynomial_Growth.csv'
                ),
                'Project Drawdown 2018_Rice Area under water management (Linear Growth)':
                THISDIR.joinpath(
                    'ad',
                    'ad_Project_Drawdown_2018_Rice_Area_under_water_management_Linear_Growth.csv'
                ),
            },
        }
        self.ad = adoptiondata.AdoptionData(ac=self.ac,
                                            data_sources=ad_data_sources,
                                            main_includes_regional=True,
                                            adconfig=adconfig)

        # Custom PDS Data
        ca_pds_columns = ['Year'] + dd.REGIONS
        tla_2050 = self.tla_per_region.loc[2050, 'World']
        ad_2018 = self.ac.ref_base_adoption['World']

        # 2050 adoption based on Project Drawdown 2018 Direct Seeded
        # Rice Area (2nd order Polynomial Growth); Refer "Adoption Data" sheet
        ad_2050_2ndpoly = 69.9380489958066000

        # 2050 adoption based on Project Drawdown 2018_Rice Area under water
        # management (Linear Growth); Refer "Adoption Data" sheet
        ad_2050_linear = 170.3736841446970000

        # 2050 adoption based on Project Drawdown 2018_Rice Area under water
        # management (Linear Growth, divided by 2); Refer "Adoption Data" sheet
        ad_2050_linear_half = 85.1868420723484000

        ad_2050_avg = (ad_2050_2ndpoly + ad_2050_linear +
                       ad_2050_linear_half) / 3.0
        ad_2050_min = min(
            [ad_2050_2ndpoly, ad_2050_linear, ad_2050_linear_half])
        ad_2050_max = max(
            [ad_2050_2ndpoly, ad_2050_linear, ad_2050_linear_half])

        ca_pds_data_sources = [
            {
                'name':
                'Medium Growth',
                'include':
                True,
                'description':
                ('Future adoption of improved rice cultivation is projected based on the '
                 'historical growth rate of direct seeded rice and water management available '
                 'in the literature (refer "Current Adoption_LR" sheet). The historical data '
                 'was interpolated, a 2nd order polynomial growth was considered for direct '
                 'seeded rice data and linear growth for the water management, The '
                 'interpolated data is then placed in the "adoption data" sheet. The future '
                 'adoption in the present scenario is based on the "average adoption value '
                 'projected for the year 2050" based on the given data set. '),
                'datapoints':
                pd.DataFrame([
                    [
                        2018, ad_2018, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                    [
                        2050, ad_2050_avg, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Low Growth',
                'include':
                True,
                'description':
                ('Future adoption of improved rice cultivation is projected based on the '
                 'historical growth rate of direct seeded rice and water management available '
                 'in the literature (refer "Current Adoption_LR" sheet). The historical data '
                 'was interpolated, a 2nd order polynomial growth was considered for direct '
                 'seeded rice data and linear growth for the water management, The '
                 'interpolated data is then placed in the "adoption data" sheet. The future '
                 'adoption in the present scenario is based on the "minimum adoption value '
                 'projected for the year 2050" based on the given data set. '),
                'datapoints':
                pd.DataFrame([
                    [
                        2018, ad_2018, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                    [
                        2050, ad_2050_min, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'High Growth',
                'include':
                True,
                'description':
                ('Future adoption of improved rice cultivation is projected based on the '
                 'historical growth rate of direct seeded rice and water management available '
                 'in the literature (refer "Current Adoption_LR" sheet). The historical data '
                 'was interpolated, a 2nd order polynomial growth was considered for direct '
                 'seeded rice data and linear growth for the water management, The '
                 'interpolated data is then placed in the "adoption data" sheet. The future '
                 'adoption in the present scenario is based on the "maximum adoption value '
                 'projected for the year 2050" based on the given data set. '),
                'datapoints':
                pd.DataFrame([
                    [
                        2018, ad_2018, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                    [
                        2050, ad_2050_max, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Medium Growth, Early Adoption',
                'include':
                True,
                'description':
                ('Future adoption of improved rice cultivation is projected based on the '
                 'historical growth rate of direct seeded rice and water management available '
                 'in the literature (refer "Current Adoption_LR" sheet). The historical data '
                 'was interpolated, a 2nd order polynomial growth was considered for direct '
                 'seeded rice data and linear growth for the water management, The '
                 'interpolated data is then placed in the "adoption data" sheet. The future '
                 'adoption in the present scenario is based on the "average adoption value '
                 'projected for the year 2050" based on the given data set. In addition, it '
                 'is also assumed that 75% of the projected adoption for the year 2050 will '
                 'be achieved by 2030. '),
                'datapoints':
                pd.DataFrame([
                    [
                        2018, ad_2018, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                    [
                        2030, 0.75 * ad_2050_avg, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                    [
                        2050, ad_2050_avg, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'Low Growth, Early Adoption',
                'include':
                True,
                'description':
                ('Future adoption of improved rice cultivation is projected based on the '
                 'historical growth rate of direct seeded rice and water management available '
                 'in the literature (refer "Current Adoption_LR" sheet). The historical data '
                 'was interpolated, a 2nd order polynomial growth was considered for direct '
                 'seeded rice data and linear growth for the water management, The '
                 'interpolated data is then placed in the "adoption data" sheet. The future '
                 'adoption in the present scenario is based on the "minimum adoption value '
                 'projected for the year 2050" based on the given data set. In addition, it '
                 'is also assumed that 75% of the projected adoption for the year 2050 will '
                 'be achieved by 2030. '),
                'datapoints':
                pd.DataFrame([
                    [
                        2018, ad_2018, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                    [
                        2030, 0.75 * ad_2050_min, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                    [
                        2050, ad_2050_min, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
            {
                'name':
                'High Growth, Early Adoption',
                'include':
                False,
                'description':
                ('Future adoption of improved rice cultivation is projected based on the '
                 'historical growth rate of direct seeded rice and water management available '
                 'in the literature (refer "Current Adoption_LR" sheet). The historical data '
                 'was interpolated, a 2nd order polynomial growth was considered for direct '
                 'seeded rice data and linear growth for the water management, The '
                 'interpolated data is then placed in the "adoption data" sheet. The future '
                 'adoption in the present scenario is based on the "maximum adoption value '
                 'projected for the year 2050" based on the given data set. In addition, it '
                 'is also assumed that 75% of the projected adoption for the year 2050 will '
                 'be achieved by 2030. '),
                'datapoints':
                pd.DataFrame([
                    [
                        2018, ad_2018, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0
                    ],
                    [
                        2030, 0.75 * ad_2050_max, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0, 0.0
                    ],
                    [
                        2050, ad_2050_max, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                        0.0, 0.0
                    ],
                ],
                             columns=ca_pds_columns).set_index('Year')
            },
        ]
        self.pds_ca = customadoption.CustomAdoption(
            data_sources=ca_pds_data_sources,
            soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        for s in self.pds_ca.scenarios.values():
            df = s['df']
            df.loc[2014, 'World'] = 31.2753335238409000
            df.loc[2015, 'World'] = 33.6257358946259000
            df.loc[2016, 'World'] = 35.9761382654110000
            df.loc[2017, 'World'] = 38.3265406361960000
            df.loc[2018, 'World'] = 40.6769430069810000

        # Custom REF Data
        ca_ref_data_sources = [
            {
                'name':
                '[Type Scenario 1 Name Here (REF CASE)...]',
                'include':
                True,
                'description':
                'No description entered.',
                'filename':
                THISDIR.joinpath(
                    'ca_ref_data',
                    'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv')
            },
        ]
        self.ref_ca = customadoption.CustomAdoption(
            data_sources=ca_ref_data_sources,
            soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
            high_sd_mult=1.0,
            low_sd_mult=1.0,
            total_adoption_limit=self.tla_per_region)

        if self.ac.soln_ref_adoption_basis == 'Custom':
            ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region(
            )
        else:
            ref_adoption_data_per_region = None

        if False:
            # One may wonder why this is here. This file was code generated.
            # This 'if False' allows subsequent conditions to all be elif.
            pass
        elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
            pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region(
            )
            pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region(
            )
            pds_adoption_is_single_source = None
        elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
            pds_adoption_data_per_region = self.ad.adoption_data_per_region()
            pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
            pds_adoption_is_single_source = self.ad.adoption_is_single_source()

        ht_ref_adoption_initial = pd.Series(list(
            self.ac.ref_base_adoption.values()),
                                            index=dd.REGIONS)
        ht_ref_adoption_final = self.tla_per_region.loc[2050] * (
            ht_ref_adoption_initial / self.tla_per_region.loc[2014])
        ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial
        ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
        ht_pds_adoption_initial = ht_ref_adoption_initial
        ht_pds_adoption_final_percentage = pd.Series(
            list(self.ac.pds_adoption_final_percentage.values()),
            index=list(self.ac.pds_adoption_final_percentage.keys()))
        ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[
            2050]
        ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
        ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial
        ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
        self.ht = helpertables.HelperTables(
            ac=self.ac,
            ref_datapoints=ht_ref_datapoints,
            pds_datapoints=ht_pds_datapoints,
            pds_adoption_data_per_region=pds_adoption_data_per_region,
            ref_adoption_limits=self.tla_per_region,
            pds_adoption_limits=self.tla_per_region,
            ref_adoption_data_per_region=ref_adoption_data_per_region,
            use_first_pds_datapoint_main=False,
            adoption_base_year=2018,
            copy_pds_to_ref=False,
            pds_adoption_trend_per_region=pds_adoption_trend_per_region,
            pds_adoption_is_single_source=pds_adoption_is_single_source)

        self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

        self.ua = unitadoption.UnitAdoption(
            ac=self.ac,
            ref_total_adoption_units=self.tla_per_region,
            pds_total_adoption_units=self.tla_per_region,
            electricity_unit_factor=1000000.0,
            soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
            soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
            bug_cfunits_double_count=False)
        soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
        soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
        conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
        soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted(
        )

        self.fc = firstcost.FirstCost(
            ac=self.ac,
            pds_learning_increase_mult=2,
            ref_learning_increase_mult=2,
            conv_learning_increase_mult=2,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_tot_iunits=conv_ref_tot_iunits,
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_first_cost_uses_tot_units=True,
            fc_convert_iunit_factor=land.MHA_TO_HA)

        self.oc = operatingcost.OperatingCost(
            ac=self.ac,
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
            soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
            conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
            soln_pds_annual_world_first_cost=self.fc.
            soln_pds_annual_world_first_cost(),
            soln_ref_annual_world_first_cost=self.fc.
            soln_ref_annual_world_first_cost(),
            conv_ref_annual_world_first_cost=self.fc.
            conv_ref_annual_world_first_cost(),
            single_iunit_purchase_year=2017,
            soln_pds_install_cost_per_iunit=self.fc.
            soln_pds_install_cost_per_iunit(),
            conv_ref_install_cost_per_iunit=self.fc.
            conv_ref_install_cost_per_iunit(),
            conversion_factor=land.MHA_TO_HA)

        self.c4 = ch4calcs.CH4Calcs(
            ac=self.ac,
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

        self.c2 = co2calcs.CO2Calcs(
            ac=self.ac,
            ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
            soln_pds_net_grid_electricity_units_saved=self.ua.
            soln_pds_net_grid_electricity_units_saved(),
            soln_pds_net_grid_electricity_units_used=self.ua.
            soln_pds_net_grid_electricity_units_used(),
            soln_pds_direct_co2eq_emissions_saved=self.ua.
            direct_co2eq_emissions_saved_land(),
            soln_pds_direct_co2_emissions_saved=self.ua.
            direct_co2_emissions_saved_land(),
            soln_pds_direct_n2o_co2_emissions_saved=self.ua.
            direct_n2o_co2_emissions_saved_land(),
            soln_pds_direct_ch4_co2_emissions_saved=self.ua.
            direct_ch4_co2_emissions_saved_land(),
            soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
            soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
            conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
            conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
            conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
            soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
            annual_land_area_harvested=self.ua.
            soln_pds_annual_land_area_harvested(),
            regime_distribution=self.ae.get_land_distribution(),
            regimes=dd.THERMAL_MOISTURE_REGIMES8)
示例#30
0
  def __init__(self, scenario=None):
    if scenario is None:
      scenario = list(scenarios.keys())[0]
    self.scenario = scenario
    self.ac = scenarios[scenario]

    # TAM
    tamconfig_list = [
      ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014,
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES',
       'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'],
      ['trend', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param')
    self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=rrs.energy_tam_1_ref_data_sources,
      tam_pds_data_sources=rrs.energy_tam_1_pds_data_sources)
    ref_tam_per_region=self.tm.ref_tam_per_region()
    pds_tam_per_region=self.tm.pds_tam_per_region()

    adconfig_list = [
      ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)',
       'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'],
      ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly',
       '3rd Poly', '3rd Poly', '3rd Poly'],
      ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium',
       'Medium', 'Medium', 'Medium', 'Medium', 'Medium',
       'Medium', 'Medium', 'Medium'],
      ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
      ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]]
    adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param')
    ad_data_sources = {
      'Baseline Cases': {
          'Based on: IEA ETP 2016 6DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_6DS.csv'),
          'Based on: AMPERE 2014 MESSAGE MACRO Reference': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_Reference.csv'),
          'Based on: AMPERE 2014 GEM E3 Reference': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_Reference.csv'),
          'Based on: AMPERE 2014 IMAGE TIMER Reference': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_Reference.csv'),
      },
      'Conservative Cases': {
          'Based on: IEA ETP 2016 4DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_4DS.csv'),
          'Based on: AMPERE 2014 MESSAGE MACRO 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_550.csv'),
          'Based on: AMPERE 2014 GEM E3 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_550.csv'),
          'Based on: AMPERE 2014 IMAGE TIMER 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_550.csv'),
      },
      'Ambitious Cases': {
          'Based on: IEA ETP 2016 2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_2DS.csv'),
          'Based on: AMPERE 2014 MESSAGE MACRO 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_450.csv'),
          'Based on: AMPERE 2014 GEM E3 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_450.csv'),
          'Based on: AMPERE 2014 IMAGE TIMER 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_450.csv'),
      },
      '100% RES2050 Case': {
          'Based on Greenpeace Advanced Revolution Scenario': THISDIR.joinpath('ad', 'ad_based_on_Greenpeace_Advanced_Revolution_Scenario.csv'),
      },
    }
    self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources,
        adconfig=adconfig)

    # Custom PDS Data
    ca_pds_data_sources = [
      {'name': 'Project Drawdown High Growth, Ambitious Cases, adjusted', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Project_Drawdown_High_Growth_Ambitious_Cases_adjusted.csv')},
      {'name': 'Project Drawdown High Growth, Conservative Cases, adjusted, smoothed curve', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Project_Drawdown_High_Growth_Conservative_Cases_adjusted_smoothed_curve.csv')},
      {'name': 'Optimum Nuclear reduces to 0% of TAM by 2050, based on AMPERE RefPol Scenario (2014) till peaking', 'include': True,
          'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Optimum_Nuclear_reduces_to_0_of_TAM_by_2050_based_on_AMPERE_RefPol_Scenario_2014_till_peaking.csv')},
    ]
    self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources,
        soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=pds_tam_per_region)

    # Custom REF Data
    ca_ref_data_sources = [
      {'name': 'Custom REF Adoption mirroring decline in nuclear in Plausible SCenario', 'include': False,
          'filename': THISDIR.joinpath('ca_ref_data', 'custom_ref_ad_Custom_REF_Adoption_mirroring_decline_in_nuclear_in_Plausible_SCenario.csv')},
    ]
    self.ref_ca = customadoption.CustomAdoption(data_sources=ca_ref_data_sources,
        soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name,
        high_sd_mult=1.0, low_sd_mult=1.0,
        total_adoption_limit=ref_tam_per_region)

    if self.ac.soln_ref_adoption_basis == 'Custom':
      ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region()
    else:
      ref_adoption_data_per_region = None

    if False:
      # One may wonder why this is here. This file was code generated.
      # This 'if False' allows subsequent conditions to all be elif.
      pass
    elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS':
      pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region()
      pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region()
      pds_adoption_is_single_source = None
    elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications':
      pds_adoption_data_per_region = self.ad.adoption_data_per_region()
      pds_adoption_trend_per_region = self.ad.adoption_trend_per_region()
      pds_adoption_is_single_source = self.ad.adoption_is_single_source()

    ht_ref_adoption_initial = pd.Series(
      [2417.0, 2067.538596846472, 337.7907984353286, 422.9280547381077, 19.434007595770563,
       34.286204887889326, 186.72565568543357, 81.7511387032866, 911.5844464681002, 822.7334922881862],
       index=dd.REGIONS)
    ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014])
    ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial
    ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0)
    ht_pds_adoption_initial = ht_ref_adoption_initial
    ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage)
    ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions))
    ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050]
    ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS)
    ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial
    ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0)
    self.ht = helpertables.HelperTables(ac=self.ac,
        ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints,
        pds_adoption_data_per_region=pds_adoption_data_per_region,
        ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region,
        ref_adoption_data_per_region=ref_adoption_data_per_region,
        pds_adoption_trend_per_region=pds_adoption_trend_per_region,
        pds_adoption_is_single_source=pds_adoption_is_single_source)

    self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac)

    self.ua = unitadoption.UnitAdoption(ac=self.ac,
        ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region,
        soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(),
        soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(),
        bug_cfunits_double_count=True)
    soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd()
    soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd()
    conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits()
    soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted()

    self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2,
        ref_learning_increase_mult=2, conv_learning_increase_mult=2,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_tot_iunits=conv_ref_tot_iunits,
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT)

    self.oc = operatingcost.OperatingCost(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd,
        soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd,
        conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(),
        soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(),
        soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(),
        conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(),
        single_iunit_purchase_year=2017,
        soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(),
        conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(),
        conversion_factor=rrs.TERAWATT_TO_KILOWATT)

    self.c4 = ch4calcs.CH4Calcs(ac=self.ac,
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted)

    self.c2 = co2calcs.CO2Calcs(ac=self.ac,
        ch4_ppb_calculator=self.c4.ch4_ppb_calculator(),
        soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(),
        soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(),
        soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(),
        soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(),
        soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(),
        soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(),
        soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(),
        conv_ref_new_iunits=self.ua.conv_ref_new_iunits(),
        conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(),
        conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(),
        soln_net_annual_funits_adopted=soln_net_annual_funits_adopted,
        fuel_in_liters=False)

    self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'],
        soln_avg_annual_use=self.ac.soln_avg_annual_use,
        conv_avg_annual_use=self.ac.conv_avg_annual_use)