Skip to content

Commit

Permalink
2013-09-17 modify for calculation ET value
Browse files Browse the repository at this point in the history
  • Loading branch information
jiadw007 committed Sep 17, 2013
1 parent 6515386 commit d754e4f
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 92 deletions.
1 change: 0 additions & 1 deletion bin/.gitignore

This file was deleted.

Binary file modified bin/timeBasedCalculation.class
Binary file not shown.
Binary file modified bin/timeBasedETControllerCalculation.class
Binary file not shown.
Binary file modified bin/timeBasedRainSensorCalculation.class
Binary file not shown.
Binary file modified bin/timeBasedSoilWaterCalculation.class
Binary file not shown.
91 changes: 1 addition & 90 deletions src/timeBasedCalculation.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,96 +433,6 @@ public void calculation(int i ){



}else{
this.delta.add(i-1,-1.0); //we have no result for this property
this.F.add(i-1,-1.0); //we have no result for this property
this.rateF.add(i-1,-1.0); //we have no result for this property
this.Q.add(i-1,0.0);
this.PERC.add(i-1,0.0);
this.InF.add(i-1,0.0);


}
//calculate the ET
double kc=b.Kc.get(this.district).get(b.Month.get(i-1));
double et=b.ET0.get(i-1);
this.ET.add(et*kc);

//calculate SWC

if(this.PERC.get(i-1)>0){

this.SWC.add(i,SOIL.get("FC")*this.RD);
}else if(this.PERC.get(i-1)==0&&(this.SWC.get(i-1)-this.ET.get(i-1)+this.InF.get(i-1))<SOIL.get("WP")*this.RD*0.1){

this.SWC.add(i,SOIL.get("WP")*this.RD*0.1);


}else{

this.SWC.add(i,this.SWC.get(i-1)+this.InF.get(i-1)-this.ET.get(i-1));

}


//calculate the water loss
this.Loss.add(i-1,Math.abs(this.Q.get(i-1)+this.PERC.get(i-1)-b.Rhr.get(i-1))*this.area);
this.PerLoss.add(i-1,Math.abs(this.Q.get(i-1)+this.PERC.get(i-1)-b.Rhr.get(i-1))/b.Ihr.get(i-1));


}
public void calculationET(int i ){

HashMap<String, Double> SOIL=b.soil.get(soilType);

if(this.WB.get(i-1)>0){ //calculate the rate(f),Q and PERC
System.out.println(i);
double delta=SOIL.get("theta")-this.SWC.get(i-1)/this.RD; //get the value of delta for equation 2
this.delta.add(i-1,delta);
double psi=SOIL.get("psi"); //get the psi property of the soil
double k=SOIL.get("K"); //get the K property of the soil
newtonMethod nm=new newtonMethod(psi,delta,k);
//double F=0.0;
if(nm.calculationMethod()){

double F=nm.getResult(); //get the value of F for equation 1
//System.out.println("F: "+F);
this.F.add(i-1,F);

}else{

System.out.println("error calculation for F");

}
//calculation for the rate(f)

double f=k*(1+(psi*delta/this.F.get(i-1)));
this.rateF.add(i-1,f);

//calculation for the Q
if(this.WB.get(i-1)>f){
double Q=this.WB.get(i-1)-f*1;
this.Q.add(i-1,Q);
this.InF.add(i-1,f*1);
}else{

this.Q.add(i-1,0.0);
this.InF.add(this.WB.get(i-1));

}
//calculation for the PERC
double perc=this.SWC.get(i-1)+this.InF.get(i-1)-SOIL.get("FC")*this.RD;
if(perc>0){

this.PERC.add(perc);

}else{

this.PERC.add(0.0);
}



}else{
this.delta.add(i-1,-1.0); //we have no result for this property
this.F.add(i-1,-1.0); //we have no result for this property
Expand Down Expand Up @@ -561,6 +471,7 @@ public void calculationET(int i ){


}


public static void main(String args[]){

Expand Down
2 changes: 1 addition & 1 deletion src/timeBasedETControllerCalculation.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void calculation(){
double wb=this.b.Rhr.get(i-1)+this.Ihret.get(i-1);
this.getWB().add(wb);

super.calculationET(i);
super.calculation(i);


}
Expand Down
6 changes: 6 additions & 0 deletions src/timeBasedRainSensorCalculation.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public void calculation(){

for(int i =this.getStartIrrigationHour();i<=this.getLastIrrigationHour();i++){

//calculate the ET
double kc=b.Kc.get(this.getDistrict()).get(b.Month.get(i-1));
double et=b.ET0.get(i-1);
this.getET().add(et*kc);


if(i<24){

this.rainSum.add(super.b.Rhr.get(i-1));
Expand Down
6 changes: 6 additions & 0 deletions src/timeBasedSoilWaterCalculation.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public void calculation(){

for(int i =this.getStartIrrigationHour();i<=this.getLastIrrigationHour();i++){

//calculate the ET
double kc=b.Kc.get(this.getDistrict()).get(b.Month.get(i-1));
double et=b.ET0.get(i-1);
this.getET().add(et*kc);


//calculation the Ihrsoil
if(this.getSWC().get(i-1)>this.soilMoistureSensorThreshold*SOIL.get("FC")*this.getRD()){

Expand Down

0 comments on commit d754e4f

Please sign in to comment.