Simpy FilterStore

238 views
Skip to first unread message

Peter Stahlecker

unread,
Oct 27, 2021, 1:41:17 PM10/27/21
to python-simpy

I have this situation:
store = simpy.FilterStore(env, capacity=N)

Now distinguishable parts (say, all having different part numbers) arrive and are put in the store. As the capacity is limited, a queue forms.
If I look at store.put_queue I get a list with entries „StorePut() object at….  .

How can I find out, which one of the parts is ‚hidden‘ in a given StorePut() object?
It must be somewhere in this object, as once it is in the store, I can find it in the store.items list.

Same question for the StoreGet() object.

Any help is greatly appreciated!


Omogbai Oleghe

unread,
Oct 27, 2021, 4:14:16 PM10/27/21
to Peter Stahlecker, python-simpy
Hi,
Sometimes I like to avoid using the simpy default objects, because others need to understand the model logic in non-simpy language.

For your situation, :
  1. I would create an empty list
  2. I would have each generated item have its own unique id as it is generated, e.g. using self.id +=1
  3. I would append each self.id into the created list when the item is entered into the store object
  4. I would remove each self.id from the list when the item has been removed from the store
  5. I can print the list items to show the items in the list


--
You received this message because you are subscribed to the Google Groups "python-simpy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-simpy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-simpy/da5aacf7-6dc8-43a3-bcd5-12df2f847a81n%40googlegroups.com.

Omogbai Oleghe

unread,
Oct 27, 2021, 4:16:35 PM10/27/21
to Peter Stahlecker, python-simpy
Hi,
Sometimes I like to avoid using the simpy default objects, because others need to understand the model logic in non-simpy language.

For your situation, I would:
  1. create an empty list
  1. have each generated item have its own unique id as it is generated, e.g. using self.id +=1
  1. append each self.id into the created list when the item is entered into the store object
  1. remove each self.id from the list when the item has been removed from the store
  2. I can print the list items to show the items in the list


    For your situation

    On Wed, Oct 27, 2021 at 6:41 PM Peter Stahlecker <peter.st...@gmail.com> wrote:

    Peter Stahlecker

    unread,
    Nov 21, 2021, 2:22:56 AM11/21/21
    to python-simpy
    Dear Sir,
    Of course your solution will work, but it does not look very elegant.
    The information about the object to be put in the fliterstore MUST be hidden somewhere in the StorePut object, otherwise how would the store know what is is receiving - and it knows it obviously.
    Any idea how to retrieve this information from the Store.Put object?
    Thanks a lot!! 

    Michael Gibbs

    unread,
    Nov 21, 2021, 11:13:01 PM11/21/21
    to python-simpy
    So  FilterStore has a attribute put_queue which is a list of put requests waiting to the added to the store each put requests has a attribute item which is the object being added to the store
    Reply all
    Reply to author
    Forward
    0 new messages