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

Update marginal adjustment cost in postsolve #1352

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

katarkow
Copy link
Contributor

@katarkow katarkow commented Jul 12, 2023

Purpose of this PR

Update marginal adjustment costs calculated in cost/postsolve.gms (o_margAdjCostInv). It is still the same logic (o_margAdjCostInv = d(v_costInvTeAdj) / d(vm_deltaCap)), but it hasn't been updated after v_costInvTeAdj had changed. I added the missing terms from the formula:

q_costInvTeAdj(t,regi,teAdj)..
  v_costInvTeAdj(t,regi,teAdj)
  =e=
  vm_costTeCapital(t,regi,teAdj) * (
    (p_adj_coeff(t,regi,teAdj) * v_adjFactor(t,regi,teAdj)) + (p_adj_coeff_glob(teAdj) * v_adjFactorGlob(t,regi,teAdj))
  ) 
  * (1.02 + pm_prtp(regi) ) ** (pm_ts(t) / 2);

where v_adjFactor:

q_eqadj(regi,ttot,teAdj(te))$(ttot.val ge max(2010, cm_startyear)) ..
  v_adjFactor(ttot,regi,te)
  =e=
  power(
    ( sum(te2rlf(te,rlf), vm_deltaCap(ttot,regi,te,rlf)) - sum(te2rlf(te,rlf), vm_deltaCap(ttot-1,regi,te,rlf)) )
    / ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) )
  , 2)
  / ( sum(te2rlf(te,rlf), vm_deltaCap(ttot-1,regi,te,rlf)) + p_adj_seed_reg(ttot,regi) * p_adj_seed_te(ttot,regi,te)  
      + p_adj_deltacapoffset("2010",regi,te)$(ttot.val eq 2010) + p_adj_deltacapoffset("2015",regi,te)$(ttot.val eq 2015)
      + p_adj_deltacapoffset("2020",regi,te)$(ttot.val eq 2020) + p_adj_deltacapoffset("2025",regi,te)$(ttot.val eq 2025)
    )
;

Type of change

  • Bug fix

Checklist:

  • My code follows the coding etiquette
  • I performed a self-review of my own code
  • I explained my changes within the PR, particularly in hard-to-understand areas

Further information (optional):

  • Test run is here: /p/tmp/katarkow/remind/develop/output/adjCosts-SSP2EU-NPi_2023-07-11_17.49.11

@katarkow katarkow merged commit 20968f1 into remindmodel:develop Jul 14, 2023
1 check passed
@katarkow katarkow deleted the marginal-adj-costs branch July 14, 2023 12:38
@cchrisgong
Copy link
Contributor

Hi Kasia, Thank you for doing this PR!
Sorry I forgot to mention this, but usually the protocol asks the PR initiator to show differences in the before vs. after the change. It looks like this change is small enough (and only about calculating output), so please make sure 1) your change does not break the model, 2) post a screenshot on the before and after values for o_margAdjCostInv with this implementation being the only change
Thanks again for spotting this~~ :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants