ciw.event_log_from_ciw_recs

ciw.event_log_from_ciw_recs(ciw_recs_obj, node_name_list)

Build an event log from a ciw.data_record object.

The returned dataframe is in the format expected by the vidigi functions reshape_for_animation and animate_activity_log.

Parameters

Name Type Description Default
ciw_recs_obj Iterable[Mapping[str, Any]] An iterable ciw.data_record object. Output by Simulation.get_all_records(). See https://ciw.readthedocs.io/en/latest/Tutorial/GettingStarted/part_3.html and https://ciw.readthedocs.io/en/latest/Reference/results.html for more details. required
node_name_list Sequence[str] User-defined list of strings where each string relates to the resource or activity that will take place at that ciw node required

Returns

Name Type Description
pd.DataFrame Event log with one row per event and the columns: entity_id, pathway, event_type, event, time, and optionally resource_id.

Notes

Given the ciw recs object, if we know the nodes and what they relate to, we can build up a picture the arrival date for the first tuple for a given user ID is the arrival

Then, for each node: - the arrival date for a given node is when they start queueing - the service start date is when they stop queueing - the service start date is when they begin using the resource - the service end date is when the resource use ends - the server ID is the equivalent of a simpy resource use ID

A more complex multi-node example can be found in https://github.com/Bergam0t/ciw-example-animation in the files: - ciw_model.py - vidigi_experiments.py

Examples

Example taken from:

https://ciw.readthedocs.io/en/latest/Tutorial/GettingStarted/part_3.html

Let us interpret the servers as workers at a bank, who can see one

customer at a time

import ciw

N = ciw.create_network( arrival_distributions=[ciw.dists.Exponential(rate=0.2)], service_distributions=[ciw.dists.Exponential(rate=0.1)], number_of_servers=[3] )

ciw.seed(1)

Q = ciw.Simulation(N)

Q.simulate_until_max_time(1440)

recs = Q.get_all_records()

event_log_from_ciw_recs(ciw_recs_obj=recs, node_name_list=[“bank_server”])

Back to top