PMSIM: Automatic Discrete Event Simulation of Processes Using Event Logs
This project provides an open-source tool that allows the user to generate an event log by simulating the discovered process model from an original event log recorded from a process aware information system. This tool is completely written in Python, using the pm4py library for process model generation and the SimPy library for discrete event simulation.
mainly comprises three modules:
- Process Mining
- In this module, the process model is discovered in the form of a Petri net by applying process mining techniques on the original event log. This Petri net presents the possible flow of activities for the cases. Furthermore, feature extraction is performed in the subsequent performance analyses step, resulting in the calculation of arrival rate of cases and activity duration. These extracted features are subsequently used in the discrete event simulation module.
-
Discrete Event Simulation
- In this module, new cases are generated based on the features extracted from the process mining module. Users are also provided with the option to interact with the tool by providing as input, the number of cases to be generated. This input also acts as an endpoint for the simulation process. Additionally, users can modify the arrival rate of cases as well as the activity duration for particular activities.
- Generating the Simulated Event Logs
- In this module, the simulated events for the generated cases are transformed into an event log. This event log is saved in the form of a
.csv
file. Moreover, the discrete event simulation clock is converted into a real timestamp and records each activity for the cases accordingly.
Features
- In the process discovery step, the presence of loops in the Petri net is handled with maximum trace length which limits the execution of unrealistic loops for the simulated cases.
- The arrival rate of cases is calculated by considering the business hours, which results in a more accurate value.
- The tool provides users the option to modify the features case arrival time and activity time.
- The tool supports
.xes
event log formats as input.
- The tool is capable of handling event logs with single as well as two timestamps i.e. when the start and complete timestamps are given in the event log, then the value of the average duration of each activity is calculated.
Screencast
In this video, you can watch a screencast of the tool which demonstrates the main functionalities of our Python-based tool for automatic discrete event simulation of processes using event logs. Please note that you may need to download the video file to watch.
Requirements
This open-source tool is OS-independent, and you only need to install the Python packages specified in the requirements file.
Usage
As a preceding step, install the mentioned python packages using the following commands:
pip install pm4py
pip install simpy
Then, navigate to the directory where the original event log (running-example.xes in our case) is stored and run the _simulationactivity.py file using the following command:
python simulation_activity.py running-example.xes
Therewith, the simulation models of the discovered process model (including all the performance information) are produced and stored in the newly generated methods.py file.
Now, run the simulation.py file which performs the actual simulation process (optionally with custom inputs provided by users) using the following command:
python simulation.py running-example.xes
Information for Citation
- Link to the paper
- Bibtex Citation:
- @misc{PTSIM2021,
title={A Python Extension to Simulate Petri nets in Process Mining},
author={M. Pourbafrani and Sandhya Vasudevan and Faizan Zafar and Yuan Xingran and Ravikumar Singh and Wil M. P. van der Aalst},
year={2021},
url={arXiv:2102.08774},
}