Closed gschivley closed 3 months ago
@gschivley , the draft PR #666 when completed will fix this. I am bringing in the init=0 in the sum expression to fix the bug. We have dome this elsewhere in the DDP code.
This is now fixed on the release branch.
Bug description
When running multi-period foresight, GenX throws an error when calculating the overnight capital cost if the
Capital_Recovery_Period
value is 0 for any resources. The parameterpayment_yrs_remaining
has a value of 0 for those resources and the code is unable to iterate overp=1:payment_yrs_remaining[I]
. The error given isERROR: LoadError: MethodError: reducing over an empty collection is not allowed; consider supplying
initto the reducer
.Since existing resources usually don't have an investment cost in GenX inputs, it doesn't make sense to require that they have a non-zero
Capital_Recovery_Period
. A blunt fix would be to change zeros to ones.Another possible fix would be to only calculate
occ
if investment costs are non-zero.This would still raise an error if a resource with non-zero investment costs has a crp of 0. Either way, it would be helpful if the code checked for this sort of condition and alerted the user that there might be a problem.
Environment and Version
MacOS, Julia 1.9, GenX 3.6
Relevant error messages
No response
Additional context
No response