Search code examples
netlogoagent-based-modeling

Can we include a procedure (let's say check wind ) in both the setup and go procedure of NetLogo?


I am building a model for dispersion of pollutants in air for which I want to import wind velocity information stored in a .csv file. I was wondering if the procedure to check wind from at each tick can also be included in the setup procedure to assign wind velocity values at tick 0 ? I am not sure if code is needed for this question but please let me know if at all it is needed .


Solution

  • There is no problem with this. For example, I routinely do this for such things as colouring patches by some value that changes - you want the colouring to apply at all times. In that case, the code would look something like:

    to setup
      clear-all
      [ bunch of stuff to initialise the world ]
      colour-patches
      reset-ticks
    end
    
    to go
      [ bunch of stuff to make changes to the worl ]
      colour-patches
      tick
    end
    
    to colour-patches
      [ stuff to do the colouring ]
    end