Exemplo n.º 1
0
def test_bass_diffusion_regions_NaN():
    # From Bioplastics "S Curve Adoption"!B119:K128
    sconfig = pd.DataFrame(
        [[
            'World', 2014, 2050, 0.00536977491961415, 1.67, 791.974792264998,
            0.00112096, 0.10333344
        ], ['OECD90', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['Eastern Europe', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['Asia (Sans Japan)', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['Middle East and Africa', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['Latin America', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['China', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['India', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['EU', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0],
         ['USA', 2014, 2050, 0.0, 0.0, 0.0, 0.0, 0.0]],
        columns=[
            'region', 'base_year', 'last_year', 'base_percent',
            'base_adoption', 'pds_tam_2050', 'innovation', 'imitation'
        ]).set_index('region')
    sc = s_curve.SCurve(transition_period=None, sconfig=sconfig)
    result = sc.bass_diffusion_adoption()
    expected = pd.DataFrame(
        bass_diffusion_adoption_regions_NaN_list[1:],
        columns=bass_diffusion_adoption_regions_NaN_list[0]).set_index('Year')
    expected.name = 'bass_diffusion_adoption'
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
Exemplo n.º 2
0
def test_bass_diffusion():
    # From Water Efficiency Measures "S Curve Adoption"!B119:K128
    sconfig = pd.DataFrame(
        [[
            'World', 2014, 2050, 0.5, 86258.8944386277, 499769.3997737280,
            0.0011209600, 0.1033334410
        ],
         [
             'OECD90', 2014, 2050, 0.5558684888, 47682.0319026127,
             165775.7429560840, 0.0011209600, 0.1033334410
         ],
         [
             'Eastern Europe', 2014, 2050, 0.0, 0.0, 21474.3917595734,
             0.0011209600, 0.1033334410
         ],
         [
             'Asia (Sans Japan)', 2014, 2050, 0.0, 0.0, 188212.6206588630,
             0.0011209600, 0.1033334410
         ],
         [
             'Middle East and Africa', 2014, 2050, 0.0, 0.0, 62742.1062748580,
             0.0011209600, 0.1033334410
         ],
         [
             'Latin America', 2014, 2050, 0.0, 0.0, 45343.3516130736,
             0.0011209600, 0.1033334410
         ],
         [
             'China', 2014, 2050, 0.0, 0.0, 77612.1430465617, 0.0011209600,
             0.1033334410
         ],
         [
             'India', 2014, 2050, 0.0, 0.0, 45491.8656042331, 0.0011209600,
             0.1033334410
         ],
         [
             'EU', 2014, 2050, 0.0, 0.0, 59700.4155768868, 0.0011209600,
             0.1033334410
         ],
         [
             'USA', 2014, 2050, 0.0, 0.0, 64756.7863759130, 0.0011209600,
             0.1033334410
         ]],
        columns=[
            'region', 'base_year', 'last_year', 'base_percent',
            'base_adoption', 'pds_tam_2050', 'innovation', 'imitation'
        ]).set_index('region')
    sc = s_curve.SCurve(transition_period=None, sconfig=sconfig)
    result = sc.bass_diffusion_adoption()
    expected = pd.DataFrame(
        bass_diffusion_adoption_list[1:],
        columns=bass_diffusion_adoption_list[0]).set_index('Year')
    expected.name = 'bass_diffusion_adoption'
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
Exemplo n.º 3
0
def test_sigmoid_logistic():
    """Test logistic sigmoid, simple case."""
    sc = s_curve.SCurve(transition_period=None, sconfig=None)
    # values from Building Automation System "S Curve Adoption"!AH17:AH22
    result = sc._sigmoid_logistic(base_year=2014,
                                  last_year=2050,
                                  base_percent=0.346959145052,
                                  last_percent=0.95,
                                  base_adoption=16577.8259167003,
                                  pds_tam_2050=77969.4257883872)
    expected = pd.DataFrame(
        world_sigmoid_logistic_list[1:],
        columns=world_sigmoid_logistic_list[0]).set_index('Year')
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
Exemplo n.º 4
0
def test_logistic_adoption():
    # From Building Automation System "S Curve Adoption"!AJ17:AJ22
    sconfig = pd.DataFrame(
        [[
            'World', 2014, 2050, 0.346959145052, 0.95, 16577.8259167003,
            77969.4257883872
        ],
         [
             'OECD90', 2014, 2050, 0.677494504097, 1.0, 14915.99,
             30578.7612542884
         ],
         [
             'Eastern Europe', 2014, 2050, 0.0, 0.212709603444,
             325.933926458798, 1532.2953039347
         ],
         [
             'Asia (Sans Japan)', 2014, 2050, 0.074153999059, 0.447707349074,
             1087.77094452167, 25358.3339750411
         ],
         [
             'Middle East and Africa', 2014, 2050, 0.0, 0.085083841378, 0.0,
             4140.6610709308
         ],
         [
             'Latin America', 2014, 2050, 0.0, 0.223853674537, 0.0,
             1021.9329224435
         ],
         ['China', 2014, 2050, 0.0848, 0.0, 1087.77094452167, 18965.135056084],
         ['India', 2014, 2050, 0.0, 0.0, 0.0, 8804.235498036],
         ['EU', 2014, 2050, 0.482603137947, 1.0, 3622.85, 11003.3574757203],
         ['USA', 2014, 2050, 0.445634302889, 1.0, 11293.14, 36879.9583966390]],
        columns=[
            'region', 'base_year', 'last_year', 'base_percent', 'last_percent',
            'base_adoption', 'pds_tam_2050'
        ]).set_index('region')
    sc = s_curve.SCurve(transition_period=16, sconfig=sconfig)
    result = sc.logistic_adoption()
    expected = pd.DataFrame(
        logistic_s_curve_adoption_list[1:],
        columns=logistic_s_curve_adoption_list[0]).set_index('Year')
    expected.name = 'logistic_adoption'
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
Exemplo n.º 5
0
def test_sigmoid_logistic_100_percent_final_adoption():
    """Test logistic sigmoid, with 100% last_percent adoption."""
    sc = s_curve.SCurve(transition_period=None, sconfig=None)
    # values from Building Automation System "S Curve Adoption"!AJ17:AJ22
    result = sc._sigmoid_logistic(base_year=2014,
                                  last_year=2050,
                                  base_percent=0.677494504097,
                                  last_percent=1.0,
                                  base_adoption=14915.990000000000,
                                  pds_tam_2050=30578.7612542884)
    expected = pd.DataFrame(
        OECD90_sigmoid_logistic_list[1:],
        columns=OECD90_sigmoid_logistic_list[0]).set_index('Year')
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
    result = sc._sigmoid_logistic(base_year=2014,
                                  last_year=2050,
                                  base_percent=0.677494504097,
                                  last_percent=0.999999999999,
                                  base_adoption=14915.990000000000,
                                  pds_tam_2050=30578.7612542884)
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
Exemplo n.º 6
0
def test_sigmoid_logistic_divide_by_zero():
    """Test logistic sigmoid, with 100% last_percent adoption."""
    sc = s_curve.SCurve(transition_period=None, sconfig=None)
    result = sc._sigmoid_logistic(base_year=2014,
                                  last_year=2050,
                                  base_percent=0.1,
                                  last_percent=0.0,
                                  base_adoption=1000.0,
                                  pds_tam_2050=1000.0)
    expected = pd.DataFrame(
        nan_sigmoid_logistic_list[1:],
        columns=nan_sigmoid_logistic_list[0]).set_index('Year')
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
    with pytest.warns(None) as warnings:
        result = sc._sigmoid_logistic(base_year=2014,
                                      last_year=2050,
                                      base_percent=np.float64(0.1),
                                      last_percent=np.float64(0.0),
                                      base_adoption=1000.0,
                                      pds_tam_2050=1000.0)
    assert len(warnings) == 0
    pd.testing.assert_frame_equal(result, expected, check_exact=False)
Exemplo n.º 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': {
          'Custom (See TAM Factoring) based on  http://www.gbpn.org/databases-tools/mrv-tool/methodology.': THISDIR.joinpath('tam', 'tam_Custom_See_TAM_Factoring_based_on_httpwww_gbpn_orgdatabasestoolsmrvtoolmethodology_.csv'),
          'Based on GBPN - BEST PRACTICE POLICIES FOR LOW CARBON & ENERGY BUILDINGS BASED ON SCENARIO ANALYSIS May 2012': THISDIR.joinpath('tam', 'tam_based_on_GBPN_BEST_PRACTICE_POLICIES_FOR_LOW_CARBON_ENERGY_BUILDINGS_BASED_ON_SCENARIO_A_c7e92439.csv'),
          'IEA (2013)': THISDIR.joinpath('tam', 'tam_IEA_2013.csv'),
      },
      'Conservative Cases': {
          'McKinsey': THISDIR.joinpath('tam', 'tam_McKinsey.csv'),
          'Navigant (2014)': THISDIR.joinpath('tam', 'tam_Navigant_2014.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)

    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(
      [165284837.0, 153214036.0, 2001574.0, 10001070.0, 1759.0,
       66398.0, 10000000.0, 1070.0, 129000000.0, 21532448.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=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)
Exemplo n.º 8
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)
Exemplo n.º 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', 'High', 'High', 'High', 'High'
            ],
            [
                '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 = {
            'Ambitious Cases': {
                'IEA, 2013, "Transition to Sustainable Buildings" – see TAM Factoring':
                THISDIR.joinpath(
                    'tam',
                    'tam_IEA_2013_Transition_to_Sustainable_Buildings_see_TAM_Factoring.csv'
                ),
                'Ürge-Vorsatz et al. (2015) – see TAM Factoring':
                THISDIR.joinpath(
                    'tam',
                    'tam_ÜrgeVorsatz_et_al__2015_see_TAM_Factoring.csv'),
            },
            'Region: China': {
                'Ambitious Cases': {
                    'IEA, 2013, "Transition to Sustainable Buildings" – see TAM Factoring':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2013_Transition_to_Sustainable_Buildings_see_TAM_Factoring.csv'
                    ),
                    'Hong et al. (2014) – see TAM Factoring':
                    THISDIR.joinpath(
                        'tam', 'tam_Hong_et_al__2014_see_TAM_Factoring.csv'),
                },
            },
            'Region: India': {
                'Ambitious Cases': {
                    'IEA, 2013, "Transition to Sustainable Buildings" – see TAM Factoring':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2013_Transition_to_Sustainable_Buildings_see_TAM_Factoring.csv'
                    ),
                    'Chaturvedi et al (2014) – see TAM Factoring':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Chaturvedi_et_al_2014_see_TAM_Factoring.csv'),
                },
            },
            'Region: EU': {
                'Ambitious Cases': {
                    'IEA, 2013, "Transition to Sustainable Buildings" – see TAM Factoring':
                    THISDIR.joinpath(
                        'tam',
                        'tam_IEA_2013_Transition_to_Sustainable_Buildings_see_TAM_Factoring.csv'
                    ),
                    'Boermans et al. (2012); BPIE (2014) – see TAM Factoring':
                    THISDIR.joinpath(
                        'tam',
                        'tam_Boermans_et_al__2012_BPIE_2014_see_TAM_Factoring.csv'
                    ),
                },
            },
            'Region: USA': {
                'Baseline Cases': {
                    'EIA, 2016, "Annual Energy Outlook 2016" – Reference Case':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_2016_Annual_Energy_Outlook_2016_Reference_Case.csv'
                    ),
                    'EIA, 2016, "Annual Energy Outlook 2016" – Reference Case w/o CPP':
                    THISDIR.joinpath(
                        'tam',
                        'tam_EIA_2016_Annual_Energy_Outlook_2016_Reference_Case_wo_CPP.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)

        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()
        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([
            16577.82591670033, 14915.99, 0.0, 1087.7709445216651, 0.0, 0.0,
            1087.7709445216651, 0.0, 3622.85, 11293.14
        ],
                                            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=1000000.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)