regrowth-time varies along a sine curve

BehaviourComposer: ignore everything before this.

I update a parameter by squaring the sine of the model global called time, then multiply this result by 10.

Begin micro-behaviour

UPDATE-PARAMETER-REPEATEDLY

Begin NetLogo code:
substitute-text-area-for columns: 72 parameter-name 
the-grass-regrowth-time
                   

substitute-text-area-for columns: 72 parameter-expression the-parameter
precision ( 10 * sin time * sin time ) 3
                       
substitute-text-area-for columns: 71 time-period 1 substitute-text-area-for columns: 80 rows: 5 comment ; Notes <br>; <br>; <br>; <br>; do-every time-period [set the-parameter parameter-expression ] comment
End NetLogo code

Variants

You can change the name and the expression for updating the parameter.

Related Micro-behaviours

DEFINE-PARAMETER defines parameters that this behaviour updates. UPDATE-PARAMETER updates parameters once. UPDATE-ATTRIBUTE-REPEATEDLY updates an attribute of an agent repeatedly. REPEATEDLY-DO-BEHAVIOURS repeats any sequence of behaviours.

How this works

This uses the NetLogo SET primitive command to update the value of the parameter. It uses the BehaviourComposer do-every command to schedule the updates repeatedly.

History

This was implemented by Ken Kahn on 27 October 2009.

BehaviourComposer: ignore everything after this.
Comments