The APSIM Time Clock Module (Clock)
Description
The APSIM Clock module has been developed to replace the functionality of progressing through time that was previously contained in the simulation engine and weather file. Encapsulation of this important simulation concept will allow future flexibility in the specification of time and progress through it.
Operation
The APSIM Time Clock module is operated in a way similar to other APSIM modules.
The specification of this module in the simulation control file, and its parameters in the parameter files follow normal APSIM module protocols.
Parameter file settings
The APSIM Clock Module requires parameters to specify the time frame of the required simulation. The user must specify the beginning and the ending of the period of time that is to be simulated.
The settings available to the user are as follows:-
Keyword = Setting |
Description |
start_date |
(Optional) Date (in dd/mm/yyyy) format for the commencement of the current simulation. |
end_date |
(Optional) Date (in dd/mm/yyyy) format for the end of the current simulation. |
start_{day,month,year} and end_{day,month,year} |
(Optional) Day, month and year the start and end of the current simulation. |
met_start_date |
(Optional) Date in number format (days since start of Gregorian calendar) for the commencement of the current simulation. |
met_end_date |
(Optional) Date in number format (days since start of Gregorian calendar) for the end of the current simulation. |
Timestep |
(Optional) See section on sub-daily timesteps below. |
Note that if no simulation start or end date is specified, the entire period of the met file will be simulated.
The number implementation is only valid for dates in the Gregorian calender (after 15 October 1582), based on the algorithm by Fliegel & van Flandern in C.ACM vol.11 (oct,1968) P.657
AN EXAMPLE
The control file would require a specification such as
[apsim.sample simulation]
module = clock sample.par[all_treatments] %apsuite\apsim\clock\clock.ini[standard]
module = report sample.par[all_treatments]
.
.
The file “sample.par” could then have the following sections:-
[all_treatments.clock.parameters]
start_date = 1/1/1988
end_date = 31/12/1988
Module Output Variables
The APSIM Time Clock Module can provide the values of several state variables for
reporting to an output file or use by other modules.
Name |
Units |
Description |
Day |
|
Day of Year (0-366) |
Year |
|
Year |
Day_of_month |
|
Day of Month (0-31) |
Month |
|
Month (1-12) |
Start_week |
True/False |
Flag for start of week† |
End_week |
True/False |
Flag for end of week† |
Start_month |
True/False |
Flag for the start of each month |
End_month |
True/False |
Flag for the end of each month |
end_year |
True/False |
Flag for the end of year |
today |
|
Today’s Julian Date |
day_of_year |
|
Today’s day of year (same as ‘day’) |
month_str |
|
Today’s month name (eg ‘Jan’) |
dd/mm |
dd/mm |
Today’s Date (eg ‘10/12) |
dd/mm/yyyy |
dd/mm/yyyy |
Today’s Date (eg ‘10/12/1990’) |
dd_mmm |
dd_mmm |
Today’s Date (eg ‘10_dec’) |
dd_mmm_yyyy |
dd_mmm_yyyy |
Today’s Date (eg ‘10_dec_1990’) |
mm/dd/yyyy |
|
Today’s Date (eg ‘12/15/1990’) |
mmm/dd/yyyy |
|
Today’s Date (eg ‘Dec/15/1990’) |
time |
hh:mm |
Daily Time in 24 hour format |
Simulation_start_day |
Day of year |
Day of year of simulation commencement |
Simulation_start_year |
Year |
Year of simulation commencement |
Simulation_end_day |
Day of year |
Day of year of simulation finish |
Simulation_end_year |
Year |
Year of simulation finish |
† This assumes a 52 week year with the duration of each week is adjusted so that the first
week starts on 1 st of January and the last week ends on the 31st of December.
Using Sub-Daily Timesteps
It is possible to use timesteps to one minute in resolution within the current APSIM framework with the following constraints.
[all_treatments.clock.parameters]
start_date = 1/1/1988 ! simulation starting date
end_date = 31/12/1988 ! simulation ending date
timestep = 60 (min) ! simulation timestep
The example above will specify the clock to step through the simulation essentially with 24 tick cycles per day. There is no thorough testing for synchrony of modules though some modules will give error messages if they perceive possible timestep errors.
If the timestep parameter is not specified the clock module will default to a timestep of 1 day (1440 mins), that is, one tick cycle per day.
Events
The clock module produces several events that can be useful, particularly when using the TRACKER module.
Name |
Description |
Start_simulation |
Published once at the start of every simulation |
Tick |
Published at the start of every day |
End_day |
Published at the end of every day |
Start_week |
Published at the start of every week |
Start_month |
Published at the start of every month |
Start_year |
Published at the start of every year |
End_week |
Published at the end of every week |
End_month |
Published at the end of every month |
End_year |
Published at the end of every year |