comparison Discovery/Src/buehlmann.c @ 295:718e5feded62

Merged in janlmulder/ostc4/div-fixes-6 (pull request #23) Cleanup VPM, NDL to 240 min, and more cleanup
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Mon, 13 May 2019 13:37:34 +0000
parents 24ff72e627f4
children 305f251cc981
comparison
equal deleted inserted replaced
287:ba9d99a2e310 295:718e5feded62
515 return ((float)pDiveSettings->gf_low) / 100.0f; 515 return ((float)pDiveSettings->gf_low) / 100.0f;
516 516
517 return (pDiveSettings->gf_high - gfSteigung * (pressure - gSurface_pressure_bar) )/ 100.0f; 517 return (pDiveSettings->gf_high - gfSteigung * (pressure - gSurface_pressure_bar) )/ 100.0f;
518 } 518 }
519 519
520 520 #define MAX_NDL 240
521 static int buehlmann_calc_ndl(SDiveSettings *pDiveSettings) 521 static int buehlmann_calc_ndl(SDiveSettings *pDiveSettings)
522 { 522 {
523 float local_tissue_nitrogen_bar[16]; 523 float local_tissue_nitrogen_bar[16];
524 float local_tissue_helium_bar[16]; 524 float local_tissue_helium_bar[16];
525 int i; 525 int i;
526 int ndl = 0; 526 int ndl = 0;
527 527
528 //Check ndl always use gHigh 528 //Check ndl always use gHigh
529 gGF_value = ((float)pDiveSettings->gf_high) / 100.0f; 529 gGF_value = ((float)pDiveSettings->gf_high) / 100.0f;
530 //10 minutes steps 530 //10 minutes steps
531 while(ndl < (300 * 60)) 531 while(ndl < (MAX_NDL * 60))
532 { 532 {
533 memcpy(local_tissue_nitrogen_bar, gTissue_nitrogen_bar, (4*16)); 533 memcpy(local_tissue_nitrogen_bar, gTissue_nitrogen_bar, (4*16));
534 memcpy(local_tissue_helium_bar, gTissue_helium_bar, (4*16)); 534 memcpy(local_tissue_helium_bar, gTissue_helium_bar, (4*16));
535 // 535 //
536 ndl += 600; 536 ndl += 600;
543 break; 543 break;
544 } 544 }
545 buehlmann_backup_and_restore(false); 545 buehlmann_backup_and_restore(false);
546 } 546 }
547 547
548 if(ndl < (300 * 60)) 548 if(ndl < (MAX_NDL * 60))
549 ndl -= 600; 549 ndl -= 600;
550 550
551 if(ndl > (150 * 60)) 551 if(ndl > (MAX_NDL/2 * 60))
552 return ndl; 552 return ndl;
553 553
554 // refine 554 // refine
555 memcpy(gTissue_nitrogen_bar, local_tissue_nitrogen_bar, (4*16)); 555 memcpy(gTissue_nitrogen_bar, local_tissue_nitrogen_bar, (4*16));
556 memcpy(gTissue_helium_bar, local_tissue_helium_bar, (4*16)); 556 memcpy(gTissue_helium_bar, local_tissue_helium_bar, (4*16));
557 557
558 //One minutes step 558 //One minutes step
559 for(i = 0; i < 10; i++) 559 for(i = 0; i < 10; i++)
560 { 560 {
561 ndl += 60; 561 ndl += 60;
562 //tissues_exposure_at_gPressure_seconds(60);
563 decom_tissues_exposure2(60, &pDiveSettings->decogaslist[gGas_id], gPressure,gTissue_nitrogen_bar,gTissue_helium_bar); 562 decom_tissues_exposure2(60, &pDiveSettings->decogaslist[gGas_id], gPressure,gTissue_nitrogen_bar,gTissue_helium_bar);
564 decom_oxygen_calculate_cns_exposure(60,&pDiveSettings->decogaslist[gGas_id],gPressure,&gCNS); 563 decom_oxygen_calculate_cns_exposure(60,&pDiveSettings->decogaslist[gGas_id],gPressure,&gCNS);
565 buehlmann_backup_and_restore(true); 564 buehlmann_backup_and_restore(true);
566 if(dive1_check_deco(pDiveSettings)) 565 if(dive1_check_deco(pDiveSettings))
567 break; 566 break;