Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
WaterHarvesting
WHCatch
Commits
6c195e4a
Commit
6c195e4a
authored
Apr 07, 2021
by
Wesseling, Jan
Browse files
Determine inflow
parent
cb61efa1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Types.jl
View file @
6c195e4a
...
...
@@ -23,4 +23,15 @@ module Types
year
::
Int64
event
::
Array
{
Float64
}
end
mutable struct
Inflow
from
::
Int64
oneOrTwo
::
Int64
fraction
::
Float64
end
mutable struct
InflowFrom
number
::
Int64
subCatchment
::
Array
{
Inflow
}
end
end
WHCatch.jl
View file @
6c195e4a
...
...
@@ -7,6 +7,7 @@ include("Types.jl")
catchment
=
Nothing
evap
=
Nothing
precip
=
Nothing
inflowFrom
=
Nothing
function
createCatchment
(
aData
::
DataFrame
)
global
catchment
=
Array
{
Types
.
CatchmentData
}(
undef
,
1
)
...
...
@@ -279,8 +280,37 @@ function readData()
end
end
function
determineInflow
()
global
inflowFrom
=
Array
{
Types
.
InflowFrom
}(
undef
,
1
)
n
=
size
(
catchment
,
1
)
resize!
(
inflowFrom
,
n
)
for
i
in
1
:
n
x
=
Types
.
Inflow
(
-
1
,
-
1
,
0.0
)
arr
=
Array
{
Types
.
Inflow
}(
undef
,
1
)
arr
[
1
]
=
x
tmp
=
Types
.
InflowFrom
(
0
,
arr
)
inflowFrom
[
i
]
=
tmp
end
for
i
in
1
:
n
if
catchment
[
i
]
.
outflowTo1
>
0
&&
catchment
[
i
]
.
percentage1
>
0.0
global
inflowFrom
[
catchment
[
i
]
.
outflowTo1
]
.
number
+=
1
resize!
(
inflowFrom
[
catchment
[
i
]
.
outflowTo1
]
.
subCatchment
,
inflowFrom
[
catchment
[
i
]
.
outflowTo1
]
.
number
)
tmp
=
Types
.
Inflow
(
i
,
1
,
0.01
*
catchment
[
i
]
.
percentage1
)
global
inflowFrom
[
catchment
[
i
]
.
outflowTo1
]
.
subCatchment
[
inflowFrom
[
catchment
[
i
]
.
outflowTo1
]
.
number
]
=
tmp
end
if
catchment
[
i
]
.
outflowTo2
>
0
&&
catchment
[
i
]
.
percentage2
>
0.0
global
inflowFrom
[
catchment
[
i
]
.
outflowTo2
]
.
number
+=
1
resize!
(
inflowFrom
[
catchment
[
i
]
.
outflowTo2
]
.
subCatchment
,
inflowFrom
[
catchment
[
i
]
.
outflowTo2
]
.
number
)
tmp
=
Types
.
Inflow
(
i
,
1
,
0.01
*
catchment
[
i
]
.
percentage2
)
global
inflowFrom
[
catchment
[
i
]
.
outflowTo2
]
.
subCatchment
[
inflowFrom
[
catchment
[
i
]
.
outflowTo2
]
.
number
]
=
tmp
end
end
end
function
initialize
()
readData
()
determineInflow
()
println
(
inflowFrom
)
end
initialize
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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