question

Luca S4 avatar image
0 Likes"
Luca S4 asked tannerp commented

Case by with or

Hello! Quick Question. The queue are entering items, marked with a Label "MyLabel1". It says either 1 or 2. How can i assign items with the label 1 to Port 1 or 3 and items with label 2 to the ports 2 or 3?

thank you for your help.

Luca

FlexSim 18.0.10
portsflexsim 18.0.10port by casevalues by caseor
unbenannt.png (303.1 KiB)
· 2
5 |100000

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

tannerp avatar image tannerp commented ·
Do you have priority values for either case? For example, if MyLabel1 indicates port 1 or 3, should it try to send to port 1 before port 3? Or should it alternate "Round Robin" style or according to a distribution?
0 Likes 0 ·
Luca S4 avatar image Luca S4 tannerp commented ·

no,there should be no priorisation. just wich ever is free.

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered tannerp commented

You insert another queue behind the one where you want Type 1 to divert to port 1 or 3. This is connected just with one output port, but this new queue can distribute by first available, round robin or random port variant.

· 3
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

Instead of Sending items to a defined port, you activate Pull in the Processors down stream of the queue. Pull Requirement is Specific Label and its value.

0 Likes 0 ·
Luca S4 avatar image Luca S4 commented ·

Thank you! I want to solve it with one queue, thats kind of a requirement. But however, the Pull-strategy solved it alone.

So its basically not possible to put AND/OR/EXOR directly in the port by case function?

0 Likes 0 ·
tannerp avatar image tannerp Luca S4 commented ·

@luca.s4,

You can hard code that logic into the port by case function, but it's a lot easier to just add another queue like Jörg suggested. This is an example of a way you could hard code it. (It's not that efficient.)

int outPort;
if(item.MyLabel1 == 1)    {
    outPort = bernoulli(50,1,3,getstream(current));
    if(!opavailable(current, outPort))    {
        if(outPort == 1)    {
            outPort = 3;
        }
        else if(outPort = 3)    {
            outPort = 1;
        }
    }
}
if(item.MyLabel1 == 2)    {
    outPort = bernoulli(50,2,3,getstream(current));
    if(!opavailable(current, outPort))    {
        if(outPort == 2)    {
            outPort = 3;
        }
        else if(outPort = 3)    {
            outPort = 2;
        }
    }
}
return outPort;
0 Likes 0 ·