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

Connected

Exercise

Modeling a petrol station: Run the model and analyze the results

In the previous exercise, you created a generator, car_generator(), to simulate the behavior of the cars arriving at a gas station, and another, gas_station_pumps_control(), to manage the gas station fuel storage.

Now, using these generators, we are ready to create a SimPy model, add resources and processes, and run simulations.

Instructions 1/2

undefined XP
    1
    2
  • Create a SimPy resource to represent the four gas pumps.
  • Create a SimPy container to represent the common gas station tank, which is set at full capacity given by the variable GAS_STATION_TANK_SIZE.
  • Add the SimPy processes separately to the SimPy environment, which have been stored in the generators gas_station_pumps_control() and car_generator().