iiasa / message_ix

The integrated assessment and energy systems model MESSAGEix
https://docs.messageix.org
Apache License 2.0
123 stars 154 forks source link

Automatics parameters such map_tec_time presenting weird behaviour #348

Open DIUANA opened 4 years ago

DIUANA commented 4 years ago

Dear

Let me try to explain this issue properly.

I have 4 sub time periods: [SUMMER, SPRING, WINTER, FALL] and a parent time which is YEAR

I have a technology X that works on the sub-annual time, the seasons however, if I set a relation XR associated to this technology X when IXMP generates the gdx file it creates a map_tec_time and map_tec_act sets automatically but with time year also associated to the technology X.

Therefore, instead of get the result as I was expecting, such as: X, node, year time=[SUMMER, SPRING, WINTER, FALL] I got X, node, year time=[SUMMER, SPRING, WINTER, FALL, YEAR]

If I try to pass those sets to the model manually I get the following error message: com.gams.api.GAMSException: Symbol map_tec_time exists already

How can I deal with this issue?

All the Best and thanks in advance.

DIUANA commented 4 years ago

Hi

I would like to emphasize that this issue still happens in the new version 3.0.

I found a work around solution I am creating another relation equation, sets and parameters and passing all info manually however I believe that is not the best solution.

Regards

behnam-zakeri commented 4 years ago

@DIUANA thanks for opening this issue. Are you trying to use parameter _relationactivity for a scenario with sub-annual timesteps?

DIUANA commented 4 years ago

Thanks for responding me.

Yes @behnam-zakeri . I am trying to do it but I changed the equation for to ACT take into account the duration time because the equation balance is built only in the year level.

RELATION_EQUIVALENCE2(relation2,node,year)..
    REL2(relation2,node,year)
        =E=
    SUM(tec,
        ( relation_new_capacity2(relation2,node,year,tec) * CAP_NEW(node,tec,year)
          + relation_total_capacity2(relation2,node,year,tec)
            * SUM(vintage$( map_tec_lifetime(node,tec,vintage,year) ), CAP(node,tec,vintage,year) )
          )$( inv_tec(tec) )
        + SUM((location,year_all2,mode,time)$( map_tec_act(location,tec,year_all2,mode,time) ),
            relation_activity2(relation2,node,year,location,tec,year_all2,mode)
            * ( SUM(vintage$( map_tec_lifetime(location,tec,vintage,year_all2) ),
                  duration_time(time) * ACT(location,tec,vintage,year_all2,mode,time) )
                  + historical_activity(location,tec,year_all2,mode,time) )
          )
      ) 

Actually I changed the new relation that I created in order to be able to correctly pass the values for map_tec_time and avoid this issue.

To be honest I have noticed just now that I should have included the duration_time parameter into historical activity as well but since it is not important for me it makes no difference in my model.