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

Updated documentation

parent 092c7694
No related branches found
No related tags found
No related merge requests found
Showing
with 100 additions and 57 deletions
......@@ -9,33 +9,38 @@ echo "Building documentation..."
julia builddocs.jl
# Disabling the pretty-url feature of `makedocs` doesn't work, so we have to
#FIXME Disabling the pretty-url feature of `makedocs` doesn't work, so we have to
# revert it manually
echo "Postprocessing..."
sed -i -e "s/io\//io\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/developing\//developing\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/architecture\//architecture\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/species-dsl\//species-dsl\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/populations\//populations\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/nature\//nature\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/species\//species\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/crops\//crops\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/farm\//farm\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/simulation\//simulation\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/search\//search\/index.html/g" build/index.html build/search_index.js
sed -i -e "s/href=\"..\/\"/href=\"..\/index.html\"/g" build/*/index.html
sed -i -e "s/..\/io\//..\/io\/index.html/g" build/*/index.html
sed -i -e "s/..\/developing\//..\/developing\/index.html/g" build/*/index.html
sed -i -e "s/..\/architecture\//..\/architecture\/index.html/g" build/*/index.html
sed -i -e "s/..\/species-dsl\//..\/species-dsl\/index.html/g" build/*/index.html
sed -i -e "s/..\/nature\//..\/nature\/index.html/g" build/*/index.html
sed -i -e "s/..\/species\//..\/species\/index.html/g" build/*/index.html
sed -i -e "s/..\/crops\//..\/crops\/index.html/g" build/*/index.html
sed -i -e "s/..\/farm\//..\/farm\/index.html/g" build/*/index.html
sed -i -e "s/..\/simulation\//..\/simulation\/index.html/g" build/*/index.html
sed -i -e "s/..\/search\//..\/search\/index.html/g" build/*/index.html
# echo "Postprocessing..."
# sed -i -e "s/io\//io\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/odd\//odd\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/developing\//developing\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/architecture\//architecture\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/gis\//gis\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/species-dsl\//species-dsl\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/populations\//populations\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/nature\//nature\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/species\//species\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/crops\//crops\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/farm\//farm\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/simulation\//simulation\/index.html/g" build/index.html build/search_index.js
# sed -i -e "s/search\//search\/index.html/g" build/index.html build/search_index.js
# #FIXME this screws up the "view source" links and src file references
# sed -i -e "s/href=\"..\/\"/href=\"..\/index.html\"/g" build/*/index.html
# sed -i -e "s/..\/io\//..\/io\/index.html/g" build/*/index.html
# sed -i -e "s/..\/odd\//..\/odd\/index.html/g" build/*/index.html
# sed -i -e "s/..\/developing\//..\/developing\/index.html/g" build/*/index.html
# sed -i -e "s/..\/architecture\//..\/architecture\/index.html/g" build/*/index.html
# sed -i -e "s/..\/gis\//..\/gis\/index.html/g" build/*/index.html
# sed -i -e "s/..\/species-dsl\//..\/species-dsl\/index.html/g" build/*/index.html
# sed -i -e "s/..\/nature\//..\/nature\/index.html/g" build/*/index.html
# sed -i -e "s/..\/species\//..\/species\/index.html/g" build/*/index.html
# sed -i -e "s/..\/crops\//..\/crops\/index.html/g" build/*/index.html
# sed -i -e "s/..\/farm\//..\/farm\/index.html/g" build/*/index.html
# sed -i -e "s/..\/simulation\//..\/simulation\/index.html/g" build/*/index.html
# sed -i -e "s/..\/search\//..\/search\/index.html/g" build/*/index.html
echo "Done."
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Source code architecture · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li class="is-active"><a class="tocitem" href="architecture.html">Source code architecture</a><ul class="internal"><li class="toplevel"><a class="tocitem" href="#Model-components"><span>Model components</span></a></li><li class="toplevel"><a class="tocitem" href="#Important-implementation-details"><span>Important implementation details</span></a></li></ul></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developing</a></li><li class="is-active"><a href="architecture.html">Source code architecture</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="architecture.html">Source code architecture</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/architecture.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Source-code-architecture"><a class="docs-heading-anchor" href="#Source-code-architecture">Source code architecture</a><a id="Source-code-architecture-1"></a><a class="docs-heading-anchor-permalink" href="#Source-code-architecture" title="Permalink"></a></h1><h1 id="Model-components"><a class="docs-heading-anchor" href="#Model-components">Model components</a><a id="Model-components-1"></a><a class="docs-heading-anchor-permalink" href="#Model-components" title="Permalink"></a></h1><p>Persephone is divided into four components, three of which are semi-independent submodels:</p><ol><li><p><code>core</code>: This is the foundation of the model software, which sets up and executes simulation runs. It also reads in the configuration file and landscape maps, and provides data output functionality.</p></li><li><p><code>nature</code>: This is an individual-based model of species in agricultural landscapes. It defines the <a href="nature.html#Persephone.Animal"><code>Animal</code></a> agent type, and a set of macros that can be used to rapidly create new species. It also includes ecological process functions that are useful for all species.</p></li><li><p><code>farm</code>: This is an agent-based model of farmer decision making. It is not yet implemented, but will provide the <a href="farm.html#Persephone.Farmer"><code>Farmer</code></a> agent type.</p></li><li><p><code>crop</code>: This is a mathematical growth model for various crops. It is not yet implemented, but already provides the agent type <a href="crops.html#Persephone.FarmPlot"><code>FarmPlot</code></a>, representing one field and its associated extent and crop type.</p></li></ol><p>Conceptually, <code>core</code> provides functionality that is needed by all of the submodels. Decisions made by <code>Farmer</code>s affect the <code>FarmPlot</code>s they own, and (directly or indirectly) the <code>Animal</code>s in the model landscape.</p><h1 id="Important-implementation-details"><a class="docs-heading-anchor" href="#Important-implementation-details">Important implementation details</a><a id="Important-implementation-details-1"></a><a class="docs-heading-anchor-permalink" href="#Important-implementation-details" title="Permalink"></a></h1><ol><li><p><strong>The <code>model</code> object:</strong> A cursory reading of the source code will quickly show that most functions take an <code>AgentBaseModel</code> object as one of their arguments. This is the key data structure of <a href="https://juliadynamics.github.io/Agents.jl/stable/tutorial/#.-The-model-1">Agents.jl</a>, and holds all state that is in any way relevant to a simulation run. (Persephone has a strict &quot;no global state&quot; policy to avoid state-dependent bugs and allow parallelisation.) The model object gives access to all agent instances (via <code>model[id]</code>, where <code>id</code> is the unique identifier of this agent). It also stores the configuration (<code>model.settings</code>), the landscape (<code>model.landscape</code>, a matrix of <a href="simulation.html#Persephone.Pixel"><code>Pixel</code></a> objects that store the local land cover, amongst other things), and the current simulation date (<code>model.date</code>).</p></li><li><p><strong>Model configuration/the <a href="io.html#Persephone.@param-Tuple{Any}"><code>@param</code></a> macro:</strong> The model is configured via a <a href="https://toml.io/en/">TOML</a> file, the default version of which is at <code>src/parameters.toml</code>. An individual run can be configured using a user-defined configuration file, commandline arguments, or function calls (when Persephone is used as a package rather than an application). During a model run, the <code>@param(parameter)</code> macro can be used as a short-hand for <code>model.settings[&quot;parameter&quot;]</code>. Note that parameter names are prepended with the name of the component they are associated with. For example, the <code>outdir</code> parameter belongs to the <code>[core]</code> section of the TOML file, and must therefore be referenced as <code>@param(core.outdir)</code>. (See <code>src/core/input.jl</code> for details.)</p></li><li><p><strong>Output data:</strong> Persephone can output model data into text files with a specified frequency (daily, monthly, yearly, or at the simulation end). Submodels can use <a href="@ref"><code>newdataoutput!</code></a> to plug into this system. For an example of how to use this, see <code>src/nature/ecologicaldata.jl</code>. (See <code>src/core/output.jl</code> for details.)</p></li><li><p><strong>Farm events:</strong> The <a href="simulation.html#Persephone.FarmEvent"><code>FarmEvent</code></a> struct is used to communicate farming-related events between submodels. An event can be triggered with <code>createevent!()</code> and affects all pixels within a <code>FarmPlot</code>. (See <code>src/core/landscape.jl</code> for details.)</p></li><li><p><strong>Random numbers and logging:</strong> By default in Julia, the random number generator (RNG) and the system logger are two globally accessible variables. As Persephone needs to avoid all global data (as this would interfere with parallel runs), the <code>model</code> object stores a local logger and a local RNG. <em>Whenever you need to use a random number, you must use the <code>model.rng</code>! The easiest way to do this is with the <a href="io.html#Persephone.@rand-Tuple"><code>@rand</code></a> and <a href="io.html#Persephone.@shuffle!-Tuple{Any}"><code>@shuffle!</code></a> macros.</em> The local logger generally does not change the way the model uses <a href="https://docs.julialang.org/en/v1/stdlib/Logging/">log statements</a>, this is only important in some functions in <code>src/core/simulation.jl</code>.</p></li><li><p><strong>Working with agents:</strong> For more information about working with agent objects, see the <a href="https://juliadynamics.github.io/Agents.jl/stable/api/">Agents.jl API</a>.</p></li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="developing.html">« Developing Persephone</a><a class="docs-footer-nextpage" href="gis.html">GIS data »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Source code architecture · Persephone</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../index.html"><img src="../assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../index.html">Persephone</a></span></div><form class="docs-search" action="../search/index.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../index.html">Introduction</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="../developing/index.html">Developing Persephone</a></li><li class="is-active"><a class="tocitem" href>Source code architecture</a><ul class="internal"><li class="toplevel"><a class="tocitem" href="#Model-components"><span>Model components</span></a></li><li class="toplevel"><a class="tocitem" href="#Important-implementation-details"><span>Important implementation details</span></a></li></ul></li><li><a class="tocitem" href="../species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="../simulation/index.html">Simulation</a></li><li><a class="tocitem" href="../io/index.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="../nature/index.html">Nature</a></li><li><a class="tocitem" href="../species/index.html">Species</a></li></ul></li><li><a class="tocitem" href="../crops/index.html">Crop submodel</a></li><li><a class="tocitem" href="../farm/index.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developing</a></li><li class="is-active"><a href>Source code architecture</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Source code architecture</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/blob/master/docs/src/architecture.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Source-code-architecture"><a class="docs-heading-anchor" href="#Source-code-architecture">Source code architecture</a><a id="Source-code-architecture-1"></a><a class="docs-heading-anchor-permalink" href="#Source-code-architecture" title="Permalink"></a></h1><p><em>TODO</em></p><h1 id="Model-components"><a class="docs-heading-anchor" href="#Model-components">Model components</a><a id="Model-components-1"></a><a class="docs-heading-anchor-permalink" href="#Model-components" title="Permalink"></a></h1><ol><li><p>core</p></li><li><p>farm</p></li><li><p>nature</p></li><li><p>crop</p></li></ol><h1 id="Important-implementation-details"><a class="docs-heading-anchor" href="#Important-implementation-details">Important implementation details</a><a id="Important-implementation-details-1"></a><a class="docs-heading-anchor-permalink" href="#Important-implementation-details" title="Permalink"></a></h1><ol><li><p>configuration/<code>param()</code></p></li><li><p>output data</p></li><li><p>Agents.jl</p></li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../developing/index.html">« Developing Persephone</a><a class="docs-footer-nextpage" href="../species-dsl/index.html">Defining new species »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Crop submodel · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li class="is-active"><a class="tocitem" href="crops.html">Crop submodel</a><ul class="internal"><li><a class="tocitem" href="#crops.jl"><span>crops.jl</span></a></li></ul></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="crops.html">Crop submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="crops.html">Crop submodel</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/crops.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Crop-submodel"><a class="docs-heading-anchor" href="#Crop-submodel">Crop submodel</a><a id="Crop-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Crop-submodel" title="Permalink"></a></h1><p>Eventually, Persephone will include a full-blown crop-growth model (an adaptation of AquaCrop, created by the FAO). At the moment, we are only working with a very basic mock-up.</p><h2 id="crops.jl"><a class="docs-heading-anchor" href="#crops.jl">crops.jl</a><a id="crops.jl-1"></a><a class="docs-heading-anchor-permalink" href="#crops.jl" title="Permalink"></a></h2><p>This includes the types and functions needed for all crop growth model, which are also referenced by the other submodels.</p><article class="docstring"><header><a class="docstring-binding" id="Persephone.CropType" href="#Persephone.CropType"><code>Persephone.CropType</code></a><span class="docstring-category">Type</span></header><section><div><p>The crop types simulated by the model</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L6">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.FarmPlot" href="#Persephone.FarmPlot"><code>Persephone.FarmPlot</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmPlot</code></pre><p>This represents one field, i.e. a collection of pixels with the same management. This is the spatial unit with which the crop growth model and the farm model work.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L11-L16">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.averagefieldsize-Tuple{Agents.AgentBasedModel}" href="#Persephone.averagefieldsize-Tuple{Agents.AgentBasedModel}"><code>Persephone.averagefieldsize</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">averagefieldsize(model)</code></pre><p>Calculate the average field size in hectares for the model landscape.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L65-L69">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.cropheight-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.cropheight-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.cropheight</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropheight(model, position)</code></pre><p>Return the height of the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L90-L95">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.croptype-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.croptype-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.croptype</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">croptype(model, position)</code></pre><p>Return the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L80-L84">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.initfields!-Tuple{Agents.AgentBasedModel}" href="#Persephone.initfields!-Tuple{Agents.AgentBasedModel}"><code>Persephone.initfields!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfields!(model)</code></pre><p>Initialise the model with its farm plots.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L34-L38">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.stepagent!-Tuple{FarmPlot, Agents.AgentBasedModel}" href="#Persephone.stepagent!-Tuple{FarmPlot, Agents.AgentBasedModel}"><code>Persephone.stepagent!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmplot, model)</code></pre><p>Update a farm plot by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/crop/crops.jl#L25-L29">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="species.html">« Species</a><a class="docs-footer-nextpage" href="farm.html">Farm submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Crop submodel · Persephone</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../index.html"><img src="../assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../index.html">Persephone</a></span></div><form class="docs-search" action="../search/index.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../index.html">Introduction</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="../developing/index.html">Developing Persephone</a></li><li><a class="tocitem" href="../architecture/index.html">Source code architecture</a></li><li><a class="tocitem" href="../species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="../simulation/index.html">Simulation</a></li><li><a class="tocitem" href="../io/index.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="../nature/index.html">Nature</a></li><li><a class="tocitem" href="../species/index.html">Species</a></li></ul></li><li class="is-active"><a class="tocitem" href>Crop submodel</a><ul class="internal"><li><a class="tocitem" href="#crops.jl"><span>crops.jl</span></a></li></ul></li><li><a class="tocitem" href="../farm/index.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Crop submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Crop submodel</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/blob/master/docs/src/crops.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Crop-submodel"><a class="docs-heading-anchor" href="#Crop-submodel">Crop submodel</a><a id="Crop-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Crop-submodel" title="Permalink"></a></h1><p>Eventually, Persephone will include a full-blown crop-growth model (an adaptation of AquaCrop, created by the FAO). At the moment, we are only working with a very basic mock-up.</p><h2 id="crops.jl"><a class="docs-heading-anchor" href="#crops.jl">crops.jl</a><a id="crops.jl-1"></a><a class="docs-heading-anchor-permalink" href="#crops.jl" title="Permalink"></a></h2><p>This includes the types and functions needed for all crop growth model, which are also referenced by the other submodels.</p><article class="docstring"><header><a class="docstring-binding" id="Persephone.CropType" href="#Persephone.CropType"><code>Persephone.CropType</code></a><span class="docstring-category">Type</span></header><section><div><p>The crop types simulated by the model</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L6">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.FarmPlot" href="#Persephone.FarmPlot"><code>Persephone.FarmPlot</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmPlot</code></pre><p>This represents one field, i.e. a collection of pixels with the same management. This is the spatial unit with which the crop growth model and the farm model work.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L11-L16">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.averagefieldsize-Tuple{Agents.AgentBasedModel}" href="#Persephone.averagefieldsize-Tuple{Agents.AgentBasedModel}"><code>Persephone.averagefieldsize</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">averagefieldsize(model)</code></pre><p>Calculate the average field size in hectares for the model landscape.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L65-L69">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.cropheight-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.cropheight-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.cropheight</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropheight(model, position)</code></pre><p>Return the height of the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L90-L95">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.croptype-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.croptype-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.croptype</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">croptype(model, position)</code></pre><p>Return the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L80-L84">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.initfields!-Tuple{Agents.AgentBasedModel}" href="#Persephone.initfields!-Tuple{Agents.AgentBasedModel}"><code>Persephone.initfields!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfields!(model)</code></pre><p>Initialise the model with its farm plots.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L34-L38">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.stepagent!-Tuple{FarmPlot, Agents.AgentBasedModel}" href="#Persephone.stepagent!-Tuple{FarmPlot, Agents.AgentBasedModel}"><code>Persephone.stepagent!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmplot, model)</code></pre><p>Update a farm plot by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/crop/crops.jl#L25-L29">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../species/index.html">« Species</a><a class="docs-footer-nextpage" href="../farm/index.html">Farm submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developing Persephone · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li class="is-active"><a class="tocitem" href="developing.html">Developing Persephone</a><ul class="internal"><li><a class="tocitem" href="#Workflow"><span>Workflow</span></a></li><li><a class="tocitem" href="#Agents.jl"><span>Agents.jl</span></a></li><li><a class="tocitem" href="#Julia-editors"><span>Julia editors</span></a></li></ul></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developing</a></li><li class="is-active"><a href="developing.html">Developing Persephone</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="developing.html">Developing Persephone</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/developing.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Developing-Persephone"><a class="docs-heading-anchor" href="#Developing-Persephone">Developing Persephone</a><a id="Developing-Persephone-1"></a><a class="docs-heading-anchor-permalink" href="#Developing-Persephone" title="Permalink"></a></h1><h2 id="Workflow"><a class="docs-heading-anchor" href="#Workflow">Workflow</a><a id="Workflow-1"></a><a class="docs-heading-anchor-permalink" href="#Workflow" title="Permalink"></a></h2><ol><li><p>Pull the current development version from the master branch on Gitlab: <a href="https://git.idiv.de/xo30xoqa/persephone">https://git.idiv.de/xo30xoqa/persephone</a>.</p></li><li><p>If you are working on a new feature, create a new branch to avoid breaking the <code>master</code> branch. (The <code>master</code> branch should always be in a runnable and (as far as possible) error-free state.)</p></li><li><p>Implement your changes.</p></li><li><p>Run <code>example.sh</code> to make sure the model executes without crashing. Also run the test suite (<code>cd test; julia runtests.jl</code>).</p></li><li><p>Commit your work frequently, and try to keep each commit small. Don&#39;t forget to add relevant tests to the test suite.</p></li><li><p>Once your satisfied with your work, do another pull/merge from the <code>master</code> branch in case somebody else changed the branch in the meantime. Then merge your work into <code>master</code> and push to the Gitlab server.</p></li><li><p>Repeat :-)</p></li></ol><p>The Gitlab issue tracker can be used to create, discuss, and assign tasks, as well as to monitor progress towards milestones/releases. Once we have a first release, we will start using <a href="https://semver.org/">semantic versioning</a>.</p><h2 id="Agents.jl"><a class="docs-heading-anchor" href="#Agents.jl">Agents.jl</a><a id="Agents.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Agents.jl" title="Permalink"></a></h2><p>Our model uses <a href="https://juliadynamics.github.io/Agents.jl/stable/">Agents.jl</a> as a framework. Their <a href="https://github.com/JuliaDynamics/Agents.jl">repository</a> can be used to inspect the source code or submit bug reports (the authors are quick to respond). Questions can be asked at the <a href="https://discourse.julialang.org/c/domain/models/21">Julia Discourse forum</a>.</p><p><em>Tutorial on collaborating on Julia packages: <a href="https://www.matecdev.com/posts/julia-package-collaboration.html">https://www.matecdev.com/posts/julia-package-collaboration.html</a>.</em></p><h2 id="Julia-editors"><a class="docs-heading-anchor" href="#Julia-editors">Julia editors</a><a id="Julia-editors-1"></a><a class="docs-heading-anchor-permalink" href="#Julia-editors" title="Permalink"></a></h2><h3 id="Emacs"><a class="docs-heading-anchor" href="#Emacs">Emacs</a><a id="Emacs-1"></a><a class="docs-heading-anchor-permalink" href="#Emacs" title="Permalink"></a></h3><p>There are a couple of addons that make working with Julia much nicer in Emacs:</p><ol><li><p><code>julia-mode</code> gives syntax highlighting. Install with <code>M-x package-install julia-mode</code>.</p></li><li><p><a href="https://github.com/gcv/julia-snail"><code>julia-snail</code></a> provides IDE-like features, especially a fully-functional REPL and the ability to evaluate code straight from inside a buffer. Note that the installation can be somewhat tricky. You first need to manually install all the dependencies of its dependency <a href="https://github.com/akermu/emacs-libvterm">vterm</a>, then install vterm itself with <code>M-x package-install vterm</code>, <em>before</em> you can do <code>M-x package-install julia-snail</code>. Then add it to your <code>init.el</code> with <code>(require &#39;julia-snail)</code> and <code>(add-hook &#39;julia-mode-hook #&#39;julia-snail-mode)</code>.</p></li><li><p><a href="http://company-mode.github.io/"><code>company-mode</code></a> integrates with Snail to give code completion. Install with <code>M-x package-install company</code>, then add <code>(add-hook &#39;julia-mode-hook #&#39;company-mode)</code> and <code>(global-set-key (kbd &quot;C-&lt;tab&gt;&quot;) &#39;company-complete)</code> to your <code>init.el</code>.</p></li><li><p><a href="https://magit.vc/"><code>magit</code></a> is a great git interface for Emacs. Install with <code>M-x package-install magit</code> and add <code>(global-set-key (kbd &quot;C-x g&quot;) &#39;magit-status)</code> to your <code>init.el</code>.</p></li></ol><h3 id="VSCode"><a class="docs-heading-anchor" href="#VSCode">VSCode</a><a id="VSCode-1"></a><a class="docs-heading-anchor-permalink" href="#VSCode" title="Permalink"></a></h3><p>See <a href="https://www.julia-vscode.org/">here</a>.</p><p><em>TODO: add more detail.</em></p><h3 id="Other-useful-stuff"><a class="docs-heading-anchor" href="#Other-useful-stuff">Other useful stuff</a><a id="Other-useful-stuff-1"></a><a class="docs-heading-anchor-permalink" href="#Other-useful-stuff" title="Permalink"></a></h3><ol><li><p><a href="https://timholy.github.io/Revise.jl/stable/"><code>Revise.jl</code></a> allows one to reload code without restarting the Julia interpreter. Get it with <code>Pkg.add(&quot;Revise&quot;)</code>, then add <code>using Revise</code> to <code>.julia/config/startup.jl</code> to have it automatically available.</p></li><li><p><a href="https://github.com/MichaelMure/git-bug"><code>git-bug</code></a> is a commandline bug tracker that integrates directly with git. It can also be used as a local interface to Gitlab issues. To install on Linux, download the <a href="https://github.com/MichaelMure/git-bug/releases/tag/v0.8.0">binary</a>, copy it to <code>/usr/local/bin/git-bug</code>, and set it as executable with <code>chmod +x /usr/local/bin/git-bug</code>. To set up Gitlab integration, run <code>git bug bridge configure</code> from within the relevant repository.</p></li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="odd.html">« Overview, Design, Details (ODD)</a><a class="docs-footer-nextpage" href="architecture.html">Source code architecture »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developing Persephone · Persephone</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../index.html"><img src="../assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../index.html">Persephone</a></span></div><form class="docs-search" action="../search/index.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../index.html">Introduction</a></li><li><span class="tocitem">Developing</span><ul><li class="is-active"><a class="tocitem" href>Developing Persephone</a><ul class="internal"><li><a class="tocitem" href="#Workflow"><span>Workflow</span></a></li><li><a class="tocitem" href="#Agents.jl"><span>Agents.jl</span></a></li><li><a class="tocitem" href="#Julia-editors"><span>Julia editors</span></a></li></ul></li><li><a class="tocitem" href="../architecture/index.html">Source code architecture</a></li><li><a class="tocitem" href="../species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="../simulation/index.html">Simulation</a></li><li><a class="tocitem" href="../io/index.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="../nature/index.html">Nature</a></li><li><a class="tocitem" href="../species/index.html">Species</a></li></ul></li><li><a class="tocitem" href="../crops/index.html">Crop submodel</a></li><li><a class="tocitem" href="../farm/index.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developing</a></li><li class="is-active"><a href>Developing Persephone</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Developing Persephone</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/blob/master/docs/src/developing.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Developing-Persephone"><a class="docs-heading-anchor" href="#Developing-Persephone">Developing Persephone</a><a id="Developing-Persephone-1"></a><a class="docs-heading-anchor-permalink" href="#Developing-Persephone" title="Permalink"></a></h1><h2 id="Workflow"><a class="docs-heading-anchor" href="#Workflow">Workflow</a><a id="Workflow-1"></a><a class="docs-heading-anchor-permalink" href="#Workflow" title="Permalink"></a></h2><ol><li><p>Pull the current development version from the master branch on Gitlab: <a href="https://git.idiv.de/xo30xoqa/persephone">https://git.idiv.de/xo30xoqa/persephone</a>.</p></li><li><p>If you are working on a new feature, create a new branch to avoid breaking the <code>master</code> branch. (The <code>master</code> branch should always be in a runnable and (as far as possible) error-free state.)</p></li><li><p>Implement your changes.</p></li><li><p>Run <code>run.sh</code> to make sure the model executes without crashing. Also run the test suite (<code>cd test; julia runtests.jl</code>).</p></li><li><p>Commit your work frequently, and try to keep each commit small. Don&#39;t forget to add relevant tests to the test suite.</p></li><li><p>Once your satisfied with your work, do another pull/merge from the <code>master</code> branch in case somebody else changed the branch in the meantime. Then merge your work into <code>master</code> and push to the Gitlab server.</p></li><li><p>Repeat :-)</p></li></ol><h2 id="Agents.jl"><a class="docs-heading-anchor" href="#Agents.jl">Agents.jl</a><a id="Agents.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Agents.jl" title="Permalink"></a></h2><p>Our model uses <a href="https://juliadynamics.github.io/Agents.jl/stable/">Agents.jl</a> as a framework. Their <a href="https://github.com/JuliaDynamics/Agents.jl">repository</a> can be used to inspect the source code or submit bug reports (the authors are quick to respond). Questions can be asked at the <a href="https://discourse.julialang.org/c/domain/models/21">Julia Discourse forum</a>.</p><p><em>Tutorial on collaborating on Julia packages: <a href="https://www.matecdev.com/posts/julia-package-collaboration.html">https://www.matecdev.com/posts/julia-package-collaboration.html</a>.</em></p><h2 id="Julia-editors"><a class="docs-heading-anchor" href="#Julia-editors">Julia editors</a><a id="Julia-editors-1"></a><a class="docs-heading-anchor-permalink" href="#Julia-editors" title="Permalink"></a></h2><h3 id="Emacs"><a class="docs-heading-anchor" href="#Emacs">Emacs</a><a id="Emacs-1"></a><a class="docs-heading-anchor-permalink" href="#Emacs" title="Permalink"></a></h3><p>There are a couple of addons that make working with Julia much nicer in Emacs:</p><ol><li><p><code>julia-mode</code> gives syntax highlighting. Install with <code>M-x package-install julia-mode</code>.</p></li><li><p><a href="https://github.com/gcv/julia-snail"><code>julia-snail</code></a> provides IDE-like features, especially a fully-functional REPL and the ability to evaluate code straight from inside a buffer. Note that the installation can be somewhat tricky. You first need to manually install all the dependencies of its dependency <a href="https://github.com/akermu/emacs-libvterm">vterm</a>, then install vterm itself with <code>M-x package-install vterm</code>, <em>before</em> you can do <code>M-x package-install julia-snail</code>. Then add it to your <code>init.el</code> with <code>(require &#39;julia-snail)</code> and <code>(add-hook &#39;julia-mode-hook #&#39;julia-snail-mode)</code>.</p></li><li><p><a href="http://company-mode.github.io/"><code>company-mode</code></a> integrates with Snail to give code completion. Install with <code>M-x package-install company</code>, then add <code>(add-hook &#39;julia-mode-hook #&#39;company-mode)</code> and <code>(global-set-key (kbd &quot;C-&lt;tab&gt;&quot;) &#39;company-complete)</code> to your <code>init.el</code>.</p></li><li><p><a href="https://magit.vc/"><code>magit</code></a> is a great git interface for Emacs. Install with <code>M-x package-install magit</code> and add <code>(global-set-key (kbd &quot;C-x g&quot;) &#39;magit-status)</code> to your <code>init.el</code>.</p></li></ol><h3 id="VSCode"><a class="docs-heading-anchor" href="#VSCode">VSCode</a><a id="VSCode-1"></a><a class="docs-heading-anchor-permalink" href="#VSCode" title="Permalink"></a></h3><p>See <a href="https://www.julia-vscode.org/">here</a>.</p><p><em>TODO: add more detail.</em></p><h3 id="Other-useful-stuff"><a class="docs-heading-anchor" href="#Other-useful-stuff">Other useful stuff</a><a id="Other-useful-stuff-1"></a><a class="docs-heading-anchor-permalink" href="#Other-useful-stuff" title="Permalink"></a></h3><ol><li><p><a href="https://timholy.github.io/Revise.jl/stable/"><code>Revise.jl</code></a> allows one to reload code without restarting the Julia interpreter. Get it with <code>Pkg.add(&quot;Revise&quot;)</code>, then add <code>using Revise</code> to <code>.julia/config/startup.jl</code> to have it automatically available.</p></li><li><p><a href="https://github.com/MichaelMure/git-bug"><code>git-bug</code></a> is a commandline bug tracker that integrates directly with git. It can also be used as a local interface to Gitlab issues. To install on Linux, download the <a href="https://github.com/MichaelMure/git-bug/releases/tag/v0.8.0">binary</a>, copy it to <code>/usr/local/bin/git-bug</code>, and set it as executable with <code>chmod +x /usr/local/bin/git-bug</code>. To set up Gitlab integration, run <code>git bug bridge configure</code> from within the relevant repository.</p></li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../index.html">« Introduction</a><a class="docs-footer-nextpage" href="../architecture/index.html">Source code architecture »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Farm submodel · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li class="is-active"><a class="tocitem" href="farm.html">Farm submodel</a><ul class="internal"><li><a class="tocitem" href="#farm.jl"><span>farm.jl</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="farm.html">Farm submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="farm.html">Farm submodel</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/farm.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Farm-submodel"><a class="docs-heading-anchor" href="#Farm-submodel">Farm submodel</a><a id="Farm-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-submodel" title="Permalink"></a></h1><p>Eventually, Persephone will include multiple farm-decision submodels. At the moment, we are only working with a very basic mock-up.</p><h2 id="farm.jl"><a class="docs-heading-anchor" href="#farm.jl">farm.jl</a><a id="farm.jl-1"></a><a class="docs-heading-anchor-permalink" href="#farm.jl" title="Permalink"></a></h2><p>This file is responsible for managing the farm module(s).</p><article class="docstring"><header><a class="docstring-binding" id="Persephone.Farmer" href="#Persephone.Farmer"><code>Persephone.Farmer</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Farmer</code></pre><p>This is the agent type for the farm ABM. (Not yet implemented.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/farm/farm.jl#L6-L10">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.initfarms!-Tuple{Agents.AgentBasedModel}" href="#Persephone.initfarms!-Tuple{Agents.AgentBasedModel}"><code>Persephone.initfarms!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfarms!(model)</code></pre><p>Initialise the model with a set of farm agents.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/farm/farm.jl#L24-L28">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.stepagent!-Tuple{Farmer, Agents.AgentBasedModel}" href="#Persephone.stepagent!-Tuple{Farmer, Agents.AgentBasedModel}"><code>Persephone.stepagent!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmer, model)</code></pre><p>Update a farmer by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/farm/farm.jl#L15-L19">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="crops.html">« Crop submodel</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Farm submodel · Persephone</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../index.html"><img src="../assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../index.html">Persephone</a></span></div><form class="docs-search" action="../search/index.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../index.html">Introduction</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="../developing/index.html">Developing Persephone</a></li><li><a class="tocitem" href="../architecture/index.html">Source code architecture</a></li><li><a class="tocitem" href="../species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="../simulation/index.html">Simulation</a></li><li><a class="tocitem" href="../io/index.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="../nature/index.html">Nature</a></li><li><a class="tocitem" href="../species/index.html">Species</a></li></ul></li><li><a class="tocitem" href="../crops/index.html">Crop submodel</a></li><li class="is-active"><a class="tocitem" href>Farm submodel</a><ul class="internal"><li><a class="tocitem" href="#farm.jl"><span>farm.jl</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Farm submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Farm submodel</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/blob/master/docs/src/farm.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Farm-submodel"><a class="docs-heading-anchor" href="#Farm-submodel">Farm submodel</a><a id="Farm-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-submodel" title="Permalink"></a></h1><p>Eventually, Persephone will include multiple farm-decision submodels. At the moment, we are only working with a very basic mock-up.</p><h2 id="farm.jl"><a class="docs-heading-anchor" href="#farm.jl">farm.jl</a><a id="farm.jl-1"></a><a class="docs-heading-anchor-permalink" href="#farm.jl" title="Permalink"></a></h2><p>This file is responsible for managing the farm module(s).</p><article class="docstring"><header><a class="docstring-binding" id="Persephone.initfarms!-Tuple{Agents.AgentBasedModel}" href="#Persephone.initfarms!-Tuple{Agents.AgentBasedModel}"><code>Persephone.initfarms!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfarms!(model)</code></pre><p>Initialise the model with a set of farm agents.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/s../farm/index.htmlfarm.jl#L19-L23">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.stepagent!-Tuple{Farmer, Agents.AgentBasedModel}" href="#Persephone.stepagent!-Tuple{Farmer, Agents.AgentBasedModel}"><code>Persephone.stepagent!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmer, model)</code></pre><p>Update a farmer by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/s../farm/index.htmlfarm.jl#L10-L14">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../crops/index.html">« Crop submodel</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>GIS data · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li class="is-active"><a class="tocitem" href="gis.html">GIS data</a><ul class="internal"><li><a class="tocitem" href="#Land-cover-maps"><span>Land cover maps</span></a></li><li><a class="tocitem" href="#Field-ID-maps"><span>Field ID maps</span></a></li></ul></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developing</a></li><li class="is-active"><a href="gis.html">GIS data</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="gis.html">GIS data</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/gis.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="GIS-data"><a class="docs-heading-anchor" href="#GIS-data">GIS data</a><a id="GIS-data-1"></a><a class="docs-heading-anchor-permalink" href="#GIS-data" title="Permalink"></a></h1><p>Persephone currently requires two separate map input files: one for land cover, the other for field geometry. This documents describe how to obtain and process the data needed for each of these.</p><h2 id="Land-cover-maps"><a class="docs-heading-anchor" href="#Land-cover-maps">Land cover maps</a><a id="Land-cover-maps-1"></a><a class="docs-heading-anchor-permalink" href="#Land-cover-maps" title="Permalink"></a></h2><p>Land cover maps for Germany at 10m resolution can be obtained from <a href="https://data.mundialis.de/geonetwork/srv/eng/catalog.search#/metadata/9246503f-6adf-460b-a31e-73a649182d07">Mundialis</a>. These are generated annually from Sentinel data and comprise the following land cover classes:</p><pre><code class="nohighlight hljs">10: forest
20: low vegetation
30: water
40: built-up
50: bare soil
60: agriculture</code></pre><p>To create a Persephone map input file, you need to crop the national Mundialis map to the extent that you want to simulate (suggestion: approx. 10x10km is a reasonable size).</p><p>To do so, download the Mundialis map and import it into QGIS. Then create a new vector layer and create a rectangle feature to delimit the extent of your region. Then go to <code>Raster -&gt; Extraction -&gt; Clip Raster by Extent</code>. Select the Mundialis map as the input layer, set the clipping extent by choosing your region vector layer under <code>Calculate from Layer</code> and specify the output file name before clicking <code>Run</code>. This will generate a TIF file that you can pass to Persephone as the <code>landcovermap</code> parameter.</p><h2 id="Field-ID-maps"><a class="docs-heading-anchor" href="#Field-ID-maps">Field ID maps</a><a id="Field-ID-maps-1"></a><a class="docs-heading-anchor-permalink" href="#Field-ID-maps" title="Permalink"></a></h2><p>In addition to the land cover data explained above, Persephone also needs information about agricultural field boundaries in order to assign these to the farming agents. Unfortunately, getting this is rather more complicated.</p><p>In the EU, every country runs a Land Parcel Information System (LPIS) to administer CAP payments. In Germany, this is called InVeKoS and is run by the Länder. For example, you can view and download the InVeKoS data for Thüringen <a href="https://thueringenviewer.thueringen.de/thviewer/invekos.html">here</a>. This gives you a vector layer which can be loaded into QGIS. However, it needs to be converted to a raster layer and cropped to your region extent before it can be used in Persephone.</p><p>The first thing to do is to make sure that the vector layer has a numeric (!) field with a unique identifier for each field block (check the attribute table). The Thüringen data has the FBI (&quot;Feldblockident&quot;) field, but this is a string value and therefore not usable by the rasteriser. So, we set the vector layer to edit mode, open the field calculator, enter the information for a new field (call it &quot;FID&quot; and set it to a 32-bit integer), and enter <code>@row_number</code> in the expression field. Then save the layer and close the calculator.</p><p>Secondly, you need to filter out all non-field/non-grassland plot types. (LPIS also has data on forests and various landscape elements that are not relevant to our use case.) Assuming you&#39;re working with the Thüringen InVeKoS data (other data sets may have a different structure), right-click on the layer name in QGIS&#39; layer overview and click on &quot;Filter...&quot;. Then, enter this expression in the query builder: <code>&quot;BNK&quot; = &#39;AL&#39; OR &quot;BNK&quot; = &#39;GL&#39;</code> and click &quot;OK&quot;. This will select only field and grassland plots.</p><p>Next, open the rasteriser (<code>Raster -&gt; Conversion -&gt; Rasterize</code>). Select your FID field as the &quot;Field to use for a burn-in value&quot;, and your land cover map (as created above - this ensures the two layers match) as the output extent. Make sure the &quot;fixed value to burn&quot; is &quot;Not set&quot;. Then choose &quot;Georeferenced units&quot; as the &quot;Out raster size units&quot; and set horizontal and vertical resolution to 10.0. In the advanced parameters, set the output data type to <code>UInt32</code>. Finally, enter an output file name and run. The resulting TIF file can be passed to Persephone as the <code>farmfieldmap</code> parameter.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="architecture.html">« Source code architecture</a><a class="docs-footer-nextpage" href="species-dsl.html">Defining new species »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Introduction · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href>Persephone</a></span></div><form class="docs-search" action="search/index.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li class="is-active"><a class="tocitem" href>Introduction</a><ul class="internal"><li><a class="tocitem" href="#Running-the-model"><span>Running the model</span></a></li><li><a class="tocitem" href="#Model-input"><span>Model input</span></a></li></ul></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing/index.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture/index.html">Source code architecture</a></li><li><a class="tocitem" href="species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation/index.html">Simulation</a></li><li><a class="tocitem" href="io/index.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature/index.html">Nature</a></li><li><a class="tocitem" href="species/index.html">Species</a></li></ul></li><li><a class="tocitem" href="crops/index.html">Crop submodel</a></li><li><a class="tocitem" href="farm/index.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Introduction</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Introduction</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/blob/master/docs/src/index.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Introduction"><a class="docs-heading-anchor" href="#Introduction">Introduction</a><a id="Introduction-1"></a><a class="docs-heading-anchor-permalink" href="#Introduction" title="Permalink"></a></h1><p>Persephone is an agent-based, socio-economic-ecological model of agricultural landscapes in Europe under the Common Agricultural Policy (CAP).</p><p>It&#39;s aim is to investigate how policy affects farmer decision-making, and how this in turn affects various animal species. It includes a farm submodel, a crop-growth submodel, and an ecological submodels.</p><h2 id="Running-the-model"><a class="docs-heading-anchor" href="#Running-the-model">Running the model</a><a id="Running-the-model-1"></a><a class="docs-heading-anchor-permalink" href="#Running-the-model" title="Permalink"></a></h2><p>To run a single experiment, execute:</p><pre><code class="nohighlight hljs">./run.jl -c &lt;CONFIG&gt;</code></pre><p>Other commandline arguments are:</p><pre><code class="nohighlight hljs">usage: run.jl [-c CONFIGFILE] [-s SEED] [-o OUTDIR] [-l LOGLEVEL]
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Introduction · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li class="is-active"><a class="tocitem" href="index.html">Introduction</a><ul class="internal"><li><a class="tocitem" href="#Running-the-model"><span>Running the model</span></a></li><li><a class="tocitem" href="#Model-input"><span>Model input</span></a></li></ul></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="index.html">Introduction</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="index.html">Introduction</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/index.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Introduction"><a class="docs-heading-anchor" href="#Introduction">Introduction</a><a id="Introduction-1"></a><a class="docs-heading-anchor-permalink" href="#Introduction" title="Permalink"></a></h1><p>Persephone is an agent-based, socio-economic-ecological model of agricultural landscapes in Europe under the Common Agricultural Policy (CAP).</p><p>It&#39;s aim is to investigate how policy affects farmer decision-making, and how this in turn affects various animal species. It includes a farm submodel, a crop-growth submodel, and an ecological submodels.</p><h2 id="Running-the-model"><a class="docs-heading-anchor" href="#Running-the-model">Running the model</a><a id="Running-the-model-1"></a><a class="docs-heading-anchor-permalink" href="#Running-the-model" title="Permalink"></a></h2><p>To run a single experiment, execute:</p><pre><code class="nohighlight hljs">./run.jl -c &lt;CONFIG&gt;</code></pre><p>Other commandline arguments are:</p><pre><code class="nohighlight hljs">usage: run.jl [-c CONFIGFILE] [-s SEED] [-o OUTDIR] [-l LOGLEVEL]
[--version] [-h]
optional arguments:
......@@ -10,4 +10,31 @@ optional arguments:
-l, --loglevel LOGLEVEL
verbosity: &quot;debug&quot;, &quot;info&quot;, or &quot;quiet&quot;
--version show version information and exit
-h, --help show this help message and exit</code></pre><h2 id="Model-input"><a class="docs-heading-anchor" href="#Model-input">Model input</a><a id="Model-input-1"></a><a class="docs-heading-anchor-permalink" href="#Model-input" title="Permalink"></a></h2><p><em>TODO: describe config &amp; map files</em></p><p><em>Last updated: 2023-01-20 (commit 4954227)</em> </p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="developing/index.html">Developing Persephone »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
-h, --help show this help message and exit</code></pre><h2 id="Model-input"><a class="docs-heading-anchor" href="#Model-input">Model input</a><a id="Model-input-1"></a><a class="docs-heading-anchor-permalink" href="#Model-input" title="Permalink"></a></h2><p>Persephone requires three input files: a configuration file and two map files. How to generate the map files is documented <a href="gis.html">elsewhere</a>. The <a href="io.html">configuration file</a> defines parameter values and looks like this (see <code>src/parameters.toml</code> for a complete list of parameters):</p><pre><code class="language-TOML hljs">### Persephone - a socio-economic-ecological model of European agricultural landscapes.
###
### This is the default configuration file for Persephone, containing all model parameters.
### The syntax is described here: https://toml.io/en/
[core]
configfile = &quot;src/parameters.toml&quot; # location of the configuration file
landcovermap = &quot;data/landcover_jena.tif&quot; # location of the landcover map
farmfieldsmap = &quot;data/fields_jena.tif&quot; # location of the field geometry map
outdir = &quot;results&quot; # location and name of the output folder
overwrite = &quot;ask&quot; # overwrite the output directory? (true/false/&quot;ask&quot;)
loglevel = &quot;debug&quot; # verbosity level: &quot;debug&quot;, &quot;info&quot;, &quot;warn&quot;
processors = 2 # number of processors to use on parallel runs
seed = 2 # seed value for the RNG (0 -&gt; random value)
# dates to start and end the simulation
startdate = 2022-01-01
enddate = 2022-12-31
[farm]
farmmodel = &quot;FieldManager&quot; # which version of the farm model to use (not yet implemented)
[nature]
targetspecies = [&quot;Wolpertinger&quot;, &quot;Wyvern&quot;] # list of target species to simulate
popoutfreq = &quot;daily&quot; # output frequency population-level data, daily/monthly/yearly/end/never
indoutfreq = &quot;end&quot; # output frequency individual-level data, daily/monthly/yearly/end/never
[crop]
cropmodel = &quot;linear&quot; # crop growth model to use, &quot;linear&quot; or &quot;aquacrop&quot; (not yet implemented)</code></pre><p><em>Last updated: 2023-02-03 (commit 092c769)</em> </p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="odd.html">Overview, Design, Details (ODD) »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Input, Output, and Settings · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li class="is-active"><a class="tocitem" href="io.html">Input, Output, and Settings</a><ul class="internal"><li><a class="tocitem" href="#parameters.toml"><span>parameters.toml</span></a></li><li><a class="tocitem" href="#input.jl"><span>input.jl</span></a></li><li><a class="tocitem" href="#output.jl"><span>output.jl</span></a></li></ul></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Core</a></li><li class="is-active"><a href="io.html">Input, Output, and Settings</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="io.html">Input, Output, and Settings</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/io.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Input,-Output,-and-Settings"><a class="docs-heading-anchor" href="#Input,-Output,-and-Settings">Input, Output, and Settings</a><a id="Input,-Output,-and-Settings-1"></a><a class="docs-heading-anchor-permalink" href="#Input,-Output,-and-Settings" title="Permalink"></a></h1><p>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.</p><h2 id="parameters.toml"><a class="docs-heading-anchor" href="#parameters.toml">parameters.toml</a><a id="parameters.toml-1"></a><a class="docs-heading-anchor-permalink" href="#parameters.toml" title="Permalink"></a></h2><p>This is the default configuration file for Persephone, containing all model parameters. The syntax is described here: <a href="https://toml.io/en/">https://toml.io/en/</a></p><p>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 <code>--config</code> parameter.</p><h2 id="input.jl"><a class="docs-heading-anchor" href="#input.jl">input.jl</a><a id="input.jl-1"></a><a class="docs-heading-anchor-permalink" href="#input.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="Persephone.PARAMFILE" href="#Persephone.PARAMFILE"><code>Persephone.PARAMFILE</code></a><span class="docstring-category">Constant</span></header><section><div><p>The file that stores all default parameters: <code>src/parameters.toml</code></p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L9-L11">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.flattenTOML-Tuple{Any}" href="#Persephone.flattenTOML-Tuple{Any}"><code>Persephone.flattenTOML</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">flattenTOML(dict)</code></pre><p>An internal utility function to convert the two-dimensional dict returned by <code>TOML.parsefile()</code> into a one-dimensional dict, so that instead of writing <code>settings[&quot;domain&quot;][&quot;param&quot;]</code> one can use <code>settings[&quot;domain.param&quot;]</code>. Can be reversed with <a href="io.html#Persephone.prepareTOML-Tuple{Any}"><code>prepareTOML</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L97-L104">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.getsettings" href="#Persephone.getsettings"><code>Persephone.getsettings</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">getsettings(configfile, seed=nothing)</code></pre><p>Combines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L34-L39">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.parsecommandline-Tuple{}" href="#Persephone.parsecommandline-Tuple{}"><code>Persephone.parsecommandline</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">parsecommandline()</code></pre><p>Certain software parameters can be set via the commandline.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L137-L141">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.preprocessparameters-Tuple{Dict{String, Any}, String}" href="#Persephone.preprocessparameters-Tuple{Dict{String, Any}, String}"><code>Persephone.preprocessparameters</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">preprocessparameters(settings)</code></pre><p>Take the raw input parameters and process them (convert types, perform checks, etc.). This is a helper function for <a href="io.html#Persephone.getsettings"><code>getsettings</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L72-L77">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.@param-Tuple{Any}" href="#Persephone.@param-Tuple{Any}"><code>Persephone.@param</code></a><span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@param(domainparam)</code></pre><p>Return a configuration parameter from the global settings. The argument should be in the form <code>&lt;domain&gt;.&lt;parameter&gt;</code>, for example <code>@param(core.outdir)</code>. Possible values for <code>&lt;domain&gt;</code> are <code>core</code>, <code>nature</code>, <code>farm</code>, or <code>crop</code>. For a full list of parameters, see <code>src/parameters.toml</code>.</p><p>Note: this macro only works in a context where the <code>model</code> object is available!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L16-L27">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.@rand-Tuple" href="#Persephone.@rand-Tuple"><code>Persephone.@rand</code></a><span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@rand(args...)</code></pre><p>Return a random number or element from the sample, using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L115-L121">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.@shuffle!-Tuple{Any}" href="#Persephone.@shuffle!-Tuple{Any}"><code>Persephone.@shuffle!</code></a><span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@shuffle!(collection)</code></pre><p>Shuffle the given collection in place, using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/input.jl#L126-L132">source</a></section></article><h2 id="output.jl"><a class="docs-heading-anchor" href="#output.jl">output.jl</a><a id="output.jl-1"></a><a class="docs-heading-anchor-permalink" href="#output.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="Persephone.DataOutput" href="#Persephone.DataOutput"><code>Persephone.DataOutput</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">DataOutput</code></pre><p>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 <a href="io.html#Persephone.newdataoutput!-Tuple{Agents.AgentBasedModel, String, String, Function, String}"><code>newdataoutput!</code></a>.</p><p>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)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L122-L134">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.createdatadir-Tuple{String, Union{Bool, String}}" href="#Persephone.createdatadir-Tuple{String, Union{Bool, String}}"><code>Persephone.createdatadir</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">createdatadir(outdir, overwrite)</code></pre><p>Creates the output directory, dealing with possible conflicts.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L11-L15">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.modellogger-Tuple{String, String}" href="#Persephone.modellogger-Tuple{String, String}"><code>Persephone.modellogger</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">modellogger(loglevel, outdir)</code></pre><p>Create a logger object that writes output both to screen and to a logfile. This object is stored as <code>model.logger</code> and can then be used with <code>with_logger()</code>. Note: requires <a href="io.html#Persephone.createdatadir-Tuple{String, Union{Bool, String}}"><code>createdatadir</code></a> to be run first.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L32-L38">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.newdataoutput!-Tuple{Agents.AgentBasedModel, String, String, Function, String}" href="#Persephone.newdataoutput!-Tuple{Agents.AgentBasedModel, String, String, Function, String}"><code>Persephone.newdataoutput!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">newdataoutput!(model, filename, header, outputfunction, frequency)</code></pre><p>Create and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L142-L147">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.outputdata-Tuple{Agents.AgentBasedModel}" href="#Persephone.outputdata-Tuple{Agents.AgentBasedModel}"><code>Persephone.outputdata</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">outputdata(model)</code></pre><p>Cycle through all registered data outputs and activate them according to their configured frequency.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L162-L167">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.prepareTOML-Tuple{Any}" href="#Persephone.prepareTOML-Tuple{Any}"><code>Persephone.prepareTOML</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">prepareTOML(dict)</code></pre><p>An internal utility function to re-convert the one-dimensional dict created by <a href="io.html#Persephone.flattenTOML-Tuple{Any}"><code>flattenTOML</code></a> into the two-dimensional dict needed by <code>TOML.print</code>, and convert any data types into TOML-compatible types where necessary.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L100-L106">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.saveinputfiles-Tuple{Agents.AgentBasedModel}" href="#Persephone.saveinputfiles-Tuple{Agents.AgentBasedModel}"><code>Persephone.saveinputfiles</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">saveinputfiles(model)</code></pre><p>Copy all input files into the output directory, including the actual parameter settings used. This allows replicating a run in future.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L66-L71">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.withtestlogger-Tuple{Agents.AgentBasedModel}" href="#Persephone.withtestlogger-Tuple{Agents.AgentBasedModel}"><code>Persephone.withtestlogger</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">withtestlogger(model)</code></pre><p>Replace the model logger with the currently active logger. This is intended to be used in the testsuite to circumvent a <a href="https://github.com/JuliaLang/julia/issues/48456">Julia issue</a>, where <code>@test_logs</code> doesn&#39;t work with local loggers.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/output.jl#L52-L58">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="simulation.html">« Simulation</a><a class="docs-footer-nextpage" href="nature.html">Nature »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Input, Output, and Settings · Persephone</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../index.html"><img src="../assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../index.html">Persephone</a></span></div><form class="docs-search" action="../search/index.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../index.html">Introduction</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="../developing/index.html">Developing Persephone</a></li><li><a class="tocitem" href="../architecture/index.html">Source code architecture</a></li><li><a class="tocitem" href="../species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="../simulation/index.html">Simulation</a></li><li class="is-active"><a class="tocitem" href>Input, Output, and Settings</a><ul class="internal"><li><a class="tocitem" href="#parameters.toml"><span>parameters.toml</span></a></li><li><a class="tocitem" href="#input.jl"><span>input.jl</span></a></li><li><a class="tocitem" href="#output.jl"><span>output.jl</span></a></li></ul></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="../nature/index.html">Nature</a></li><li><a class="tocitem" href="../species/index.html">Species</a></li></ul></li><li><a class="tocitem" href="../crops/index.html">Crop submodel</a></li><li><a class="tocitem" href="../farm/index.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Core</a></li><li class="is-active"><a href>Input, Output, and Settings</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Input, Output, and Settings</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/blob/master/docs/src/io.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Input,-Output,-and-Settings"><a class="docs-heading-anchor" href="#Input,-Output,-and-Settings">Input, Output, and Settings</a><a id="Input,-Output,-and-Settings-1"></a><a class="docs-heading-anchor-permalink" href="#Input,-Output,-and-Settings" title="Permalink"></a></h1><p>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.</p><h2 id="parameters.toml"><a class="docs-heading-anchor" href="#parameters.toml">parameters.toml</a><a id="parameters.toml-1"></a><a class="docs-heading-anchor-permalink" href="#parameters.toml" title="Permalink"></a></h2><p>This is the default configuration file for Persephone, containing all model parameters. The syntax is described here: https://toml.io/en/</p><p>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 <code>--config</code> parameter.</p><h2 id="input.jl"><a class="docs-heading-anchor" href="#input.jl">input.jl</a><a id="input.jl-1"></a><a class="docs-heading-anchor-permalink" href="#input.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="Persephone.getsettings" href="#Persephone.getsettings"><code>Persephone.getsettings</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">getsettings(configfile, seed=nothing)</code></pre><p>Combines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/input.jl#L27-L32">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.parsecommandline-Tuple{}" href="#Persephone.parsecommandline-Tuple{}"><code>Persephone.parsecommandline</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">parsecommandline()</code></pre><p>Certain software parameters can be set via the commandline.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/input.jl#L70-L74">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.@param-Tuple{Any}" href="#Persephone.@param-Tuple{Any}"><code>Persephone.@param</code></a><span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@param(domainparam)</code></pre><p>Return a configuration parameter from the global settings. The argument should be in the form <code>&lt;domain&gt;.&lt;parameter&gt;</code>, for example <code>@param(core.outdir)</code>. Possible values for &lt;domain&gt; are <code>core</code>, <code>nature</code>, <code>farm</code>, or <code>crop</code>. For a full list of parameters, see <code>src/parameters.toml</code>.</p><p>Note that this macro only works in a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/input.jl#L9-L20">source</a></section></article><h2 id="output.jl"><a class="docs-heading-anchor" href="#output.jl">output.jl</a><a id="output.jl-1"></a><a class="docs-heading-anchor-permalink" href="#output.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="Persephone.DataOutput" href="#Persephone.DataOutput"><code>Persephone.DataOutput</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">DataOutput</code></pre><p>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 <code>newdataoutput()</code>.</p><p>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)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/output.jl#L67-L79">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.newdataoutput-Tuple{Agents.AgentBasedModel, String, String, Function, String}" href="#Persephone.newdataoutput-Tuple{Agents.AgentBasedModel, String, String, Function, String}"><code>Persephone.newdataoutput</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">newdataoutput(model, filename, header, outputfunction, frequency)</code></pre><p>Create and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/output.jl#L87-L92">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.outputdata-Tuple{Agents.AgentBasedModel}" href="#Persephone.outputdata-Tuple{Agents.AgentBasedModel}"><code>Persephone.outputdata</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">outputdata(model)</code></pre><p>Cycle through all registered data outputs and activate them according to their configured frequency.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/output.jl#L107-L112">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.setupdatadir-Tuple{Agents.AgentBasedModel}" href="#Persephone.setupdatadir-Tuple{Agents.AgentBasedModel}"><code>Persephone.setupdatadir</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">setupdatadir()</code></pre><p>Creates the output directory and copies relevant files into it.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/blob/4954227da853bdb7bd242d937841a008cca9e54b/src/core/output.jl#L11-L15">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../simulation/index.html">« Simulation</a><a class="docs-footer-nextpage" href="../nature/index.html">Nature »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Overview, Design, Details (ODD) · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li class="is-active"><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="odd.html">Overview, Design, Details (ODD)</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="odd.html">Overview, Design, Details (ODD)</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/odd.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Overview,-Design,-Details-(ODD)"><a class="docs-heading-anchor" href="#Overview,-Design,-Details-(ODD)">Overview, Design, Details (ODD)</a><a id="Overview,-Design,-Details-(ODD)-1"></a><a class="docs-heading-anchor-permalink" href="#Overview,-Design,-Details-(ODD)" title="Permalink"></a></h1><p><em>TODO</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="index.html">« Introduction</a><a class="docs-footer-nextpage" href="developing.html">Developing Persephone »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="search.html">Search</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="search.html">Search</a></li></ul></nav><div class="docs-right"><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article><p id="documenter-search-info">Loading search...</p><ul id="documenter-search-results"></ul></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body><script src="search_index.js"></script><script src="assets/search.js"></script></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · Persephone</title><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../index.html"><img src="../assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../index.html">Persephone</a></span></div><form class="docs-search" action><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../index.html">Introduction</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="../developing/index.html">Developing Persephone</a></li><li><a class="tocitem" href="../architecture/index.html">Source code architecture</a></li><li><a class="tocitem" href="../species-dsl/index.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="../simulation/index.html">Simulation</a></li><li><a class="tocitem" href="../io/index.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="../nature/index.html">Nature</a></li><li><a class="tocitem" href="../species/index.html">Species</a></li></ul></li><li><a class="tocitem" href="../crops/index.html">Crop submodel</a></li><li><a class="tocitem" href="../farm/index.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Search</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Search</a></li></ul></nav><div class="docs-right"><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article><p id="documenter-search-info">Loading search...</p><ul id="documenter-search-results"></ul></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 20 January 2023 11:33">Friday 20 January 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body><script src="../search_index.js"></script><script src="../assets/search.js"></script></html>
This diff is collapsed.
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Simulation · Persephone</title><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persephone logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persephone</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><a class="tocitem" href="odd.html">Overview, Design, Details (ODD)</a></li><li><span class="tocitem">Developing</span><ul><li><a class="tocitem" href="developing.html">Developing Persephone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">GIS data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li class="is-active"><a class="tocitem" href="simulation.html">Simulation</a><ul class="internal"><li><a class="tocitem" href="#simulation.jl"><span>simulation.jl</span></a></li><li><a class="tocitem" href="#landscape.jl"><span>landscape.jl</span></a></li></ul></li><li><a class="tocitem" href="io.html">Input, Output, and Settings</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Core</a></li><li class="is-active"><a href="simulation.html">Simulation</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="simulation.html">Simulation</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//docs/src/simulation.md#" title="Edit source"><span class="docs-icon fa"></span><span class="docs-label is-hidden-touch">Edit source</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Simulation"><a class="docs-heading-anchor" href="#Simulation">Simulation</a><a id="Simulation-1"></a><a class="docs-heading-anchor-permalink" href="#Simulation" title="Permalink"></a></h1><p>The <code>core</code> directory holds source files that are important for all submodels, including scheduling, landscape, and input/output functions.</p><h2 id="simulation.jl"><a class="docs-heading-anchor" href="#simulation.jl">simulation.jl</a><a id="simulation.jl-1"></a><a class="docs-heading-anchor-permalink" href="#simulation.jl" title="Permalink"></a></h2><p>This file includes the basal functions for initialising and running simulations.</p><article class="docstring"><header><a class="docstring-binding" id="Persephone.finalise!-Tuple{Agents.AgentBasedModel}" href="#Persephone.finalise!-Tuple{Agents.AgentBasedModel}"><code>Persephone.finalise!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">finalise!(model)</code></pre><p>Wrap up the simulation. Currently doesn&#39;t do anything except print some information.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L136-L140">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.initialise" href="#Persephone.initialise"><code>Persephone.initialise</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">initialise(config=PARAMFILE, seed=nothing)</code></pre><p>Initialise the model: read in parameters, create the output data directory, and instantiate the AgentBasedModel object(s). Optionally allows specifying the configuration file and overriding the <code>seed</code> parameter. This returns a single model object, unless the config file contains multiple values for one or more parameters, in which case it creates a full-factorial simulation experiment and returns a vector of model objects.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L34-L43">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.initmodel-Tuple{Dict{String, Any}}" href="#Persephone.initmodel-Tuple{Dict{String, Any}}"><code>Persephone.initmodel</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initmodel(settings)</code></pre><p>Initialise a model object using a ready-made settings dict. This is a helper function for <code>initialise()</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L54-L59">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.paramscan-Tuple{Dict{String, Any}, Vector{String}}" href="#Persephone.paramscan-Tuple{Dict{String, Any}, Vector{String}}"><code>Persephone.paramscan</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">paramscan(settings)</code></pre><p>Create a list of settings dicts, covering all possible parameter combinations given by the input settings (i.e. a full-factorial experiment). This is a helper function for <code>initialise()</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L85-L91">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.simulate" href="#Persephone.simulate"><code>Persephone.simulate</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">simulate(config=PARAMFILE, seed=nothing)</code></pre><p>Initialise one or more model objects and carry out a full simulation experiment, optionally specifying a configuration file and a seed for the RNG.</p><p>This is the default way to run a Persephone simulation.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L8-L15">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.simulate!-Tuple{Agents.AgentBasedModel}" href="#Persephone.simulate!-Tuple{Agents.AgentBasedModel}"><code>Persephone.simulate!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">simulate!(model)</code></pre><p>Carry out a complete simulation run using a pre-initialised model object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L23-L27">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.stepsimulation!-Tuple{Agents.AgentBasedModel}" href="#Persephone.stepsimulation!-Tuple{Agents.AgentBasedModel}"><code>Persephone.stepsimulation!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepsimulation!(model)</code></pre><p>Execute one update of the model.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/simulation.jl#L113-L117">source</a></section></article><h2 id="landscape.jl"><a class="docs-heading-anchor" href="#landscape.jl">landscape.jl</a><a id="landscape.jl-1"></a><a class="docs-heading-anchor-permalink" href="#landscape.jl" title="Permalink"></a></h2><p>This file manages the landscape maps that underlie the model.</p><article class="docstring"><header><a class="docstring-binding" id="Persephone.EventType" href="#Persephone.EventType"><code>Persephone.EventType</code></a><span class="docstring-category">Type</span></header><section><div><p>The types of landscape event that can be simulated</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L10">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.FarmEvent" href="#Persephone.FarmEvent"><code>Persephone.FarmEvent</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmEvent</code></pre><p>A data structure to define a landscape event, giving its type, spatial extent, and duration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L26-L31">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.LandCover" href="#Persephone.LandCover"><code>Persephone.LandCover</code></a><span class="docstring-category">Type</span></header><section><div><p>The land cover classes encoded in the Mundialis Sentinel data.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L6">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.Pixel" href="#Persephone.Pixel"><code>Persephone.Pixel</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Pixel</code></pre><p>A pixel is a simple data structure to combine land use and ownership information in a single object. The model landscape consists of a matrix of pixels. (Note: further landscape information may be added here in future.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L13-L19">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.createevent!" href="#Persephone.createevent!"><code>Persephone.createevent!</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">createevent!(model, pixels, name, duration=1)</code></pre><p>Add a farm event to the specified pixels (a vector of position tuples) for a given duration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L87-L91">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.distanceto-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel, Function}" href="#Persephone.distanceto-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel, Function}"><code>Persephone.distanceto</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, habitatdescriptor)</code></pre><p>Calculate the distance from the given location to the closest location matching the habitat descriptor function. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L120-L125">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.distanceto-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel, Persephone.LandCover}" href="#Persephone.distanceto-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel, Persephone.LandCover}"><code>Persephone.distanceto</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, habitattype)</code></pre><p>Calculate the distance from the given location to the closest habitat of the specified type. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L154-L159">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.distancetoedge-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.distancetoedge-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.distancetoedge</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distancetoedge(pos, model)</code></pre><p>Calculate the distance from the given location to the closest neighbouring habitat. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L165-L170">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.farmplot-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.farmplot-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.farmplot</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">farmplot(position, model)</code></pre><p>Return the farm plot at this position, or nothing if there is none (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L109-L113">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.initlandscape-Tuple{String, String}" href="#Persephone.initlandscape-Tuple{String, String}"><code>Persephone.initlandscape</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initlandscape(landcovermap, farmfieldsmap)</code></pre><p>Initialise the model landscape based on the map files specified in the configuration. Returns a matrix of pixels.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L38-L43">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.landcover-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}" href="#Persephone.landcover-Tuple{Tuple{Int64, Int64}, Agents.AgentBasedModel}"><code>Persephone.landcover</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">landcover(position, model)</code></pre><p>Return the land cover class at this position (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L100-L104">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Persephone.updateevents!-Tuple{Agents.AgentBasedModel}" href="#Persephone.updateevents!-Tuple{Agents.AgentBasedModel}"><code>Persephone.updateevents!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">updateevents!(model)</code></pre><p>Cycle through the list of events, removing those that have expired.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master//src/core/landscape.jl#L66-L70">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="species-dsl.html">« Defining new species</a><a class="docs-footer-nextpage" href="io.html">Input, Output, and Settings »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.23 on <span class="colophon-date" title="Friday 3 February 2023 15:43">Friday 3 February 2023</span>. Using Julia version 1.9.0-alpha1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment