Events¶
Events are needed to notify objects of some change of state.
In QHG we have two kinds of events: events from the command line and internal events.
The events from the commandline events are passed as values of the –events option of QHGMain.
–events=<event-list>¶
Set event list.
event-list ::= "'" <event> ["," <event>]*"'"
event ::= <event-type> "|" <event-params> "@" <event-times>
event times and triggers¶
<event-times>
defines at which times the event should be triggered.
event-times ::= <full-trigger> [ "+" <full-trigger>]*
full-trigger ::= ["S"|"T"]<full-trigger-sub>
full-trigger-sub ::= <normal-trigger> | <point-trigger> | <final-trigger>
normal-trigger ::= [<trigger-interval>] <step-size>
trigger-interval ::= "["[<minval>] ":" [<maxval>] "]"
fNegInf
),fPosInf
).point-trigger ::= "["<time>"]"
This form causes a single event at the specified time.
final-trigger ::= "final"
20+[305:]500+[250:600]10+[37]
Event types¶
event-type ::= <standard_types> | <tech-types>
standard-type ::= "write" | "env" | "arr" | "pop" | "file"
tech-types ::= "dump" | "interpol" | "comm" | "check" | "user" | "scramble"
event-params ::= <type> ["+" <type>]*
type ::= <group-types> | <special-types>
group-types ::= "grid" | "geo" | "climate " | "veg " | "nav" |
special-types ::= "occ" | "stats" | "pop:"<speciesname>[<filter>]
#
’ only write agent data%
’ only write status arrays~
’ only write additional datafor <event-type> == “env”:
event-params ::= <type> ["+" <type>]* ":" <qdf-file>
type ::= "geo" | "climate" | "veg" | "nav"
Read the specified data sets from the qdf file.
for <event-type> == “arr”:
event-params ::= <type> ":" <arrayname> ":" <qdf-file>
type ::= "geo" | "climate" | "veg"
Read the specified arrays from the qdf file.
for <event-type> == “pop”:
event-params ::= <speciesname> ["+" <speciesname>]* ":" <qdf-file>
Read the specified populations from file.
for <event-type> == “file”:
event-params ::= <filename>
The file must contain lines of the form
line ::= <event-type> "|" <event-params> "@" <event-times>
Add the events listed in the file to the event manager.
for <event-type> == “interpol”:
event-params ::= <interpol-data> | <command>
interpol-data ::= "file:" <interpol-file>
command ::= "cmd:" <interpol-command>
interpol-command ::= "start" | "stop"
where
"interpol-file" : a QDF file containing interpolation steps.
"stop" : stop interpolation
"start" : restart interpolation
for <event-type> == “dump”:
event-params ::= "flat" | "smart" | "free"
for <event-type> == “comm”:
event-params ::= <cmd-file> | <command>
command ::= <iter_cmd> | <del_action_cmd> | <mod_pop_cmd> | <dis_action_cmd> | <ena_action_cmd> | <event>
iter_cmd ::= "SET ITERS:"<num_iters>
del_action_cmd ::= "REMOVE ACTION:"<population>:<action_name>
mod_pop_cmd ::= "MOD POP:"<population>:<param_name>:<value>
dis_action_cmd ::= "DISABLE ACTION:"<population>:<param_name>:<value>
ena_action_cmd ::= "ENABLE ACTION:"<population>:<param_name>:<value>
event : any event description; see definition above
The format of <cmd-file>
cmd-file ::= <command-line>*
command-line ::= <command> <NL>
iter_cmd
: set new iteration limitdel_action_cmd
: remove action from prio listmod_pop_cmd
: change parameter of populationevent
: add event to event manager’s listfor <event-type> == “check”:
event-params ::= <what> ["+" <what>]*
what ::= "lists"
(Debugging only) “lists”: check linked lists at specified times
for <event-type> == “user”:
event-params ::= <eventid>:<stringdata>
eventid : an event id in [1000, 9999]
stringdata : a string
for <event-type> == “scramble”:
event-params ::= "connections" | "all"
Scrambles the order of connections between nodes
Example¶
Here is a full example for an event list:
--events='env|geo+climate:map120.qdf@[120],write|pop:GrassLover|grid@5+[20:30]1,comm|REMOVE ACTION sapiens:ConfinedMove@[3000]'
- This
loads a QDF file containing new geography and climate data from ‘map120.qdf’ at step 120,
writes a QDF file containing grid data and population data for species “GrassLover” every 5 steps and additiionally every step between steps 20 and 30.
at step 3000 the ‘ConfinedMove’ action of species ‘sapiens’ is disabled.