Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: Keep logged events within the timing bounds #120

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- 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.
- An edge case where events occurred just after the end of a simulation has been resolved by checking the datetime stamp of that event and not adding any action log to the simulation that is after the `WombatEnvironment.end_datetime`.

### General Updates

Expand Down
8 changes: 6 additions & 2 deletions wombat/core/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,10 @@ def log_action(
)
total_labor_cost = hourly_labor_cost + salary_labor_cost
total_cost = total_labor_cost + equipment_cost + materials_cost
now = self.simulation_time
row = {
"datetime": dt.datetime.now(),
"env_datetime": self.simulation_time,
"env_datetime": now,
"env_time": self.now,
"system_id": system_id,
"system_name": system_name,
Expand All @@ -705,7 +706,10 @@ def log_action(
"total_labor_cost": total_labor_cost,
"total_cost": total_cost,
}
self._events_buffer.append(row)
# Don't log the initiation of a crew transfer that can forced at the end of an
# operation but happens to be after the end of the simulation
if now <= self.end_datetime:
self._events_buffer.append(row)

def _log_actions(self):
"""Writes the action log items every 8000 hours."""
Expand Down