Skip to content

add GroupTotalAnnualMaxNewCapacity / duckdb changes - #51

Open
loeffko wants to merge 3 commits into
mainfrom
feature/groupannualadditionlimit
Open

add GroupTotalAnnualMaxNewCapacity / duckdb changes#51
loeffko wants to merge 3 commits into
mainfrom
feature/groupannualadditionlimit

Conversation

@loeffko

@loeffko loeffko commented Jul 5, 2026

Copy link
Copy Markdown
Member

📌 Pull Request Summary

Adds Par_GroupTotalAnnualMaxNewCapacity, improves duckdb functionalities.

🔗 Related Issue(s)

N/A

🛠️ Changes Introduced

  • Addition of Par_GroupTotalAnnualMaxNewCapacity, limiting annual gross additions of a flexible region/technology group. Also adds an equation (TCC5).
  • Fix for equation SC2, where the formulation could potentially lead to infeasibilities in case of unfortunate parameter combinations.
  • Improvements for duckdb:
  1. moved duckdb files from two separate ones to one single file (everything from one run is contained in one singular file)
  2. improved writing/reading behaviour so that the db file is unlocked as much as possible
  3. incusion of a db manipulation script in "Scripts" that allows for renaming/splitting/removing of runs in the db file.

📋 Checklist

  • Code follows project conventions
  • Tests have been added/updated (if needed)
  • Documentation has been updated (if applicable)
  • Relevant issues linked
  • NEWS.md updated
  • Version number increase applied (if planned for release)
  • Reviewers assigned

loeffko and others added 2 commits July 5, 2026 18:14
…5); SC2 min-increment floor

TCC5 caps the summed NewCapacity (annual additions) of a technology subset x
region subset per year, complementing the TCC3/TCC4 level limits: the build
PATH of a tech group can now be smoothed from input data, with no per-tech or
per-region hardcoding. Optional sheet Par_GroupTotalAnnualMaxNewCap
(TechnologySubset, RegionSubset, Year, Value); absent sheet or a 999999 value
means no limit.

SC2 additionally gets a min-increment floor: the annual RE-additions cap can
never fall below the new build required to stay on the TotalAnnualMinCapacity
path. Without it, a dataset whose max funnel hugs a steeply rising min becomes
infeasible under switch_investLimit; min_inc is a constant computed from input
parameters, so the model stays linear.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…b; add DB manager script

One database file holds everything a run produces: processed tables
(output_*), raw variables (raw_*), VarPar intermediates (varpar_*), selected
duals (duals_*) and the input-data dump (input_* tables, one per parameter /
set / tag). Result writes stay Scenario-keyed (purge + insert per scenario);
re-dumping inputs replaces only the input_* tables. Readers fall back to the
pre-merge genesysmod_results_db.duckdb filename so dispatch runs still find
older investment results.

Scripts/manage_results_db.py: interactive manager for the merged database -
list scenarios/tables, rename a scenario, split scenarios into a separate
file, purge, and compact (VACUUM into a fresh file with a .pre_compact.bak).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@loeffko
loeffko requested a review from dqpinel July 5, 2026 19:49
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@dqpinel dqpinel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment regarding the location of the script manage_results_db.

`Scenario` column (results db AND dispatch db); tables without one (input_*,
SET_* ...) are treated as shared.

Usage: python Scripts/manage_results_db.py [path/to/db.duckdb]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to have it in Julia? Should this be in the tool repository?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loeffko any news here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants