eianlei / pydplan

Scuba Dive planner using Buhlmann algorithm, Python with PyQt5 GUI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix the bouncing ascent (Calculate mode)

eianlei opened this issue · comments

In some dive profiles the deco/ascent is bouncing. The state machine exits deco state too early, and starts a tiny ascent step. Then ceiling is immediately reached and the state bounces back to deco. This can be seen as tiny peaks in the profile. Enhance the checking of ceiling.

example case: bottom 55 meters, 20 min, you see bounce at 27 meters.
Issue occurs because ascent may go too fast beyond a potential deco stop.
Quick and dirty fix is to check that ascent cannot increment above ceiling. Add checks to statemachine checks of DivePhase.ASC_T and DivePhase.ASCENDING. Printing to console some debug messages.
TODO: add a debug window to the app, instead of using print to console.

Example:
if (beginDepth - stepAscend) < model.leadCeilingStop:
print('ASC_T bounce stop at {} m, runtime {}, index {}'
.format(model.leadCeilingStop, runtime, index))
endDepth = model.leadCeilingStop
else:
endDepth = beginDepth - stepAscend