procedure RHnew;
var
iocode:integer;
ch,chm:char;
Dens1,dens2,hr1,hr2,t2,t1,rh1,rh2,pv1,pa1,pa2,mv1,mv2,ma1,psat1,psat2,
mf1,mf2,pv2,a1,b1,c1,tk1,tk2,p1,p2,mwa1,a2,b2,c2,v1,v2,ma2,
vpd1,vpd2,v2t,twb1,twb2,rhwb,ew,fw,gw,hw,iw,rhwb1,rhwb2,
pwb1,pwb2: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 RH1 % ');
{$I-}
readln(RH1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (RH1>0) and (RH1<=100);
repeat
write('Enter atm P1 in kPa ');
{$I-}
readln(P1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P1>20) and (P1<=150);
repeat
write('Enter V1 in cubic m ');
{$I-}
readln(V1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (V1>0);
repeat
write('Enter mass mwa1 of water added in kg ');
{$I-}
readln(mwa1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (mwa1>=0);
repeat
write('Enter T2 in deg C ');
{$I-}
readln(T2);
{$I+}
iocode:=ioresult;
until (iocode=0) and (T2>0) and (T2<100);
repeat
write('Enter P2 in kPa ');
{$I-}
readln(P2);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P2>=20) and (P2<=150);
Tk1:=T1+273.15;
Tk2:=T2+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;
mf1:=Pv1/P1;
ma1:=Pa1*V1/(0.287*Tk1);
mv1:=Pv1*V1/(0.4615*Tk1);
VPD1:=Psat1-Pv1;
mv2:=mwa1+mv1;
HR1:=mv1/ma1;
HR2:=mv2/ma1;
A2:=18.678-T2/234.5;
B2:=T2/(257.14+T2);
C2:=A2*B2;
Psat2:=0.61121*exp(C2);
RH2:=HR2*P2/((0.62185+HR2)*Psat2);
Pv2:=Psat2*RH2;
Pa2:=P2-Pv2;
mf2:=Pv2/P2;
ma2:=ma1;
V2:=mv2*(0.4615*Tk2)/Pv2;
V2t:=ma2*(0.287*Tk2)/Pa2;
VPD2:=Psat2-Pv2;
Pwb1:=P1/101.325;
RHwb1:=RH1;
TWB1:=T1;
repeat
Twb1:=Twb1-0.001;
ew:=17.502*Twb1;
fw:=240.97+Twb1;
gw:=ew/fw;
hw:=66.8745*(1.0+0.00115*Twb1);
iw:=6.112*exp(17.502*T1/(240.97+T1));
RHwb:=(611.2*exp(gw)-hw*Pwb1*(T1-Twb1))/iw;
until (RHwb<=RHwb1);
Pwb2:=P2/101.325;
RHwb2:=RH2*100;
Twb2:=T2;
repeat
Twb2:=Twb2-0.001;
ew:=17.502*Twb2;
fw:=240.97+Twb2;
gw:=ew/fw;
hw:=66.8745*(1.0+0.00115*Twb2);
iw:=6.112*exp(17.502*T2/(240.97+T2));
RHwb:=(611.2*exp(gw)-hw*Pwb2*(T2-Twb2))/iw;
until (RHwb<=RHwb2);
dens1:=(ma1+mv1)/V1;
dens2:=(ma2+mv2)/V2;
writeln('ma1 = ',ma1:12:5,' kg');
writeln('mv1 = ',mv1:12:5,' kg');
writeln('mole fraction of water vapour mf1 = ',mf1:12:5,' ');
writeln('VPD1 = ',VPD1:12:5,' kPa');
writeln('mv2 = ',(mv1+mwa1):12:5,' kg');
writeln('mole fraction of water vapour mf2 = ',mf2:12:5,' ');
writeln('VPD2 = ',VPD2:12:5,' kPa');
writeln('RH2 = ',(RH2*100):12:3,'%');
writeln('V2 = ',(V2):15:4,' cubic m');
writeln('V2 test = ',(V2t):15:4,' cubic m');
writeln('Twb1 = ',Twb1:15:4,' deg C');
writeln('Twb2 = ',Twb2:15:4,' deg C');
writeln('Dens1 = ',dens1:15:4,' kg/cubic m, Dens2 = ',dens2:15:4,' kg/cubic m');
writeln('');
write('Another? Y/N');
repeat
ch:=readkey
until (ch in ['Y','y','N','n']);
until (ch in ['N','n']);
end;
Ideas to solve air pollution problems. Things you may not know about air. The blog owner T E Miller (Swayseeker) will not accept liability or responsibility for any problems or mistakes. You can contact me at millertrader@gmail.com Also see my profile at https://mewe.com/i/thomasmiller13
Saturday, April 19, 2025
Air density after adding water vapour Turbo Pascal code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment