import java.io.*;
 
class f2 extends f_x
{
 double func(double x)
 {
   return Math.sin(x)-x/2;
 }
}

class PlotTwa
{
     public static void main (String args[]) throws IOException
     {
  /* wet air return variables 
  aa[0]=P;
  aa[1]=v1;
  aa[2]=ap[2];
  aa[3]=pv;
  aa[4]=Pa;
  aa[5]=w;
  aa[6]=rh;
  aa[7]=dos;
  aa[8]=h;
  aa[9]=s;
  aa[10]=tdp;
  aa[11]=ha;
  aa[12]=hv;
  aa[13]=w*hv;
  //options for input selection switch   "tdb_twb"  dry bulb - wet bulb temperatures
  //                                     "tdb_rh"   dry bulb temperature - relative humidity
  //                                     "tdb_w"    dry bulb temperature - specific humidity
  //                                     "tdb_tdew" dry bulb temperature - dew point temperature
  //                                     "tdb_pv"   dry bulb temperature - water vapor pressure
  //                                     "tdb_dos"  dry bulb temperature - degree of saturation
  //                                     "tdb_h"    dry bulb temperature - enthalpy
  //                                     "tdb_s"    dry bulb temperature - enthropy
  //                                     "w_rh"     specific humidity    - relative humifdity
  //                                     "w_h"      specific humidity    -  enthalpy
  */
     wetair w=new wetair();
     double aa[]=new double[14];  
     double bb[]=new double[14];  
	 f2 ff=new f2();
	 double x1[][]=new double[62][51];
	 double y1[][]=new double[62][51];
     //initilise as a function plot
     double P=1.01325;
     int i,j;
     i=0;
     double h;
     for(double rh=0.1;rh<=1.0;rh+=0.1)
     {   j=0;
         for(double t=0.0;t<=50.0;t+=1.0)
         {
	     aa=w.property("tdb_rh",t,rh,P);
	     h=aa[8];
	        if(rh>0.99) 
            { 
	        h=aa[8];
	        //System.out.println("rh="+rh+"h="+h);
            x1[11+j][0]=t;y1[11+j][0]=aa[5];bb=w.property("w_h",0.0,h,P);
            x1[11+j][1]=bb[10];y1[11+j][1]=0.0;
            }
	        x1[i][j]=t;
            y1[i][j]=aa[5];
	        j++;
            }
         i++;
     }
     Plot1 pp=new Plot1(x1,y1);
     pp.setPlabel("Psikometri");
     pp.setXlabel("T C kuru termometre sıcaklıgı");
     pp.setYlabel("w mutlak nem kg nem/kg kuru hava");
     pp.setMinMax(0.0,50.0,0,0.05);
     pp.setXgrid(1);
     pp.setYgrid(1);
     PlotWetAir.plot(pp,P); 
     //wetairTable.open();    
     }     
}
