Resolve issues related to `technical_lifetime` and historical vintages in Westeros tutorials
This PR resolves issues related to Westeros "baseline" tutorial, including #525, #609, #813, and #814. This PR does the following:
- Defines vintage-activity years for each technology based on
technical_lifetimeof that technology (addressing #525) - Defines vintage and activity for historical parameters, i.e., adding historical years to relevant parameters (addressing #609, partially related to this comment in #451, and partially related to #624)
- Corrects the units, makes sure they are consistent, and adds a note (partially addressing #814).
- Adds capacity-related parameters for the grid (resolving #813). An investment cost of 800 USD/kW and fixed O&M cost of 16 USD/kW/a is added.
How to review
- Load Westeros baseline under this branch, read through the corrected text, and make sure it's understandable.
- Solve Westeros baseline under the "main" branch (and name it differently)
- Solve Westeros baseline under this branch and compare it with the older version. The results should show that the objective function is different, but the activity and capacity of coal and wind power plants must be the same in the model horizon.
PR checklist
- [x] Continuous integration checks all ✅
- [x] Add or expand tests; coverage checks both ✅
- [x] Add, expand, or update documentation.
- [x] Update release notes.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.6%. Comparing base (
0cc8102) to head (fde7729). Report is 55 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #815 +/- ##
=======================================
+ Coverage 95.4% 95.6% +0.1%
=======================================
Files 46 46
Lines 4354 4335 -19
=======================================
- Hits 4156 4145 -11
+ Misses 198 190 -8
| Files | Coverage Δ | |
|---|---|---|
| message_ix/testing/__init__.py | 99.6% <100.0%> (ø) |
|
| message_ix/tests/test_feature_price_emission.py | 100.0% <100.0%> (ø) |
|
| message_ix/tests/test_macro.py | 100.0% <ø> (ø) |
|
| message_ix/tests/test_report.py | 100.0% <100.0%> (ø) |
|
| message_ix/tests/test_soft_constraints.py | 100.0% <100.0%> (ø) |
|
| message_ix/tests/test_tutorials.py | 97.6% <ø> (ø) |
|
| message_ix/tests/util/test_tutorial.py | 100.0% <100.0%> (ø) |
Thanks @glatterf42 for the quick review. I hadn't changed the objective functions in those test because we need to add investment cost for the grid (one of the ToDos) which will change the objective function. I discussed with @OFR-IIASA this morning, and we believe it's not needed to update the investment cost of wind and coal power plants (the optional ToDo), because this tutorial is not representing the reality of today, or in fact any period in history, and just wants to showcase how the model works with two technologies with different investment cost. As such, I will leave the investment cost for wind and coal power plants as it is for the time being.
Highjacking this PR to enable ruff for all tutorial files since I started migrating to make_df and was annoyed by the code not following our code style.
As for the question I raised earlier, I have now concluded from your PR description, @behnam-zakeri, that all issues except #814 are indeed closed by this PR since #814 is the only one where you say "partially addressing". Assuming this is true, once we get the tests to pass, this PR is good to go :)
Thanks @glatterf42 for the kind reminder and sorry for the delay. This PR indeed closes the issues https://github.com/iiasa/message_ix/issues/525, https://github.com/iiasa/message_ix/issues/609, https://github.com/iiasa/message_ix/issues/813, and https://github.com/iiasa/message_ix/issues/814. I correct the description to show that this resolves #814 fully and not partially.