Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made changes to tools.costs related to base year and first year of modeling #186

Merged
merged 11 commits into from
Apr 25, 2024
Merged
6 changes: 6 additions & 0 deletions doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ What's new
v2024.4.22
==========

- Made changes to :doc:`/api/tools-costs` (:pull:`186`).
glatterf42 marked this conversation as resolved.
Show resolved Hide resolved

- Fixed jumps in cost projections for technologies with first technology year that's after than the first model year.
glatterf42 marked this conversation as resolved.
Show resolved Hide resolved
- Changed the use of base_year to mean the year to start modeling cost changes.
- Update cost assumptions for certain CCS technologies.
- Changed the default fixed O&M reduction rate to 0.
- Incorporate the :doc:`/global/index` documentation (:pull:`107`, :pull:`110`).
This documentation formerly lived at https://docs.messageix.org/global/ and in a separate repository at `iiasa/message_doc <https://github.com/iiasa/message_doc>`_.
- Improve tool for :ref:`migrate-filter-repo` (:pull:`174`); expand documentation.
Expand Down
4 changes: 2 additions & 2 deletions message_ix_models/data/costs/energy/cost_reduction_energy.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ gas_cc_ccs,CCS,0.1,0.2,0.29,0.5,0.7
bio_istig_ccs,CCS,0,0.1,0.3,0.4,0.6
syn_liq,Coal,0,0.05,0.1,0.15,0.2
meth_coal,Coal,0,0.05,0.1,0.15,0.2
syn_liq_ccs,CCS,0,0.05,0.1,0.25,0.3
syn_liq_ccs,CCS,0,0.05,0.1,0.15,0.2
meth_coal_ccs,CCS,0,0.05,0.1,0.15,0.2
h2_coal,Coal,0,0.25,0.4,0.4,0.5
h2_smr,Gas/Oil,0,0.25,0.4,0.5,0.7
h2_bio,Biomass,0,0.25,0.4,0.5,0.7
h2_coal_ccs,CCS,0,0.25,0.4,0.5,0.7
h2_coal_ccs,CCS,0,0.25,0.4,0.4,0.5
h2_smr_ccs,CCS,0,0.25,0.4,0.5,0.7
h2_bio_ccs,CCS,0,0.25,0.4,0.5,0.7
eth_bio,Biomass,0,0.27,0.27,0.4,0.55
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ gas_cc_ccs,medium,medium,low,high,high,medium
bio_istig_ccs,medium,medium,low,high,high,medium
syn_liq,medium,medium,high,medium,medium,medium
meth_coal,medium,medium,high,medium,medium,medium
syn_liq_ccs,medium,medium,low,high,high,medium
meth_coal_ccs,medium,medium,low,high,high,medium
syn_liq_ccs,medium,medium,high,medium,medium,medium
meth_coal_ccs,medium,medium,high,medium,medium,medium
h2_coal,medium,medium,high,medium,medium,medium
h2_smr,high,medium,low,medium,high,medium
h2_bio,high,medium,low,high,medium,medium
h2_coal_ccs,medium,medium,low,high,high,medium
h2_coal_ccs,medium,medium,high,medium,medium,medium
h2_smr_ccs,medium,medium,low,high,high,medium
h2_bio_ccs,medium,medium,low,high,high,medium
h2_bio_ccs,high,medium,low,high,medium,medium
eth_bio,high,medium,low,high,medium,medium
eth_bio_ccs,medium,medium,low,high,high,medium
c_ppl_co2scr,medium,medium,low,high,high,medium
Expand All @@ -36,12 +36,12 @@ geo_ppl,high,medium,low,high,medium,medium
hydro_lc,high,medium,low,high,medium,medium
hydro_hc,high,medium,low,high,medium,medium
meth_ng,high,medium,low,medium,high,medium
meth_ng_ccs,medium,medium,low,high,high,medium
meth_ng_ccs,high,medium,low,medium,high,medium
coal_ppl_u,medium,medium,high,medium,medium,medium
stor_ppl,high,medium,low,high,medium,medium
h2_elec,high,medium,low,high,medium,medium
liq_bio,high,medium,low,high,medium,medium
liq_bio_ccs,medium,medium,low,high,high,medium
liq_bio_ccs,high,medium,low,high,medium,medium
coal_i,medium,medium,high,medium,medium,medium
foil_i,high,medium,low,medium,high,medium
loil_i,high,medium,low,medium,high,medium
Expand Down
14 changes: 7 additions & 7 deletions message_ix_models/data/costs/energy/tech_map_energy.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The base year costs and WEO mappings are taken from the following file: ,,,,
# https://github.com/iiasa/message_data/blob/dev/data/model/investment_cost/doc/NAM_technology_cost_input_20200507.xlsx,,,,
# If base_year_reference_region_cost is blank then the 2021 WEO cost from the mapped technology is used in its place.
# If base_year_reference_region_cost is blank then the 2021 WEO cost from the mapped technology is used in its place.,,,,
message_technology,reg_diff_source,reg_diff_technology,base_year_reference_region_cost,fix_ratio
bio_hpl,weo,igcc,275,
bio_istig,weo,igcc,4064,
Expand Down Expand Up @@ -36,9 +36,9 @@ gas_ppl,weo,gas_turbine,1205,
geo_hpl,weo,geothermal,1500,
geo_ppl,weo,geothermal,2928,
h2_bio,weo,igcc,3744,
h2_bio_ccs,weo,igcc_ccs,3824,
h2_bio_ccs,weo,igcc,3824,
h2_coal,weo,igcc,2163,
h2_coal_ccs,weo,igcc_ccs,2252,
h2_coal_ccs,weo,igcc,2252,
h2_elec,weo,csp,1139,
h2_fc_I,weo,igcc,3500,
h2_fc_RC,weo,igcc,3500,
Expand All @@ -55,15 +55,15 @@ hydro_lc,weo,hydropower_large,2187,
igcc,weo,igcc,2106,
igcc_ccs,weo,igcc_ccs,4819,
liq_bio,weo,igcc,4264,
liq_bio_ccs,weo,igcc_ccs,4344,
liq_bio_ccs,weo,igcc,4344,
loil_cc,weo,igcc,800,
loil_i,weo,ccgt_chp,93,
loil_ppl,weo,igcc,600,
meth_coal,weo,igcc,2348,
meth_coal_ccs,weo,igcc_ccs,2385,
meth_coal_ccs,weo,igcc,2385,
meth_i,weo,bioenergy_medium_chp,93,
meth_ng,weo,igcc,1234,
meth_ng_ccs,weo,igcc_ccs,1339,
meth_ng_ccs,weo,igcc,1339,
nuc_hc,weo,nuclear,5000,
nuc_lc,weo,nuclear,3800,
solar_i,weo,solarpv_buildings,737,
Expand All @@ -73,6 +73,6 @@ solar_pv_RC,weo,solarpv_buildings,,
solar_th_ppl,weo,csp,969,
stor_ppl,weo,csp,800,
syn_liq,weo,igcc,3224,
syn_liq_ccs,weo,igcc_ccs,3268,
syn_liq_ccs,weo,igcc,3268,
wind_ppf,weo,wind_offshore,1771,
wind_ppl,weo,wind_onshore,1181,
12 changes: 7 additions & 5 deletions message_ix_models/tests/tools/costs/test_decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ def test_get_cost_reduction_data(module: str, t_exp) -> None:

