You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 parameter payment_yrs_remaining has a value of 0 for those resources and the code is unable to iterate over p=1:payment_yrs_remaining[I]. The error given is ERROR: LoadError: MethodError: reducing over an empty collection is not allowed; consider supplying init to 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.
occ =zeros(length(inv_costs_yr))
for i in1:length(occ)
if inv_costs_yr[i] >0
occ[i] =sum(inv_costs_yr[i]/(1+tech_wacc[i]) .^ (p) for p=1:payment_yrs_remaining[i])
endend
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
The text was updated successfully, but these errors were encountered:
@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.
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
The text was updated successfully, but these errors were encountered: