OSeMOSYS / OSeMOSYS_GNU_MathProg

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

Technology specific discount rates #65

Closed robertodawid closed 3 years ago

robertodawid commented 3 years ago

Changes in code to solve issue #61

Hello, I have made a few changes to the code. The capital recovery factors use a global discount rate, and the new one CapitalRecoveryFactorIdv[r, t], uses individual discount rates. This factor multiplied by the Capitalinvest[r,t,y] calculates : • The annuity payment for n years (assuming that the economic and lifetime of a technology are the same). • then, the PV of those annuities in the investment year at the specific discount rate, • Finally, it is discounted at the global discount rate.

The parameter TypeOfDiscountRate{r in REGION} allows selecting between equations CC2 and CC3. CC2 calculates the discounted capital investment using ONLY a global discount rate, and CC3 using individual discount rates.

willu47 commented 3 years ago

Hi @robertodawid - many thanks for this. @abhishek0208 do have time to take a look at @robertodawid's solution to #61 as I know this was a concern for Tom?

In the meantime, I have a few suggestions which I'll make in a review.

abhishek0208 commented 3 years ago

Hi @robertodawid - many thanks for this. @abhishek0208 do have time to take a look at @robertodawid's solution to #61 as I know this was a concern for Tom?

In the meantime, I have a few suggestions which I'll make in a review.

@willu47 @robertodawid This was on my to-do list so glad that it's already being done. Thanks! Glad to review it (and run it by Tom too).

abhishek0208 commented 3 years ago

Hi @robertodawid, I tested out the script with a simple model and it works as expected (i.e. technologies with a lower technology-specific discount rate are preferred to those with a higher rate). However, couldn't the calculation of CapitalRecoveryFactor (to be renamed to DiscountFactor) be simplified? https://github.com/OSeMOSYS/OSeMOSYS_GNU_MathProg/pull/65/files#r589061867

willu47 commented 3 years ago

Thanks @abhishek0208 for performing the review. @robertodawid - please could you make the changes suggested by @abhishek0208 and me and push the commits to the same branch. This will update the pull request. Once the tests pass (which will require the same change made to short and fast versions of the code), we'll be able to merge in your changes and make a new release!

robertodawid commented 3 years ago

Hi, @willu47, I have updated the pull request. Thanks, @abhishek0208 for your help. These are the main updates:

  1. From #60. Changed parameter names CapitalRecoveryFactor for DiscountFactor

  2. Deleted parameter TypeofDiscountRate and CC3 removed

  3. Updated CC1 and CC2

  4. Parameter DiscountRateIdv defaults to DiscountRate param DiscountRateIdv{r in REGION, t in TECHNOLOGY}, default DiscountRate[r];

  5. Added CapitalRecoveryFactor (CRF). This factor allows calculating the individual payments from a lump sum (investment cost) every year of a power plant's operational life. CRF is calculated by using the individual discount rate. The individual discount rates are used only in the CRF.

param CapitalRecoveryFactor{r in REGION, t in TECHNOLOGY} := (1 - (1 + DiscountRateIdv[r,t])^(-1))/(1 - (1 + DiscountRateIdv[r,t])^(-(OperationalLife[r,t])));

  1. Added PvAnnuity This factor allows calculating the present value of the all-individual payments (calculated by the CRF) in the investment year at the global discount rate.

param PvAnnuity{r in REGION, t in TECHNOLOGY} := (1 - (1 + DiscountRate[r])^(-(OperationalLife[r,t]))) * (1 + DiscountRate[r]) / DiscountRate[r];

I have updated the long, short, and fast versions of the code and tested them with the Utopia data file.

willu47 commented 3 years ago

@abhishek0208 - any chance you could finish your review of the revised code?

abhishek0208 commented 3 years ago

@willu47 @robertodawid sorry for the delay. Tested out all three versions of osemosys with utopia.txt and it looks good. Ready to be merged now. I suppose otoole will need to be updated? I can try and implement that if it helps.