@pytest.mark.parametrize("module", ("energy", "materials"))
def test_get_technology_reduction_scenarios_data(module: str) -> None:
config = Config()
# The function runs without error
result = get_technology_reduction_scenarios_data(Config.base_year, module=module)
result = get_technology_reduction_scenarios_data(config.y0, module=module)

# All first technology years are equal to or greater than the default base year
assert Config.base_year <= result.first_technology_year.min()
# All first technology years are equal to or greater than
# the default first model year
assert config.y0 <= result.first_technology_year.min()

# Data for LED and SSP1-5 scenarios are present
assert {"SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "LED"} <= set(
Expand Down Expand Up @@ -70,5 +72,5 @@ def test_project_ref_region_inv_costs_using_reduction_rates(
# Excluded technologies are *not* present
assert set() == (t_excluded & t)

# The first technology year is equal to or greater than the default base year
assert Config.base_year <= result.first_technology_year.min()
# The first technology year is equal to or greater than the default first model year
assert config.y0 <= result.first_technology_year.min()
10 changes: 7 additions & 3 deletions message_ix_models/tools/costs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ class Config:
"""

#: Base year for projected costs.
base_year: int = 2021
#: This is the first year for which cost reductions/decay are calculated.
#: If the base year is greater than y0 (first model year),
#: then the costs are assumed to be the same from y0 to base_year.
base_year: int = 2025

#: Year of convergence; used when :attr:`.method` is "convergence". This is the year
#: by which costs in all regions should converge to the reference region's costs.
Expand All @@ -27,9 +30,10 @@ class Config:
final_year: int = 2100

#: Rate of exponential growth (positive values) or decrease of fixed operating and
#: maintenance costs over time. The default of 0.025 implies exponential growth at a
#: maintenance costs over time. The default of 0 implies no change over time.
#: If the rate is 0.025, for example, that implies exponential growth at a
#: rate of 2.5% per year; or :py:`(1 + 0.025) ** N` for a period of length N.
fom_rate: float = 0.025
fom_rate: float = 0

#: Format of output from :func:`.create_cost_projections`. One of:
#:
Expand Down
15 changes: 6 additions & 9 deletions message_ix_models/tools/costs/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_cost_reduction_data(module) -> pd.DataFrame:


def get_technology_reduction_scenarios_data(
base_year: int, module: str
first_year: int, module: str
) -> pd.DataFrame:
"""Read in technology first year and cost reduction scenarios.

Expand Down Expand Up @@ -184,13 +184,13 @@ def get_technology_reduction_scenarios_data(
.assign(
first_technology_year=lambda x: np.where(
x.first_year_original.isnull(),
base_year,
first_year,
x.first_year_original,
)
)
.assign(
first_technology_year=lambda x: np.where(
x.first_year_original > base_year, x.first_year_original, base_year
x.first_year_original > first_year, x.first_year_original, first_year
)
)
.drop(columns=["first_year_original"])
Expand Down Expand Up @@ -309,9 +309,7 @@ def project_ref_region_inv_costs_using_reduction_rates(
df_cost_reduction = get_cost_reduction_data(config.module)

# Get scenarios data
df_scenarios = get_technology_reduction_scenarios_data(
config.base_year, config.module
)
df_scenarios = get_technology_reduction_scenarios_data(config.y0, config.module)

# Merge cost reduction data with cost reduction rates data
df_cost_reduction = df_cost_reduction.merge(
Expand All @@ -336,10 +334,9 @@ def project_ref_region_inv_costs_using_reduction_rates(
for y in config.seq_years:
df_ref = df_ref.assign(
ycur=lambda x: np.where(
y <= config.y0,
y <= config.base_year,
x.reg_cost_base_year,
(x.reg_cost_base_year - x.b)
* np.exp(x.r * (y - x.first_technology_year))
(x.reg_cost_base_year - x.b) * np.exp(x.r * (y - config.base_year))
+ x.b,
)
).rename(columns={"ycur": y})
Expand Down
2 changes: 1 addition & 1 deletion message_ix_models/tools/costs/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Defaults for all configuration settings:
# - base_year=BASE_YEAR,
# - convergence_year=2050,
# - fom_rate=0.025,
# - fom_rate=0,
# - format="message",
# - method="gdp",
# - module="energy",
Expand Down
Loading
Loading