Mercurial > public > ostc4
comparison Common/Src/decom.c @ 684:9bc817e9e221 Betatest
Ignore automatic setpoint changes during ascend:
In the previous version setpoint changes which have been configured for descending were considered for deco calculation in case one or more additional diluents have been activated.
This procedure does not fit to the common way to keep setpoint high till end of the dive in order to get rid of the deco time.
In the new implementation the OSTC assumes that the current setpoint is used till the end of the dive.
author | Ideenmodellierer |
---|---|
date | Thu, 02 Jun 2022 20:24:59 +0200 |
parents | 1b995079c045 |
children | 012f94ec2fe0 |
comparison
equal
deleted
inserted
replaced
683:6f5a18bb25be | 684:9bc817e9e221 |
---|---|
635 else | 635 else |
636 { | 636 { |
637 //divmode CCR or PSCR | 637 //divmode CCR or PSCR |
638 for(i=6; i <= 10; i++) | 638 for(i=6; i <= 10; i++) |
639 { | 639 { |
640 if(pInput->gas[i].note.ub.active && pInput->gas[i].depth_meter | 640 if((pInput->gas[i].note.ub.active) && (pInput->gas[i].depth_meter) |
641 && (pLifeData->actualGas.GasIdInSettings != i) | 641 && (pLifeData->actualGas.GasIdInSettings != i) |
642 &&(pInput->gas[i].depth_meter < pLifeData->depth_meter ) ) | 642 && (pInput->gas[i].depth_meter < pLifeData->depth_meter )) |
643 { | 643 { |
644 count = 1; | 644 count = 1; |
645 for(j=6;j<= 10;j++) | 645 for(j=6;j<= 10;j++) |
646 { | 646 { |
647 // if(pInput->gas[j].note.ub.active && pInput->gas[j].depth_meter > 0 &&pInput->gas[j].depth_meter > pInput->gas[i].depth_meter) | 647 // if(pInput->gas[j].note.ub.active && pInput->gas[j].depth_meter > 0 &&pInput->gas[j].depth_meter > pInput->gas[i].depth_meter) |
648 if( (pInput->gas[j].note.ub.active && pInput->gas[j].depth_meter > 0) | 648 if(((pInput->gas[j].note.ub.active) && (pInput->gas[j].depth_meter > 0)) |
649 && (pLifeData->actualGas.GasIdInSettings != j) // new hw 160905 | 649 && (pLifeData->actualGas.GasIdInSettings != j) // new hw 160905 |
650 && (pInput->gas[j].depth_meter > pInput->gas[i].depth_meter)) | 650 && (pInput->gas[j].depth_meter > pInput->gas[i].depth_meter)) |
651 count++; | 651 count++; |
652 } | 652 } |
653 pInput->decogaslist[count].change_during_ascent_depth_meter_otherwise_zero = pInput->gas[i].depth_meter; | 653 pInput->decogaslist[count].change_during_ascent_depth_meter_otherwise_zero = pInput->gas[i].depth_meter; |
659 pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].oxygen_percentage; | 659 pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].oxygen_percentage; |
660 } | 660 } |
661 else | 661 else |
662 { | 662 { |
663 pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].oxygen_percentage; | 663 pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].oxygen_percentage; |
664 pInput->decogaslist[count].AppliedDiveMode = DIVEMODE_CCR; | |
665 pInput->decogaslist[count].setPoint_cbar = pInput->decogaslist[0].setPoint_cbar; /* assume that current setpoint is kept till end of the dive */ | |
664 } | 666 } |
665 pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].helium_percentage; | 667 pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].helium_percentage; |
666 pInput->decogaslist[count].helium_percentage = pInput->gas[i].helium_percentage; | 668 pInput->decogaslist[count].helium_percentage = pInput->gas[i].helium_percentage; |
667 pInput->decogaslist[count].GasIdInSettings = i; | 669 pInput->decogaslist[count].GasIdInSettings = i; |
668 | |
669 } | 670 } |
670 } | |
671 if(pInput->diveMode == DIVEMODE_CCR) | |
672 { | |
673 /* Include Setpoint Changes */ | |
674 for(j=0; j <= count; j++) | |
675 { | |
676 uint8_t depth = 0; | |
677 uint8_t changedepth = 0; | |
678 char newSetpoint; | |
679 | |
680 pInput->decogaslist[j].AppliedDiveMode = DIVEMODE_CCR; | |
681 if(j == 0) | |
682 { | |
683 depth = pLifeData->depth_meter; | |
684 } | |
685 else | |
686 { | |
687 //no setpointchange ? | |
688 pInput->decogaslist[j].setPoint_cbar = pInput->decogaslist[j - 1].setPoint_cbar; | |
689 depth = pInput->decogaslist[j].change_during_ascent_depth_meter_otherwise_zero + 0.1f; | |
690 } | |
691 /* Setpoint change at the same depth as gas changes */ | |
692 if(nextSetpointChange(pInput,depth + 1, &changedepth,&newSetpoint) && changedepth == depth) | |
693 { | |
694 pInput->decogaslist[j].setPoint_cbar = newSetpoint; | |
695 } | |
696 /* Setpoint changes inbetween gas changes */ | |
697 while(nextSetpointChange(pInput, depth, &changedepth,&newSetpoint) | |
698 && ( | |
699 ( (j < count) && (changedepth > pInput->decogaslist[j + 1].change_during_ascent_depth_meter_otherwise_zero)) | |
700 || ((j == count) && (changedepth > 0)) | |
701 )) | |
702 { | |
703 //Include new entry with setpoint change in decogaslist | |
704 for(int k = count; k > j; k--) | |
705 { | |
706 pInput->decogaslist[k+1] = pInput->decogaslist[k]; | |
707 } | |
708 pInput->decogaslist[j + 1] = pInput->decogaslist[j]; | |
709 pInput->decogaslist[j + 1].setPoint_cbar = newSetpoint; | |
710 j++; | |
711 count++; | |
712 depth = changedepth; | |
713 } | |
714 | |
715 } | |
716 | |
717 } | 671 } |
718 } | 672 } |
719 } | 673 } |
720 void test_decom_CreateGasChangeList(void) | 674 void test_decom_CreateGasChangeList(void) |
721 { | 675 { |