With these changes the program seems to run correctly.
Code:
#pragma mode( separator(.,;) integer(h32) )
ENTRADA();
LOCAL AC,AA; VIEW "viga H",START() BEGIN startview(6,1); DIMGROB_P(G1,320,240); RECT_P(G1,RGB(255,179,102));
LOCAL i,lm=50,lb=80,tm,tb,px,py,px1;
LOCAL k,AC,AA;RECT();
for i from 1 to 8 do FILLPOLY_P(G1,{0,0,320,0,320,0+60*i,0,0+20*i},RGB(202,255,240),10);
end;
TEXTOUT_P("HP PRIME ",G1,115,5,6,#FFFFFFh,300);
TEXTOUT_P("HP PRIME ",G1,114,4,6,#2E64FEh,300);
TEXTOUT_P("Ing. MECANICA",G1,81,25,7,#1C1C1Ch,300);
TEXTOUT_P("Ing. MECANICA",G1,80,24,7,#FFFFFFh,300);
TEXTOUT_P("AUTOR: URRUTIA",G1,100,195,2,#0174DFh);
TEXTOUT_P("ℤ",G1,210,200,2,#0174DFh,300);
TEXTOUT_P("Arequipa, PERU - 2019",G1,90,215,3,#0174DFh,300);
FOR i FROM 1 TO 25 DO BLIT_P(G0,G1);
TEXTOUT_P(("Cargando... "),119,155,1,#2E64FEh,100);
TEXTOUT_P((2*i)+("%"),171,155,1,#2E64FEh,100);
RECT_P(G1,105,170,206,174,0,#FFFFFFh);
RECT_P(G1,106,171,105+2*i,173,#0174DFh);
tm:=i*15*pi/180;tb= asin((lm*sin(tm))/lb);
px:=lm*(cos(tm));py:=lm*(sin(tm));
px1:=lm*cos(tm)+lb*cos(tb);
LINE_P(100,100,100+px,100+py,RGB(0,128,255));
LINE_P(100+px,100+py,100+px1,100,RGB(0,128,255));
TEXTOUT_P("◉",94,92);
TEXTOUT_P("•",97+px,92+py);
TEXTOUT_P("▓▓▓",96+px1,92);
WAIT(0.02);
END;
FOR i FROM 1 TO 25 DO BLIT_P(G0,G1);
k:=i+25;TEXTOUT_P(("Cargando... "),119,155,1,#2E64FEh,100);
TEXTOUT_P((50+2*i)+("%"),171,155,1,#2E64FEh,100);
RECT_P(105,170,206,174,0,#FFFFFFh);
RECT_P(106,171,155+2*i,173,#0174DFh);
tm:=k*15*pi/180;
tb= asin((lm*sin(tm))/lb);
px:=lm*(cos(tm));
py:=lm*(sin(tm));
px1:=lm*cos(tm)+lb*cos(tb);
LINE_P(100,100,100+px,100+py,RGB(0,128,255));
LINE_P(100+px,100+py,100+px1,100,RGB(0,128,255));
TEXTOUT_P("◉",94,92);TEXTOUT_P("•",97+px,92+py);
TEXTOUT_P("▓▓▓",96+px1,92);WAIT(0.02);END;
RECT_P(G1,RGB(255,179,102));
for i from 1 to 8 do FILLPOLY_P(G1,{0,0,320,0,320,0+60*i,0,0+20*i},RGB(202,255,240),10);
END;
BLIT_P(G0,G1);
TEXTOUT_P(" [PRESIONE AQUI O ENTER PARA CONTINUAR]",10,180,2,#2E64FEh,300);
WAIT(-1);
ENTRADA();
END;
PSY();
TBSYHR();
TBSYTBH();
TRYTBH();
WYTBS();
WYHR();
INTERPOL();
LOCAL TARA,MENU;
PSY()BEGIN IF AA==AA THEN REPEAT CHOOSE(MENU,"PROPIEDADES DEL AIRE","TBS,HR,Presion","TBS,TBH,Presion","TBS,TRocio,Presion","TBS,w,Presion","HR,w,Presion","INTERPOL","SALIR");
IF MENU=1 THEN TARA:=1;
TBSYHR()END;
IF MENU=2 THEN TBSYTBH() END;
IF MENU=3 THEN TRYTBH() END;
IF MENU=4 THEN WYTBS() END;
IF MENU=5 THEN WYHR() END;
IF MENU=6 THEN INTERPOL() END;
UNTIL MENU=7;
ELSE
END;
END;
EXPORT TBSYHR()
BEGIN LOCAL T1,O1,HR1,O2,P1,O3; LOCAL C1,C2,C3,C4,C5,C6,C7,C8; LOCAL C9,C10,C11,C13,C14,C15,C16,C17; LOCAL C12,C18,PW,PU,W1,W2,GO; LOCAL V1,H1,TR1,TR2,pa,HR;
IF TARA=1 THEN
INPUT({
{T1,[0],{30,30,1}},
{O1,{"°C","K","F"},{65,15,1}},
{HR1,[0],{30,30,2}},
{O2,{"%"},{65,15,2}},
{P1,[0],{30,30,3}},
{O3,{"MPa","KPa","Bar","Psi","atm"},{65,15,3}},
{pa,pa,{65,5,4}}},
"Propiedades Termodinamicas del Aire",
{"TBS= ","","HR= ","","P= ","","Presion atm ="});
IF pa==0 THEN
IF O3==1 THEN
P1:=P1*1000000;
ELSE
IF O3==2 THEN
P1:=P1*1000;
ELSE
IF O3==3 THEN
P1:=P1*100000;
ELSE
IF O3==4 THEN
P1:=0.133322368421*P1;
END;END;END;END;
ELSE
P1:=101325;
END;
IF O1==1 THEN
T1:=T1+273.15;
ELSE
IF O1==2 THEN
T1:=T1;
ELSE
IF O1==3 THEN
T1:=5*(T1-32)/9 +273.15;
END;END;END;
END;
IF TARA=2 THEN
HR1:=W;
T1:=Y;
P1:=Z;
END;
IF TARA=3 THEN
HR1:=W;
T1:=Y;
P1:=Z;
END;
C1:=-5674.359;C2:=6.3925247;C3:=-0.009677843;C4:=0.00000062215701;C5:=0.0000000020747825;C6:=-0.0000000000009484024;C7:=4.1635019;C8:=-5800.2206;C9:=1.3914993;C10:=-0.048640239;C11:=0.000041764768;C12:=-0.000000014452093;C13:=6.5459673;C14:=6.54;C15:=14.326;C16:=0.7389;C17:=0.09486;
C18:=0.4569;
IF T1>=273.15 THEN
PW:=trunc(EXP((C8/T1)+C9+(C10*T1)+(C11*T1^2)+(C12*T1^3)+(C13*LN(T1))),3);
ELSE
PW:=trunc(EXP((C1/T1)+C2+(C3*T1)+(C4*T1^2)+(C5*T1^3)+(C6*T1^4)+(C7*LN(T1))),3);
END;
PU:=(HR1/100)*PW;
W1:=ROUND(0.62198*(PU/(P1-PU)),8);
W2:=0.62198*(PW/(P1-PW));
GO:=trunc(100*W1/W2,3);
V1:=(8314/28.9645)*(T1/P1)*(1+1.6078*W1);
H1:=trunc(1.006*(T1-273.15)+ W1*(2501+1.805*(T1-273.15)),3);
TR1:=trunc(C14+C15*LN(PU/1000)+C16*LN(PU/1000)^2+C17*LN(PU/1000)^3+C18*LN(PU/1000)^0.1984,2);
TR2:=trunc(6.09+12.608*LN(PU/1000)+0.4959*LN(PU/1000)^2,2);
LOCAL TH,PW1,WW,THC,ER;
TH:=T1;
ER:=1;
WHILE ER>0.5 OR ER<0 DO
IF TH>=273.15 THEN
PW1:=trunc(EXP((C8/TH)+C9+(C10*TH)+(C11*TH^2)+(C12*TH^3)+(C13*LN(TH))),3);
ELSE
PW1:=trunc(EXP((C1/TH)+C2+(C3*TH)+(C4*TH^2)+(C5*TH^3)+(C6*TH^4)+(C7*LN(TH))),3);
END;
WW:=0.62198*(PW1/(P1-PW1));
THC:=TH-273.15;
ER:=(W1-(((2501-2.381*THC)*WW)-(T1-273.15-THC))/(2501+1.805*(T1-273.15)-4.186*THC))/W1;
TH:=TH-0.1;
END;
TH:=TH-273.15;
P:=P1/1000; //KPa
T:=T1-273.15;// celsius
A:=1;
IF A=1 THEN
REPEAT
RECT_P();
RECT_P(0,0,RGB(174,225,218));
TEXTOUT_P("TABLA DE RESULTADOS",50,3,4,RGB(192,128,0));
TEXTOUT_P("⇒ Temperatura de bulbo seco: "+T+" [°C]",5,20,3,RGB(00,0,0));
TEXTOUT_P("⇒ Temperatura de bulbo Humedo: "+TH+" [°C] ",5,40,3,RGB(00,0,0));
TEXTOUT_P("⇒ Temperatura Punto de Rocio: "+TR1+" [°C]",5,60,3,RGB(00,0,0));
TEXTOUT_P("⇒ Humedad specific (W) : "+W1+" [Kg_w/Kg_air]",5,80,3,RGB(00,0,0));
TEXTOUT_P("⇒ Humendad relativa (HR): "+HR1+" [%]",5,100,3,RGB(00,0,0));
TEXTOUT_P("⇒ Entalpia de aire hum (h): "+H1+" [KJ/Kg_as]",5,120,3,RGB(00,0,0));
TEXTOUT_P("⇒ Vol specific (v) : "+V1+" [m^3/Kg_air]",5,140,3,RGB(00,0,0));
TEXTOUT_P("⇒ Presion de saturacion: "+P+" [kPa]",5,160,3,RGB(00,0,0));
TEXTOUT_P("⇒ P.de vapor (Pu) a T bulb seco : "+PU+" [Pa]",5,180,3,RGB(00,0,0));
TEXTOUT_P("⇒ Grado de saturcion (GD) : "+GO+" [%]",5,200,3,RGB(00,0,0));
TEXTOUT_P(" [ HUMBERTO ZURITA ]",195,220,2,RGB(128,128,0));
WAIT(-2);
UNTIL ISKEYDOWN(4);
END;
PSY();
END;
EXPORT TBSYTBH()
BEGIN
//INICIO DE MENU 2
LOCAL T2,TH2,P2,o1,o2,o3,pr;
LOCAL C1,C2,C3,C4,C5,C6,C7,C8;
LOCAL C9,C10,C11,C13,C14,C15,C16,C17;
LOCAL C12,C18,PW,PW1,W1,W2;
LOCAL W3,PU,HR2,GO,V2,H2,TR2;
INPUT({
{T2,[0],{30,30,1}},
{o1,{"°C","K","F"},{65,15,1}},
{TH2,[0],{30,30,2}},
{o2,{"°C","K","F"},{65,15,2}},
{P2,[0],{30,30,3}},
{o3,{"MPa","KPa","Bar","Psi","atm"},{65,15,3}},
{pr,pr,{65,5,4}}},
"Propiedades Termodinamicas del Aire",
{"TBS= ","","TBH= ","","P= ","","Presion atm ="});
IF pr==0 THEN
IF o3==1 THEN
P2:=P2*1000000;
ELSE
IF o3==2 THEN
P2:=P2*1000;
ELSE
IF o3==3 THEN
P2:=P2*100000;
ELSE
IF o3==4 THEN
P2:=0.133322368421*P2;
END;END;END;END;
ELSE
P2:=101325;
END;
IF o1==1 THEN
T2:=T2+273.15;
ELSE
IF o1==2 THEN
T2:=T2;
ELSE
IF o1==3 THEN
T2:=5*(T2-32)/9 +273.15;
END;END;END;
IF o2==1 THEN
TH2:=TH2+273.15;
ELSE
IF o2==2 THEN
TH2:=TH2;
ELSE
IF o2==3 THEN
TH2:=5*(TH2-32)/9 +273.15;
END;END;END;
C1:=-5674.359;C2:=6.3925247;C3:=-0.009677843;C4:=0.00000062215701;C5:=0.0000000020747825;C6:=-0.0000000000009484024;C7:=4.1635019;C8:=-5800.2206;C9:=1.3914993;C10:=-0.048640239;C11:=0.000041764768;C12:=-0.000000014452093;C13:=6.5459673;C14:=6.54;C15:=14.326;C16:=0.7389;C17:=0.09486;
C18:=0.4569;
IF TH2>=273.15 THEN
PW:=trunc(EXP((C8/TH2)+C9+(C10*TH2)+(C11*TH2^2)+(C12*TH2^3)+(C13*LN(TH2))),3);
ELSE
PW:=trunc(EXP((C1/TH2)+C2+(C3*TH2)+(C4*TH2^2)+(C5*TH2^3)+(C6*TH2^4)+(C7*LN(TH2))),3);
END;
IF T2>=273.15 THEN
PW1:=trunc(EXP((C8/T2)+C9+(C10*T2)+(C11*T2^2)+(C12*T2^3)+(C13*LN(T2))),3);
ELSE
PW1:=trunc(EXP((C1/T2)+C2+(C3*T2)+(C4*T2^2)+(C5*T2^3)+(C6*T2^4)+(C7*LN(T2))),3);
END;
W1:=0.62198*(PW/(P2-PW));
W2:=ROUND((((2501-2.381*(TH2-273.15))*W1)-(T2-TH2))/(2501+1.805*(T2-273.15)-4.186*(TH2-273.15)),8);
W3:=0.62198*(PW1/(P2-PW1));
PU:=(P2*W2)/(0.62198+W2);
GO:=100*(W2/W3);
HR2:=trunc(100*((GO/100)/(1-(1-(GO/100))*(PW1/P2))),3);
V2:=(8314/28.9645)*(T2/P2)*(1+1.6078*W2);
H2:=trunc(1.006*(T2-273.15)+W2*(2501+1.805*(T2-273.15)),4);
TR2:=trunc(C14+C15*LN(PU/1000)+C16*LN(PU/1000)^2+C17*LN(PU/1000)^3+C18*LN(PU/1000)^0.1984,2);
T2:=T2-273.15; TH2:=TH2-273.15;
REPEAT
RECT_P();
RECT_P(0,0,RGB(174,225,218));
TEXTOUT_P("TABLA DE RESULTADOS",70,3,4,RGB(192,128,0));
TEXTOUT_P("⇒ Temperatura de bulbo seco: "+T2+" [°C]",5,20,3,RGB(00,0,0));
TEXTOUT_P("⇒ Temperatura de bulbo Humedo: "+TH2+" [°C] ",5,40,3,RGB(00,0,0));
TEXTOUT_P("⇒ Temperatura Punto de Rocio: "+TR2+" [°C]",5,60,3,RGB(00,0,0));
TEXTOUT_P("⇒ Humedad specific (W) : "+W2+" [Kg_w/Kg_air]",5,80,3,RGB(00,0,0));
TEXTOUT_P("⇒ Humendad relativa (HR): "+HR2+" [%]",5,100,3,RGB(00,0,0));
TEXTOUT_P("⇒ Entalpia de aire hum (h): "+H2+" [KJ/Kg_as]",5,120,3,RGB(00,0,0));
TEXTOUT_P("⇒ Vol specific (v) : "+V2+" [m^3/Kg_air]",5,140,3,RGB(00,0,0));
TEXTOUT_P("⇒ Presion de saturacion: "+P2+" [kPa]",5,160,3,RGB(00,0,0));
TEXTOUT_P("⇒ P.de vapor (Pu) a T bulb seco : "+PU+" [Pa]",5,180,3,RGB(00,0,0));
TEXTOUT_P("⇒ Grado de saturcion (GD) : "+GO+" [%]",5,200,3,RGB(00,0,0));
TEXTOUT_P(" [ HUMBERTO ZURITA ]",195,220,2,RGB(128,128,0));
WAIT(-2);
UNTIL ISKEYDOWN(4);
PSY()
END;
EXPORT ENTRADA()
BEGIN
AC:=LEFT(SERIAL,8); AA:=cat(9,"CJ",70207);
PSY();
END;
EXPORT TRYTBH()
BEGIN
// INICIO DEL MENU =3
LOCAL T2,TH2,P2,o1,o2,o3,pr;
LOCAL C1,C2,C3,C4,C5,C6,C7,C8;
LOCAL C9,C10,C11,C13,C14,C15,C16,C17;
LOCAL C12,C18,PW,PW1,W1,W2;
LOCAL W3,PU,HR2,GO,V2,H2,TR2;
INPUT({
{T2,[0],{30,30,1}},
{o1,{"°C","K","F"},{65,15,1}},
{TR2,[0],{30,30,2}},
{o2,{"°C","K","F"},{65,15,2}},
{P2,[0],{30,30,3}},
{o3,{"MPa","KPa","Bar","Psi","atm"},{65,15,3}},
{pr,pr,{65,5,4}}},
"Propiedades Termodinamicas del Aire",
{"TBS= ","","TR= ","","P= ","","Presion atm ="});
IF pr==0 THEN
IF o3==1 THEN
P2:=P2*1000000;
ELSE
IF o3==2 THEN
P2:=P2*1000;
ELSE
IF o3==3 THEN
P2:=P2*100000;
ELSE
IF o3==4 THEN
P2:=0.133322368421*P2;
END;END;END;END;
ELSE
P2:=101325;
END;
IF o1==1 THEN
T2:=T2+273.15;
ELSE
IF o1==2 THEN
T2:=T2;
ELSE
IF o1==3 THEN
T2:=5*(T2-32)/9 +273.15;
END;END;END;
IF o2==1 THEN
TR2:=TR2+273.15;
ELSE
IF o1==2 THEN
TR2:=TR2;
ELSE
IF o1==3 THEN
TR2:=5*(TR2-32)/9 +273.15;
END;END;END;
C1:=-5674.359;C2:=6.3925247;C3:=-0.009677843;C4:=0.00000062215701;C5:=0.0000000020747825;C6:=-0.0000000000009484024;C7:=4.1635019;C8:=-5800.2206;C9:=1.3914993;C10:=-0.048640239;C11:=0.000041764768;C12:=-0.000000014452093;C13:=6.5459673;C14:=6.54;C15:=14.326;C16:=0.7389;C17:=0.09486;
C18:=0.4569;
IF TR2>=273.15 THEN
PW:=trunc(EXP((C8/TR2)+C9+(C10*TR2)+(C11*TR2^2)+(C12*TR2^3)+(C13*LN(TR2))),3);
ELSE
PW:=trunc(EXP((C1/TR2)+C2+(C3*TR2)+(C4*TR2^2)+(C5*TR2^3)+(C6*TR2^4)+(C7*LN(TR2))),3);
END;
IF T2>=273.15 THEN
PW1:=trunc(EXP((C8/T2)+C9+(C10*T2)+(C11*T2^2)+(C12*T2^3)+(C13*LN(T2))),3);
ELSE
PW1:=trunc(EXP((C1/T2)+C2+(C3*T2)+(C4*T2^2)+(C5*T2^3)+(C6*T2^4)+(C7*LN(T2))),3);
END;
W1:=ROUND(0.62198*(PW/(P2-PW)),8);
W2:=0.62198*(PW1/(P2-PW1));
GO:=trunc(100*(W1/W2),3);
HR2:=trunc(100*((GO/100)/(1-(1-(GO/100))*(PW1/P2))),3);
V2:=(8314/28.9645)*(T2/P2)*(1+1.6078*W1);
H2:=trunc(1.006*(T2-273.15)+W1*(2501+1.805*(T2-273.15)),4);
LOCAL TH,PW1,WW,THC,ER;
TH:=T2;
ER:=1;
WHILE ER>0.5 OR ER<0 DO
IF TH>=273.15 THEN
PW1:=trunc(EXP((C8/TH)+C9+(C10*TH)+(C11*TH^2)+(C12*TH^3)+(C13*LN(TH))),3);
ELSE
PW1:=trunc(EXP((C1/TH)+C2+(C3*TH)+(C4*TH^2)+(C5*TH^3)+(C6*TH^4)+(C7*LN(TH))),3);
END;
WW:=0.62198*(PW1/(P2-PW1));
THC:=TH-273.15;
ER:=(W1-(((2501-2.381*THC)*WW)-(T2-273.15-THC))/(2501+1.805*(T2-273.15)-4.186*THC))/W1;
TH:=TH-0.1;
END;
T2:=T2-273.15; TH:=TH-273.15;TR2:=TR2-273.15;
REPEAT
RECT_P();
RECT_P(0,0,RGB(174,225,218));
TEXTOUT_P("TABLA DE RESULTADOS",70,3,4,RGB(192,128,0));
TEXTOUT_P("⇒ Temperatura de bulbo seco: "+T2+" [°C]",5,20,3,RGB(00,0,0));
TEXTOUT_P("⇒ Temperatura de bulbo Humedo: "+TH+" [°C] ",5,40,3,RGB(00,0,0));
TEXTOUT_P("⇒ Temperatura Punto de Rocio: "+TR2+" [°C]",5,60,3,RGB(00,0,0));
TEXTOUT_P("⇒ Humedad specific (W) : "+W1+" [Kg_w/Kg_air]",5,80,3,RGB(00,0,0));
TEXTOUT_P("⇒ Humendad relativa (HR): "+HR2+" [%]",5,100,3,RGB(00,0,0));
TEXTOUT_P("⇒ Entalpia de aire hum (h): "+H2+" [KJ/Kg_as]",5,120,3,RGB(00,0,0));
TEXTOUT_P("⇒ Vol specific (v) : "+V2+" [m^3/Kg_air]",5,140,3,RGB(00,0,0));
TEXTOUT_P("⇒ Presion de saturacion: "+P2+" [kPa]",5,160,3,RGB(00,0,0));
TEXTOUT_P("⇒ P.de vapor (Pu) a T bulb seco : "+PW+" [Pa]",5,180,3,RGB(00,0,0));
TEXTOUT_P("⇒ Grado de saturcion (GD) : "+GO+" [%]",5,200,3,RGB(00,0,0));
TEXTOUT_P(" [ HUMBERTO ZURITA ]",195,220,2,RGB(128,128,0));
WAIT(-2);
UNTIL ISKEYDOWN(4);
PSY()
END; // FIN DE MENU =3
EXPORT WYTBS()
BEGIN
LOCAL T1,O1,HR1,O2,P1,O3,pa;
LOCAL ma,m0,m2,n,h,w;
LOCAL TE1,TE2,hw,hg,a1,a11;
LOCAL b1,b11,b2,b22,a2,a22;
LOCAL Psat,O4,HR;
INPUT({
{T1,[0],{30,30,1}},
{O1,{"°C","K"},{65,25,1}},
{w,[0],{30,30,2}},
{O2,{"kg_w/kg_a"},{65,25,2}},
{P1,[0],{30,30,3}},
{O3,{"MPa","KPa","Bar"},{65,25,3}},
{pa,pa,{65,5,4}}},
"Propiedades Termodinamicas del Aire",
{"TBS= ",""," w= ","","P= ","","Presion atm ="});
IF pa==0 THEN
IF O3==1 THEN
P1:=P1/1000;
ELSE
IF O3==2 THEN
P1:=P1;
ELSE
IF O3==3 THEN
P1:=P1/100;
END;END;END;
ELSE
P1:=101.325;
END;
IF O1==1 THEN
T1:=T1;
ELSE
IF O1==2 THEN
T1:=T1-273;
END;END;
ma:=[[-10 , 2482.7],
[0 , 2500.9],
[10 , 2519.1],
[20 , 2537.3],
[30 , 2555.5],
[40 , 2573.7],
[50 , 2591.9]];
m2:=col(ma,1);n:=1;m0:=-10;
WHILE T1>m0 DO
m0:= row(m2,n);
n:=n+1
END;
TE1:=SUB(ma,{n-1,1},{n-1,12});
TE2:=SUB(ma,{n-2,1},{n-2,12});
a1:=col(TE1,1); a11:=a1(1);
a2:=col(TE1,2); a22:=a2(1);
b1:=col(TE2,1); b11:=b1(1);
b2:=col(TE2,2); b22:=b2(1);
hw:=((b22-a22)/(b11-a11))*(T1-a11)+a22;
hg:=hw + 1.82*(T1);
h:=1.005*T1 + w*hg;
LOCAL ts,ps,TT1;
LOCAL E,F,G,D,n10,n9,be,te;
TT1:=T1+273.15;
te:=TT1+(-0.23855557567849/(TT1-0.65017534844798*10^3));
A:=te^2 + (0.11670521452767*10^4)*te+(-0.72421316703206*10^6);
B:=te^2 *(-0.17073846940092*10^2)+0.1202082470247*10^5*te+(-0.32325550322333*10^7);
C:=(0.1491510861353*10^2)*te^2+te*(-0.4823265736159*10^4)+0.40511340542057*10^6;
Psat:=1000*(2*C/(-B+(B^2-4*C*A)^0.5))^4;
HR:=(w*P1/((0.622+w)*Psat))*100;
W:=HR;
Y:=T1+273.15;
Z:=P1*1000;
TARA:=2;
TBSYHR();
END;
EXPORT WYHR()
BEGIN
LOCAL T1,O1,HR1,O2,P1,O3,pa;
LOCAL ma,m0,m2,n,h,w;
LOCAL TE1,TE2,hw,hg,a1,a11;
LOCAL b1,b11,b2,b22,a2,a22;
LOCAL Psat,O4,HR,ts1;
INPUT({
{HR1,[0],{30,30,1}},
{O1,{"%"},{65,25,1}},
{w,[0],{30,30,2}},
{O2,{"kg_w/kg_a"},{65,25,2}},
{P1,[0],{30,30,3}},
{O3,{"MPa","KPa","Bar"},{65,25,3}},
{pa,pa,{65,5,4}}},
"Propiedades Termodinamicas del Aire",
{"HR= ",""," w= ","","P= ","","Presion atm ="});
IF pa==0 THEN
IF O3==1 THEN
P1:=P1/1000;
ELSE
IF O3==2 THEN
P1:=P1;
ELSE
IF O3==3 THEN
P1:=P1/100;
END;END;END;
ELSE
P1:=101.325;
END;
HR1:=HR1/100;
Psat:=P1*w/(HR1*w+0.622*HR1);
P:=Psat;
LOCAL E,F,G,D,n10,n9,be;
be:=(P/1000)^(1/4);
E:=be^2 + (be*(-0.17073846940092*10^2)+0.1491510861353*10^2);
F:=(0.11670521452767*10^4)*(be^2)+0.12020824702*10^5*(be)+(-0.48232657361591*10^4);
G:=(-0.724213167032*10^6)*(be^2)+(-0.323255503223333*10^7)*(be)+0.40511340542057*10^6;
D:=2*G/(-F-(F^2-4*E*G)^0.5);
n10:=0.65017534844798*10^3;
n9:=-0.23855557567849;
ts1:=(n10+D-((n10+ D)^2 - (4*(n9+n10*D)))^0.5)/2;// grados kelvin
T1:=ts1;
W:=HR1*100;
Y:=T1;
Z:=P1*1000;
TARA:=3;
TBSYHR();
END;
EXPORT INTERPOL()
BEGIN
LOCAL A1,A2,B1,B2,C1,C2;
INPUT({{A1,[0],{15,20,2}},{A2,[0],{50,20,2}},
{B1,[0],{15,20,3}},
{C1,[0],{15,20,4}},{C2,[0],{50,20,4}}}," TABULANDO",{"X1 =","Y1=","X =","X2 =","Y2="});
B2:=((B1-A1)/(C1-A1))*(C2-A2)+A2;
REPEAT
RECT_P(0,0,RGB(229,229,229));
TEXTOUT_P(" TABULADO",80,5,4,RGB(129,129,0));
TEXTOUT_P("X1 = "+A1,20,50,4,RGB(0,0,0),150); TEXTOUT_P("Y1 = "+A2,180,50,4);
TEXTOUT_P("X = "+B1,20,80,4,RGB(0,0,0),90); TEXTOUT_P("Y = "+B2,180,80,4,RGB(99,4,000));
TEXTOUT_P("X2 = "+C1,20,110,4,RGB(0,0,0),90); TEXTOUT_P("Y2 = "+C2,180,110,4);
TEXTOUT_P(" [ HUMBERTO ZURITA ]",195,220,2,RGB(128,128,0));
WAIT(-1);
UNTIL ISKEYDOWN(4);
END;