File: gas_station_refuel.rst

package info (click to toggle)
python-simpy3 3.0.11-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,080 kB
  • sloc: python: 2,885; makefile: 138
file content (33 lines) | stat: -rw-r--r-- 1,021 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
=====================
Gas Station Refueling
=====================

Covers:

- Resources: Resource
- Resources: Container
- Waiting for other processes


This examples models a gas station and cars that arrive at the station for
refueling.

The gas station has a limited number of fuel pumps and a fuel tank that is
shared between the fuel pumps. The gas station is thus modeled as
:class:`~simpy.resources.resource.Resource`. The shared fuel tank is modeled
with a :class:`~simpy.resources.container.Container`.

Vehicles arriving at the gas station first request a fuel pump from the
station. Once they acquire one, they try to take the desired amount of fuel
from the fuel pump. They leave when they are done.

The gas stations fuel level is regularly monitored by *gas station control*.
When the level drops below a certain threshold, a *tank truck* is called to
refuel the gas station itself.


.. literalinclude:: code/gas_station_refuel.py

The simulation's output:

.. literalinclude:: code/gas_station_refuel.out