Skip to contents

Attach a new source of arrivals to a trajectory from a data frame.


add_dataframe(.env, name_prefix, trajectory, data, mon = 1, batch = 50,
  col_time = "time", time = c("interarrival", "absolute"),
  col_attributes = NULL, col_priority = "priority",
  col_preemptible = col_priority, col_restart = "restart")



the simulation environment.


the name prefix of the generated arrivals.


the trajectory that the generated arrivals will follow (see trajectory).


a data frame with, at least, a column of (inter)arrival times (see details).


whether the simulator must monitor the generated arrivals or not (0 = no monitoring, 1 = simple arrival monitoring, 2 = level 1 + arrival attribute monitoring)


number of arrivals generated at a time. Arrivals are read from the data frame and attached to the trajectory in batches depending on this value. In general, it should not be changed.


name of the time column in the data frame.


type of time column: interarrival, if the time column contains interarrival times, or absolute, if the time column contains absolute arrival times.


vector of names of the attributes columns (see details).


name of the priority column.


name of the preemptible column.


name of the restart column.


Returns the simulation environment.


The data frame provided must have, at least, a column of (inter)arrival times. This method will look for it under the name "time" by default, although this can be changed with the col_time parameter.

If there is any column named col_priority="priority", col_preemptible=priority or col_restart="restart", they will be used to set the prioritization values for each arrival (see add_generator).

If there are additional columns (with col_attributes=NULL, by default), they will be assigned to arrival attributes named after each column name. All these columns must be numeric (or logical). Otherwise, if a vector of column names is specified, only these will be assigned as attributes and the rest of the columns will be ignored.

A value of batch=Inf means that the whole data frame will be attached at the beginning of the simulation. This is not desirable in general, because the performance of the event queue is degraded when it is populated with too many events. On the other hand, a low value results in an increased overhead due to many function calls. The default value has been tested to provide a good trade-off.

See also

Other sources: add_generator.