Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
ed5875ed
Commit
ed5875ed
authored
Jul 05, 2023
by
Eric Duminil
Browse files
DRY
parent
61a747b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
tree-water-demand/src/main/java/de/hft/stuttgart/water/TreeWaterDemand.java
View file @
ed5875ed
...
@@ -101,14 +101,10 @@ public class TreeWaterDemand {
...
@@ -101,14 +101,10 @@ public class TreeWaterDemand {
int
dayOfYear
=
counter
.
getDayOfYear
();
int
dayOfYear
=
counter
.
getDayOfYear
();
double
hourOfDay
=
counter
.
getHour
()
+
0.5
;
double
hourOfDay
=
counter
.
getHour
()
+
0.5
;
//TODO: DRY
double
extraterrestrialRadiation
=
extraterrestrialRadiation
(
dayOfYear
,
hourOfDay
,
lz
,
lm
);
// ra
double
netRadiation
=
rn
(
temp
,
actualVaporPressure
,
incomingRadiation
,
height
,
dayOfYear
,
hourOfDay
,
double
netLongwaveRadiation
=
rnl
(
temp
,
actualVaporPressure
,
incomingRadiation
,
height
,
extraterrestrialRadiation
);
// rnl
lz
,
lm
);
double
netRadiation
=
rn
(
incomingRadiation
,
netLongwaveRadiation
);
double
et0
=
et0
(
temp
,
actualVaporPressure
,
incomingRadiation
,
height
,
windSpeed
,
humidity
,
netRadiation
);
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
);
double
et0u
=
et0u
(
svf
,
advection
,
et0
);
...
@@ -163,9 +159,7 @@ public class TreeWaterDemand {
...
@@ -163,9 +159,7 @@ public class TreeWaterDemand {
}
}
private
static
double
et0
(
double
temperature
,
double
actualVaporPressure
,
double
shortWaveRadiation
,
double
height
,
private
static
double
et0
(
double
temperature
,
double
actualVaporPressure
,
double
shortWaveRadiation
,
double
height
,
double
windSpeed
,
double
humidity
,
int
dayOfYear
,
double
hourOfDay
,
double
lz
,
double
lm
)
{
double
windSpeed
,
double
humidity
,
double
netRadiation
)
{
double
netRadiation
=
rn
(
temperature
,
actualVaporPressure
,
shortWaveRadiation
,
height
,
dayOfYear
,
hourOfDay
,
lz
,
lm
);
double
gamma
=
gamma
(
height
);
double
gamma
=
gamma
(
height
);
double
saturationVaporPressure
=
saturationVaporPressure
(
temperature
);
double
saturationVaporPressure
=
saturationVaporPressure
(
temperature
);
double
delta
=
delta
(
temperature
,
saturationVaporPressure
);
double
delta
=
delta
(
temperature
,
saturationVaporPressure
);
...
@@ -197,21 +191,18 @@ public class TreeWaterDemand {
...
@@ -197,21 +191,18 @@ public class TreeWaterDemand {
}
}
// unit is apparently [MJ / (m².h)]
// unit is apparently [MJ / (m².h)]
private
static
double
rn
(
double
temperature
,
double
actualVaporPressure
,
double
shortWaveRadiation
,
double
height
,
private
static
double
rn
(
double
shortWaveRadiation
,
double
rnl
)
{
int
dayOfYear
,
double
hourOfDay
,
double
lz
,
double
lm
)
{
// 1 - 0.23: albedo effect of grass
// 1 - 0.23: albedo effect of grass
return
(
1
-
0.23
)
*
shortWaveRadiation
return
(
1
-
0.23
)
*
shortWaveRadiation
-
rnl
;
-
rnl
(
temperature
,
actualVaporPressure
,
shortWaveRadiation
,
height
,
dayOfYear
,
hourOfDay
,
lz
,
lm
);
}
}
// unit is apparently [MJ / (m².h)]
// unit is apparently [MJ / (m².h)]
private
static
double
rnl
(
double
temperature
,
double
actualVaporPressure
,
double
shortWaveRadiation
,
double
height
,
private
static
double
rnl
(
double
temperature
,
double
actualVaporPressure
,
double
shortWaveRadiation
,
double
height
,
int
dayOfYear
,
double
hourOfDay
,
double
lz
,
double
lm
)
{
double
extraterrestrialRadiation
)
{
// divide by 24 for hourly
// divide by 24 for hourly
double
sigma
=
4.903
E
-
9
/
24
;
double
sigma
=
4.903
E
-
9
/
24
;
double
rs
=
shortWaveRadiation
;
double
rs
=
shortWaveRadiation
;
double
ra
=
extraterrestrialRadiation
(
dayOfYear
,
hourOfDay
,
lz
,
lm
);
double
rso
=
(
0.75
+
2
*
10
E
-
5
*
height
)
*
extraterrestrialRadiation
;
double
rso
=
(
0.75
+
2
*
10
E
-
5
*
height
)
*
ra
;
double
rsRsoQuotient
=
0.5
;
double
rsRsoQuotient
=
0.5
;
if
(
rso
!=
0
)
{
if
(
rso
!=
0
)
{
rsRsoQuotient
=
rs
/
rso
;
rsRsoQuotient
=
rs
/
rso
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment