Commit f17d02f0 authored by Eric Duminil's avatar Eric Duminil
Browse files

Removing debug code.

parent 85da8f77
......@@ -16,9 +16,7 @@ import java.util.stream.Collectors;
import com.opencsv.CSVReader;
import com.opencsv.exceptions.CsvException;
public class TreeWaterDemand
{
public class TreeWaterDemand {
/**
* Rs/Rso für Nacht = 0.5
......@@ -67,13 +65,12 @@ public class TreeWaterDemand
LocalDateTime start = LocalDateTime.of(2005, 1, 1, 1, 0);
LocalDateTime end = LocalDateTime.of(2006, 1, 1, 0, 0);
// LocalDateTime start = LocalDateTime.of(2005, 4, 1, 0, 0);
// LocalDateTime end = LocalDateTime.of(2005, 10, 1, 0, 0);
// LocalDateTime start = LocalDateTime.of(2005, 4, 1, 0, 0);
// LocalDateTime end = LocalDateTime.of(2005, 10, 1, 0, 0);
List<Double> et0us = new ArrayList<>();
List<Double> et0s = new ArrayList<>();
List<Double> demands = new ArrayList<>();
List<Double> rain = new ArrayList<>();
LocalDateTime counter = start;
System.out.println("Date,ETIa (L/m²/d),ET0 (L/m²/d)");
int startHours = (int) Duration.between(startOfYear, start).toHours();
......@@ -81,7 +78,8 @@ public class TreeWaterDemand
DateTimeFormatter f = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
Locale.setDefault(new Locale("en", "US"));
try (BufferedWriter bw = Files.newBufferedWriter(Paths.get("all_values.csv"), StandardCharsets.UTF_8)) {
bw.write("DateTime;Temperature;Humidity;GHI;WindSpeed;SaturationVaporPressure;ActualVaporPressure;Psy;ET0;ET0u\n");
bw.write(
"DateTime;Temperature;Humidity;GHI;WindSpeed;SaturationVaporPressure;ActualVaporPressure;Psy;ET0;ET0u\n");
bw.write("dd/mm/yyyy HH:MM;[°C];[%];[W/m²];[m/s];[kPa];[kPa];[kPa/°C];[l/h];[l/h]\n");
for (int i = startHours; i <= startHours + hours; i++) {
bw.write(String.format("%s;", counter.format(f)));
......@@ -113,20 +111,19 @@ public class TreeWaterDemand
bw.write(String.format(";%.3f", et0u));
et0s.add(et0);
// System.out.println("et0: " + et0);
// System.out.println("etia: " + etia);
// System.out.println("et0: " + et0);
// System.out.println("etia: " + etia);
et0us.add(et0u);
counter = counter.plusHours(1);
bw.write("\n");
}
}
// System.out.println(rain.stream().collect(Collectors.summarizingDouble(Double::doubleValue)));
// System.out.println(rain.stream().collect(Collectors.summarizingDouble(Double::doubleValue)));
Double et0Sum = et0s.stream().collect(Collectors.summingDouble(Double::doubleValue));
System.out.println("Summe aller ET0: " + et0Sum);
Double et0uSum = et0us.stream().collect(Collectors.summingDouble(Double::doubleValue));
System.out.println("Summe aller ET0u: " + et0uSum);
double et0uFactor = (0.865 * Math.log10(1 / et0uSum) + 3.36);
......@@ -140,60 +137,16 @@ public class TreeWaterDemand
}
System.out
.println("Summe aller ETIa: " + demands.stream().collect(Collectors.summingDouble(Double::doubleValue)));
// printHourly(start, et0s, demands);
// printDaily(start, et0s, demands);
// test();
}
private static void printHourly(LocalDateTime start, List<Double> et0s, List<Double> demands) {
LocalDateTime date = start;
for (int i = 0; i < demands.size(); i++) {
System.out.println(date + "," + demands.get(i) + "," + et0s.get(i));
date = date.plusHours(1);
}
}
private static void printDaily(LocalDateTime start, List<Double> et0s, List<Double> demands) {
LocalDateTime date = start;
for (int i = 0; i < demands.size(); i = i + 24) {
double demandSum = 0;
double et0Sum = 0;
for (int j = i; j < i + 24; j++) {
demandSum += demands.get(j);
et0Sum += et0s.get(j);
}
System.out.println(date + "," + demandSum + "," + et0Sum);
date = date.plusHours(24);
}
}
private static void test() {
double lz = 15;
double lm = 16.25;
double height = 8;
.println(
"Summe aller ETIa: " + demands.stream().collect(Collectors.summingDouble(Double::doubleValue)));
double temp = 38;
double humidity = 52;
double windSpeed = 3.3;
double incomingRadiation = 2.45;
double saturationVaporPressure = e0(temp);
double actualVaporPressure = ea(saturationVaporPressure, humidity);
int dayOfYear = 274;
double hourOfDay = 14 + 0.5;
double et0 = et0(temp, actualVaporPressure, incomingRadiation, height, windSpeed, humidity, dayOfYear,
hourOfDay, lz, lm);
System.out.println(et0);
}
private static double etia(double tr, double et0u, double et0uFactor) {
// return 1 * 1.6 * et0u;
// return 1 * 1.6 * et0u;
return tr * 1.25 * et0u * et0uFactor;
// return tr * (1.61 * Math.log10(800) - 3.39) * et0u * (0.865 * Math.log10(1 / et0u) + 3.36);
// return tr * (1.61 * Math.log10(800) - 3.39) * et0u * (0.865 * Math.log10(1 /
// et0u) + 3.36);
}
private static double et0u(double svf, double advection, double et0) {
......@@ -275,5 +228,4 @@ public class TreeWaterDemand
private static double delta(double temperatur, double e0) {
return (4098 * e0) / Math.pow(temperatur + 237.3, 2);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment