-
Notifications
You must be signed in to change notification settings - Fork 168
Extend user-defined relations to include the index of time
#680
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
base: main
Are you sure you want to change the base?
Conversation
timetime
0435076 to
6691ee1
Compare
518a514 to
b8b628d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #680 +/- ##
=====================================
Coverage 95.5% 95.5%
=====================================
Files 46 46
Lines 4340 4351 +11
=====================================
+ Hits 4148 4159 +11
Misses 192 192
|
|
#705 already includes the content of commit 08ef0c7, so when you continue working on this PR, you can/have to exclude this commit. See this comment for how to do that. |
b8b628d to
63a4b0c
Compare
63a4b0c to
e509494
Compare
80ea481 to
ec8a2bd
Compare
|
@behnam-zakeri This sounds useful to me in principle :) |
This PR re-introduces user-defined relations (sets, parameters, equations, variables) with the inclusion of sub-annual
timeindex.Background: The user-defined relations in the GAMS formulation do not represent index of
time, which can be an issue when working on models with sub-annual time slices (see #191). For example, it is not possible to represent time slices in parameterrelation_activity, which relates to the activity of technologies and must be defined at the sub-annual time level. The addition oftimeto existing sets and parameters means re-initializing these items, which will create backward incompatibility. Via #631 a workaround was suggested, which was implemented in PR#633. The improvements proposed in this PR could use the same workaround as #633, however, a few sets here, namely,is_relation_upperandis_relation_lowerare populated in the Java Backend side, which may make re-initializing these sets impossible or complex on themessage_ixside, i.e., inmodels.py.Solution: Until a robust solution will be in place for re-initializing sets and parameters that are at the moment being populated at the Java side in
message_ix, this PR proposes an interim solution as follows:relation_activity_timeis introduced as the mirror of existingrelation_activity, and similarlyrelation_cost_time,relation_lower_timeandrelation_upper_timeare added.models.py. This includesis_relation_lower_timeandis_relation_upper_timeinstead of existingis_relation_lowerandis_relation_upper, respectively, which are produced on the Java backend.RELATION_EQUIVALENCE_TIME,RELATION_CONSTRAINT_UP_TIME, andRELATION_CONSTRAINT_LO_TIME) for enhancing the mathematical formulation.This PR remains as draft for the time being. Merging this PR in the main branch shouldn't create any problems for running existing scenarios. However, having duplicate items (set, parameter, variable and equations) proposed in this PR may not be an optimal solution from a design perspective.
How to review
PR checklist