Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
233431d
Merge pull request #328 from TemoaProject/sync-main-to-unstable
jdecarolis May 19, 2026
606df13
clean incomplete emissions constraint handler
DavidLikesLearning Jun 2, 2026
2e082e2
Fix logger to preferred style
DavidLikesLearning Jun 2, 2026
fc50f5d
chore: upgrade dependencies (canary)
jdecarolis Jun 9, 2026
13b6559
Merge pre-commit changes from main back to unstable
jdecarolis Jun 9, 2026
a7af98e
Merge pull request #329 from TemoaProject/dependency-canary-updates
jdecarolis Jun 9, 2026
3b6dd34
chore: upgrade dependencies (canary)
jdecarolis Jun 14, 2026
c55c6ce
Merge pull request #334 from TemoaProject/dependency-canary-updates
jdecarolis Jun 14, 2026
de8a623
chore: upgrade dependencies (canary)
jdecarolis Jun 19, 2026
8ac253c
Merge pull request #336 from TemoaProject/dependency-canary-updates
jdecarolis Jun 19, 2026
23b0acc
chore: upgrade dependencies (canary)
jdecarolis Jun 23, 2026
e242703
Merge pull request #337 from TemoaProject/dependency-canary-updates
jdecarolis Jun 23, 2026
57b5efd
chore: upgrade dependencies (canary)
jdecarolis Jun 27, 2026
57fa4c3
Merge pull request #339 from TemoaProject/dependency-canary-updates
jdecarolis Jun 27, 2026
bea323a
Merge branch 'main' into fixEmissionLimTypeError
DavidLikesLearning Jun 29, 2026
382a5d1
chore: upgrade dependencies (canary)
jdecarolis Jul 2, 2026
2bde478
Merge pull request #341 from TemoaProject/dependency-canary-updates
jdecarolis Jul 2, 2026
9d26bd5
Fix treatment of early retirement in myopic mode (#340)
idelder Jul 10, 2026
56d586f
Move schema components out of tutorial database for SSOT
idelder Jun 29, 2026
591d261
Create a framework for extending model components
idelder Jun 29, 2026
16fe576
Move growth rate constraints to an extension
idelder Jul 6, 2026
1fbc8c8
Fix bugs for Bugs
idelder Jul 6, 2026
71a970c
Route v3 split-table rows to the annual v4 tables for annual techs
SutubraResearch Jul 14, 2026
5ba582d
Add integer capacity extension
idelder Jul 7, 2026
0d1f4cf
Stop ignoring extensions in ruff
idelder Jul 8, 2026
45ff154
Bypass duals in highs because they dont work and raise errors for MIL…
idelder Jul 8, 2026
a0d0b93
Move index set loading to manifest
idelder Jul 8, 2026
dd9ba65
Tidy up for Bugs
idelder Jul 8, 2026
a015319
Build main extension components for economies of scale
idelder Jul 8, 2026
feaa99e
Enable output cost results for economies of scale extension
idelder Jul 8, 2026
f9c02f6
Create documentation for economies of scale extension
idelder Jul 8, 2026
82b73f4
Cleanup for Bugs
idelder Jul 8, 2026
0ce8cc0
Add economies of scale and discrete capacities to myopic capacities test
idelder Jul 9, 2026
55ace13
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
18e287c
Cover _get_annual_techs source variants (Technology.annual, tech_annu…
SutubraResearch Jul 15, 2026
8af495e
chore: upgrade dependencies (canary)
jdecarolis Jul 19, 2026
353367f
Merge pull request #346 from TemoaProject:dependency-canary-updates
jdecarolis Jul 19, 2026
5791f04
Merge pull request #343 from idelder/extensions/framework
jdecarolis Jul 28, 2026
1cc09d2
Merge pull request #345 from idelder/extension/integer_capacity
jdecarolis Jul 31, 2026
07d6220
Merge branch 'unstable' into extension/economies_of_scale
jdecarolis Jul 31, 2026
966896c
Restore suffix directions after solve for appsi_highs
idelder Aug 7, 2026
f3008be
Take values of params on cost curve guard rail checks
idelder Aug 7, 2026
1b16560
Fix myopic p0
idelder Aug 7, 2026
82d1475
Move contextlib import for tidiness
idelder Aug 7, 2026
be82a28
Fix existing capacity segment check
idelder Aug 7, 2026
cd4b97b
Fix docstring for rabbit
idelder Aug 7, 2026
43ae027
Fix typo in extension framework tables prompt
idelder Aug 7, 2026
8965e20
Wrap eos import in extension check
idelder Aug 7, 2026
8d20b00
Merge pull request #349 from idelder/extension/economies_of_scale
jdecarolis Aug 7, 2026
1fe875e
Optimise O(n2) group tech-region lookups
idelder Jul 14, 2026
c774ec2
Remove season ramp constraints and refactor
idelder Jul 14, 2026
ace81f3
Some miscellaneous refactoring/tidy up
idelder Jul 14, 2026
3679fc6
Refactor existing components in preparation for unit_commitment conne…
idelder Jul 22, 2026
404d755
Add unit commitment extension
idelder Jul 22, 2026
b46be76
Add a test for unit_commitment
idelder Jul 22, 2026
92f465b
Miscellaneous tidying for the rabbit
idelder Jul 22, 2026
4e7b09f
Update mediumville set and make empty sets more obvious for diagnosis
idelder Jul 22, 2026
c554938
Many little fixes for a picky little rabbit
idelder Aug 7, 2026
950f5e1
Stop asking appsi for duals
idelder Aug 7, 2026
0b6a5b1
Update test_week to check that output_cost matches objective
idelder Aug 8, 2026
9c62947
Few more small fixes for Bugs
idelder Aug 8, 2026
813f566
chore: upgrade dependencies (canary)
jdecarolis Aug 16, 2026
349e7bc
Merge pull request #350 from idelder/extension/unit_commitment
jdecarolis Aug 17, 2026
e2a151b
Merge pull request #351 from SutubraResearch/fix/migrator-annual-split
jdecarolis Aug 17, 2026
d8e7665
Merge pull request #355 from TemoaProject/dependency-canary-updates
jdecarolis Aug 17, 2026
24fc6d6
Temporarily lock pyomo version to 6.9.5 due to performance regression
idelder Aug 28, 2026
63c6398
Merge pull request #359 from idelder/fix/pyomo_lock
jdecarolis Aug 28, 2026
a7bb04e
chore: upgrade dependencies (canary)
jdecarolis Aug 31, 2026
612b8be
Merge pull request #362 from TemoaProject/dependency-canary-updates
jdecarolis Aug 31, 2026
99f42eb
Merge branch 'unstable' into fixEmissionLimTypeError
jdecarolis Aug 31, 2026
4db1eaf
Merge pull request #332 from DavidLikesLearning/fixEmissionLimTypeError
jdecarolis Aug 31, 2026
aada72a
Fix the programmatic path documentation in README
idelder Sep 2, 2026
251822b
Fix tutorial config to stop trying to save duals with appsi
idelder Sep 2, 2026
a60cd3c
chore: upgrade dependencies (canary)
jdecarolis Sep 3, 2026
16d52e2
Touch up the sample script
idelder Sep 3, 2026
6248655
Improve commenting
idelder Sep 3, 2026
18fd370
Merge pull request #366 from TemoaProject/dependency-canary-updates
jdecarolis Sep 3, 2026
1c5a65d
Merge pull request #368 from idelder/fix/programmatic_path
jdecarolis Sep 3, 2026
9fe48a7
Merge unstable into main: extension framework, three new model
jdecarolis Sep 3, 2026
9c5a690
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 3, 2026
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
57 changes: 42 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,56 @@ uv run temoa tutorial # Create tutorial files
You can use Temoa as a Python library:

```python
import temoa
from logging import getLogger
from pathlib import Path
from temoa import TemoaModel, TemoaConfig, TemoaMode
from temoa._internal.temoa_sequencer import TemoaSequencer
from temoa.core.config import TemoaConfig
from temoa.core.modes import TemoaMode
from temoa.cli import setup_logging
from pyomo.environ import value, check_optimal_termination

# Create configuration
output_path = Path('output_files/my_run')
output_path.mkdir(parents=True, exist_ok=True)

setup_logging(output_path, debug=False, silent=False)

logger = getLogger(__name__)

# ======================================================================
# Choose ONE of the following two options for configuring the model run:
# ======================================================================

# OPTION 1: build the config in code
config = TemoaConfig(
scenario='my_scenario',
scenario='zulu',
scenario_mode=TemoaMode.PERFECT_FORESIGHT,
input_database=Path('path/to/input.db'),
output_database=Path('path/to/output.db'),
output_path=Path('path/to/output'),
time_sequencing='seasonal_timeslices',
input_database='tutorial_database.sqlite',
output_database='tutorial_database.sqlite',
solver_name='appsi_highs',
output_path=output_path,
silent=False,
)
# OPTION 2: load the config from a file
config = TemoaConfig.build_config(
config_file=Path('tutorial_config.toml'),
output_path=output_path,
silent=False,
)

# Build and solve model
model = TemoaModel(config)
result = model.run() # Equivalent to: temoa run tutorial_config.toml
ts = TemoaSequencer(config=config)
ts.start() # TemoaSequencer runs the model and handles results

# Results are saved to your output_database but can also be accessed in code, here
solved_instance = ts.pf_solved_instance # solved Temoa instance with solution values
solver_results = ts.pf_results # information from the solver

# Check if run was successful
if result:
print('Model solved successfully!')
else:
print('Model failed to solve')
# Example code usage of the solved instance and solver results
logger.info(f'Solver results: {solver_results["solver"]}')
if check_optimal_termination(solver_results):
logger.info(f'Model solved! Objective value: {value(solved_instance.total_cost):.2f}')
built_capacity = value(solved_instance.v_new_capacity['utopia', 'E51', 2010])
logger.info(f'Built {built_capacity:.2f} GW of storage in 2010')
```

## Database Setup
Expand Down
19 changes: 12 additions & 7 deletions docs/source/computational_implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ which determines the valid indices from other model components. This second meth
when the indices of a constraint do not exactly align with the indices of the database
table. For example, the database table :code:`ramp_up_hourly` is indexed by :code:`region`,
:code:`tech` in the database but one of its inheriting constraints,
:code:`ramp_up_day_constraint`, is indexed by :code:`region`, :code:`period`,
:code:`ramp_up_constraint`, is indexed by :code:`region`, :code:`period`,
:code:`season`, :code:`time_of_day`, :code:`tech`, :code:`vintage` in the model. In this case,
an index function is needed to determine the valid indices for the constraint.

Expand All @@ -277,19 +277,19 @@ an index function is needed to determine the valid indices for the constraint.
.. code-block:: python
:linenos:

self.ramp_up_day_constraint_rpsdtv = Set(
dimen=6, initialize=operations.ramp_up_day_constraint_indices
self.ramp_up_constraint_rpsdtv = Set(
dimen=6, initialize=operations.ramp_up_constraint_indices
)
self.ramp_up_day_constraint = Constraint(
self.ramp_up_day_constraint_rpsdtv, rule=operations.ramp_up_day_constraint
self.ramp_up_constraint = Constraint(
self.ramp_up_constraint_rpsdtv, rule=operations.ramp_up_constraint
)

.. topic:: in ``temoa/components/operations.py`` (return valid indices)

.. code-block:: python
:linenos:

def ramp_up_day_constraint_indices(
def ramp_up_constraint_indices(
model: TemoaModel,
) -> set[tuple[Region, Period, Season, TimeOfDay, Technology, Vintage]]:
indices = {
Expand All @@ -302,7 +302,7 @@ an index function is needed to determine the valid indices for the constraint.

return indices

With the sparse set (:code:`demand_constraint_rpc` or :code:`ramp_up_day_constraint_rpsdtv`)
With the sparse set (:code:`demand_constraint_rpc` or :code:`ramp_up_constraint_rpsdtv`)
created, we can now can use it in place of the sets specified in the non-sparse
implementation. Pyomo will now call the constraint implementation rule the
minimum number of times.
Expand All @@ -320,6 +320,11 @@ dimensionality of 3, and (following the :ref:`naming scheme
:code:`region`, the second an element of :code:`time_optimize`,
and third a demand commodity.

.. seealso::
The same component pattern (index set, parameter, and constraint declared in a
``model.py`` and implemented in component modules) can be packaged as an
optional, self-contained add-on. See :ref:`extensions` for the extension
framework and a copy-from template.



Expand Down
54 changes: 0 additions & 54 deletions docs/source/database_schema.mmd
Original file line number Diff line number Diff line change
Expand Up @@ -275,33 +275,6 @@ limit_capacity_share {
TEXT notes
REAL share
}
limit_degrowth_capacity {
TEXT operator PK
TEXT region PK
TEXT tech_or_group PK
TEXT notes
REAL rate
REAL seed
TEXT seed_units
}
limit_degrowth_new_capacity {
TEXT operator PK
TEXT region PK
TEXT tech_or_group PK
TEXT notes
REAL rate
REAL seed
TEXT seed_units
}
limit_degrowth_new_capacity_delta {
TEXT operator PK
TEXT region PK
TEXT tech_or_group PK
TEXT notes
REAL rate
REAL seed
TEXT seed_units
}
limit_emission {
TEXT emis_comm PK
TEXT operator PK
Expand All @@ -311,33 +284,6 @@ limit_emission {
TEXT units
REAL value
}
limit_growth_capacity {
TEXT operator PK
TEXT region PK
TEXT tech_or_group PK
TEXT notes
REAL rate
REAL seed
TEXT seed_units
}
limit_growth_new_capacity {
TEXT operator PK
TEXT region PK
TEXT tech_or_group PK
TEXT notes
REAL rate
REAL seed
TEXT seed_units
}
limit_growth_new_capacity_delta {
TEXT operator PK
TEXT region PK
TEXT tech_or_group PK
TEXT notes
REAL rate
REAL seed
TEXT seed_units
}
limit_new_capacity {
TEXT operator PK
INTEGER period PK
Expand Down
Loading
Loading