SORTIE Core C++ Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clFuncResponseSeedPredation Class Reference

Models functional response seed predation. More...

#include <FuncResponseSeedPredation.h>

Inheritance diagram for clFuncResponseSeedPredation:
clBehaviorBase clWorkerBase

Public Member Functions

 clFuncResponseSeedPredation (clSimManager *p_oSimManager)
 Constructor. More...
 
 ~clFuncResponseSeedPredation ()
 Destructor. More...
 
void Action ()
 Performs the model. More...
 
void SetNameData (std::string sNameString)
 Captures the behavior name passed from the parameter file. More...
 
float GetOfftakeRate ()
 Get the amount of offtake. More...
 
- Public Member Functions inherited from clBehaviorBase
virtual float GetBehaviorVersion ()
 Gets the behavior version number. More...
 
 clBehaviorBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clBehaviorBase ()
 Destructor. More...
 
virtual short int ValidateVersionNumber (float fTestVersion)
 Makes sure that the version number of a file passed is between the minimum and current version numbers. More...
 
virtual void RegisterTreeDataMembers ()
 Registers tree data members. More...
 
virtual void SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos)
 Sets the species/type combos for a behavior. More...
 
virtual short int GetNewTreeInts ()
 Gets the number of new tree integer data members this behavior wants to register. More...
 
virtual short int GetNewTreeFloats ()
 Gets the number of new tree float data members this behavior wants to register. More...
 
virtual short int GetNewTreeChars ()
 Gets the number of new tree character data members this behavior wants to register. More...
 
virtual short int GetNewTreeBools ()
 Gets the number of new tree bool data members this behavior wants to register. More...
 
virtual short int GetNumSpeciesTypeCombos ()
 Gets the number of species/type combos to which this behavior applies. More...
 
virtual short int GetNumBehaviorSpecies ()
 Gets the number of unique tree species to which this behavior applies. More...
 
struct stcSpeciesTypeCombo GetSpeciesTypeCombo (short int iIndex)
 Gets one of this behavior's type/species combos. More...
 
virtual short int GetBehaviorSpecies (short int iIndex)
 Gets one of the behavior's species. More...
 
short int GetBehaviorListNumber ()
 Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More...
 
void SetBehaviorListNumber (short int iNumber)
 Sets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More...
 
std::string FormatSpeciesTypeQueryString ()
 Formats the string for species/types query. More...
 
virtual DOMElement * GetParentParametersElement (xercesc::DOMDocument *p_oDoc)
 This will get the correct set of parameters for this behavior based on the behavior list position number. More...
 
- Public Member Functions inherited from clWorkerBase
 clWorkerBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clWorkerBase ()
 Destructor. More...
 
std::string GetName ()
 Gets the object's namestring. More...
 
clSimManagerGetSimManager ()
 
void DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType)
 Triggers the setup process. More...
 
virtual void TimestepCleanup ()
 Performs any necessary cleanup operations at the end of a timestep. More...
 
virtual void EndOfRunCleanup ()
 Performs any necessary cleanup operations at the end of a run. More...
 

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads in the parameter file values. More...
 
void SetPredatorInitialDensity ()
 Sets all grid cells in the predator grid with the appropriate initial density. More...
 
void GetParameterFileData (xercesc::DOMDocument *p_oDoc)
 Gets the data from the parameter file. More...
 
void DoModel ()
 Does the model for a given value of m_fTempSeeds and m_fTempPredators. More...
 
- Protected Member Functions inherited from clWorkerBase
void AssembleFileCode (int iFileType, int iFileVersion, char *cCode)
 Creates the proper identifying filecode for an XML file. More...
 

Protected Attributes

clGridmp_oSeedGrid
 Pointer to the "Dispersed Seeds" grid created by disperse behaviors. More...
 
clGridmp_oPredatorGrid
 Pointer to predator grid. More...
 
std::string m_sOutput
 File to which to write intermediate output, if desired. More...
 
