//======================================================
// java Termodinamik paketi
// Class ref_BS doyma bölgesi soğutma akışkanların özellikleri
// Dr. Turhan Coban
// Ege Üniversitesi Mühendislik fakultesi
// Makina Bölümü
// 
//===========================================================
// Dosya adı   : ref_BS.java
// Bu dosya soğutucu akışkanların  
// doyma notalarındaki termodinamik özelliklerini verir
// ==========================================================

import java.io.*;
import java.net.*;
import java.util.*;
import javax.swing.*;

public class ref_BS
{
public ref_BS_Data rd;

public ref_BS()
{readref("R134a");}

public ref_BS(String rName)
{readref(rName);}


public String[] liste()
{ String s1=rd.refrigerantName;String s2=readref("null");readref(s1);
  StringTokenizer t=new StringTokenizer(s2);
  int n=t.countTokens();
  String s3[]=new String[n];
  int i=0;
  while(t.hasMoreTokens())
  {
  s3[i]=t.nextToken();
  i++;
  }
  return s3;
}

public String readGasNames()
{ String s1=rd.refrigerantName;String s2=readref("null");readref(s1);return s2;}

public String readref(String rName)
{
String s="";
//ArrayList<ref_BS_Data> gi=new ArrayList<ref_BS_Data>();
     
    rd=new ref_BS_Data("R134a","1,1,1,2-tetrafluoroethane CF3CH2F",102.03,-26.074,-103.3,101.06,4059.3,511.9);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
    
    rd=new ref_BS_Data("R123","2,2 dichloro-1,1,1-trifluoroethane  CHCl2CF3",152.93,27.823,-107.15,183.68,3661.8,550.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
    
    rd=new ref_BS_Data("R718","su H2O",18.015,99.974,0.01,373.95,22064.0,322.0);
     {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

    rd=new ref_BS_Data("R12","Dichlorodifluoromethane CCl2F2",120.91,-29.752,-157.05,111.97,4136.1,565.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
   
    rd=new ref_BS_Data("R22","Chlorodifluoromethane CHClF2",86.468,-40.81,-157.42,96.145,4990.0,523.84);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

    rd=new ref_BS_Data("R23","Trifluoromethane CHF3",70.014,-82.018,-155.13,26.143,4832.0,526.5);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
   
    rd=new ref_BS_Data("R32","Difluoromethane CH2F2",52.024,-51.651,-136.81,78.105,5782.0,424.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
             
rd=new ref_BS_Data("R123","Dichlorotrifluoroethane CHCl2CF3",152.93,27.823,-107.15,183.68,3661.8,550.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName)) return s;
    }

rd=new ref_BS_Data("R124","Chlorotetrafluoroethane CHClFCF3",136.48,-11.963,-199.15,122.28,3624.3,560.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R125","Pentafluoroethane C2HF5",120.02,-48.09,-100.63,66.023,3617.7,573.58);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
              
rd=new ref_BS_Data("R143a","Trifluoroethane CH3CF3",84.041,-47.241,-111.81,72.707,3761.0,431.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R152a","Difluoroethane CHF2CH3",66.051,-24.023,-118.59,113.26,4516.8,368.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R404A","R-32/125 (50/50)",86.204,-51.443,0.0,71.358,4902.6,459.53);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R407C","R-32/125/134a (23/25/52)",86.204,-43.627,0.0,86.034,4629.8,484.23);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }
        
rd=new ref_BS_Data("R410A","R-125/143a/134a (44/52/4)",72.585,-51.443,0.0,71.358,4902.6,459.53);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R507A","R-125/143a (50/50)",98.859,-46.741,0.0,70.617,3705.0,490.77);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R717","Amonyak NH3",17.03,-33.327,-77.655,132.25,11333.0,225.0);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R744","karbondioksit CO2",44.01,-78.4,-56.558,30.978,7377.3,467.6);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R50","Metan CH4",16.043,-161.48,-182.46,-82.586,4599.2,162.66);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R170","Etan C2H6",30.07,-88.598,-182.8,32.18,4871.8,206.58);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R290","Propan C3H8",44.096,-42.09,-187.67,96.675,4247.1,218.5);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName))  return s;
    }

rd=new ref_BS_Data("R600","n-Bütan C4H10",58.122,-0.55,-138.28,151.98,3796.0,227.84);
    {s+=rd.refrigerantName+" ";
      if (rd.refrigerantName.equals(rName)) return s;
    }  
    return s;
    }
    
