Code:
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<iomanip.h>
{
double compute(double ws)
double sqrt(double r)
double main()
{
double mf,v[2],a[2],q,h[2],sv[2],z[2],r,ans2,c,ws;
double g = 9.8;
cout<<"Device: Centrifugal compressor ";
cout<<"Mass flow rate mf (Kg/min) = ";
cin>>mf;
mf = mf/60;
cout<<"Conditions at inlet: ";
cout<<"v1 (m/s) = ";
cin>>v[0];
cout<<"h1 (KJ/Kg) = ";
cin>>h[0];
cout<<"Specific volume (cubic meter/Kg) = ";
cin>>sv[0];
cout<<"Height of inlet above the ground z1 = ";
cin>>z[0];
cout<<"Condition at exit: ";
cout<<"v2 (m/s) = ";
cin>>v[1];
cout<<"h2 (KJ/Kg) = ";
cout<<"Specific volume (cubic meter/Kg) = ";
cin>>sv[1];
cout<<"Height of outlet above the ground z2 = ";
cin>>z[1];
cout<<"Heat loss to cooling water q (KJ/min) = ";
cin>>q;
cout<<"From SFEE ";
double compute()
{
ws = -1*(mf((h[1]-h[0])+1/2(v[1]*v[1]-v[0]*v[0]+g(z[1]-z[0]))+q);
if (z[0]=z[1])
{
g(z[1]-z[0]) = 0;
}
cout<<"Thus the power of motor required to drive the compressor is = "<<ws<<endl;
return 0;
}
cout<<"Mass flow rate at inlet = Mass flow rate at outlet = "<<mf<<endl;
a[0] = mf*sv[0]/sv[0];
a[1] = mf*sv[1]/sv[1];
r = a[0]/a[1];
cout<<"Thus the ratio of inlet pipe diameter to outlet pipe diameter is = "<<sqrt(double r)<<endl;
getch();
return 0;
}
}
Comment