double * mp_fMaxInstantaneousDeclineRate
 Max instantaneous rate at which predator abundance declines in the absense of food, number of predators per week - array index is 2 (# seasons) More...
 
double * mp_fDemographicEfficiency
 Population's demographic efficiency - array size is 2 (# seasons) More...
 
double * mp_fDensityDependentCoefficient
 Density-dependent coefficient - array size is 2 (# seasons) More...
 
double * mp_fForagingEfficiency
 Foraging efficiency - array size is # behavior species. More...
 
double m_fPredatorInitialDensity
 Predator initial density - number per square meter. More...
 
double * mp_fMaxIntakeRate
 Maximum seed intake rate - number of seeds per predator per day - array size is # behavior species. More...
 
double m_fProportionGerminating
 Proportion of seeds that germinate each week in the germination period - this must be a number between 0 and 1. More...
 
float m_fCellArea
 Area of a seed grid grid cell in square meters - when multiplied by the density of predators, produces the number in the cell. More...
 
float m_fOfftake
 Offtake rate - proportion of total seeds eaten, between 0 and 1. More...
 
float * mp_fTempSeeds
 A place to stash the number of seeds, to allow easy collaborative access to this data between functions. More...
 
float m_fTempPredators
 A place to stash the number of predators, to allow easy collaborative access to this data between functions. More...
 
int m_iNumWeeksToModel
 Number of weeks to run the model. More...
 
int m_iNumWeeksSeedFall
 Number of weeks of seed fall. More...
 
int m_iWeekGerminationStarts
 Week in which germination begins. More...
 
int m_iWeekSeason2Starts
 Week in which season 2 begins. More...
 
short int * mp_iSeedGridCode
 Data member codes for seed grid for number of seeds. More...
 
short int m_iNumPredsCode
 Data member in the predators grid. More...
 
bool m_bPreservePredatorDensities
 Whether or not to carry over mouse population densities. More...
 
bool m_bIsLinked
 Whether this is the linked (true) or standalone (false) version. More...
 
- Protected Attributes inherited from clBehaviorBase
short int m_iNumSpeciesTypeCombos
 How many type/species combos a behavior will act on. More...
 
short int m_iNumBehaviorSpecies
 How many distinct species are in the combo list - important for filling species-specific values from parameter file. More...
 
short int * mp_iWhatSpecies
 List of distinct species - for filling species-specific values from parameter file. More...
 
stcSpeciesTypeCombomp_whatSpeciesTypeCombos
 Array of species/type combos that the behavior will act on. More...
 
short int m_iNewTreeInts
 The number of new tree integer data members this behavior wants to add. More...
 
short int m_iNewTreeFloats
 The number of new tree float data members this behavior wants to add. More...
 
short int m_iNewTreeChars
 The number of new tree character data members this behavior wants to add. More...
 
short int m_iNewTreeBools
 The number of new tree boolean data members this behavior wants to add. More...
 
short int m_iBehaviorListNumber
 The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior. More...
 
float m_fVersionNumber
 Version number - this will be rounded to 2 digits after the decimal place. More...
 
std::string m_sXMLRoot
 XML root that encloses the parameters for this behavior. More...
 
float m_fMinimumVersionNumber
 Minimum version number - this behavior will run parameter data for a file marked between this number and the current version number, inclusive. More...
 
- Protected Attributes inherited from clWorkerBase
std::string m_sNameString
 If a behavior has registered a command line command with the sim manager, this allows it to be called. More...
 
clSimManagermp_oSimManager
 Pointer to the simulation manager object. More...
 
int * mp_iAllowedFileTypes
 List of the input file types this object can handle. More...
 
int m_iNumAllowedTypes
 Number of input file types this object can handle. More...
 

Detailed Description

Models functional response seed predation.

This runs as a model-within-a-model, in weekly timesteps for a year. It doesn't matter if the length of the overall model timestep is longer than a year; the amount of seeds is treated as a one-year pool, which produces the same result.

This behavior reduces the number of seeds available in the "Dispersed Seeds" grid. In each cell of that grid, there are a certain number of predators (calculated from the initial density of predators) which have the number of seeds present in that cell as a food source. Each species to which this behavior is applied has its own parameters controlling how it is predated.

Seed rain is evenly divided over a set number of timesteps (weeks). The predator population has as a food source the number of seeds added during the current week's rain (if the rain is going on) plus any leftover seeds from previous weeks which have not been consumed. Beginning at a certain week in the spring, the number of seeds available to the mice is further reduced by a certain percentage each week to simulate germination. Once germination begins, it continues until the predator model finishes running. In order to correctly calculate mouse consumption and ensure that the seeds which germinate are actually available later, this keeps track of the seeds consumed; it is this number which is subtracted from total seeds at the end.

The predator population is updated each timestep as a response to number of seeds consumed. The response parameters can be divided into two seasons.

Seed offtake for each week is calculated as

O = Σ IRs * N
where

Per capita seed offtake for each species is

IRs = cs(1 - e-(S*D)) * ps

where

The number of predators in each cell's population is calculated as

Nt = Nt-1 * ert-1


where

The instantaneous rate of change, r, can use different parameters for two user-defined seasons. r is calculated as

r = (a + d(IR) + g(N))/12

where

This behavior must be used in conjunction with a disperse behavior. If such a behavior is not present (and thus the "Dispersed Seeds" grid is not present), a fatal error will be thrown during setup.

This behavior can be used as an independent behavior where seeds are removed, or it can be linked to another behavior (i.e. the neighborhood seed predation behavior, clNeighborhoodSeedPredation) and used to calculate a whole-plot offtake amount without actually removing any seeds. It's possible to use both in a single run so separate parameters are used for each.

The namestring and parameter file call string are "FunctionalResponseSeedPredation" when used alone, or "LinkedFunctionalResponseSeedPredation" when linked with another behavior.

Copyright 2011 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)

Constructor & Destructor Documentation

◆ clFuncResponseSeedPredation()

clFuncResponseSeedPredation::clFuncResponseSeedPredation ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clFuncResponseSeedPredation()

clFuncResponseSeedPredation::~clFuncResponseSeedPredation ( )

Destructor.

Frees memory.

Member Function Documentation

◆ Action()

void clFuncResponseSeedPredation::Action ( )
virtual

Performs the model.

If predator densities are not to be preserved, then the predator grid is initialized with SetPredatorInitialDensity().

Reimplemented from clBehaviorBase.

◆ DoModel()

void clFuncResponseSeedPredation::DoModel ( )
protected

Does the model for a given value of m_fTempSeeds and m_fTempPredators.

◆ GetData()

void clFuncResponseSeedPredation::GetData ( xercesc::DOMDocument *  p_oDoc)
protectedvirtual

Reads in the parameter file values.

Parameters
p_oDocDOM tree of parsed input file.
Exceptions
modelErrif there is no such grid called "Dispersed Seeds", or if the "Dispersed Seeds" grid does not contain a valid return code for all behavior species.

Implements clWorkerBase.

◆ GetOfftakeRate()

float clFuncResponseSeedPredation::GetOfftakeRate ( )
inline

Get the amount of offtake.

Returns
Offtake, as a proportion of seeds eaten between 0 and 1.

◆ GetParameterFileData()

void clFuncResponseSeedPredation::GetParameterFileData ( xercesc::DOMDocument *  p_oDoc)
protected

Gets the data from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
Exceptions
modelErrif:
  • Number of weeks of seedfall is less than or equal to zero
  • Initial predator density is less than or equal to zero
  • Number of weeks to run the model is less than 0 or greater than 52
  • Week to start germination is less than 0 or greater than 52
  • Proportion germinating isn't between 0 and 1

◆ SetNameData()

void clFuncResponseSeedPredation::SetNameData ( std::string  sNameString)
virtual

Captures the behavior name passed from the parameter file.

This is useful since this class can produce different kinds of behaviors.

Parameters
sNameStringBehavior name from parameter file.

Reimplemented from clBehaviorBase.

◆ SetPredatorInitialDensity()

void clFuncResponseSeedPredation::SetPredatorInitialDensity ( )
protected

Sets all grid cells in the predator grid with the appropriate initial density.

Member Data Documentation

◆ m_bIsLinked

bool clFuncResponseSeedPredation::m_bIsLinked
protected

Whether this is the linked (true) or standalone (false) version.

◆ m_bPreservePredatorDensities

bool clFuncResponseSeedPredation::m_bPreservePredatorDensities
protected

Whether or not to carry over mouse population densities.

◆ m_fCellArea

float clFuncResponseSeedPredation::m_fCellArea
protected

Area of a seed grid grid cell in square meters - when multiplied by the density of predators, produces the number in the cell.

◆ m_fOfftake

float clFuncResponseSeedPredation::m_fOfftake
protected

Offtake rate - proportion of total seeds eaten, between 0 and 1.

Used if this is linked.

◆ m_fPredatorInitialDensity

double clFuncResponseSeedPredation::m_fPredatorInitialDensity
protected

Predator initial density - number per square meter.

◆ m_fProportionGerminating

double clFuncResponseSeedPredation::m_fProportionGerminating
protected

Proportion of seeds that germinate each week in the germination period - this must be a number between 0 and 1.

◆ m_fTempPredators

float clFuncResponseSeedPredation::m_fTempPredators
protected

A place to stash the number of predators, to allow easy collaborative access to this data between functions.

◆ m_iNumPredsCode

short int clFuncResponseSeedPredation::m_iNumPredsCode
protected

Data member in the predators grid.

◆ m_iNumWeeksSeedFall

int clFuncResponseSeedPredation::m_iNumWeeksSeedFall
protected

Number of weeks of seed fall.

◆ m_iNumWeeksToModel

int clFuncResponseSeedPredation::m_iNumWeeksToModel
protected

Number of weeks to run the model.

◆ m_iWeekGerminationStarts

int clFuncResponseSeedPredation::m_iWeekGerminationStarts
protected

Week in which germination begins.

◆ m_iWeekSeason2Starts

int clFuncResponseSeedPredation::m_iWeekSeason2Starts
protected

Week in which season 2 begins.

◆ m_sOutput

std::string clFuncResponseSeedPredation::m_sOutput
protected

File to which to write intermediate output, if desired.

◆ mp_fDemographicEfficiency

double* clFuncResponseSeedPredation::mp_fDemographicEfficiency
protected

Population's demographic efficiency - array size is 2 (# seasons)

◆ mp_fDensityDependentCoefficient

double* clFuncResponseSeedPredation::mp_fDensityDependentCoefficient
protected

Density-dependent coefficient - array size is 2 (# seasons)

◆ mp_fForagingEfficiency

double* clFuncResponseSeedPredation::mp_fForagingEfficiency
protected

Foraging efficiency - array size is # behavior species.

◆ mp_fMaxInstantaneousDeclineRate

double* clFuncResponseSeedPredation::mp_fMaxInstantaneousDeclineRate
protected

Max instantaneous rate at which predator abundance declines in the absense of food, number of predators per week - array index is 2 (# seasons)

◆ mp_fMaxIntakeRate

double* clFuncResponseSeedPredation::mp_fMaxIntakeRate
protected

Maximum seed intake rate - number of seeds per predator per day - array size is # behavior species.

◆ mp_fTempSeeds

float* clFuncResponseSeedPredation::mp_fTempSeeds
protected

A place to stash the number of seeds, to allow easy collaborative access to this data between functions.

Array size is # behavior species.

◆ mp_iSeedGridCode

short int* clFuncResponseSeedPredation::mp_iSeedGridCode
protected

Data member codes for seed grid for number of seeds.

Array size is # behavior species.

◆ mp_oPredatorGrid

clGrid* clFuncResponseSeedPredation::mp_oPredatorGrid
protected

Pointer to predator grid.

The name of this grid is "Seed Predators". Its grid cell resolution will match that of "Dispersed Seeds". It has one float data member - "num preds". It will accept maps if m_bPreservePredatorDensities = true and if they are of the right resolution.

◆ mp_oSeedGrid

clGrid* clFuncResponseSeedPredation::mp_oSeedGrid
protected

Pointer to the "Dispersed Seeds" grid created by disperse behaviors.


The documentation for this class was generated from the following file: