Mailing List Archive

Mailing List: techdiver

Banner Advert

Message Display

To: techdiver@opal.com
Subject: non-automatic semi-clsed circuit rebreathers
From: "A.APPLEYARD" <A.APPLEYARD@fs*.mt*.um*.ac*.uk*>
Date: Fri, 5 Aug 1994 15:14:24 GMT
  If it is any use for anyone, I wrote this short C program to calculate depth
limits with any given setting of a non-automatic semi-closed circuit mixture
rebreather with one sort of gas. I apologize for any algebra or computer
programming errors in it.

#include <stdio.h>
#include <std.h>
/*-----*/
double ask(char*s) {double x; static char buf[512]; X: printf(s); gets(buf);
if(sscanf(buf,"%lf",&x)<1) goto X; return x;}
/*-----*/
int yesno(char*s) {char c,d; do{printf("%s",s); c=d=getchar();
while(d!='\n') d=getchar(); if(c=='Y'?1:c=='y') return 1;
if(c=='N'?1:c=='n') return 0; printf("(answer 'yes' or 'no') ");} while(1);}
/*-----*/
main(){double cylflow,cylox,oxused,bagox,pres,x,y,p1,p2;
puts("[semi-closed circuit rebreather with one sort of gas]");
AGAIN: cylflow=ask("gas flow from cylinder (litres/minute)?");
do cylox=ask("%% oxygen in cylinder?")/100; while(cylox < 0 ?: cylox > 1);
oxused=ask("oxygen used by diver (litres/minute)?");
x = cylflow * cylox - oxused; y = cylflow - oxused;
if(x <= 0) {puts("anoxia"); goto END;}
bagox = x / y; /* = oxygen overflowed / total gas overflowed */
printf("%5.2f%% oxygen in bag, ",bagox*100);
p1 = (0.2 / bagox - 1) * 10; /* lower limit */
p2 = (1.4 / bagox - 1) * 10; /* upper limit */
printf("allowed depth range = %7.4f to %7.4f meters\n",p1,p2);
printf("%5.2f%% of the oxygen has been used rather than overflowed\n",
  oxused/cylflow/cylox*100);
END: if(yesno("another run?")) goto AGAIN;}

Navigate by Author: [Previous] [Next] [Author Search Index]
Navigate by Subject: [Previous] [Next] [Subject Search Index]

[Send Reply] [Send Message with New Topic]

[Search Selection] [Mailing List Home] [Home]