Tuesday, April 29, 2025

Percentage of oxygen in air

procedure PercO;
var
iocode:integer;
ch,chm:char;
t1,rh1,rh2,pv1,pa1,mv1,ma1,psat1,
a1,b1,c1,tk1,p1,PO2,Perco2:extended;

begin
repeat
clrscr;
repeat
write('Enter air temp T1 deg C    ');
{$I-}
readln(T1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (T1>0) and (T1<100);
repeat
write('Enter relative humidity RH1%    ');
{$I-}
readln(RH1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (RH1>0) and (RH1<=100);
repeat
write('Enter atmospheric pressure P1 in kPa    ');
{$I-}
readln(P1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P1>20) and (P1<=150);

Tk1:=T1+273.15;
A1:=18.678-T1/234.5;
B1:=T1/(257.14+T1);
C1:=A1*B1;
Psat1:=0.61121*exp(C1);
Pv1:=Psat1*(Rh1/100);
Pa1:=P1-Pv1;
PO2:=Pa1*(21/100);
ma1:=Pa1*1000/(0.287*Tk1);
mv1:=Pv1*1000/(0.4615*Tk1);
PercO2:=100*(PO2/P1);
writeln;
writeln('Percentage of oxygen in air by volume is: ',PercO2:12:3,'%');
writeln('Mass of water vapour per 1000 cubic m of air is:',mv1:12:3,' kg');
writeln('Mass of dry air per 1000 cubic m of air is: ',ma1:12:3,' kg');
writeln;
write('Another Y/N?');
repeat
ch:=readkey
until (ch in ['Y','N','y','n']);
until (ch in ['N','n']);
end;









No comments:

Post a Comment