Skip to content
Snippets Groups Projects
Commit a3ce5121 authored by xo30xoqa's avatar xo30xoqa
Browse files

Renamed EventType to Management

parent 04b3efec
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ mutable struct FarmPlot <: ModelAgent
LAItotal::Float64
LAIgreen::Float64
#biomass::Float64 #XXX I need to figure out how to calculate this
events::Vector{EventType}
events::Vector{Management}
end
"""
......@@ -50,7 +50,7 @@ function initfields!(model::SimulationModel)
month(model.date) < 3 ? phase = janfirst : phase = marchfirst
fp = FarmPlot(length(model.farmplots)+1, [(x,y)],
model.crops["natural grass"], phase,
0.0, 0.0, 0.0, 0.0, Vector{EventType}())
0.0, 0.0, 0.0, 0.0, Vector{Management}())
push!(model.farmplots, fp)
model.landscape[x,y].fieldid = fp.id
convertid[rawid] = fp.id
......
......@@ -38,7 +38,7 @@ function insectbiomass(pixel::Pixel, model::SimulationModel)::Float64
## based on fig. 3a in Paquette et al. (2013)
if "season" in @param(nature.insectmodel)
calendarday = dayofyear(model.date)
seasonfactor = -0.085(calendarday-187)^2
seasonfactor = (-0.085(calendarday-187)^2)mg/
end
## habitat dependence of insect biomass,
......
......@@ -31,9 +31,9 @@ At the moment, this implementation is still in development.
"""
@species Skylark begin
# species parameters
const eggtime::Int64 = 11 # 11 days from laying to hatching
const nestlingtime::UnitRange{Int64} = 7:11 # 7-11 days from hatching to leaving nest
const fledglingtime::UnitRange{Int64} = 25:30 # 25-30 days from hatching to independence
const eggtime::Int64 = 11 # days from laying to hatching
const nestlingtime::UnitRange{Int64} = 7:11 # days from hatching to leaving nest
const fledglingtime::UnitRange{Int64} = 25:30 # days from hatching to independence
const eggpredationmortality::Float64 = 0.03 # per-day egg mortality from predation
const nestharvestmortality::Float64 = 0.9 # egg/nestling mortality after a harvest event (XXX guess)
......@@ -45,8 +45,8 @@ At the moment, this implementation is still in development.
const nestingbegin::Tuple{Int64,Int64} = (April, 10) # begin nesting in the middle of April
const nestbuildingtime::UnitRange{Int64} = 4:5 # 4-5 days needed to build a nest (doubled for first nest)
const eggsperclutch::UnitRange{Int64} = 2:5 # 2-5 eggs laid per clutch
const breedingdelay::Int64 = 18 # wait 18 days after hatching to start a new brood
const eggsperclutch::UnitRange{Int64} = 2:5 # eggs laid per clutch
const breedingdelay::Int64 = 18 # days after hatching before starting a new brood
const nestingend::Int64 = July # last month of nesting
const habitats::Function = skylarkhabitat
......@@ -221,9 +221,12 @@ Do lots of foraging (not yet implemented).
# if all young have fledged, move to nonbreeding (if it's July) or breed again
if isempty(self.clutch)
self.nest = ()
month(model.date) >= self.nestingend ?
@setphase(nonbreeding) :
if month(model.date) >= self.nestingend
self.territory = []
@setphase(nonbreeding)
else
@setphase(nestbuilding)
end
end
end
......
......@@ -7,8 +7,8 @@
"The land cover classes encoded in the Mundialis Sentinel data."
@enum LandCover nodata forest grass water builtup soil agriculture
"The types of landscape event that can be simulated"
@enum EventType tillage sowing fertiliser pesticide harvesting
"The types of management event that can be simulated"
@enum Management tillage sowing fertiliser pesticide harvesting
#XXX rename to Management or similar?
"""
......@@ -21,7 +21,7 @@ in a single object. The model landscape consists of a matrix of pixels.
mutable struct Pixel
landcover::LandCover
fieldid::Union{Missing,Int64}
events::Vector{EventType}
events::Vector{Management}
animals::Vector{Int64}
end
......@@ -32,7 +32,7 @@ A data structure to define a landscape event, giving its type,
spatial extent, and duration.
"""
mutable struct FarmEvent
etype::EventType
management::Management
pixels::Vector{Tuple{Int64,Int64}}
duration::Int64
end
......@@ -82,7 +82,7 @@ function updateevents!(model::SimulationModel)
if event.duration <= 0
push!(expiredevents, e)
for p in event.pixels
i = findnext(x -> x == event.etype, model.landscape[p...].events, 1)
i = findnext(x -> x == event.management, model.landscape[p...].events, 1)
deleteat!(model.landscape[p...].events, i)
end
end
......@@ -96,7 +96,7 @@ end
Add a farm event to the specified pixels (a vector of position tuples) for a given duration.
"""
function createevent!(model::SimulationModel, pixels::Vector{Tuple{Int64,Int64}},
name::EventType, duration::Int64=1)
name::Management, duration::Int64=1)
push!(model.events, FarmEvent(name, pixels, duration))
for p in pixels
push!(model.landscape[p...].events, name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment