Skip to content

Comments

Aggregate LCOE and NPV over timeslices for objectives#635

Merged
tsmbland merged 26 commits intomainfrom
lcoe_objective
Jan 22, 2025
Merged

Aggregate LCOE and NPV over timeslices for objectives#635
tsmbland merged 26 commits intomainfrom
lcoe_objective

Conversation

@tsmbland
Copy link
Collaborator

@tsmbland tsmbland commented Jan 20, 2025

Description

Previously, LCOE was calculated at the timeslice-level for the objectives, and then a max operation was taken over the timeslices, and this was the value taken as the cost of installing one unit of capacity.

It seems nonsensical to take the max, and could prevent a technology from being invested in just because it's expensive in a single timeslice.

Really, we should be calculating the average LCOE across the whole year and using this as the cost metric.

To do this, I've added an aggregate_timeslices argument to the LCOE function, which sums timeslice-level costs and production when True, returning a single value for the year (no "timeslice" dimension). This is then what's used for the objectives.

Ultimately, this then gets broadcast over the timeslices here, and the same max operation is taken, which gives you back a single value proportional to the original LCOE for the year as a whole.

It's all a bit convoluted, but this seemed like the easiest way to introduce these changes quickly. I think there are bigger changes required to the solver in the future which will require larger refactoring, so there's no point over-optimizing things right now.

Surprisingly, none of the results change at all. Don't know what to make of this, but it still seems like the right thing to do

Fixes #288

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass: $ python -m pytest
  • The documentation builds and looks OK: $ python -m sphinx -b html docs docs/build

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@tsmbland tsmbland marked this pull request as ready for review January 21, 2025 09:08
@tsmbland tsmbland linked an issue Jan 21, 2025 that may be closed by this pull request
@tsmbland tsmbland requested a review from dalonsoa January 21, 2025 13:54
Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

Well, it is a bit convoluted, but I don't feel it is a big bottleneck. The key thing is a question of documentation - possibly a separate PR: when LCOE is timeslice-dependent, when it is not and why that is the case.

Base automatically changed from costs to main January 22, 2025 11:43
@tsmbland tsmbland changed the title Aggregate LCOE over timeslices for objectives Aggregate LCOE and NPV over timeslices for objectives Jan 22, 2025
@tsmbland
Copy link
Collaborator Author

I've added similar changes to NPV/NPC/EAC

@tsmbland tsmbland enabled auto-merge (squash) January 22, 2025 11:59
@tsmbland tsmbland merged commit e4332e6 into main Jan 22, 2025
14 checks passed
@tsmbland tsmbland deleted the lcoe_objective branch January 22, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Change logic of how LCOE is used to calculate commodity prices

2 participants