simpy.resources.store — Store type resources¶
This module contains all Store like resources.
Stores model the production and consumption of concrete objects. The object type is, by default, not restricted. A single Store can even contain multiple types of objects.
- class simpy.resources.store.Store(env, capacity=inf)¶
Models the production and consumption of concrete Python objects.
Items put into the store can be of any type. By default, they are put and retrieved from the store in a first-in first-out order.
The env parameter is the Environment instance the container is bound to.
The capacity defines the size of the Store and must be a positive number (> 0). By default, a Store is of unlimited size. A ValueError is raised if the value is negative.
- items = None¶
List of the items within the store.
The maximum capacity of the store.
- class simpy.resources.store.FilterStore(env, capacity=inf)¶
The FilterStore subclasses Store and allows you to only get items that match a user-defined criteria.
Example: The store is empty. Process 1 tries to get an item of type a, Process 2 an item of type b. Another process puts one item of type b into the store. Though Process 2 made his request after Process 1, it will receive that new item because Process 1 doesn’t want it.
- class simpy.resources.store.StorePut(resource, item)¶
Put item into the store if possible or wait until it is.
- item = None¶
The item to put into the store.
- class simpy.resources.store.StoreGet(resource)¶
Get an item from the store or wait until one is available.
- class simpy.resources.store.FilterStoreGet(resource, filter=lambda item: True)¶
Get an item from the store for which filter returns True. This event is triggered once such an event is available.
The default filter function returns True for all items, and thus this event exactly behaves like StoreGet.
- filter = None¶
The filter function to use.
- class simpy.resources.store.FilterQueue¶
Get the keyth event from all events that have an item available in the corresponding store’s item queue.
Return True if the queue contains an event for which an item is available in the corresponding store’s item queue.