11  Setup Procedure

This chapter is a work in progress. The content may be incomplete, inconsistent, or subject to significant revision. Reader discretion is advised.

The setup procedure is responsible for initializing the model’s state, including setting up the world, variables, and patches.

The code below show the setup procedure of the Logonia model. LogoClim insertions are denoted with ; LogoClim at the end of the line to make it easier to identify which parts of the code are specific to LogoClim and which are related to Logônia.

to setup
  clear-all

  assert-start-year ; LogoClim

  if (test-start-year = false) [stop] ; LogoClim

  ls:reset ; LogoClim

  setup-logoclim ; LogoClim
  setup-world ; LogoClim
  setup-variables ; LogoClim
  setup-patches ; LogoClim

11.1 setup-logoclim

LogoClim’s setup procedure comes with a headless? parameter to improve the model’s performance when running in headless mode. NetLogo already shut down some interface elements when in headless mode, such as monitors and plots, but it cannot disable internal model procedures. When headless? is set to true, the model skips all code related to LogoClim interface, which can significantly speed up simulations.

This is why when ls:ask ls:models [setup true] is called, the setup procedure is executed with headless? set to true. If you want to run the model in interactive mode, you can call ls:ask ls:models [setup false] instead.

11.2 setup-world

11.3 setup-variables

11.4 setup-patches