Skip to content
Snippets Groups Projects
Commit 73695895 authored by Kottelenberg, David's avatar Kottelenberg, David
Browse files

Changed branch abortion.

parent 87206bbe
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@
"n_short_internodes": 4,
"max_branch_angle": 90.0,
"min_branch_angle": 1.0,
"ssr_abortion": 0.5,
"ssr_abortion": 1.0,
"cumul_phyt_nr_lower": 3,
"germination_delay": 260.0,
"germination_delay_var": 0.0,
......
......@@ -58,6 +58,9 @@ module Plant
extending::Bool = false # Whether this branch has elongating internodes
dead::Bool = false # Whether this branch is dead and should be removed
flowering::Bool = false # Whether this branch is flowering
branch_source_strength::Float64 = 0.0
branch_sink_strength::Float64 = 0.0
branch_source_sink_ratio::Float64 = 0.0
#...
end
......@@ -81,7 +84,6 @@ module Plant
assimilated::Float64 = 0.0 # Assimilated carbon (umol CO2 / day)
substrates::Float64 = 0.0 # Substrates available for growth (mg CO2)
source_strength::Float64 = 0.0
source_sink_ratio_no_reserve = 0.0
reserve_pool::Float64 = 0.0 # Substrate reserves available for growth (mg)
yield::Float64 = 0.0 # Total plant yield (biomass of fruit organ)
harvest_index::Float64 = 0.0 # The harvest index of the plant after harvest ()
......@@ -613,6 +615,7 @@ module Plant
end
if length(leaves) > 0
sink_strength += sum([x.sink_strength for x in leaves])
end
if length(roots) > 0
sink_strength += sum([x.sink_strength for x in roots])
......@@ -626,7 +629,6 @@ module Plant
plant_base.sink_strength = sink_strength > 0.0 ? sink_strength : 0.00001
plant_base.source_sink_ratio = plant_base.substrates / plant_base.sink_strength
plant_base.source_sink_ratio_no_reserve = plant_base.source_strength / plant_base.sink_strength
return nothing
end
......@@ -642,12 +644,20 @@ module Plant
source_strength::Float64 = 0.0
if length(internodes) > 0
source_strength += sum([x.assimilated for x in internodes])
for i in internodes
i.branch_base.branch_source_strength += (i.assimilated * fp["MASS_CO2"] * 1e-3 * fp["CONVERSION_CO2"]) - (plant_base.maintenance_respiration * i.biomass)
end
end
if length(leaves) > 0
source_strength += sum([x.assimilated for x in leaves])
for i in leaves
i.branch_base.branch_source_strength += (i.assimilated * fp["MASS_CO2"] * 1e-3 * fp["CONVERSION_CO2"]) - (plant_base.maintenance_respiration * i.biomass)
end
end
for branch_base in plant_base.branch_bases
branch_base.branch_source_sink_ratio = branch_base.branch_source_strength / branch_base.branch_sink_strength
end
# Calculate substrates in mg
#println("reserve_pool_source: " * string(reserve_pool_source))
plant_base.substrates = max(((source_strength * fp["MASS_CO2"] * 1e-3)) * # from umol CO2 to mg CO2
fp["CONVERSION_CO2"] + # from mg CO2 to mg biomass
plant_base.reserve_pool -
......@@ -898,6 +908,7 @@ module Plant
sink_strength::Float64 = max_sink_strength / (1 - r) * ((te - t) / (te - tm)) * (t / tm)^(tm / (te - tm))
go.sink_strength = sink_strength * (go.age_dd - go.age_dd_prev)
end
go.branch_base.branch_sink_strength += go.sink_strength
return nothing
end
......@@ -1078,14 +1089,11 @@ module Plant
function determine_branch_abortion!(plant::Graph)
plant_base = data(plant)
sp = plant_base.species_parameters
if #=plant_base.age_dd > 50.0 &&=# plant_base.source_sink_ratio_no_reserve < sp.ssr_abortion[plant_base.species]
println("1")
youngest_active_branch = [x.age_dd for x in plant_base.branch_bases if !x.dormant && x.extending && !x.flowering]
if length(youngest_active_branch) > 0
println("2")
target_branch = plant_base.branch_bases[argmin(youngest_active_branch)]
target_branch.dead = true
end
for branch_base in plant_base.branch_bases
if branch_base.branch_source_sink_ratio < sp.ssr_abortion[plant_base.species]
println("abort branch")
branch_base.dead = true
end
end
return nothing
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment