IBM
Individual-Based-Model for NetLogo: runs NetLogo's Java-code using a generalized reactor
Contents
Syntax
txNL23W = IBM (species, tT, tJX, X_0, V_X, h, t_R, t_max, tickRate, runNetLogo)
Description
Individual-Based-Model for NetLogo: Plots population trajectories in a generalised reactor for a selected species of cohorts that reproduce using a choice of 3 reproduction-buffer-handling rules: (1) as soon as buffer allows (2) at accumulation during period a_b {3} at accumulation during period t_R. Opens 2 html-pages in system browser to report species traits and IBM parameter settings, and plots 4 figures. The parameters of species are obtained either from allStat.mat, or from a cell-string {par, metaPar, metaData}. The 3 cells are obtained by loading a copy of results_my_pet.mat. Structure metaData is required to get species-name, T_typical and ecoCode, metaPar to get model. Sex allocation is randomised. If dioecy applies, the default (mean) sex-ratio is 1:1. Fertilisation is assumed to be sure. Males might differ in {p_Am} and/or E_Hp. The initial population is a single fertilized (female) egg from a well-fed mother. Starvation parameters are added to parameter structure, if not present. Like all parameters, default settings can be changed by changing structure par in cell-string input. If specified background hazards in 6th input are too high, the population goes extinct.
Input:
- species: character-string with name of entry or cell-string with structures: {metaData, metaPar, par, txtPar}
- tT: optional (nT,2)-array with time (d) and temperature (K) (default: T_typical); time between 0 (= start) and t_max If scalar, the temperature is assumed to be constant
- tJX: optional (nX,2)-array with time (d) and food supply (mod/d); time scaled between 0 (= start) and t_max If scalar, the food supply is assumed to be constant (default 100 times max ingestion rate)
- h: optional vector with dilution and background hazards for each stage (depending on the model) and boolean for thinning Default value for the std model: [h_X, h_B0b, h_Bbp, h_Bpi, thin] = [0 0 0 0 0]
- V_X: optional scalar with reactor volume (default 1000*V_m, where V_m is max struct volume)
- X_0: optional scalar with initial food density (default: 0)
- t_R: optional scalar for reproduction buffer handling rule with
- 0 for spawning as soon as reproduction buffer allows (default) - 1 for spawning after accumulation over an incubation period - time between spawning events
- t_max: optional scalar with simulation time (d, default 250*a_m, where a_m is mean life span)
- tickRate: optional scalar number of ticks per day
- runNetLogo: optional boolean for running NetLogo under Matlab in command-line (default 1)
Output:
- txNL23W: (n,7)-array with times and densities of scaled food, total number, length, squared length, cubed length, weight
- info: boolean with failure (0) of success (1)
Remarks
The function assumes that NetLogo (version 6.2.0 was tested) and java.exe has been installed and a path to them specified. Model DEBtool_M/popDyn/IBMnlogo/std.nlogo (and other DEB models) can also be loaded directly into NetLogo (via dropdown File, item Open), after running this function with runNetLogo = 0, to set parameters. The parameters in NetLogo are set by hitting setup in NetLogo's gui and can subsequently be modified. See, however, info in NetLogo for restrictions. Hitting setup initiates the output file txNL23W.txt.
If species is specified by string (rather than by data), its parameters are obtained from allStat.mat. The starvation parameters can only be set different from the default values by first input in the form of data and adding them to the par-structure. Empty inputs are allowed, default values are then used. The (first) html-page has traits at inidvidual level using the possibly modified parameter values. This function IBM only controls input/output; computations are done in NetLogo. Temperature changes during embryo-period are ignored; age at birth uses T(0); All embryo's start with f=1. Background hazards do not depend on temperature, ageing hazards do.
Be aware that the required computation time is roughly proportional to the number of individuals in the reactor, which can be very large, depending on the parameter settings. Progress can be monitored by inspecting output-file txNL23W.txt NetLogo uses Euler integration with stepsize 1/tickRate, which should be small relative to the state that changes fastest. For this reason, embryo dynamics is not included explicitly, but its states are "frozen" till birth.
Example of use
- If results_My_Pet.mat exists in current directory (where "My_Pet" is replaced by the name of some species, but don't replace "my_pet"): load('results_My_Pet.mat'); prt_my_pet_pop({metaData, metaPar, par}, [], T, f, destinationFolder)
- IBM('Torpedo_marmorata');
- IBM('Torpedo_marmorata', C2K(18));