Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
85c756e
Sketch 2 variants to add commodity flow of capacity variables
volker-krey Aug 19, 2020
a65fb1c
Introduce special treatment of commodity flows prior to/after end of …
volker-krey Aug 25, 2020
221bb72
Expand variant 1 to include retirement, incl. treatment of premature …
volker-krey Aug 25, 2020
afd470a
Merge variants 1 and 2 of capacity related commodity flows
volker-krey Aug 25, 2020
04cf68c
Add scaling factor to account for period length difference
volker-krey Aug 25, 2020
a99ab8c
Add new parameters to data loading from GDX
volker-krey Aug 25, 2020
7a28ba8
Add auto documentation for capacity related commodity flow
volker-krey Aug 25, 2020
d66d6d1
Correct commodity at end of life of capacities to be on annual basis
volker-krey Sep 23, 2020
092c31a
Add scaling factor to account for period length difference
volker-krey Aug 25, 2020
fad3ea7
Correct commodity at end of life of capacities to be on annual basis
volker-krey Sep 23, 2020
8a6d3b3
Correct typos, wrong parenthesis and missing EOL symbols
volker-krey Jan 10, 2021
dc3a19a
Correct syntax and inter-period notation
volker-krey Jan 11, 2021
2a5cd72
Add pytest script to test new parameters
Jihoon Apr 1, 2021
9fcf5ee
Re-format in 'black' style
Jihoon Apr 1, 2021
c7a58de
Make the lint test pass
Jihoon Apr 2, 2021
667a58b
Add capacity_maintenance2 equation
GamzeUnlu95 May 23, 2022
78504bb
Add new map_tec and map_tec_lifetime sets
GamzeUnlu95 Jun 8, 2022
d00006d
Modify first year equations
GamzeUnlu95 Jun 8, 2022
67f5117
Update first year conditions
GamzeUnlu95 Jun 9, 2022
4dae28d
Replaced year2 by year_all2…
volker-krey Jun 13, 2022
a85532a
Revise formulation for different lifetimes
GamzeUnlu95 Jun 14, 2022
958796c
Change the equation name capacity_maintenence2
GamzeUnlu95 Jun 14, 2022
61a5305
Update documentation
GamzeUnlu95 Jun 15, 2022
7713a86
Fix the formulation for remaining_capacity_extended
GamzeUnlu95 Jun 17, 2022
6dfb405
Extend documentation
GamzeUnlu95 Jun 20, 2022
e1da3fe
Address PR review comments
GamzeUnlu95 Sep 27, 2022
5080537
Separate if statements
GamzeUnlu95 Mar 27, 2023
a0c2829
Add sets to relevant files
GamzeUnlu95 Mar 28, 2023
152ae1e
Update model_core.gms
GamzeUnlu95 Mar 28, 2023
e3e79d0
Add in_cap_new to Reporter tasks
macflo8 Jan 20, 2025
3cba7f0
Add land_in to Reporter tasks
macflo8 Jan 20, 2025
e8e6e14
Add MESSAGE_CAP_COM/cap_comm GAMS option/scalar
yiyi1991 Apr 3, 2025
3e366ef
Add #451 to release notes
GamzeUnlu95 Jun 17, 2022
bdf6c0c
Format data_load.gms
khaeru May 26, 2025
12c1dae
Handle Scenario.solve(…, cap_comm=…) arg
khaeru May 26, 2025
0233e85
Improve tests of cap_comm
khaeru May 26, 2025
e6a46ed
Format GAMS code added/modified by #451
khaeru May 26, 2025
ac54a49
Simplify GAMS implementation for #451
khaeru May 26, 2025
61143c4
Deduplicate contents of reporter-keys-*.txt
khaeru May 26, 2025
a2cdcbd
Update reporter-keys-ixmp.txt
khaeru May 26, 2025
055bb90
Update reporter-keys-message-ix.txt
khaeru May 26, 2025
113061c
Add COMMODITY_BALANCE{,_GT} to MESSAGE.items
khaeru Aug 12, 2025
cbf1527
Add test_report.exp_len_all fixture
khaeru Aug 12, 2025
96b6e5c
Adjust test expectations for #451
khaeru Aug 12, 2025
10df434
Derive PRICE_COMMODITY from COMMODITY_BALANCE_AUX
khaeru Aug 12, 2025
d77ab2b
Document #451
khaeru Aug 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ Next release
All changes
-----------

- Add representation of commodity flows associated with construction and retirement of technology capacity (:pull:`451`).

- New parameters
|input_cap|,
|input_cap_new|,
|input_cap_ret|,
|output_cap|,
|output_cap_new|, and
|output_cap_ret|.
When loading a Scenario created with :mod:`message_ix` version 3.11.0 or earlier,
these items are automatically initialized (and left empty),
using at most one call to :meth:`~message_ix.Scenario.commit`.
See :meth:`.MESSAGE.initialize`.
- Revise :ref:`equation_commodity_balance_aux` to include input and output flows based on |CAP| and |CAP_NEW|.
- New :class:`.MESSAGE` / :meth:`.Scenario.solve` option :py:`cap_comm=True` to enable this representation.

