Please find below a short explanation of the most important terminologies used in the docs.

  • Arrival An arrival is created by a generator. An arrival can be considered a process, an active entity which has a number of activities associated to it and (in general) a limited lifetime in the system. These activities conform to a trajectory specification.

  • Trajectory When a generator creates an arrival, it couples the arrival to a given trajectory. A trajectory is defined as an interlinkage of activities which together form the arrivals’ lifetime in the system. Once an arrival is coupled to the trajectory, it will (in general) start processing the activities in the trajectory in the specified order and, eventually, leave the system.

  • Activity There are different kinds of activities that allow arrivals to interact with resources, perform custom tasks while spending time in the system, move back and forth through the trajectory dynamically… Currently, the set of available activities consist of seize, release, timeout, set_attribute, rollback and branch. See their respective documentation for details (e.g. ?seize).

  • Generator A generator is a process which creates arrivals with a given interarrival time pattern. These arrivals follow a specified trajectory.

  • Resource A resource is in essence a passive entity. It comprises two parts:
    • Server Conceptually, it represents the resource itself. It has a specified capacity and can be seized and released by an arrival.
    • Queue When an arrival tries to seize a resource (tries to access its server) and it is busy, this arrival is appended to the queue (of a given length) if there is room for it. If not, the arrival is rejected and immediately leaves the system.

From terminology to model

In the simulation model below we create a trajectory which we will call my trajectory. This trajectory consists of three consecutive activities; a seize, timeout and release event. In the seize and release events a associated resource type is specified. In this case the resource type is called operator.


# create a trajectory "my_trajectory"
# this trajectory consists of 3 activities, a seize, timeout and release activity.
  trajectory("my_trajectory") %>%
  # seize one unit of the resource called "operator"
  seize("operator", 1) %>%
  # spend some (stochastic) time holding that resource
  timeout(function() rpois(1,50)) %>%
  # release the previously seized unit of "operator"
  release("operator", 1)

Once the trajectory has been created, the simulation object (a simmer instance) is set up. One of the first steps is to actually attach a resource instance called operator. Next, a generator instance is attached. This generator, called my_generator, has an associated trajectory (my_trajectory stored in t0) and an associated dist function. Once run() is called the simulation model will start running. The generator my_generator will create an arrival at an interarrival time delivered by the function passed to dist.

env<-simmer() %>%
  # a resource called "operator"" is created with a capacity of 1 and an infinite queue size
  add_resource("operator", 1, Inf) %>%
  # this generator will create arrivals at each interval rpois(1,40) during
  # the simulation lifetime (while "dist" returns positive time values)
  # the arrivals will follow the trajectory specified in t0
                trajectory = t0,
                dist = function() rpois(1, 40)) %>%

For more information, see the other vignettes or the function specific help documentation (e.g. ?simmer).