Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…cheduling will fail
|
Thanks @VeckoTheGecko! PR now updated to reflect your suggestions. I've also updated the logic for determining an expedition identifier (id). Before it was determining a new expedition (and therefore new set of problems) based on a change in instrument deployment at any waypoint. However, that could inadvertently lead to a new set of problems being returned if a user deletes a waypoint to deal with scheduling issues. Now, instead, a new id is only returned when there is an addition to the set of instruments deployed across whole expedition (but not subtraction because this could be triggered, again, by deleting waypoints if the waypoint is the only one with that instrument type). |
for more information, see https://pre-commit.ci
|
I've now changed "prob-level" to "difficulty-level" (as suggested by @VeckoTheGecko) and set the default to "easy". For in-class applications where we want to use problems then we can point to a custom installation with default set to e.g. "medium" instead. Let me know when you're happy with the PR (cc @ammedd and @erikvansebille) and we'll get this merged 🚢 |
|
I run into the same issue as #281 |
To understand this better, are you encountering this problem because you have indeed made changes to the timings at waypoints before the waypoint affected by the problem? If so I would say this is the expected behaviour...as we only want users to make changes to waypoint timings after the problem waypoint? |
|
No, the message is "Waypoint 5 could not be reached in time. Current time: 1998-01-01 03:00:14.987829. Waypoint time: 1998-01-01 03:00:00." |
|
I don't have time to carefully go through the code again myself, but I think that the issue that Emma raised above is very important to get fixed before merging. Please keep me updated how you are progressing |
|
If I understand this correctly, @ammedd your point is about the first part of #281 (waypoint not reached in time) rather than the second part (warning about not re-scheduling previous waypoints)? In any case, I've asked for the This alone is not necessarily unexpected behaviour in the code's existing form. It is possible that a user fixes a scheduling issue as a result of a problem, which passes the If indeed this is what's happening (I will check this thoroughly though using Nick's |
|
Update: Schedule.verify() now also takes the instrument deployment times into account when calculating whether the next waypoint can be reached in time. This should avoid situations where |
Summary
This PR adds a 'problems' module to VirtualShip, whereby as expeditions are run users are faced with authentic problems which may happen on a real-life research vessel. These can be "general" problems (e.g. delayed food/fuel deliveries, unplanned safety drills), or "instrument" problems (e.g. CTD winch breaks down).
Features & implementation
All problems are associated with a delay duration. There are checks of whether there is already enough contingency time built into the schedule to still reach the next waypoint in time. If there is then the simulation is allowed to continue. However, if the next waypoint would be missed, users are prompted to account for the delay in their schedules and the expedition cannot proceed until the scheduling is resolved.
The problems module interacts with
Checkpointobjects to test that the scheduling issues have been resolved. A unique record of the problems is also cached to keep track of and determine whether they've been resolved etc. It may be that dealing with a problem at one waypoint causes more scheduling issues way down the chain of waypoints. This is by design (as similar headaches would be experienced in real life!) and the schedule/checkpoint verification methods should capture this and prompt further changes.The selection of problems and their execution in the main
virtualship runworkflow is handled by a newProblemSimulatorclass. Specific problem scenarios are housed inscenarios.pyas problem classes, which are themselves sub-classes ofGeneralProblemandInstrumentProblembase classes (to establish a structure for building complexity in further PRs).When propagated through
virtualship run, a selection of all the problems for the expedition is first created but the individual problems are only raised at the right time. For example, a pre-departure problem will occur before any instrument simulations and a CTD related problem only when the CTD instrument is being simulated.A new 'prob-level' argument is now added to the
virtualship runCLI command. There are three options to choose from:N.B. I have set the default to
prob_level = 1for now, as this is best for upcoming in-class VirtualShip use.Additional notes
I have set up the logic so that if waypoints are added/removed from the expedition, if a waypoint location changes or the instruments employed changes, this will prompt a new set of problems for the expedition. I see this as the expedition having materially changed and it being a 'new' expedition. This also prevents just re-running the same expedition until you get a 'nicer' set of problems (without manually removing the problems cache!).
Closes #120