Skip to content

Commit

Permalink
Bug Fix: Address Inconsistenty in Turbine vs. Wind Farm Availability (#…
Browse files Browse the repository at this point in the history
…161)

* fix inconsistent substation accounting for turbine vs wind farm availability
  • Loading branch information
RHammond2 authored Dec 12, 2024
1 parent 7c6af0a commit fa8d8cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ repos:
hooks:
- id: isort
name: isort
stages: [commit]
stages: [pre-commit]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py39-plus]
stages: [commit]
stages: [pre-commit]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.2
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# CHANGELOG

## Unreleased (TBD)

- Fixes a discrepancy where the wind farm vs turbine availability losses do not match. A slight difference in total availability will be noticeable as a result.

## 0.9.5 (6 August 2024)

- Fixes a bug that causes delayed mobilizations. The underlying cause was the lack of
Expand Down
9 changes: 7 additions & 2 deletions wombat/core/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,7 @@ def _calculate_windfarm_total(
turbines = self.windfarm.turbine_weights[t_id].values * op[t_id]
total = np.sum(
[
op[[sub]]
* np.array(
np.array(
[
[math.fsum(row)]
for _, row in turbines[val["turbines"]].iterrows()
Expand Down Expand Up @@ -855,6 +854,12 @@ def load_operations_log_dataframe(self) -> pd.DataFrame:
.set_index("datetime")
.sort_values("datetime")
)

# Adjust the turbine operational values to account for substation downtime
for sub, val in self.windfarm.substation_turbine_map.items():
log_df[val["turbines"]] *= log_df[[sub]].values

# Calculate the wind farm aggregate operational value
log_df["windfarm"] = self._calculate_windfarm_total(log_df)
return log_df

Expand Down
2 changes: 0 additions & 2 deletions wombat/core/post_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ def time_based_availability(self, frequency: str, by: str) -> pd.DataFrame:
# Determine the operational capacity of each turbine with substation downtime
operations_cols = ["year", "month", "day", "windfarm"] + self.turbine_id
turbine_operations = self.operations[operations_cols].copy()
for sub, val in self.substation_turbine_map.items():
turbine_operations[val["turbines"]] *= self.operations[[sub]].values

hourly = turbine_operations.loc[:, self.turbine_id]

Expand Down

0 comments on commit fa8d8cf

Please sign in to comment.