Input, Output, and Settings

These functions are responsible for reading in all model configurations (passed by config file or commandline), administrating them during a run, and printing any output.

parameters.toml

This is the default configuration file for Persephone, containing all model parameters. The syntax is described here: https://toml.io/en/

DO NOT MODIFY THIS FILE FOR SIMULATION EXPERIMENTS! Instead, copy it to another directory, modify the copy, and then pass it to the model using the --config parameter.

input.jl

Persephone.getsettingsFunction
getsettings(configfile, seed=nothing)

Combines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values

source
Persephone.@paramMacro
@param(domainparam)

Return a configuration parameter from the global settings. The argument should be in the form <domain>.<parameter>, for example @param(core.outdir). Possible values for <domain> are core, nature, farm, or crop. For a full list of parameters, see src/parameters.toml.

Note that this macro only works in a context where the model object is available.

source

output.jl

Persephone.DataOutputType
DataOutput

A struct for organising model output. This is designed for text-based data output that is updated more or less regularly (e.g. population data in csv files). Submodels can register their own output functions using newdataoutput().

Struct fields: - filename: the name of the file to be created in the user-specified output directory - header: a string to be written to the start of the file as it is initialised - outputfunction: a function that takes a model object and returns a string to write to file - frequency: how often to call the output function (daily/monthly/yearly/end/never)

source
Persephone.newdataoutputMethod
newdataoutput(model, filename, header, outputfunction, frequency)

Create and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.

source
Persephone.outputdataMethod
outputdata(model)

Cycle through all registered data outputs and activate them according to their configured frequency.

source