Commit 61a747b4 authored by Eric Duminil's avatar Eric Duminil
Browse files

Extraterrestrial radiation

parent 57fd5725
This diff is collapsed.
......@@ -79,8 +79,8 @@ public class TreeWaterDemand {
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;DayOrNight;netLongwaveRadiation;WindSpeed;SaturationVaporPressure;ActualVaporPressure;Psy;NetRadiation;ET0;ET0u\n");
bw.write("dd/mm/yyyy HH:MM;[°C];[%];[W/m²];[0/1];[MJ/(m².h)];[m/s];[kPa];[kPa];[kPa/°C];[MJ/(m².h)];[l/h];[l/h]\n");
"DateTime;Temperature;Humidity;GHI;DayOrNight;NetLongwaveRadiation;WindSpeed;SaturationVaporPressure;ActualVaporPressure;Psy;ExtraterrestrialRadiation;NetRadiation;ET0;ET0u\n");
bw.write("dd/mm/yyyy HH:MM;[°C];[%];[W/m²];[0/1];[MJ/(m².h)];[m/s];[kPa];[kPa];[kPa/°C];[MJ/(m².h)];[MJ/(m².h)];[l/h];[l/h]\n");
for (int i = startHours; i <= startHours + hours; i++) {
bw.write(String.format("%s;", counter.format(f)));
String[] row = csvValues.get(i + 2);
......@@ -101,19 +101,23 @@ public class TreeWaterDemand {
int dayOfYear = counter.getDayOfYear();
double hourOfDay = counter.getHour() + 0.5;
//TODO: DRY
double netRadiation = rn(temp, actualVaporPressure, incomingRadiation, height, dayOfYear, hourOfDay,
lz, lm);
double extraterrestrialRadiation = extraterrestrialRadiation(dayOfYear, hourOfDay, lz, lm);
double netLongwaveRadiation = rnl(temp, actualVaporPressure, incomingRadiation, height, dayOfYear, hourOfDay, lz, lm);
double et0 = et0(temp, actualVaporPressure, incomingRadiation, height, windSpeed, humidity, dayOfYear,
hourOfDay, lz, lm);
double et0u = et0u(svf, advection, et0);
bw.write(String.format(";%.5f", netLongwaveRadiation));
bw.write(String.format(";%.1f", windSpeed));
bw.write(String.format(";%.5f", saturationVaporPressure));
bw.write(String.format(";%.5f", actualVaporPressure));
bw.write(String.format(";%.5f", gamma(height)));
bw.write(String.format(";%.5f", extraterrestrialRadiation));
bw.write(String.format(";%.5f", netRadiation));
bw.write(String.format(";%.3f", et0));
bw.write(String.format(";%.3f", et0u));
......@@ -206,6 +210,20 @@ public class TreeWaterDemand {
// divide by 24 for hourly
double sigma = 4.903E-9 / 24;
double rs = shortWaveRadiation;
double ra = extraterrestrialRadiation(dayOfYear, hourOfDay, lz, lm);
double rso = (0.75 + 2 * 10E-5 * height) * ra;
double rsRsoQuotient = 0.5;
if (rso != 0) {
rsRsoQuotient = rs / rso;
}
if (rsRsoQuotient > 1) {
rsRsoQuotient = 1;
}
return sigma * Math.pow(temperature + 273.16, 4) * (0.34 - 0.14 * Math.sqrt(actualVaporPressure))
* (1.35 * rsRsoQuotient - 0.35);
}
private static double extraterrestrialRadiation(int dayOfYear, double hourOfDay, double lz, double lm) {
double dr = 1 + 0.033 * Math.cos(2 * Math.PI * dayOfYear / 365d);
double b = (2 * Math.PI * (dayOfYear - 81)) / 364;
double sc = 0.1645 * Math.sin(2 * b) - 0.1255 * Math.cos(b) - 0.025 * Math.sin(b);
......@@ -220,16 +238,7 @@ public class TreeWaterDemand {
ra = 12 * 60 / Math.PI * 0.0820 * dr * ((omega2 - omega1) * Math.sin(phi) * Math.sin(delta)
+ Math.cos(phi) * Math.cos(delta) * (Math.sin(omega2) - Math.sin(omega1)));
}
double rso = (0.75 + 2 * 10E-5 * height) * ra;
double rsRsoQuotient = 0.5;
if (rso != 0) {
rsRsoQuotient = rs / rso;
}
if (rsRsoQuotient > 1) {
rsRsoQuotient = 1;
}
return sigma * Math.pow(temperature + 273.16, 4) * (0.34 - 0.14 * Math.sqrt(actualVaporPressure))
* (1.35 * rsRsoQuotient - 0.35);
return ra;
}
private static double delta(double temperatur, double e0) {
......
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