tok_xes: XES event log of a simulation

View source: R/sim.R

tok_xesR Documentation

XES event log of a simulation

Description

Writes the event log of tok_sim() as an XES document (IEEE 1849-2016, eXtensible Event Stream), the exchange format of process-mining tools such as ProM, pm4py, bupaR, Disco and Celonis; it is the file of ⁠tok sim --xes⁠.

Usage

tok_xes(
  x,
  file = NULL,
  cases = NULL,
  seed = NULL,
  lang = getOption("tok.lang", "en")
)

Arguments

x

A result of tok_sim(), whose run is repeated with the same model, number of cases and seed (which gives the same log), or a model: a tok_model, the path of a .tok file, or the text of a model, which is simulated with cases and seed.

file

Optional path to write to.

cases, seed

As in tok_sim(); only for a model, not for a result of tok_sim().

lang

Language of the messages, "en" or "pl". The default comes from the option tok.lang.

Details

The log has one trace per case and up to three events per activity instance, with the transitions of the standard lifecycle model: schedule when the case reached the activity, start when a performer started the work and complete when it completed; an instance interrupted by a boundary timer ends with ati_abort when it was running and with withdraw when it was still waiting for a performer. Events carry concept:name (the label of the activity), concept:instance, org:resource, time:timestamp (with milliseconds and the UTC offset of ⁠start=⁠ of simulate) and activity (the identifier). Traces carry the case number, start, end, end_event, cycle_time_s and the case variables as typed attributes. See docs/simulation.md in the repository for the details.

Value

The XES text; invisibly when written to file.

Examples

f <- system.file("examples", "kwerenda-symulacja.tok", package = "tokr")
s <- tok_sim(f, cases = 20)
xes <- tempfile(fileext = ".xes")
tok_xes(s, xes)
substr(tok_xes(f, cases = 2, seed = 7), 1, 200)

tokr documentation built on Nov. 26, 2026, 5:08 p.m.