Changeset e31714d9 in subsurface


Ignore:
Timestamp:
Feb 11, 2017, 8:31:42 AM (6 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
9f47004
Parents:
057419f
git-author:
Robert C. Helling <helling@…> (02/09/17 09:12:44)
git-committer:
Dirk Hohndel <dirk@…> (02/11/17 08:31:42)
Message:

Set up gaslist only in the beginning of diveplan

In the beginning of the diveplan, divedatapoints of zero
duration indicate available gases with the depth giving
the suggested switch depth. Zero-duration datapoints in
the middle of the dive do not have this meaning and should
thus be ignored when composing the gaslist.

The tests should have these gas defining segments in the beginning.

This fixes a problem when replanning a dive that would change
to random gases during deco.

Signed-off-by: Robert C. Helling <helling@…>

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/planner.c

    r057419f re31714d9  
    427427        struct divedatapoint *dp = diveplan->dp;
    428428        int best_depth = displayed_dive.cylinder[*asc_cylinder].depth.mm;
     429        bool total_time_zero = true;
    429430        while (dp) {
    430                 if (dp->time == 0) {
     431                if (dp->time == 0 && total_time_zero) {
    431432                        if (dp->depth <= depth) {
    432433                                int i = 0;
     
    450451                                }
    451452                        }
     453                } else {
     454                        total_time_zero = false;
    452455                }
    453456                dp = dp->next;
  • tests/testplan.cpp

    rc2ea3c2 re31714d9  
    5757
    5858        int droptime = M_OR_FT(79, 260) * 60 / M_OR_FT(23, 75);
     59        plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
     60        plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    5961        plan_add_segment(dp, droptime, M_OR_FT(79, 260), 0, 0, 1);
    6062        plan_add_segment(dp, 30*60 - droptime, M_OR_FT(79, 260), 0, 0, 1);
    61         plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    62         plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    6363}
    6464
     
    9898
    9999        int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
     100        plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    100101        plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1);
    101102        plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1);
    102         plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    103103}
    104104
     
    120120
    121121        int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
     122        plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    122123        plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1);
    123124        plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1);
    124         plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    125125}
    126126
     
    164164
    165165        int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
     166        plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
     167        plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    166168        plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1);
    167169        plan_add_segment(dp, 60*60 - droptime, M_OR_FT(100, 330), 0, 0, 1);
    168         plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    169         plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    170170}
    171171
     
    189189
    190190        int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
     191        plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
     192        plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    191193        plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1);
    192194        plan_add_segment(dp, 10*60 - droptime, M_OR_FT(100, 330), 0, 0, 1);
    193         plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    194         plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    195195}
    196196
     
    234234
    235235        int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(18, 60);
     236        plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
     237        plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
     238        plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 3, 0, 1);
    236239        plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1);
    237240        plan_add_segment(dp, 20*60 - droptime, M_OR_FT(100, 330), 0, 0, 1);
    238241        plan_add_segment(dp, 3*60, M_OR_FT(70, 230), 0, 0, 1);
    239242        plan_add_segment(dp, (30 - 20 - 3) * 60, M_OR_FT(70, 230), 0, 0, 1);
    240         plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
    241         plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
    242         plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 3, 0, 1);
    243243}
    244244
Note: See TracChangeset for help on using the changeset viewer.