diff --git a/CHANGELOG.md b/CHANGELOG.md index 08042f22..045eb14e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.8.1 (28 August 2023) + +- Fixes a bug where servicing equipment waiting for the next operational period at the end of a simulation get stuck in an infinite loop because the timeout is set for just prior to the end of the simulation, and not just after the end of the simulation's maximum run time. + ## v0.8.0 (16 August 2023) ### Bug Fixes diff --git a/docs/source/conf.py b/docs/source/conf.py index 6d250c4a..11cbcd82 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -95,7 +95,7 @@ } # toggle this between auto/off to rerun full documentation build -nb_execution_mode = "off" +nb_execution_mode = "auto" nb_execution_timeout = -1 nb_execution_allow_errors = True # nb_execution_excludepatterns.append("*_demonstration.md") diff --git a/wombat/__init__.py b/wombat/__init__.py index afb41ca5..ec239fff 100644 --- a/wombat/__init__.py +++ b/wombat/__init__.py @@ -4,4 +4,4 @@ from wombat.core.library import create_library_structure -__version__ = "0.8.0" +__version__ = "0.8.1" diff --git a/wombat/core/environment.py b/wombat/core/environment.py index db5dfae3..49116345 100644 --- a/wombat/core/environment.py +++ b/wombat/core/environment.py @@ -418,7 +418,7 @@ def _weather_setup( weather_file: str, start_year: int | None = None, end_year: int | None = None, - ) -> pd.DataFrame: + ) -> pl.DataFrame: """Reads the weather data from the "/weather" directory, and creates the ``start_date`` and ``end_date`` time stamps for the simulation. @@ -476,7 +476,12 @@ def _weather_setup( .reset_index(drop=False) ) .with_row_count() - .with_columns((pl.col("datetime").dt.hour()).alias("hour")) + .with_columns( + [ + pl.col("datetime").cast(pl.Datetime).dt.cast_time_unit("ns"), + (pl.col("datetime").dt.hour()).alias("hour"), + ] + ) ) missing = set(REQUIRED).difference(weather.columns) diff --git a/wombat/core/service_equipment.py b/wombat/core/service_equipment.py index 019fe5db..95ad28af 100644 --- a/wombat/core/service_equipment.py +++ b/wombat/core/service_equipment.py @@ -1662,10 +1662,15 @@ def run_unscheduled_in_situ(self) -> Generator[Process, None, None]: self.settings.non_operational_dates_set ) if intersection: - hours_to_next = self.hours_to_next_operational_date( - start_search_date=max(intersection), - exclusion_days=mobilization_days, - ) + intersection_end = max(intersection) + sim_end = self.env.end_datetime.date() + if intersection_end != sim_end: + hours_to_next = self.hours_to_next_operational_date( + start_search_date=intersection_end, + exclusion_days=mobilization_days, + ) + else: + hours_to_next = self.env.max_run_time - self.env.now self.env.log_action( agent=self.settings.name, action="delay",