Incorrect definition of `map_tec_lifetime` due to parametrization requirements of `technical_lifetime`
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 150
- Forks
- 178
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 2
Description
map_tec_lifetime is a set created as part of data_loead.gms. It partly relies on the parameter technical_lifetime. The issue is that technical_lifetime needs to be defined for all activity years (the exact reason is unknown at this point in time). What this means: a powerplant which is phased out and can only be built until e.g. the vtg_year 2040 (see global model coal_ppl in NAM, PAO, WEU) has parameters defined until year_act 2060 and hence also requires the technical_lifetime to be defined for the vtg_years until 2060. This results in map_tec_lifetime creating entries for the vintages > 2040, which is unintended. The result, a powerplant can be built despite not having input/output defined which can happen if for example there is a relation activity entry, which is vintage independent.
Code sample or context
see map_tec_lifetime for coal_ppl in any given global MESSAGEix scenario. Entries exist for vintages post 2040, although input/output parameters exist only for the vintage 2040. the technical_lifetime entries post 2040 should be removed to get the correct entries. Doing so results in a GAMS error.
df = scen.par("technical_lifetime", {"technology": "coal_ppl", "node_loc": "R11_NAM"})
yr_max = max(scen.par("input", {"technology": "coal_ppl", "node_loc": "R11_NAM"}).year_vtg)
df = df[df.year_vtg > yr_max]
scen.check_out()
scen.remove_par("technical_lifetime", df)
scen.commit("")
scen.solve()
Problem description
--- MESSAGE_run.gms(1877) 425 Mb
Error: Technical lifetime not defined for 'R11_NAM|coal_ppl|2045' !
Error: Technical lifetime not defined for 'R11_NAM|coal_ppl|2050' !
Error: Technical lifetime not defined for 'R11_NAM|coal_ppl|2055' !
Error: Technical lifetime not defined for 'R11_NAM|coal_ppl|2060' !
Error: Technical lifetime not defined for 'R11_NAM|coal_ppl|2070' !
--- MESSAGE_run.gms(1883) 425 Mb
*** Error at line 1884: Execution halted: abort 'There is a problem with the definition of the technical lifetime!'
Versions
Output of message-ix show-versions
<!--
Run one of the following and paste the results here:
- 'message-ix show-versions' in a terminal, or
- 'import ixmp; ixmp.show_versions()' in a Python interpreter.
-->
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with map_tec_lifetime in message_ix/model/MESSAGE/data_load.gms around line 116, then reproduce the coal_ppl case using the technical_lifetime and input parameter queries shown in the issue. Run scen.solve after removing post-2040 technical_lifetime entries; done means the unintended vintages are absent and the scenario no longer reports missing technical-lifetime errors.
Written by the indexing model from the issue text.
Assessment
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100