PDA

View Full Version : Recycling


Alistair Smitheman
04-20-2009, 03:22 AM
A little of bit of guidance is required.

I have sources that is continually creating flowitems and as such appear to slow down the model. I have been using the destroyobject function however the consensus on here seems to be against that.

So what I want to know is that is there a way of forcing an source to recycle an item if the output is blocked.

OR

Do I put a sink to each source and get the source to send any objects to the sink when blocked and get the sink to do the recycling.

Steven Hamoen
04-20-2009, 04:18 AM
Alistair,

Creating flow items cost time. If they can't be taken from a recycle bin it takes even more time because memory has to be allocated and filled. If the item exists, the source can simply take that and send it out again.

If you want to recycle or not has to be entered on a sink or on a combiner (if applicable). The source automatically tries to recycle if possible. And it is only possible if somewhere else you have entered that flowitems should be recycled.

If you want to have a source that produces in a fixed rythm but can not always get rid of it's production, using a sink is a good way to go. If you want to destroy the object, use recycleitem instead of destroyobject.

You will find that it speeds up your models quite a lot if you recycle. especially if you create large amounts of products.

1 piece of warning, if you start with recycling, make sure that all your labels are reset and itemtypes are correct when the items enter your model again, because you can get very strange results otherwise that are quite difficult to find. (experience has taught me:()