question

Flexinator avatar image
0 Likes"
Flexinator asked Jason Lightfoot commented

processor is blocked because item afterwords is full - use other itemtype

Hello,


i have a problem with my main model. That model here is just an example.


Problem: I have in my main model 3 different Item types they go through the same processor. after the processor there are different items like WIP buffer, Combiner or Seperator etc. Lets go through the problem that afterwards comes the three different WIP buffer queues with different sizes for each item type. If one of these queues are full, then it should close the input of the buffer and should produce other item types where there buffer queues are not full, otherwise unfortunately the whole processor blocks.


i try it with the example from How to close ports for a processor when the queue is full - FlexSim Community. But here it close the whole processor1 before and it doesn't produce the items from Source2 :( How i can fix it?

1704295208269.pngproblem.fsm


Thanks for your help!!!


Best regards

FlexSim 23.1.1
triggerslogicitem blocked
1704295208269.png (150.9 KiB)
problem.fsm (18.6 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

You can implement this with ports and triggers but note that you may find a process flow easier to implement and verify.

You can modifying the pull from port code to only consider ports where ipavailable and opavailable in deciding which is the longest waiting item, so line 16 becomes:

    if (ipavailable(current,index) && opavailable(current,index) && tempinobject.subnodes.length > 0 ) {
                 

Then in case no longest waiting item is found and you return 0 (pull from any port), you should still use the pull requirement to only pull items where there is downstream capacity:

Object buffer=current.outObjects[port];
return (buffer.subnodes.length+getvarnum(buffer,"nroftransportsin"))<buffer.getProperty("MaxContent");

This can result in no items being pulled but no hook to retrigger the pull so on the second processor's exit trigger open the first processor's input using a delayed open input event (it's already open - it just forces the pull to reevaluate if it can take items).

createevent(current.upstreamMachine,0,EVENT_USEROPENINPUT)

Model attached.

pull_portMatchingInOut_bufferCapacity.fsm

(I changed the pallet buffer capacity to 10 to test the constraint more quickly)


· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Flexinator avatar image Flexinator commented ·

Hi Jason, first of all thank you again! That is exactly what i wanted :)

I just create another problem: I extend my model a bit, that after the processor there comes a seperator and than it follows the line..

Now your last code:

createevent(current.upstreamMachine,0,EVENT_USEROPENINPUT)

is giving a error, because the item itself changes... Do you know how i can solve that problem?

1704803644440.png

kind regards!

pull-portmatchinginout-buffercapacity_newproblem.fsm

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Flexinator commented ·
You seem to have copied code that references the label "upstreamMachine" on the seperator but not re-created the label. Add a pointer label to the seperator and point it to the machine that needs to reevaluate its pull (Processor1) and remove it from the final Processor2.
0 Likes 0 ·
Flexinator avatar image Flexinator Jason Lightfoot ♦♦ commented ·

Yesss you're right, my bad... thanks!! :) Quick question: Why do i have to point the processor1? Is it because i have more upstreams processes and that is why "upstreamMachine" does not know which of these upstream value he should change? otherwise i wonder why it works with your first solution without a pointer

0 Likes 0 ·
Show more comments
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Flexinator commented

Pull Items into a processor rather send them from queues into it. Pull from any port, but use a strategy, where you restrict a type. You choose a type value for example by a label value. This value changes while your model runs.

pull_changing_type.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Flexinator avatar image Flexinator commented ·

Hi! First of all thanks for your help!


But i don't get your solution tbh. Maybe because i'm now into FlexSim.


So you have an array that increase +1 if the strategy is true and -1 if he doesn't pull anything right?


So in your model the array isn't changing at all. So he does not pull an item towards him over time.


But maybe my problem wasn't described well enough by me, sorry for that!




So my problem is clearly visible in the following picture.


1704359052935.png




Queue 4 is full and yet he has pulled the red item and is blocking the entire flow. In my main model it would now take some time until queue 4 is free again, but this does not reflect reality. I would like to avoid this mistake and he should have taken the blue or green item instead of the red item.




To use your strategy it means that i fill in the Queue sizes into to array and then he should check in the array if the limit in the array is reached or not. When not then use the other item. Did i understand it correctly? If yes, than i think it wouldn't help me into this. Because next time the topull value increases again because he fits into the requirement but i doesn't mean that the queue size after is decreased at the same time.

0 Likes 0 ·
1704359052935.png (124.6 KiB)