- Document the :ref:`minimum version of Java <install-java>` required for :class:`ixmp.JDBCBackend <ixmp.backend.jdbc.JDBCBackend>` (:pull:`962`).
- Improve type hinting (:pull:`963`).

Expand Down
21 changes: 17 additions & 4 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@ Model classes
:exclude-members: defaults
:show-inheritance:

MESSAGE accepts the following *model_options* to control its behaviour:

- **cap_comm** (:class:`bool` or equivalent :class:`int` or :class:`float`):
If :any:`True`, include **comm** odity flows associated with **cap** acity changes of technologies
in :ref:`equation_commodity_balance_aux`.
If :any:`False` (the default), these flow are omitted,
and values of the associated parameters have no effect.
This corresponds to the GAMS compile-time variable ``MESSAGE_CAP_COMM``.

.. note:: For some models, this can significantly increase the linear program (LP) size
and thus the solve time.

.. autoattribute:: items
:no-value:

Expand All @@ -263,10 +275,10 @@ Model classes
The MACRO class solves only the MACRO model in “standalone” mode—that is, without MESSAGE.
It is also invoked from :class:`.MESSAGE_MACRO` to process *model_options* to control the behaviour of MACRO:

- **concurrent** (:class:`int` or :class:`float`, either :py:`0` or :py:`1`).
- **concurrent** (:class:`bool` or equivalent :class:`int` or :class:`float`).
This corresponds to the GAMS compile-time variable ``MACRO_CONCURRENT``.
If set to :py:`0` (the default), MACRO is solved in a loop, once for each node in the Scenario.
If set to :py:`1`, MACRO is solved only once, for all nodes simultaneously.
If :any:`False` (the default), MACRO is solved in a loop, once for each node in the Scenario.
If :any:`True`, MACRO is solved only once, for all nodes simultaneously.

.. autoattribute:: items
:no-value:
Expand All @@ -279,7 +291,8 @@ Model classes
MESSAGE_MACRO solves the MESSAGE and MACRO models iteratively, connecting changes in technology activity and resource demands (from MESSAGE) to changes in final demands and prices (from MACRO).
This iteration continues until the solution *converges*; i.e. the two models reach a stable point for the values of these parameters.

MESSAGE_MACRO accepts three additional *model_options* that control the behaviour of this iteration algorithm:
MESSAGE_MACRO accepts all of the *model_options* recognized by :class:`.MESSAGE` and :class:`.MACRO`,
plus additional options that control the behaviour of this iteration algorithm:

- **max_adjustment** (:class:`float`, default 0.2): the maximum absolute relative change in final demands between iterations.
If MACRO returns demands that have changed by more than a factor outside the range (1 - `max_adjustment`, 1 + `max_adjustment`) since the previous iteration, then the change is confined to the limits of that range for the next run of MESSAGE.
Expand Down
20 changes: 19 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

<abbr title="International Institute for Applied Systems Analysis">IIASA</abbr>

.. |y0| replace:: :math:`y_0`
.. |yA| replace:: :math:`y^A`
.. |yV| replace:: :math:`y^V`
"""
Expand All @@ -77,13 +78,29 @@
# sometimes multiple targets appear above a single heading, and that heading text would
# be automatically used for the link text.
for name in (
"ACT",
"CAP",
"CAP_NEW",
"LAND",
"STOCK_CHG",
"duration_period",
"duration_period_sum",
"growth_new_capacity_up",
"historical_new_capacity",
"initial_new_capacity_up",
"input",
"input_cap",
"input_cap_new",
"input_cap_ret",
"output",
"output_cap",
"output_cap_new",
"output_cap_ret",
"land_input",
"land_output",
"map_tec_lifetime",
"remaining_capacity",
"technical_lifetime",
):
rst_prolog += f"\n.. |{name}| replace:: :ref:`{name} <{name}>`"

Expand Down Expand Up @@ -222,8 +239,9 @@ def local_inv(name: str, *parts: str) -> Optional[str]:
macros = {}
macros.update(
{
k.replace("_", ""): r"\text{{{k}}}"
k.replace("_", ""): rf"\text{{{k}}}"
for k in """ACT
COMMODITY_BALANCE
STORAGE
STORAGE_CHARGE
duration_time_rel
Expand Down
3 changes: 2 additions & 1 deletion message_ix/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,8 @@ def solve(self, model="MESSAGE", solve_options={}, **kwargs):
See the :class:`.MESSAGE` class and :obj:`.DEFAULT_CPLEX_OPTIONS`.
kwargs :
Other options control the execution of the underlying GAMS code; see the
:class:`.MESSAGE_MACRO` class and :class:`.GAMSModel`.
*model_options* described for :class:`.MESSAGE`, :class:`.MACRO`,
:class:`.MESSAGE_MACRO`, and :class:`.GAMSModel`.
"""
super().solve(model=model, solve_options=solve_options, **kwargs)

Expand Down
Loading
Loading