public String[][] toString(double t)
{
  String s1[][]=new String[27][3];
   s1[0][0]="Soğutucu akışkan adı ";
   s1[1][0]="Soğutucu akışkan formülü";
   s1[2][0]="M, Soğutucu akışkan molekül ağırlığı";
   s1[3][0]="Tb, kaynama noktası";
   s1[4][0]="Td, donma noktası";
   s1[5][0]="Tc, kritik sıcaklık";
   s1[6][0]="Pc, kritik basınç";
   s1[7][0]="roc, kritik yoğunluk";
   s1[8][0]="Psb, doymuş sıvı basıncı";
   s1[9][0]="Psd, doymuş buhar basıncı";
   s1[10][0]="rol, doymuş sıvı yoğunluğu";
   s1[11][0]="rov, doymuş buhar yoğunluğu";
   s1[12][0]="hl, doymuş sıvı entalpisi";
   s1[13][0]="hv, doymuş buhar entalpisi";
   s1[14][0]="hlv, kaynama entalpisi ";
   s1[15][0]="sl, doymuş sıvı entropisi";
   s1[16][0]="sv, doymuş buhar entalpisi";
   s1[17][0]="slv, kaynama entropisi";
   s1[18][0]="mu_l, doymuş sıvı viskozitesi";
   s1[19][0]="mu_v, doymuş buhar viskozitesi";
   s1[20][0]="k_l, doymuş sıvı ısıl iletkenlik katsayısı";
   s1[21][0]="k_v, doymuş buhar ısıl iletkenlik katsayısı";
   s1[22][0]="Cp_l, doymuş sıvı özgül ısı";
   s1[23][0]="Cp_v, doymuş buhar özgül ısı";
   s1[24][0]="v_l, doymuş sıvı ses hızı";
   s1[25][0]="v_v, doymuş buhar ses hızı";
   s1[26][0]="st, yüzey gerilim kuvveti";   
   s1[0][2]=" ";
   s1[1][2]=" ";
   s1[2][2]="kg/kmol";
   s1[3][2]="derece C";
   s1[4][2]="derece C";
   s1[5][2]="derece C";
   s1[6][2]="kPa";
   s1[7][2]="kPa";
   s1[8][2]="kPa";
   s1[9][2]="kPa";
   s1[10][2]="kg/m^3";
   s1[11][2]="kg/m^3";
   s1[12][2]="KJ/kg";
   s1[13][2]="KJ/kg";
   s1[14][2]="KJ/kg";
   s1[15][2]="KJ/kgK";
   s1[16][2]="KJ/kgK";
   s1[17][2]="KJ/kgK";
   s1[18][2]="Pa.s";
   s1[19][2]="Pa.s";
   s1[20][2]="KJ/mK";
   s1[21][2]="KJ/mK";
   s1[22][2]="KJ/kgK";
   s1[23][2]="KJ/kgK";
   s1[24][2]="m/s";
   s1[25][2]="m/s";
   s1[26][2]="N/m";
   

   s1[0][1]=rd.refrigerantName;
   s1[1][1]=rd.openName;
   s1[2][1]=""+rd.M;
   s1[3][1]=""+rd.BP;
   s1[4][1]=""+rd.FP;
   s1[5][1]=""+rd.Tc;
   s1[6][1]=""+rd.Pc;
   s1[7][1]=""+rd.roc;
   s1[8][1]=""+rd.Psb(t);
   s1[9][1]=""+rd.Psd(t);
   s1[10][1]=""+rd.rol(t);
   s1[11][1]=""+rd.rov(t);
   s1[12][1]=""+rd.h_l(t);
   s1[13][1]=""+rd.h_v(t);
   s1[14][1]=""+rd.h_lv(t);
   s1[15][1]=""+rd.s_l(t);
   s1[16][1]=""+rd.s_v(t);
   s1[17][1]=""+rd.s_lv(t);
   s1[18][1]=""+rd.viscosity_l(t);
   s1[19][1]=""+rd.viscosity_v(t);
   s1[20][1]=""+rd.k_l(t);
   s1[21][1]=""+rd.k_v(t);
   s1[22][1]=""+rd.Cpl(t);
   s1[23][1]=""+rd.Cpv(t);
   s1[24][1]=""+rd.soundv_l(t);
   s1[25][1]=""+rd.soundv_v(t);   
    s1[26][1]=""+rd.yuzeygerilim(t);
return s1;
}
    
}