Skip to content

Commit

Permalink
OpEx Breakdown Function (#119)
Browse files Browse the repository at this point in the history
* Update post_processor.py

OpEx breakdown function

* eliminate extra year

* delete nan years line

* make existing opex() method make the breakdown

* Opex breakdown in Metrics.opex()

* add CHANGELOG

---------

Co-authored-by: dmulash <[email protected]>
  • Loading branch information
dmulas and dmulash authored Oct 26, 2023
1 parent 20fcb13 commit f1c85da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- `plot_detailed_availability` plots a heatmap of the hourly turbine and farm operational levels to help in debugging simulations where availability may be running suspiciously low (i.e., a turbine might have shut down or a cable failure didn't get repaired within a reasonable time frame).
- `Simulation.service_equipment` is now a dictionary to provide clear access to the servicing equipment details.
- `Simulation.from_config()` requires both a library input and a file name input for the configuration after deprecating the `library` field from the configuration requirements due to it being cumbersome
- `Metrics.opex()` provides the opex output by category if `by_category` is set to be `True`

### Methodology Updates

Expand Down
10 changes: 8 additions & 2 deletions wombat/core/post_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ def project_fixed_costs(self, frequency: str, resolution: str) -> pd.DataFrame:

return costs

def opex(self, frequency: str) -> pd.DataFrame:
def opex(self, frequency: str, by_category: bool = False) -> pd.DataFrame:
"""Calculates the project's OpEx for the simulation at a project, annual, or
monthly level.
Expand All @@ -1924,10 +1924,14 @@ def opex(self, frequency: str) -> pd.DataFrame:
frequency : str
One of project, annual, monthly, or month-year.
by_category : bool, optional
Indicates whether the values are with resepect to the various cost
categories (True) or not (False), by default False.
Returns
-------
pd.DataFrame
The project's OpEx broken out at the desired time resolution.
The project's OpEx broken out at the desired time and category resolution.
"""
frequency = _check_frequency(frequency, which="all")

Expand Down Expand Up @@ -1967,6 +1971,8 @@ def opex(self, frequency: str) -> pd.DataFrame:
column = "OpEx"
opex = pd.concat(opex_items, axis=1)
opex.loc[:, column] = opex.sum(axis=1)
if by_category:
return opex
return opex[[column]]

def process_times(self) -> pd.DataFrame:
Expand Down

0 comments on commit f1c85da

Please sign in to comment.