Libraries‎ > ‎Somie‎ > ‎

Clock-Somie

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:

Begin description:

Global variables for reporting time within a model.

End description

Clock (Somie)

Begin NetLogo code:

  set the-hour the-hour + the-hours-to-ticks-ratio
  if the-hour >= 24 [
    set the-day-in-week the-day-in-week + 1
    set the-day-in-year the-day-in-year + 1
    set the-day-in-month the-day-in-month + 1
    set the-hour 0
  ]
  if the-day-in-week = 7 [
    set the-day-in-week 0
  ]
  if the-day-in-month = 30 [
    set the-day-in-month 0
    set the-month the-month + 1
  ]
  if the-month = 12 [
    set the-month 0
  ]
  if the-day-in-year = 365 [
    set the-day-in-year 0
    set the-year the-year + 1
  ]
  set the-d-week item the-day-in-week the-day-in-week-text
  set the-d-month item the-month the-month-text

End NetLogo code

Variants

How this works

Related micro-behaviours

History

BehaviourComposer: ignore everything after this.

Comments