def test_between_two_values():
    """Check that the average price value is between the local value and the international value"""
    fuel_1 = Fuel_Price(local_prices, price_gas, price_coal, local_production,
                        baseline)
    assert pd.concat([fuel_1.international_prices["Gas"], local_prices["Gas"]], axis=1)\
    .min(axis=1).all() <= fuel_1.average_price["Gas"].all()
    assert fuel_1.average_price["Gas"].all() <= pd.concat(
        [fuel_1.international_prices["Gas"], local_prices["Gas"]],
        axis=1).max(axis=1).all()
Example #2
0
 def carbon_captured(self, headers):
     """Dataframe comparing the carbon captured in the two runs, for key years."""
     cc_bau = self.BAU.carbon_captured()
     cc_alt = self.ALT.carbon_captured()
     cc_diff = cc_alt - cc_bau
     table = pd.concat([cc_bau, cc_alt, cc_diff], axis=1)
     table.columns = headers
     return table
Example #3
0
 def carbon_intensity(self, headers):
     """Dataframe comparing the CO2 intensity of electricity in the two runs, for key years."""
     ci_bau = self.BAU.carbon_intensity()
     ci_alt = self.ALT.carbon_intensity()
     ci_diff = ci_alt - ci_bau
     table = pd.concat([ci_bau, ci_alt, ci_diff], axis=1)
     table.columns = headers
     return table
Example #4
0
 def emission_sum(self, headers):
     """Dataframe comparing total intertemporal CO2 emissions of the two runs, by technology."""
     es_BAU = self.BAU.emission_sum()
     es_ALT = self.ALT.emission_sum()
     es_diff = es_ALT - es_BAU
     d = pd.concat([es_BAU, es_ALT, es_diff], axis=1)
     d.columns = headers
     return d
Example #5
0
 def total(self, headers):
     """Dataframe comparing the key results of the two runs."""
     units = self.BAU.total().iloc[:, 1]
     total_BAU = self.BAU.total().iloc[:, 0]  # Only the values
     total_ALT = self.ALT.total().iloc[:, 0]
     total_diff = total_ALT - total_BAU
     d = pd.concat([total_BAU, total_ALT, total_diff, units], axis=1)
     d.columns = headers + ['Units']
     return d
Example #6
0
    def __init__(self, plan, parameter):
        self.plan = plan
        self.parameter = parameter

        def pv(variable):
            return present_value(
                variable, parameter.discount_rate).sum()  # Sum on technologies

        self.total_production = pv(plan.production[sources])

        self.investment = (plan.additions * MW * parameter.construction_cost *
                           USD / kW / MUSD)
        self.total_investment = pv(self.investment)

        self.salvage_value = pd.concat([
            residual_value(plan.additions, parameter.plant_accounting_life,
                           fuel) for fuel in sources
        ],
                                       axis=1)
        self.total_salvage_value = pv(self.salvage_value)

        self.fixed_OM_cost = (plan.capacities * MW *
                              parameter.fixed_operating_cost * USD / kW / MUSD)
        self.total_fixed_OM_cost = pv(self.fixed_OM_cost)

        self.variable_OM_cost = (plan.production * GWh *
                                 parameter.variable_operating_cost * USD /
                                 MWh / MUSD)
        self.total_variable_OM_cost = pv(self.variable_OM_cost)

        self.heat_used = (plan.production * GWh * parameter.heat_rate * Btu /
                          kWh / TBtu)
        self.fuel_cost = (self.heat_used * TBtu * parameter.heat_price * USD /
                          MBtu / MUSD)
        self.total_fuel_cost = pv(self.fuel_cost)

        self.total_cost = (self.total_investment - self.total_salvage_value +
                           self.total_fixed_OM_cost +
                           self.total_variable_OM_cost + self.total_fuel_cost)

        self.lcoe = self.total_cost / self.total_production

        self.emissions = (plan.production * GWh * parameter.emission_factor *
                          g / kWh / kt)
        self.emissions["Total"] = self.emissions.sum(axis=1)
        self.total_emissions = self.emissions["Total"].sum() * kt / Gt

        self.capture = (plan.production * GWh * parameter.capture_factor * g /
                        kWh / kt)
        self.capture["Total"] = self.capture.sum(axis=1) * kt / Mt
        self.total_capture = self.capture["Total"].sum() * Mt / Gt

        self.external_cost = (self.emissions["Total"] * kt *
                              parameter.carbon_price * USD / t / MUSD)
        self.total_external_cost = pv(self.external_cost)

        self.signature = '#' + plan.digest + "-" + parameter.digest
Example #7
0
def test_between_two_values():
    """Check that the averaged price is between the local value and the international value."""
    fuel_1 = price_fuel(local_prices, price_gas, price_coal, local_production,
                        baseline)
    averaged = fuel_1.average_price["Gas"].all()
    prices = pd.concat([fuel_1.import_prices["Gas"], local_prices["Gas"]],
                       axis=1)
    lower = prices.min(axis=1).all()
    upper = prices.max(axis=1).all()
    assert lower <= averaged <= upper
