1. Learn
  2. /
  3. Courses
  4. /
  5. Discrete Event Simulation in Python

Connected

Exercise

Developing a discrete-event model

You have been asked to develop a discrete-event model for a farming operation to help allocate resources, increase productivity and identify-eliminate bottlenecks.

You are still discussing the different processes involved with your colleagues and in what detail they should be represented in the model. Thus, you have agreed that the information will be compiled in a dictionary named process_dict with the following structure. The idea is that this dictionary will be updated as more information about the processes becomes available.

process_dict = {
    "Process name 1":  <duration>,
    "Process name 2":  <duration>,
    ...
}

Let's build a generic discrete event model named discrete_model_farm() that can schedule any number of discrete events defined in the dictionary.

The input arguments of the model are (in order):

  1. process_dict: Dictionary with information about the processes
  2. simulation_time: Simulation period

Time in the model will be measured in days.

Instructions

100 XP
  • Initiate the state variables of the model, time (tracks time) and supply_chain (tracks number of cycles) and set them to zero.
  • Define the ending condition so that the model runs while time is less than simulation_time.
  • Add the duration of the process to the state-variable time.