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

bug fix in 45_carbonprice realization expoLinear #1774

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

laurinks
Copy link
Contributor

@laurinks laurinks commented Aug 8, 2024

Purpose of this PR

Bug fix in 45_carbonprice realization "expoLinear": Changing a parameter into a scalar (because it does not depend on the region) in a previous PR was created a problem and is reversed now.

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
  • I checked that the in-code documentation is up-to-date
  • I adjusted the reporting in remind2 where it was needed
  • I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • All automated model tests pass (FAIL 0 in the output of make test)
  • The changelog CHANGELOG.md has been updated correctly

s45_co2_tax_startyear "level of CO2 tax in start year in T$/GtC"
;
parameter
p45_tau_co2_tax_inc(all_regi) "Linear annual increase in carbon price T$/GtC/yr"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PR #1747, I had replaced the parameter p45_tau_co2_tax_inc(all_regi) by the scalar s45_tau_co2_tax_inc because the carbon price trajectory is the same for all regions. However, since pm_taxCO2eq(t,regi) is defined separately for each region, it is more convenient to keep it as a parameter. Now, the change is reversed.

p45_tau_co2_tax_inc(regi) = sum(ttot$(ttot.val eq cm_expoLinear_yearStart),((pm_taxCO2eq(ttot, regi) - pm_taxCO2eq(ttot - 1, regi)) / (pm_ttot_val(ttot) - pm_ttot_val(ttot - 1))));
pm_taxCO2eq(ttot,regi)$(ttot.val gt cm_expoLinear_yearStart) = sum(t$(t.val eq cm_expoLinear_yearStart), pm_taxCO2eq(t, regi) + p45_tau_co2_tax_inc(regi) * (pm_ttot_val(ttot) - pm_ttot_val(t))) ;
*** calculate tax path until cm_expoLinear_yearStart (defaults to 2060)
pm_taxCO2eq(t,regi) = s45_co2_tax_startyear*cm_co2_tax_growth**(t.val-cm_startyear);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using set t instead of ttot.

pm_taxCO2eq(t,regi) = s45_co2_tax_startyear*cm_co2_tax_growth**(t.val-cm_startyear);
*** use linear tax path from cm_expoLinear_yearStart on (with slope given by last timestep before cm_expoLinear_yearStart)
p45_tau_co2_tax_inc(regi) = sum(ttot$(ttot.val eq cm_expoLinear_yearStart),
((pm_taxCO2eq(ttot, regi) - pm_taxCO2eq(ttot - 1, regi)) / (pm_ttot_val(ttot) - pm_ttot_val(ttot - 1)))); !! Using ttot to make use of pm_ttot_val
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes. Kept ttot to make use of pm_ttot_val (instead of introducing pm_t_val).

p45_tau_co2_tax_inc(regi) = sum(ttot$(ttot.val eq cm_expoLinear_yearStart),
((pm_taxCO2eq(ttot, regi) - pm_taxCO2eq(ttot - 1, regi)) / (pm_ttot_val(ttot) - pm_ttot_val(ttot - 1)))); !! Using ttot to make use of pm_ttot_val
pm_taxCO2eq(t,regi)$(t.val gt cm_expoLinear_yearStart) = sum(t2$(t2.val eq cm_expoLinear_yearStart), pm_taxCO2eq(t2, regi))
+ p45_tau_co2_tax_inc(regi) * (t.val - cm_expoLinear_yearStart);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using t instead of ttot. Improving readability by taking second term out of the pseudo sum.

*** set carbon price constant after 2110 to prevent huge carbon prices which lead to convergence problems
pm_taxCO2eq(ttot,regi)$(ttot.val gt 2110) = pm_taxCO2eq("2110",regi);
pm_taxCO2eq(t,regi)$(t.val gt 2110) = pm_taxCO2eq("2110",regi);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using t instead of ttot

@laurinks laurinks requested a review from orichters August 8, 2024 08:57
Copy link
Contributor

@orichters orichters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@laurinks laurinks merged commit 5a7e479 into remindmodel:develop Aug 8, 2024
2 checks passed
@laurinks laurinks deleted the expoLinear-bugfix branch August 8, 2024 09:03
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