View Single Post
Old 12-08-2008
BenjaminBuecklein's Avatar
BenjaminBuecklein BenjaminBuecklein is offline
Flexsim User
Join Date: Sep 2008
Location: Cottbus, Germany
Posts: 11
Downloads: 6
Uploads: 0
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 140
BenjaminBuecklein is on a distinguished road

Hey Steve,

thanks for the very quick reply and your ideas. But now I figured something out for myself.

Here is my solution:

In the Queue's flow-tab I just modified the code for "send to random available port a little bit. I created a label called "PortNr" and the code looks like this:

treenode item = parnode(1);
treenode current = ownerobject(c);
/**Random Available Port*/
/** \nIf no ports are are available, send to the first port to become available.*/

double arraysize = nrop(current);
doublearray openports = makearray(arraysize);
int nrofportsopen = 0;

if (getlabelnum(current,"portnr")==-1)
for( int index = 1; index <= arraysize; index++)
if( objectexists(outobject( current , index)) && ipopen(outobject( current , index), opipno( current , index)) && get(connectionsin(outobject( current , index)))==0 )
openports[ nrofportsopen ]
[h1] index;

double returnvalue;
if(nrofportsopen > 0)
int returnindex [/h1]
duniform(1, nrofportsopen);
returnvalue = openports[returnindex];
returnvalue = 0;

return returnvalue;

return getlabelnum(current,"portnr");

And in the OnReset and OnEntry trigger I used this:

/**BB: R├╝cksetzen PortNr*/
treenode item = parnode(1);
treenode current = ownerobject(c);
int port = parval(2);

Now the Queue sends the batched contents completely to one port and close the receiveport for the other queues.

But your answer might be useful in other ways.

So, thanks a lot.

Best regards
Reply With Quote