def by_regression(fuel, col):
    """Regression, when the literature forecasts cost saving technical progress."""
    data = view[fuel]
    explaining = data.Year - start_year
    explaining = sm.add_constant(explaining)
    model = sm.OLS(data[col], explaining, missing='drop')
    results = model.fit()

    show(fuel, results.summary())
    level = results.params.const
    trend = results.params.Year if results.pvalues.Year < 0.05 else 0
    s = pd.Series(np.linspace(level, level + trend * n_year, n_year),
                  index=years,
                  name=fuel)
    if VERBOSE:
        myplot(data, fuel, col, s, " (regression on " + str(len(data)) + ") ")

    return s
示例#2
0
6/ Column "capacities" means nameplate capacity.
Adding up capacities across columns is generally misleading,
since the capacity factors are not comparable, neither are the investment costs

7/ Column "capacities" is in terms of net electric power.
"Coal CCS" has a lower efficiency (higher heat rate) than "Coal" of same capacity
"""

from init import pd, show, PLANT_TYPE, SOURCES, addcol_Renewable, addcol_Renewable4

# %% Read data from EVN 2016 activity report
# Historical capacity addition

CAPACITY_ADDITIONS_PAST = pd.read_fwf("data/capacity_additions_past.txt")

show(CAPACITY_ADDITIONS_PAST)

capacity_2015_EVN = CAPACITY_ADDITIONS_PAST.groupby(["fuel"]).capacity_MW.sum()
# show("SummaryCapacity in 2015")
# show(capacity_2015)

# Comparision with EVN Annual Report 2016, page 11.
capacity_2015_EVN[
    "BigHydro"] = capacity_2015_EVN.LargeHydro + capacity_2015_EVN.InterHydro
assert capacity_2015_EVN.BigHydro == 14636
assert capacity_2015_EVN.Coal == 12903
assert capacity_2015_EVN.Oil == 875
assert capacity_2015_EVN.Gas == 7998
assert capacity_2015_EVN.Wind == 135
assert capacity_2015_EVN.Biomass + capacity_2015_EVN.SmallHydro == 2006
capacity_2015_EVN["Renewable4"] = (capacity_2015_EVN.SmallHydro +
示例#3
0
                         variable_operating_cost, heat_rate, heat_price)

from data_IPCC import EMISSION_FACTOR

from plan_baseline import plant_life as plant_accounting_life

# %% CCS technologies

START_PENALTY = 0.30
END_PENALTY = 0.20
energy_penalty = np.linspace(START_PENALTY, END_PENALTY, N_YEARS)
heat_rate["CoalCCS"] = heat_rate["Coal"] * (1 + energy_penalty)
heat_rate["GasCCS"] = heat_rate["Gas"] * (1 + energy_penalty)
heat_rate["BioCCS"] = heat_rate["Biomass"] * (1 + energy_penalty)

show("Heat rate  (Btu/kWh)")
show(heat_rate.round())
show()

heat_price["CoalCCS"] = heat_price["Coal"]
heat_price["GasCCS"] = heat_price["Gas"]
heat_price["BioCCS"] = heat_price["Biomass"]

# %%
"""
Without CCS:
   CO2_emitted = EMISSION_FACTOR_noCCS * production

   CO2_produced = CO2_factor_of_heat * heat_used
   heat_used = production * heat_rate_noCCS
   CO2_produced = CO2_factor_of_heat * production * heat_rate_noCCS
#%% Main statement

alternative = PowerPlan(additions, retirement, capacityfactor, net_import)
alternative.__doc__ = "Baseline - alternative extended"

if __name__ == '__main__':
    if (len(sys.argv) == 2) and (sys.argv[1] == "summarize"):
        alternative.summarize()
    if (len(sys.argv) == 3) and (sys.argv[1] == "plot"):
        alternative.plot_plan(sys.argv[2])

#%% Validation: compares to PDP7A

show("""
*****************************************************
***     Comparing our baseline with PDP7          ***
*****************************************************
""")

compared = ["Coal", "Gas", "BigHydro", "Renewable4", "Nuclear"]

