public class LiBrproptest
{
public static void main(String arg[])
{LiBr_H2O lip=new LiBr_H2O();
double t0=30.0;//degree C Absorber
double t2=100.0;//degree C Generator
double t3=40.0;//degree C Condenser
double t4=t3;
double t5=10.0;//degreee C Evaporator
double m1=0.6; //kg/s LiBr-Water solution
 double a[]=lip.st.property("tx",t3,0.0);
 double P3=a[0]*100;//water vapor (saturated)
 double P2=lip.Psw(t3);//generator
 double w2=lip.W(t2,P2);//generator
 double P5=lip.Psw(t5);//saturated water
 double P6=P5;// water vapor
 double P0=P5;// water vapor
 double P1=P2;
 double w1=lip.W(t0,P0);//absorber-pump
 double m2=m1*w1/w2;//generator exit
 System.out.println("P3="+P3+" kPa condenser=");
 System.out.println("P2="+P2+" kPa generator w2="+w2+"kg LiBr/kg mix");
 System.out.println("P5=P6="+P5+" kPA evaporator ");
 System.out.println("P1="+P1+" kPa generator w1="+w1+"kg LiBr/kg mix");
 System.out.println("m1="+m1+" kg/s solution absorber exit");
 System.out.println("m2="+m2+" kg/s solution generator exit");
 double m3=m1-m2;//water vapor going to condenser
 System.out.println("m3="+m3+" kg/s water vapor generator exit");
 double h0=lip.h_w(t0,w1);//absorber
 System.out.println("h0="+h0+" kJ/kg solution absorber");
 double ro1=lip.ro_w(t0,w1);
 double v1=1.0/ro1;
 System.out.println("v1="+v1+"m^3/kg"+"ro1="+ro1+"kg/m^3");
 double dh=v1*(P1-P0);//enthalpy change in pump
 double h1=h0+dh;
 System.out.println("h0="+h0+"h1="+h1+" kJ/kg pump output");
 double h2=lip.h_w(t2,w2);//Generator
 System.out.println("h2="+h2+" kJ/kg solution generator");
 a=lip.st.property("tp",t2,P3*1e-2);
 double h3=a[3];// kJ/kg superheated water at t2,P3
 System.out.println("h3="+h3+" kJ/kg generator exit superheated water");
 a=lip.st.property("tx",t4,0.0);
 double h4=a[3]; // kJ/kg saturated liquid water at t3
 System.out.println("h4="+h4+" kJ/kg condenser  exit saturated water");
 double h5=h4;
 a=lip.st.property("ph",P5*1e-2,h5);
 double x5=a[5];
 a=lip.st.property("tx",t5,1.0);
 double h6=a[3];
 System.out.println("h5="+h5+" kJ/kg evaporator inlet saturated water");
 System.out.println("x5="+x5+" kg vapor/kg evaporator inlet saturated water");
 System.out.println("h6="+h6+" kJ/kg  saturated water vapor absorption inlet");
 double Qgenerator=m3*h3+m2*h5-m1*h1;
 double Qabsorber=m2*h2+m3*h6-m1*h1;
 double Qcondenser=m3*(h3-h4);
 double Qevaporator=m3*(h6-h5);
 double Wpump=m1*(h1-h0);
 System.out.println("Qgenerator="+Qgenerator+" kw  ");
 System.out.println("Qabsorber="+Qabsorber+" kw  ");
 System.out.println("Qcondenser="+Qcondenser+" kw  ");
 System.out.println("Qevaporator="+Qevaporator+" kw  ");
 System.out.println("Wpump="+Wpump+" kw  ");
 double COP=Qevaporator/(Wpump+Qgenerator);
  System.out.println("COP="+COP+" ");
 
}
}