Issue when reading par/var/equ values from the database

44 views
Skip to first unread message

jasper...@googlemail.com

unread,
May 29, 2018, 6:06:03 PM5/29/18
to message_ix
Dear all,

small issue regarding the reading of data from the platform (in order to gather some of the marginal values). While some of the commands work, many others do not: For example

df1=scenario.equ('COMMODITY_BALANCE')
gives back the required data frame.

df=scenario.equ('CAPACITY_CONSTRAINT')
does not. Apparently there exists no such equation, although the .gdx shows values.

Best
Jasper

HUPPMANN Daniel

unread,
May 30, 2018, 3:46:16 AM5/30/18
to jasper...@googlemail.com, messa...@googlegroups.com

Hi Jasper,

 

Thank you for raising all these great questions!

 

At the moment, we only import the most relevant variables and equations from the solution to the platform and database instance. But you can easily import additional parts of the solution.

 

You have to do two things:

- First, you have to tell the scenario in the ixmp instance that this variable or equation exists. In you case,

 

scenario.init_equ('CAPACITY_CONSTRAINT',

                  idx_sets=['node', 'technology', 'year', 'year', 'time'],

                  idx_names=['node_loc', 'technology', 'year_vtg', 'year_act', 'time'])

 

I followed the convention we use for all technology-related parameters and variables in the naming of the index here.

 

- Second, you have to tell the platform to read that additional variable from the solution. The `solve()` function does three things: export to gdx, call GAMS, read the solution. For a MESSAGE-scheme scenario, this only imports the default variables and equations. But you can just “re-read” the solution and tell ixmp to import the additional equation as well:

 

scenario.read_sol_from_gdx(<path>, <gdx_file_name>, equ_list=['CAPACITY_CONSTRAINT'])

 

- Then, you can retrieve that equation-solution just as any other parameter or variable using

 

scenario.equ('CAPACITY_CONSTRAINT')

 

I hope this is helpful for you!

Best of luck,

Daniel

 

PS: I just generated an issue on GitHub to add an easier method here, namely just calling

 

scenario.solve ('MESSAGE', equ_list=['CAPACITY_CONSTRAINT'])

 

see https://github.com/iiasa/message_ix/issues/16

--
You received this message because you are subscribed to the Google Groups "message_ix" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message_ix+...@googlegroups.com.
To post to this group, send email to messa...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/message_ix/3c6c277d-ce7c-4826-90be-e0c2fb34e969%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages