Skip to content
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

Non-integer technical_lifetime → error in scaling_investment_costs.gms #503

Open
Tracked by #506
khaeru opened this issue Aug 23, 2021 · 0 comments
Open
Tracked by #506
Labels
bug Doesn't work as advertised/unintended effects

Comments

@khaeru
Copy link
Member

khaeru commented Aug 23, 2021

If technical_lifetime has non-integer values, the calculation of beyond_horizon_factor in scaling_investment_costs.gms errors:

( 1 - POWER( 1 / ( 1 + interestrate(last_period) ), beyond_horizon_lifetime(node,inv_tec,vintage) ) )

…with a message like:

**** Exec Error at line 2056: power: FUNC DOMAIN: pow(x,i), i not integer

The i argument is beyond_horizon_lifetime, which is computed in the same file:

* compute the technical lifetime remaining beyond the overall model horizon
beyond_horizon_lifetime(node,inv_tec,vintage)$( map_tec(node,inv_tec,vintage) ) =
technical_lifetime(node,inv_tec,vintage) - remaining_years(vintage) ;
When technical_lifetime is real/non-integer, this parameter will also be non-integer.

Because it's not mentioned in the documentation, it's not clear (cf. related issues, below) whether other parts of the GAMS code also expect technical_lifetime to be only integer numbers of years. Conceptually, this restriction doesn't make any sense, but practically the code may have been written that way.

For this particular error, a fix would be to use the GAMS ** operator, which accepts real exponents, instead of the POWER() function, which does not. The line can also be simplified since (1 / (1 + i))**b is just (1+i)**(-b).

Notes:

@khaeru khaeru added the bug Doesn't work as advertised/unintended effects label Aug 23, 2021
@khaeru khaeru mentioned this issue Aug 27, 2021
6 tasks
khaeru added a commit that referenced this issue Aug 27, 2021
@khaeru khaeru changed the title Non-integer technical_lifetime → error in scaling_investment_costs.gms Non-integer technical_lifetime → error in scaling_investment_costs.gms May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Doesn't work as advertised/unintended effects
Projects
None yet
Development

No branches or pull requests

1 participant