User Tools

Site Tools


events

Events

Simulation events are used to perform actions during a simulation. An event can be triggered either when a condition is met or at a predetermined time point. There are several blocks that can be associated to events; the transfer block can discretely move inventory between compartments when an event trigger, the snapshot block needs an event to let it know when to take a snapshot, etc.

Time events

Time events are defined with the time event block. An event can be set to trigger at a specific time point, or repeatedly. This event type is the most common.

Example use cases could be:

  • On the 25th each month, add salary to the account compartment
  • At time=100, perform an instant deposition onto the soil compartment
  • At the 1st of each year, reset a running mean of plant concentration and take a snapshot of the value

Discrete events

Discrete events are very flexible and allow an event to trigger based on a condition which compares two values in the model. They are defined using the discrete event block.

Example use cases could be:

  • When ball reaches ground, set velocity to negative
  • When bucket is full, move excess to ground

Reacting to events

  • The transfer block allows an event to specify when transfer should occur. This allows discrete/instantaneous transfer into, between or out of a compartment.
  • The snapshot block requires an event to know when to take snapshots.
  • The min max block allows an event to reset the current minimum/maximum, which is required for (instance) yearly maximums. The block can also be switched on/off in order to only record under certain conditions - for instance, give me the maximum of A when B is below X.
  • The running mean block can be reset for a specific event. It can also be turned on or off by an event. This way one can calculate the running mean of an output for a specific period - say 5th of March until 29th of August.

See also

events.txt · Last modified: 2021/11/12 14:12 by mina