tocompare = alternative.capacities.loc[[2020, 2025, 2030]]
tocompare["Gas"] = tocompare.Gas + tocompare.Oil
tocompare["Nuclear"] = 0
addcol_Renewable4(tocompare)
tocompare = tocompare[compared]

relerror = (tocompare - capacities_PDP7A) / capacities_PDP7A
relerror = relerror[compared]

show("PDP7A")
示例#5
0
                               "TDTN": "PumpedStorage",
                               "NLTT": "Renewable4",   # Renewable energy (agregate)
                               "TDN": "Renewable4",    # Small hydro
                               "NMDSK": "Renewable4",  # Biomass
                               "DG": "Renewable4",     # Wind
                               "DMT": "Renewable4",    # Solar
                               "DHN": "Nuclear",
                               }},
                     inplace=True
                     )

# show(PDP7A_annex1)

capacity_total_plan = PDP7A_annex1.groupby("fuel").capacity_MW.sum()
show("""
Summary of 2016-2030 new capacity listed in PDP7A annex 1, MW
""")
show(capacity_total_plan)
show("""
*: Backup coal units in case all the renewable sources do not meet the set target (27GW by 2030).
Small hydro not specified, included in Renewable4
Wind, Solar, Biomass not specifed after 2020
""")

# %% Capacity objectives (Installed GW by fuel type)

capacities_PDP7A = pd.read_csv("data/PDP7A/Objectives.csv", header=13, nrows=4, index_col=0)

capacities_PDP7A = capacities_PDP7A.drop(2015)

capacities_PDP7A["Hydro"] = capacities_PDP7A["Hydro+Storage"] - capacities_PDP7A["PumpedStorage"]
def as_zero(fuel, _):
    """Return a time series of zero."""
    show(fuel + " set as zero for all years")
    return pd.Series(0, index=years, name=fuel)
# 53 / 114 = 0.465 $/W = 465 $ per kW
#
#
# http://news.xinhuanet.com/english/2017-04/19/c_136220293.htm
# PREY VENG, Cambodia, April 19 (Xinhua) : The 160-km project... line
# is capable of transmitting 150 megawatts (MW) electric power
# at the cost of 75 million U.S. dollars
# ==>
# 500 $ per kW

construction_cost_start_year_import = 500
construction_cost["Import"] = pd.Series(construction_cost_start_year_import,
                                        index=years,
                                        name="Import")

show("Overnight construction costs, $/kW ", start_year)
show(construction_cost.loc[start_year].round())
show()
show("Trends in overnight construction costs, $/kW/yr", start_year, "-",
     end_year)
show(construction_cost.diff().loc[start_year].round(2))
show()
show("Overnight construction costs, $/kW")
show(construction_cost[sources].round())

# %%  Fixed operating costs


def set_fixed_operating_cost(fuel, method):
    """Update the fixed operating cost dataframe for the  fuel  technology, using given  method."""
    fixed_operating_cost[fuel] = method(fuel, "FixedOMDolPerKw")
# 53 / 114 = 0.465 $/W = 465 $ per kW
#
#
# http://news.xinhuanet.com/english/2017-04/19/c_136220293.htm
# PREY VENG, Cambodia, April 19 (Xinhua) : The 160-km project... line
# is capable of transmitting 150 megawatts (MW) electric power
# at the cost of 75 million U.S. dollars
# ==>
# 500 $ per kW

construction_cost_START_YEAR_import = 500
construction_cost["Import"] = pd.Series(construction_cost_START_YEAR_import,
                                        index=YEARS,
                                        name="Import")

show("Overnight construction costs, $/kW ", START_YEAR)
show(construction_cost.loc[START_YEAR].round())
show()
show("Trends in overnight construction costs, $/kW/yr", START_YEAR, "-",
     END_YEAR)
show(construction_cost.diff().loc[START_YEAR].round(2))
show()
show("Overnight construction costs, $/kW")
show(construction_cost[SOURCES].round())

# %%  Fixed operating costs


def set_fixed_operating_cost(fuel, method):
    """Update the fixed operating cost dataframe for the  fuel  technology, using given  method."""
    fixed_operating_cost[fuel] = method(fuel, "FixedOMDolPerKw")