Professional Documents
Culture Documents
h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
{
if(P[i] == x)
{ flag = 1;pos = i;
break;
}
}
if(flag == 1)
{
if(c == 21)
{
//printf("check1 %.6f \n",Vl[i]);
return Vl[i];
}
if(c == 22)
{
//printf("check1 %.6f \n" ,Vv[i]);
return Vv[i];
}
if(c == 11)
{
//printf("check1 %.6f \n",Ul[i]);
return Ul[i];
}
if(c == 12)
{
//printf("check1 %.6f \n" ,Uv[i]);
return Uv[i];
}
if(c == 32)
{
//printf("check1 %.6f \n" ,Hv[i]);
return Hv[i];
}
if(c == 31)
{
//printf("check1 %.6f \n" ,Hl[i]);
return Hl[i];
}
}
if(c == 21)
{
if(x == 903)
{
//printf("q = %f j = %d vl[j] = %f x = %f P[j] =
%f Vl[j+1] = %f P[j+1] = %f P[j] = %f x1 = %f\
n" ,q,j,Vl[j],x,P[j],Vl[j+1],P[j+1],P[j],x1);
//printf("X1 = %f \n",x1);
}
return x1;
}
if(c == 22)
{
if(x == 903)
{
//printf("q = %f j = %d vv[j] = %f x =
%f P[j] = %f Vv[j+1] = %f P[j+1] = %f P[j] = %f \
n" ,q,j,Vv[j],x,P[j],Vv[j+1],P[j+1],P[j]);
//printf("X2 = %f \n",x2);
}
return x2;
}
if(c == 31)
{
return y1;
}
if(c == 32)
{
y2 = Hv[j] + ( (x - P[j])*(Hv[j+1] - Hv[j]) )/ (P[j+1] -
P[j]);
return y2;
}
if(c == 11)
{
z1 = Ul[j] + ( (x - P[j])*(Ul[j+1] - Ul[j]) )/
(P[j+1] - P[j]);
if(x == 903)
{
//printf("q = %f j = %d Ul[j] = %f x =
%f P[j] = %f Ul[j+1] = %f P[j+1] = %f P[j] = %f \
n" ,q,j,Ul[j],x,P[j],Ul[j+1],P[j+1],P[j]);
//printf("z1 = %f \n",z1);
return z1;
}
if(c == 12)
{
z2 = Uv[j] + ( (x - P[j])*(Uv[j+1] - Uv[j]) )/
(P[j+1] - P[j]);
if(x == 903)
{
//printf("q = %f j = %d Uv[j] = %f x =
%f P[j] = %f Uv[j+1] = %f P[j+1] = %f P[j] = %f \
n" ,q,j,Uv[j],x,P[j],Uv[j+1],P[j+1],P[j]);
//printf("z2 = %f \n",z2);
return z2;
}
}
}
void main()
{
FILE *fptr;
fptr = fopen("thermo","w");
if(fptr == NULL)
{
printf("file does not exist \n");
return ;
}
printf("Enter parameter for P1 P2 m1dot m2dot deltat pi alphai alphaf\n\n");
//scanf("%f %f %f %f %f %f %f %f",&c1,&c2,&c3,&c4,&c5,&c6,&c7,&c8);
fclose(fptr);
//while(fscanf(fptr,"%f",&e[k]) )
// k++;
//fclose(fptr);
//e[i] = '\0';
float req_pf=0,reqg1_pfaf,req_m1,req_m2,assumed_mean;
printf("g1(piai) = %f \n\n",g1_piai);
printf("g2(piai) = %f \n\n",g2_piai);
float b = (m1dot*steamtablevalues(32,P1) -
m2dot*steamtablevalues(32,P2))*deltat;
printf("a = %f\n\n",a);
printf("b = %f\n\n",b);
{ //printf("Pf = %f \n",Pf);
float g2_pfaf =
(alphaf/steamtablevalues(21,Pf))*steamtablevalues(11,Pf) +
((1-alphaf)/steamtablevalues(22,Pf))*steamtablevalues(12,Pf);
if(Pf == 700)
{
assumed_mean = fabs(fabs(m2) - fabs(m1));
//printf("assumed mean = %f a = %f b = %f \n",
assumed_mean,fabs(m1),fabs(m2));
reqg1_pfaf = g1_pfaf;
req_m1 = m1;
req_m2 = m2;
//printf("diff = %f pf = %f \n",fabs(fabs(m2) -
fabs(m1)),Pf);
//}
printf("Pf = %f\n\n",req_pf);
printf("Vacc = %f\n\n",vacc);
else
else