public class reciprocating_compressor
{
Gas g;
double PP1[],vv1[];
double PP2[],vv2[];
double TT3[],ss3[];
double T1,P1,T2,P2,T3,P3,T4,P4;
double V4;
double VS; //Swept volume
double Vfr;
double nc,ne,nr;
double VCP;//Clearance volume percent
double eta_mechanic;
double V_per_cycle; //m^3/cycle;
public reciprocating_compressor(double Vfri,double T1i,double P1i, double P2i,double nci,double nei,double nri,double clearance_volume_percent, double eta_mechanici)
{  // V1:inlet delivery air volumetric flow rate m^3/s at T1,P1
   // T1 inlet temperature
   // P1 inlet pressure
   // P2 delivery pressure
   // nr rotational speed revolution per minute (rpm)
   // nc compression polytropic power
   // ne expansion polytropic power
   // eta_mechanic : mechanical efficiency;
   g=new Gas("air");
   g.mole=false;
   PP1=new double[25];vv1=new double[25];
   PP2=new double[2];vv2=new double[2];
   Vfr=Vfri;
   T1=T1i;
   P1=P1i;
   nc=nci;
   ne=nei;
   nr=nri;
   V_per_cycle=Vfr*60.0/nr;
   VCP=clearance_volume_percent;
   P2=P2i;
   eta_mechanic=eta_mechanici;
   V4=VCP*Math.pow((P2/P1),(1.0/ne));
   VS=V_per_cycle/((1+VCP)-V4);  //  m^3/cycle
   T2=T1*Math.pow((P2/P1),((nc-1.0)/nc));
   double VD=V4*VS;
   double VA=VCP-VD;
   double R=8314.5/28.97;
   double mA=VD*P1*1e5/(R*T1);
   double mD=VD*P1*1e5/(R*T1);
   double W=nr/(60.0*eta_mechanic)*((nc-1.0)/nc*mA*(T2-T1)-(ne-1.0)/ne*mD*(T2-T1));
 
}
public String toString()
{
String s=" Reciprocating compressor\n";

return s;
}

}