From 135f9eda0a4462deb02523f27b251359948e818f Mon Sep 17 00:00:00 2001 From: RHammond2 <13874373+RHammond2@users.noreply.github.com> Date: Thu, 21 Sep 2023 10:10:56 -0700 Subject: [PATCH 1/5] add potential fix for low task completion due to replacements --- wombat/core/post_processor.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wombat/core/post_processor.py b/wombat/core/post_processor.py index eeb11221..d7c990c0 100644 --- a/wombat/core/post_processor.py +++ b/wombat/core/post_processor.py @@ -591,11 +591,9 @@ def capacity_factor(self, which: str, frequency: str, by: str) -> pd.DataFrame: return pd.DataFrame(production / potential, columns=columns) def task_completion_rate(self, which: str, frequency: str) -> float | pd.DataFrame: - """Calculates the task completion rate over a project's lifetime as a single - value, annual average, or monthly average for the whole windfarm or by turbine. - - .. note:: This currently assumes that if there are multiple substations, that - the turbines are all connected to multiple. + """Calculates the task completion rate (including tasks that are canceled after + a replacement event) over a project's lifetime as a single value, annual + average, or monthly average for the whole windfarm or by turbine. Parameters ---------- @@ -625,8 +623,8 @@ def task_completion_rate(self, which: str, frequency: str) -> float | pd.DataFra task_filter = ["maintenance", "repair"] cols = ["env_datetime", "request_id"] - completion_filter = [f"{el} complete" for el in task_filter] request_filter = [f"{el} request" for el in task_filter] + completion_filter = ["request canceled", *request_filter] requests = self.events.loc[ self.events.action.isin(request_filter), cols ].reset_index(drop=True) From 1714d70ee935a3fb57f83dc9c96b353fdcc3794c Mon Sep 17 00:00:00 2001 From: RHammond2 <13874373+RHammond2@users.noreply.github.com> Date: Thu, 21 Sep 2023 10:40:57 -0700 Subject: [PATCH 2/5] log which request type is canceled in 'action' --- wombat/core/post_processor.py | 2 +- wombat/core/repair_management.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wombat/core/post_processor.py b/wombat/core/post_processor.py index d7c990c0..c6ff1bd1 100644 --- a/wombat/core/post_processor.py +++ b/wombat/core/post_processor.py @@ -624,7 +624,7 @@ def task_completion_rate(self, which: str, frequency: str) -> float | pd.DataFra cols = ["env_datetime", "request_id"] request_filter = [f"{el} request" for el in task_filter] - completion_filter = ["request canceled", *request_filter] + completion_filter = [*[f"{el} canceled" for el in task_filter], *request_filter] requests = self.events.loc[ self.events.action.isin(request_filter), cols ].reset_index(drop=True) diff --git a/wombat/core/repair_management.py b/wombat/core/repair_management.py index e60fb418..3772a857 100644 --- a/wombat/core/repair_management.py +++ b/wombat/core/repair_management.py @@ -683,6 +683,7 @@ def purge_subassembly_requests( return None for request in requests: + which = "repair" if isinstance(request.details, Failure) else "maintenance" self.env.log_action( system_id=request.system_id, system_name=request.system_name, @@ -691,7 +692,7 @@ def purge_subassembly_requests( system_ol=float("nan"), part_ol=float("nan"), agent="RepairManager", - action="request canceled", + action=f"{which} canceled", reason="replacement required", request_id=request.request_id, ) From 0ad157d9a9024e9c37965b53e81190834e9c1fea Mon Sep 17 00:00:00 2001 From: RHammond2 <13874373+RHammond2@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:00:43 -0700 Subject: [PATCH 3/5] update metric for change in canceled phrasing --- wombat/core/post_processor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wombat/core/post_processor.py b/wombat/core/post_processor.py index c6ff1bd1..6e120d21 100644 --- a/wombat/core/post_processor.py +++ b/wombat/core/post_processor.py @@ -624,7 +624,9 @@ def task_completion_rate(self, which: str, frequency: str) -> float | pd.DataFra cols = ["env_datetime", "request_id"] request_filter = [f"{el} request" for el in task_filter] - completion_filter = [*[f"{el} canceled" for el in task_filter], *request_filter] + completion_filter = [ + f"{task} {el}" for task in task_filter for el in ("complete", "canceled") + ] requests = self.events.loc[ self.events.action.isin(request_filter), cols ].reset_index(drop=True) From 18dc42b3c43ec0802090aba00ebf967ad90110da Mon Sep 17 00:00:00 2001 From: RHammond2 <13874373+RHammond2@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:11:11 -0700 Subject: [PATCH 4/5] fix cable getter to allow for multiple cable naming conventions --- wombat/windfarm/windfarm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wombat/windfarm/windfarm.py b/wombat/windfarm/windfarm.py index b17d7b42..b1920d8a 100644 --- a/wombat/windfarm/windfarm.py +++ b/wombat/windfarm/windfarm.py @@ -425,7 +425,9 @@ def cable(self, cable_id: tuple[str, str] | str) -> Cable: The ``Cable`` object. """ if isinstance(cable_id, str): - edge_id = tuple(cable_id.split("::")[1:]) + edge_id = tuple(cable_id.split("::")) + if len(edge_id) == 3: + edge_id = edge_id[1:] else: edge_id = cable_id try: From 08db36a3861105287663a5f7cccb1d0add87380c Mon Sep 17 00:00:00 2001 From: RHammond2 <13874373+RHammond2@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:06:46 -0700 Subject: [PATCH 5/5] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245c22f4..8082613e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,12 @@ - Repairs that had a weather delay extended repairs past the end of the shift now properly extend the repair into future shifts instead of completing early. This has a small negative impact on availability because that means some repairs can take longer than they had originally. - Traveling to a system for a repair where the timing extends beyond the end of the shift, but into the next shift, is now registered as a shift delay just like travel weather delays that extend beyond the end of the current shift but before the start of the next shift. This has a small positive impact on availability because a turbine or cable may not start being repaired until weather is more consistently clear, rather than starting it and extending it for many shifts. +- `Windfarm.cable()` now correctly identifies 2 and 3 length cable naming conventions to differentiate which version of the cable id is being retrieved. ### General Updates - `Metrics.equipment_labor_cost_breakdowns` now has a `by_equipment` boolean flag, so that the labor and equipment costs can be broken down by category and equipment. Additionally, `total_hours` has been added to the results, resulting in fewer computed metrics across the same set of breakdowns. +- "request canceled" and "complete" are now updated in the logging to directly state if it's a "repair" or "maintenance" task that was completed or canceled to ensure consistency across the logging messages. As a result, `Metrics.task_completion_rate()` can now correctly differentiate between the completed tasks effectively. ### Methodology Updates