BeltStore

Bases: ReservablePriorityReqFilterStore

This is a class that is derived from SimPy's Store class and has extra capabilities that makes it a priority-based reservable store for processes to reserve space for storing and retrieving items with priority-based access.

Processes can use reserve_put() and reserve_get() methods to get notified when a space becomes available in the store or when an item gets available in the ReservablePriorityReqStore. These methods returns a unique event (SimPy.Event) to the process for every reserve requests it makes. Processes can also pass a priority as argument in the request. Lower values indicate higher priority.

get and put are two methods that can be used for item storing and retrieval from ReservablePriorityReqStore. Process has to make a prior reservation and pass the associated reservation event as argument in the get and put requests. ReservablePriorityReqStore maintains separate queues for reserve_put and reserve_get operations to ensures that only processes with valid reservations can store or retrieve items.

ReservablePriorityReqStore preserves item order by associating an unreserved item in the store with a reservation event by index when a reserve_get() request is made. As a result, it maintains a list of reserved events to preserve item order.

It also allows users to cancel an already placed reserve_get or reserve_put request even if it is yielded. It also handles the dissociation of the event and item done at the time of reservation when an already yielded event is canceled.

ConveyorBelt

Bases: Edge

A conveyor belt system with optional accumulation.

Attributes:

state (str): state of the machine
capacity (int): Maximum capacity of the belt.
delay (float): Time delay for items on the belt.
accumulation (int): Whether the belt supports accumulation (1 for yes, 0 for no).
belt (BeltStore): The belt store object.

Methods:

is_empty(self):
    Checks if the belt is empty.
show_occupancy(self):
    Returns the number of items on the belt.
is_full(self):
    Checks if the belt is full.
can_get(self):
    Checks if an item can be retrieved from the belt.
is_stalled(self):
    Checks if the belt is stalled due to time constraints.
can_put(self):
    Checks if an item can be added to the belt.


get(self, get_event):
    Retrieves an item from the belt if there is already a matching get_event in the belt.
put(self, put_event, item):
    Places an item on the belt if there is already a matching put_event in the belt.
reserve_get(self):
    Queues a reservation for get request.
reserve_put(self):
    Queues a reservation for a put request

behaviour(self):
    Main behavior of the conveyor belt.
Raises:
  • AssertionError

    If the belt does not have at least one source node or one destination node.

  • ValueError

    If the belt already has 1 out_edge or tries to add an in_edge.

is_empty()

Check if the belt is completely empty.

is_full()

Check if the belt is full.

can_get()

Check if an item can be retrieved from the belt.

is_stalled()

Check if the belt is stalled due to time constraints.

can_put()

Check if an item can be added to the belt.

move()

Move items along the belt.

accumulate()

Handle item accumulation on the belt.

noaccumulate()

Handle non-accumulating belt behavior.

reserve_get()

Queue a get request.

reserve_put()

Queue a put request or add item to the belt if possible.

behaviour()

Main behavior of the conveyor belt.