Create a MizerParams object using the extension template
Source:R/constructor.R
newExtensionTemplateParams.RdThis constructor demonstrates all five extension mechanisms available in mizer. Read the inline comments to understand what each block does and how to adapt it for your own extension.
Usage
newExtensionTemplateParams(
species_params,
season_amplitude = 0.2,
extra_food_coef = 0.1,
background_mort_coef = 0.05,
plankton_rate = 0.5,
...
)Arguments
- species_params
A data frame of species parameters passed directly to
mizer::newMultispeciesParams().- season_amplitude
Amplitude of the sinusoidal seasonal variation in the encounter rate, as a fraction of the base rate.
0disables the effect; the default0.2gives ±20 % variation over the year.- extra_food_coef
Coefficient for the allometric extra food source added via
setExtEncounter(). Set to0to disable.- background_mort_coef
Coefficient for background mortality added via
setExtMort(). Set to0to disable.- plankton_rate
Intrinsic growth rate of the plankton component (yr⁻¹). Higher values make the plankton respond faster to depletion.
- ...
Additional arguments passed to
mizer::newMultispeciesParams().
Details
Extension mechanisms demonstrated
setExtEncounter()/setExtMort()— add fixed, species × size arrays to encounter or mortality without any dynamics.project*S3 method — seasonal encounter multiplier implemented inprojectEncounter.mizerExtensionTemplate(), replacing thesetRateFunction()approach.setComponent()— a dynamical plankton component with its own time-evolution and an encounter contribution. Defined incomponent-functions.R.S3 generic overrides —
getBiomass.mizerExtensionTemplate()andgetBiomass.mizerExtensionTemplateSim()add the plankton biomass to the standard output.
Metadata-only vs. dispatching extensions
This constructor creates a dispatching extension: the returned object
has class "mizerExtensionTemplate" so that mizer's generic functions
dispatch to the S3 methods defined in this package. For a
metadata-only extension (one that does not override any generic), you
would omit the setClass() definition in mizerExtensionTemplate-class.R
and the coerceToExtensionClass() call at the end of this function. You
still call params@extensions <- getRegisteredExtensions() so the
dependency is recorded.