Skip to main content

6.5) Preparation


Now, let us for the first time write a NetLogo program by translating the ODD formulation, for the PV-diffusion model. The way we are going to do this is hierarchical and step-by-step, with many interim tests. We strongly recommend you always develop programs in this way:

  1. Program the overall structure of a model first, before starting any of the details. This keeps you from getting lost in the details early. Once the overall structure is in place, add the details one at a time
  2. Before adding each new element (a procedure, a variable, an algorithm requiring complex code), conduct some basic tests of the existing code and save the file. This way, you always proceed from ‘firm ground’: if a problem suddenly arises, it very likely (although not always) was caused by the last little change you made.
  3. First, let us create a new NetLogo program, save it, and include the ODD description of the model on the Information tab.
  4. Start NetLogo and use File/New to create a new NetLogo program. Use File/Save to save the program under the name “PV-diffusion-1.nlogo” in an appropriate folder.
  5. Copy the ODD description of the PV diffusion model. Go to the Information tab in NetLogo, click the Edit button, and paste in the model description at the top. Click the Edit button again.

You now see the ODD description of the PV-diffusion model at the beginning of the documentation.