Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c16e6cd
Move days_per_period parameter to config
idelder Mar 3, 2026
dcae359
Remove days_per_period from all sql files
idelder Mar 3, 2026
5b2ddd3
First pass at removing period index on seasons
idelder Mar 4, 2026
fc3b8c1
Update test sets for removal of period indexed seasons
idelder Mar 4, 2026
49d9095
Remove period index from time_next dicts
idelder Mar 4, 2026
bb54662
Update time_manual to remove period index
idelder Mar 4, 2026
d73a664
Remove period index from several tables
idelder Mar 4, 2026
5aeee57
Update test_system legacy values for more storage frac constraints
idelder Mar 4, 2026
8b548ef
Remove season_label table
idelder Mar 5, 2026
4b0e730
Change time_season_sequential pk to only seas_seq
idelder Mar 5, 2026
e0ea360
Fix ramp rate constraints to adjust limit to hourly output
idelder Mar 5, 2026
bb243ca
Add hours column to time_of_day
idelder Mar 6, 2026
fbf1408
Move segment_fraction definition to season tables
idelder Mar 6, 2026
e23f267
Fix sequencing of model construction for time params
idelder Mar 6, 2026
ba9ecc1
Update seasonal storage season weight adjustment
idelder Mar 6, 2026
c211edb
Update test values for new seg_frac definition as no longer rounded
idelder Mar 6, 2026
7419317
Fix two bugs in new season_seq definition
idelder Mar 6, 2026
495e26c
Remove erroneous fk from limit_storage_level_fraction
idelder Mar 6, 2026
9f8ea11
Update hours column of time_of_day to REAL not INTEGER
idelder Mar 6, 2026
52981e0
Reinforce 0 to 1 constraint on segfrac
idelder Mar 6, 2026
6c0d467
Remove erroneous season fk from output_storage_level
idelder Mar 6, 2026
e944356
Fix season fk in output_curtailment
idelder Mar 6, 2026
9076cfc
Fix storage fraction constraints in example dbs
idelder Mar 6, 2026
598f461
Fix 0 to 1 constraint on segment fractions
idelder Mar 6, 2026
11563a9
Fix index construction for limit_storage_level_fraction and add prope…
idelder Mar 6, 2026
4454147
Remove period from deprecated cfp check
idelder Mar 7, 2026
71cffe7
Update unit cost explorer tool
idelder Mar 7, 2026
ba2b2a0
Update sql data validation
idelder Mar 7, 2026
4ff3814
Add 0 to 1 sql check on limit_storage_level_fraction
idelder Mar 7, 2026
f6eba06
Change some param domains to PositiveReals to avoid divide-by-zero er…
idelder Mar 7, 2026
17a0ead
Make time_of_day consistent with test sql style
idelder Mar 7, 2026
ec2f3af
Remove redundant time_season entries from survival_curve test sql
idelder Mar 7, 2026
866a3a6
Change INSERT to REPLACE in time_of_day for utopia test
idelder Mar 7, 2026
e37e8cf
Make sequence column unique in season tables
idelder Mar 7, 2026
74da33a
Update data_files temoa_schema_v4
idelder Mar 8, 2026
ead3a39
adapting migrator to changes in v4 schema and adding test for migration
idelder Mar 8, 2026
b65aad5
Merge branch 'unstable' of https://github.com/TemoaProject/temoa into…
idelder Mar 24, 2026
f48bd7e
Rename time_season_sequential and remove unneeded season index
idelder Mar 23, 2026
c08bcad
Rename time_season_to_sequential (name was wrong)
idelder Mar 24, 2026
bbc69b7
Add sequence ordering to critical ordered time sets in loading
idelder Mar 24, 2026
c984fa2
Resolve some merge issues
idelder Mar 24, 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
Prev Previous commit
Next Next commit
Fix storage fraction constraints in example dbs
  • Loading branch information
idelder authored and ParticularlyPythonicBS committed Mar 10, 2026
commit 9076cfcca06010bb576a44b57c213174fa4b50df
4 changes: 2 additions & 2 deletions data_files/example_dbs/seasonal_storage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ CREATE TABLE limit_storage_level_fraction
notes TEXT,
PRIMARY KEY(region, season, tod, tech, operator)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
);
INSERT INTO "limit_storage_level_fraction" VALUES('region','winter','b','seas_stor',2000,0.5,NULL);
INSERT INTO "limit_storage_level_fraction" VALUES('region','charge','b','dly_stor',2000,0.5,NULL);
INSERT INTO "limit_storage_level_fraction" VALUES('region','winter','b','seas_stor','e',0.5,NULL);
INSERT INTO "limit_storage_level_fraction" VALUES('region','charge','b','dly_stor','e',0.5,NULL);
CREATE TABLE limit_tech_input_split
(
region TEXT,
Expand Down
4 changes: 2 additions & 2 deletions data_files/example_dbs/test_system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,8 @@ CREATE TABLE limit_storage_level_fraction
notes TEXT,
PRIMARY KEY(region, season, tod, tech, operator)
);
Comment on lines 885 to 899
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Keep this fixture schema aligned with the runtime storage schema.

Because this file creates its own tables, the missing REFERENCES time_season(season) on limit_storage_level_fraction.season and output_storage_level.season will keep this fixture accepting bad season labels even after the main schema is fixed.

Suggested fix
 CREATE TABLE limit_storage_level_fraction
 (
     region   TEXT,
-    season TEXT,
+    season TEXT
+        REFERENCES time_season (season),
     tod      TEXT
         REFERENCES time_of_day (tod),
     tech     TEXT
         REFERENCES technology (tech),
@@
 CREATE TABLE output_storage_level
 (
     scenario TEXT,
     region TEXT,
     sector TEXT
         REFERENCES sector_label (sector),
     period INTEGER
         REFERENCES time_period (period),
-    season TEXT,
+    season TEXT
+        REFERENCES time_season (season),
     tod TEXT
         REFERENCES time_of_day (tod),
     tech TEXT
         REFERENCES technology (tech),
     vintage INTEGER

Also applies to: 1238-1255

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@data_files/example_dbs/test_system.sql` around lines 885 - 899, The fixture
table limit_storage_level_fraction defines season without referencing the
canonical time_season table, so update the season column definition to include
REFERENCES time_season(season); do the same for output_storage_level.season (the
other fixture mentioned) so these fixture tables enforce valid season labels;
locate the CREATE TABLE blocks for limit_storage_level_fraction and
output_storage_level and add the REFERENCES time_season(season) clause to their
season column definitions, ensuring surrounding commas and constraints remain
syntactically correct.

INSERT INTO "limit_storage_level_fraction" VALUES('R1','winter','day','E_BATT',2025,0.5,'');
INSERT INTO "limit_storage_level_fraction" VALUES('R2','summer','day','E_BATT',2020,0.5,'');
INSERT INTO "limit_storage_level_fraction" VALUES('R1','winter','day','E_BATT','e',0.5,'');
INSERT INTO "limit_storage_level_fraction" VALUES('R2','summer','day','E_BATT','e',0.5,'');
CREATE TABLE limit_tech_input_split
(
region TEXT,
Expand Down