additions = additions.groupby(["year", "fuel"]).capacity_MW.sum()
additions = additions.unstack()
additions.drop("ND*", axis=1, inplace=True)

# 2016 - 2030 capacity additions for the four renewable technologies

additions["Solar"] = fill_in(capacities_PDP7A.Solar)
additions["Wind"] = fill_in(capacities_PDP7A.Wind)
additions["Biomass"] = fill_in(capacities_PDP7A.Biomass)
additions["SmallHydro"] = fill_in(capacities_PDP7A.SmallHydro)
additions["Import"] = fill_in(capacities_PDP7A.Import)

# 1974 - 2015 capacity additions and cleanup

additions = pd.concat([capacity_past, additions])

additions = additions[fuels + ["PumpedStorage", "Import"]].fillna(0)

# 2031 - 2050 scenario definition

increment = {
    "Coal": 0,
    "Gas": 750,
    "Oil": 20,
    "BigHydro": 0,
    "SmallHydro": 50,
    "Biomass": 50,
    "Wind": 900,
    "Solar": 1000,
    "PumpedStorage": 50,
Example #9
0
    def __init__(self, plan, parameter):
        self.plan = plan
        self.parameter = parameter

        def pv(variable):
            """Present value of a variable summed across technologies."""
            return present_value(variable, parameter.DISCOUNT_RATE).sum()

        self.total_production = pv(plan.production[SOURCES])

        self.investment = (plan.additions * MW
                           * parameter.construction_cost * USD / kW
                           / MUSD)
        self.total_investment = pv(self.investment)

        self.salvage_value = pd.concat([residual_value(plan.additions,
                                                       parameter.plant_accounting_life,
                                                       fuel)
                                        for fuel in SOURCES],
                                       axis=1)
        self.total_salvage_value = pv(self.salvage_value)

        self.fixed_om_cost = (plan.capacities * MW *
                              parameter.fixed_operating_cost * USD / kW
                              / MUSD)
        self.total_fixed_om_cost = pv(self.fixed_om_cost)

        self.variable_OM_cost = (plan.production * GWh
                                 * parameter.variable_operating_cost * USD / MWh
                                 / MUSD)
        self.total_variable_OM_cost = pv(self.variable_OM_cost)

        self.heat_used = (plan.production * GWh
                          * parameter.heat_rate * Btu / kWh
                          / TBtu)
        self.fuel_cost = (self.heat_used * TBtu
                          * parameter.heat_price * USD / MBtu
                          / MUSD)
        self.total_fuel_cost = pv(self.fuel_cost)

        self.total_cost = (self.total_investment - self.total_salvage_value
                           + self.total_fixed_om_cost + self.total_variable_OM_cost
                           + self.total_fuel_cost)

        self.lcoe = self.total_cost / self.total_production

        self.emissions = (plan.production * GWh
                          * parameter.EMISSION_FACTOR * g / kWh
                          / kt)
        self.emissions["Total"] = self.emissions.sum(axis=1)
        self.total_emissions = self.emissions["Total"].sum() * kt / Gt

        self.capture = (plan.production * GWh
                        * parameter.capture_factor * g / kWh
                        / kt)
        self.capture["Total"] = self.capture.sum(axis=1) * kt / Mt
        self.total_capture = self.capture["Total"].sum() * Mt / Gt

        self.external_cost = (self.emissions["Total"] * kt
                              * parameter.CARBON_PRICE * USD / t
                              / MUSD)
        self.total_external_cost = pv(self.external_cost)

        self.signature = '#' + plan.digest + "-" + parameter.digest
Example #10
0
additions = additions.groupby(["year", "fuel"]).capacity_MW.sum()
additions = additions.unstack()
additions.drop("ND*", axis=1, inplace=True)

# 2016 - 2030 capacity additions for the four renewable technologies

additions["Solar"] = fill_in(capacities_PDP7A.Solar)
additions["Wind"] = fill_in(capacities_PDP7A.Wind)
additions["Biomass"] = fill_in(capacities_PDP7A.Biomass)
additions["SmallHydro"] = fill_in(capacities_PDP7A.SmallHydro)
additions["Import"] = fill_in(capacities_PDP7A.Import)

# 1974 - 2015 capacity additions and cleanup

additions = pd.concat([CAPACITY_PAST, additions])

# FIXME: PLANT_TYPE + ["PumpedStorage", "Import"] is technologies
additions = additions[PLANT_TYPE + ["PumpedStorage", "Import"]].fillna(0)

# 2031 - 2050 scenario definition

increment = {
    "Coal": 0,
    "Gas": 750,
    "Oil": 20,
    "BigHydro": 0,
    "SmallHydro": 50,
    "Biomass": 50,
    "Wind": 900,
    "Solar": 1000,