OSeMOSYS / OSeMOSYS_GNU_MathProg

The GNU MathProg implementation of OSeMOSYS
Apache License 2.0
9 stars 14 forks source link

Bug: Storage equations (and objective function) contain mistakes! #96

Open Timon-R opened 6 months ago

Timon-R commented 6 months ago

Some of the storage equations are wrong:

The following equation (that appear 4 times in the code) contains mistakes that are explained below:

####s.t. TDC2_TotalDiscountedCost{r in REGION, y in YEAR}: sum{t in TECHNOLOGY}((((sum{yy in YEAR: y-yy < OperationalLife[r,t] && y-yy>=0} NewCapacity[r,t,yy])+ ResidualCapacity[r,t,y])*FixedCost[r,t,y] + sum{m in MODEperTECHNOLOGY[t], l in TIMESLICE} RateOfActivity[r,l,t,m,y]*YearSplit[l,y]*VariableCost[r,t,m,y])/DiscountFactorMid[r,y]+CapitalCost[r,t,y] * NewCapacity[r,t,y]/DiscountFactor[r,y]+DiscountedTechnologyEmissionsPenalty[r,t,y]-DiscountedSalvageValue[r,t,y]) + sum{s in STORAGE} (CapitalCostStorage[r,s,y] * NewStorageCapacity[r,s,y]/DiscountFactor[r,y]-CapitalCostStorage[r,s,y] * NewStorageCapacity[r,s,y]/DiscountFactor[r,y]) = TotalDiscountedCost[r,y];

The storage part of this equation has two mistakes.

  1. It substacts to zero and should instead substract the DiscountedSalvageValueStorage instead of this term: CapitalCostStorage[r,s,y] * NewStorageCapacity[r,s,y]/DiscountFactor[r,y]
  2. Intead of the DiscountFactor[r,y], the DiscountFactorStorage[r,y,s] should be used. Otherwise it doesn't compute.

(In newer version of the code, the DiscountFactor might be replaced by the CapitalRecoveryFactor) The error is also in the objective function, in the section "Summary Results" and at the bottom of the code in the table TotalDiscountedCostResults.

The error with the use of the DiscountFactor instead of the DiscountFactorStorage also appears in this equation: #s.t. SI9_SalvageValueStorageDiscountedToStartYear[...]