Chapter 6: Read-Only Variables

FRED includes several read-only variables that cannot be directly modified by an agent. Read-only variables can be either shared or agent-specific in scope.

Shared Read-Only Variables

Shared read-only variables will evaluate to the same quantity for any agent at a given time step. These read-only variables fall into the following categories:

simulation run

  • sim_run – the simulation run number

  • now – the current simulation step in hours, starting with 0

  • sim_day – the simulation day, starting with day 0

date and time

  • hour – the current hour of the day, in the range \([0, 23]\).

  • day_of_week – the current day of the week, in the range \([0, 6]\). The days of the week are numbered 0 through 6 starting with Sunday.

  • day_of_month – the current day of the month, in the range \([1, 31]\)

  • day_of_year – the current day of the year, in the range \([1, 366]\). On January 1st, day_of_year is equal to 1. On non-leap years, December 31st, day_of_year is equal to 365.

  • month – the current month, in the range \([1, 12]\). The months are numbered 1 through 12 starting with January.

  • year – the current four digit year.

  • epi_week – the current epidemiological week of the year, in the range \([1, 53]\).


    An epidemiological week, i.e. epi-week, contains seven days, beginning with Sunday and ending with Saturday. By definition, the end of the first week of the year must fall at least four days into the year. Weeks are numbered 1 to 53, although most years consist of only 52 epi-weeks.

  • epi_year – the current four digit epidemiological year.

  • today – the current datestamp.


    A datestamp is an expression that evaluates to a number of the form YYYYMMDD. The formula for a datestamp is:

    my_datestamp = 10000 * year + 100 * month + day_of_month
  • date – a synonym for today.


  • <condition_name>.<state_name> – the integer index of the state in the order in which the state is defined within the condition.

Agent Read-Only Variables

Agent read-only variables may evaluate to different quantities depending on the agent. These read-only variables fall into the following categories:


  • id – evaluates to an agent’s unique integer ID.

  • age – evaluates to the integer part of an agent’s age.

  • birth_year – evaluates to the four digit year of the agent’s birth.

  • age_in_days – evaluates to integer number of days since an agent’s assigned the agent’s assigned birthdate.

  • age_in_years – evaluates to an agent’s age in years computed as age_in_days / 365.25).

  • real_age – a synonym for age_in_years.


  • <group_name> – evaluates to the agent’s mixing group ID for the given group type name or -1 if no such group exists.