Repository navigation
fix: limit storage charging by energy drawn (#376) #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SutubraResearch
wants to merge
1
commit into
TemoaProject:unstable
Choose a base branch
from
SutubraResearch:fix/storage-charge-drawn
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| scenario = "storage charge rate" | ||
| scenario_mode = "perfect_foresight" | ||
| input_database = "tests/testing_outputs/storage_charge_rate.sqlite" | ||
| output_database = "tests/testing_outputs/storage_charge_rate.sqlite" | ||
| neos = false | ||
| solver_name = "appsi_highs" | ||
| save_excel = false | ||
| save_duals = false | ||
| save_lp_file = false | ||
| time_sequencing = "seasonal_timeslices" | ||
| days_per_period = 365 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| -- One battery charged from free solar available only in d1 (issue #376). | ||
| -- Capacity 1, efficiency 0.8, C2A 1 and four slices of a quarter year each: | ||
| -- the battery may draw at most 0.25 in d1. | ||
| REPLACE INTO "metadata" VALUES('DB_MAJOR',4,''); | ||
| REPLACE INTO "metadata" VALUES('DB_MINOR',0,''); | ||
| REPLACE INTO "metadata_real" VALUES('default_loan_rate',0.05,''); | ||
| REPLACE INTO "metadata_real" VALUES('global_discount_rate',0.05,''); | ||
| REPLACE INTO "operator" VALUES('e','equal to'); | ||
| REPLACE INTO "operator" VALUES('le','less than or equal to'); | ||
| REPLACE INTO "operator" VALUES('ge','greater than or equal to'); | ||
| REPLACE INTO "commodity_type" VALUES('p','physical commodity'); | ||
| REPLACE INTO "commodity_type" VALUES('d','demand commodity'); | ||
| REPLACE INTO "commodity_type" VALUES('s','source commodity'); | ||
| REPLACE INTO "commodity_type" VALUES('e','emissions commodity'); | ||
| REPLACE INTO "technology_type" VALUES('p','production technology'); | ||
| REPLACE INTO "technology_type" VALUES('ps','storage production technology'); | ||
| REPLACE INTO "sector_label" VALUES('electric',NULL); | ||
| REPLACE INTO "region" VALUES('R',NULL); | ||
| REPLACE INTO "time_period_type" VALUES('e','existing vintages'); | ||
| REPLACE INTO "time_period_type" VALUES('f','future'); | ||
| REPLACE INTO "time_period" VALUES(1,2020,'e'); | ||
| REPLACE INTO "time_period" VALUES(2,2025,'f'); | ||
| REPLACE INTO "time_period" VALUES(3,2030,'f'); | ||
| REPLACE INTO "time_season" VALUES(1,'s1',1.0,NULL); | ||
| REPLACE INTO "time_of_day" VALUES(1,'d1',6.0,NULL); | ||
| REPLACE INTO "time_of_day" VALUES(2,'d2',6.0,NULL); | ||
| REPLACE INTO "time_of_day" VALUES(3,'d3',6.0,NULL); | ||
| REPLACE INTO "time_of_day" VALUES(4,'d4',6.0,NULL); | ||
| REPLACE INTO "commodity" VALUES('earth','s','source',NULL); | ||
| REPLACE INTO "commodity" VALUES('ELC','p','electricity',NULL); | ||
| REPLACE INTO "commodity" VALUES('RL','d','demand',NULL); | ||
| REPLACE INTO "technology" VALUES('sun','p','electric','solar','',0,0,0,0,0,0,0,0,'free, d1 only'); | ||
| REPLACE INTO "technology" VALUES('gas','p','electric','gas','',0,0,0,0,0,0,0,0,'expensive'); | ||
| REPLACE INTO "technology" VALUES('batt','ps','electric','battery','',0,0,0,0,0,0,0,0,'battery'); | ||
| REPLACE INTO "technology" VALUES('load','p','electric','load','',0,0,0,0,0,0,0,0,'to demand'); | ||
| REPLACE INTO "efficiency" VALUES('R','earth','sun',2025,'ELC',1.0,NULL,NULL); | ||
| REPLACE INTO "efficiency" VALUES('R','earth','gas',2025,'ELC',1.0,NULL,NULL); | ||
| REPLACE INTO "efficiency" VALUES('R','ELC','batt',2025,'ELC',0.8,NULL,NULL); | ||
| REPLACE INTO "efficiency" VALUES('R','ELC','load',2025,'RL',1.0,NULL,NULL); | ||
| REPLACE INTO "capacity_to_activity" VALUES('R','sun',1.0,NULL,''); | ||
| REPLACE INTO "capacity_to_activity" VALUES('R','gas',1.0,NULL,''); | ||
| REPLACE INTO "capacity_to_activity" VALUES('R','batt',1.0,NULL,''); | ||
| REPLACE INTO "capacity_to_activity" VALUES('R','load',1.0,NULL,''); | ||
| REPLACE INTO "capacity_factor_tech" VALUES('R','s1','d1','sun',1.0,NULL); | ||
| REPLACE INTO "capacity_factor_tech" VALUES('R','s1','d2','sun',0.0,NULL); | ||
| REPLACE INTO "capacity_factor_tech" VALUES('R','s1','d3','sun',0.0,NULL); | ||
| REPLACE INTO "capacity_factor_tech" VALUES('R','s1','d4','sun',0.0,NULL); | ||
| REPLACE INTO "storage_duration" VALUES('R','batt',24.0,NULL); | ||
| REPLACE INTO "cost_invest" VALUES('R','sun',2025,0.001,NULL,NULL); | ||
| REPLACE INTO "cost_invest" VALUES('R','gas',2025,0.001,NULL,NULL); | ||
| REPLACE INTO "cost_invest" VALUES('R','batt',2025,0.001,NULL,NULL); | ||
| REPLACE INTO "cost_invest" VALUES('R','load',2025,0.001,NULL,NULL); | ||
| REPLACE INTO "cost_variable" VALUES('R',2025,'gas',2025,100.0,'',''); | ||
| REPLACE INTO "limit_capacity" VALUES('R',2025,'sun','le',10.0,'',''); | ||
| REPLACE INTO "limit_capacity" VALUES('R',2025,'batt','ge',1.0,'',''); | ||
| REPLACE INTO "limit_capacity" VALUES('R',2025,'batt','le',1.0,'',''); | ||
| REPLACE INTO "demand" VALUES('R',2025,'RL',4.0,'',''); | ||
| REPLACE INTO "demand_specific_distribution" VALUES('R',2025,'s1','d1','RL',0.25,NULL); | ||
| REPLACE INTO "demand_specific_distribution" VALUES('R',2025,'s1','d2','RL',0.25,NULL); | ||
| REPLACE INTO "demand_specific_distribution" VALUES('R',2025,'s1','d3','RL',0.25,NULL); | ||
| REPLACE INTO "demand_specific_distribution" VALUES('R',2025,'s1','d4','RL',0.25,NULL); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Test the throughput change independently.
The asserted limit does not distinguish the two throughput formulas when a slice only charges or only discharges. In d1, the separate charge-rate limit already caps the asserted 0.25 draw. Reverting only the throughput charge term to efficiency-adjusted flow could leave this scenario green. Add a targeted case with both flows positive. For a 0.25 limit, a 0.20 draw and 0.08 discharge would violate the new throughput limit but satisfy the old one.
🤖 Prompt for AI Agents