Commit 6c195e4a authored by Wesseling, Jan's avatar Wesseling, Jan
Browse files

Determine inflow

parent cb61efa1
......@@ -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
......@@ -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()
......
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