# TRACKER

### What is the Data Tracker Module?

The tracker module allows the user to track information through a simulation and perform simple statistics to that data prior to recording it in an APSIM output file.

For example, tracker can record and accumulate flows of matter (e.g. rainfall, irrigation, drainage, fertiliser) between simulation outputs.

### 2 Definition of statistical types

Statistics can be provided on either events or the states of variables within simulation execution.

In both cases, the statistic can be based upon a single “spot” sample at some defined point or it can be based upon an accumulated sample of values for a defined timeframe within model execution.

In all cases the statistical variable is defined in the parameter file via a specification of the form,

“specification”

where specification is a description of the statistic via a predefined grammar.

### 2.1 Event Statistics

#### 2.1.1 Spot Sample

**Statistic** of **Event** as **Alias**

where:

**Statistic** : is the type of statistic to be applied. Currently the only option here is “date”.

**Event** : is the event on which the statistic is to be applied. This can be any event within the APSIM simulation.

**Alias** : is the tracker output variable alias to be applied to this statistic. This is the name by which other modules can access the value of this statistic.

Sample 1 – Report the sowing date of the last wheat crop

date of wheat.sowing as wheat_sowing_date

Sample 2 – Report the harvesting date of the last wheat crop

date of wheat.harvesting as wheat_harvest_date

#### 2.1.2 Accumulated Samples

**Statistic** of **Event** from **StartEvent** to **EndEvent** as **Alias**

where

**Statistic** : is the type of statistic to be applied. Currently the only option here is “count”.

**Event** : is the event on which the statistic is to be applied. This can be any event within the APSIM simulation.

**StartEvent** : is the APSIM event which signals the start of the sampling window.

**EndEvent** : is the APSIM event which signals the start of the sampling window.

**Alias** : is the tracker output variable alias to be applied to this statistic. This is the name by which other modules can access the value of this statistic.

Sample 1 – Count the number of lucerne cuts since the last report to the output file.

count of lucerne.harvesting from reported to now as number_of_cuts

Sample 2 – Count the number of days since chickpea was last sown

count of tick from chickpea.sowing to now as days_since_chickpea_sowing

## 2.2 State Variable Statistics

### 2.2.1 Spot Sample

**Statistic** of **Variable** on **Event** as **Alias**

where

**Statistic** : is the type of statistic to be applied. Currently the only option for the user is “value”.

**Variable** : is the APSIM state variable upon which statistics are calculated. This can be any variable within the APSIM simulation.

**Event** : is the event on which the statistic is to be applied. This can be any event within the APSIM simulation.

**Alias** : is the tracker output variable alias to be applied to this statistic. This is the name by which other modules can access the value of this statistic.

Sample 1 – Report the yield of the last wheat crop

value of wheat.yield on wheat.harvesting as wheat_yield

Sample 2 – Report the total soil water at the sowing of the last wheat crop

value of sw_dep() on wheat.sowing as wheat_sowing_sw

### 2.2.2 Accumulated Samples

**Statistic** of **Variable** on [ **last** nnn ] **Event** [from **StartEvent** to **EndEvent**] as **Alias**

where

**Statistic** : is the type of statistic to be applied. Currently the user can choose from “sum”, “average”, “maximum” and “minimum”.

**Variable** : is the APSIM state variable upon which statistics are calculated. This can be any variable within the APSIM simulation.

**last** nnn : is an optional specification to allow the user to specify a moving sample set.

**Event** : is the event on which the statistic is to be applied. This can be any event within the APSIM simulation.

**StartEvent** : is the APSIM event which signals the start of the sampling window.

**EndEvent** : is the APSIM event which signals the start of the sampling window.

**Alias** : is the tracker output variable alias to be applied to this statistic. This is the name by which other modules can access the value of this statistic.

Note: the “from StartEvent to EndEvent” is optional only if the “ last nnn” is specified.

Sample 1 – Report the accumulated rainfall since the last report to the output file

sum of rain on start_of_day from reported to now as rainfall

Sample 2 – Report the accumulated rainfall for the last 3 days

sum of rain on last 3 start_of_day as rain3

Sample 3 – Report the accumulated lucerne harvest since the last report to the output file

sum of lucerne.biomass on lucerne.harvesting from reported to now … as cut_biomass

Sample 4 – Report the in-crop rainfall for the last wheat crop

sum of met.rain on met.newmet from wheat.sowing to wheat.harvesting as wheat_incrop_rain

Sample 5 – Report the 7 day moving average of the wheat crop water stress factor

average of wheat.swdef_photo on last 7 end_of_day from wheat.sowing … to wheat.harvesting as wheat_weekly_stress