Discrete Event Simulation in Python
Diogo Costa (PhD, MSc)
Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific
Example: Management of passenger flow in airports
Deterministic processes
Example: Welding machine
Processing time = Length of welding line x Speed of the welding machine
Non-deterministic processes
Example: Assembly line with welding
2 deterministic processeswelding_1
welding_2
welding_1
5
hourswelding_2
length * hours_per_length
Creating a dictionary
for each process:
welding_1 = {
"name": "Welding component A",
"time_hours": 5
}
length = 20 # meters
hours_per_length = 0.2 # hours
welding_2 = {
"name": "Welding component B",
"time_hours": length * hours_per_length
}
Example: The assembly line
2 non-deterministic processes
manual_assembly_1
manual_assembly_2
manual_assembly_1
80
hours5
hoursmanual_assembly_2
20
hours2
hoursCreating a dictionary
for each process:
manual_assembly_1 = {
"name": "Manual Assembly A",
"time_hours": 80,
"std_hours": 5
}
manual_assembly_2 = {
"name": "Manual Assembly B",
"time_hours": 20,
"std_hours": 2}
Manufacturing sequence of processes
Discrete-event model
# Initiate time-tracking variable time = numpy.zeros(number_of_processes)
# Next-event time progression time[0] = 0 time[1] = time[0] + welding_1["time_hours"] time[2] = time[1] + rd.gauss(manual_assembly_1["time_hours"], manual_assembly_1["std_hours"]) time[3] = time[2] + rd.gauss(manual_assembly_2["time_hours"], manual_assembly_2["std_hours"]) time[4] = time[3] + welding_2["time_hours"] time[5] = time[4]
Discrete Event Simulation in Python