Deterministic events and processes

Discrete Event Simulation in Python

Diogo Costa (PhD, MSc)

Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific

Event (or Process) determinism

NOTE: Terms "event" and "process" used interchangeably.

What is event (or process) determinism?

  • Ability of process to be predicted accurately
  • Process referred to as "Deterministic"

Why are deterministic processes important?

  • Natural and human-driven activities are complex
  • Many interdependent processes and resources
  • Some processes repeat the same way in every occurrence
  • Impact on system output can be predicted accurately
Discrete Event Simulation in Python

Examples of deterministic processes or events

Natural world

  • Height of ocean tides
  • Acceleration of objects due to gravity (9.81 m$^2$/s)
  • Movement of planets in solar system
  • Speed of sound in air (331.29 m/s)
  • Speed of light (300,000 km/s)
  • Freezing of water (at 0 degrees Celsius)

Human-driven or human-initiated

  • Flow from water tap
  • Speed of water bottle filling machine
  • Time coffee machine takes to make a coffee
  • Heat released by oven at 230 degrees Celsius
  • Washing machine programmed cycles
  • Functioning of microwave appliance
Discrete Event Simulation in Python

Representing deterministic events in discrete-event models

Deterministic processes

  • Predictable impact on dynamic systems
  • Well-known duration
  • Repeat themselves in the same manner

Process duration needs to be accounted for in the simulation time

# Deterministic processes (time in hours)
duration_process_1 = 10
duration_process_2 = 5

while sim_time < total_sim_time:
# Update simulation time: Process 1 sim_time += duration_process_1
# Update simulation time: Process 2 sim_time += duration_process_2
Discrete Event Simulation in Python

Representing deterministic events using SimPy

A SimPy implementation of deterministic events:

  • .timeout()method clocks-in duration of process
    • Blind to time units
    • Treats time as numbers
    • Time units need to be consistent across model
# Deterministic processes
duration_process_1 = 10
duration_process_2 = 5

while True:

   # Update simulation time: Process 1
   env.timeout(duration_process_1)

   # Update simulation time: Process 2
   env.timeout(duration_process_2)

Discrete Event Simulation in Python

Let's practice!

Discrete Event Simulation in Python

Preparing Video For Download...