Give one channel preference at the input strategy

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Nico
Posts: 1
Joined: Wednesday 04 July, 2012 - 15:28

Give one channel preference at the input strategy

Post by Nico »

Hey,
i ve following problem. My server has 4 input queues and 4 output queues. I told the server by the sendto 4D skript, that it has to send parts from the A input queue to the A Output queue and so on.

The first 3 queues are sending togehter a third of atoms than the fourth queue is sending.

If i use the " largeste queue" or longest waiting" as input strategy the amount of all atoms from the sending queues becomes equal after a while. But actually it has to serv the the fourth channel 3 times more than the other one. The cicly time are fix and cant be changed, so i ve to do it about the input strategy.

So the server should take atomes from the fourtht queue 3 times more often than from the other queues but of course not only just from the 4th one.
Thought about this something like this code

If
( content queue 4 bigger than x
, use channel 4
,every other channel)

or

use channel 4 ,3 times more often than the other

How can i do this, its blocking my model and the deadline for the project is running?!
Last edited by MatthijsJongboer on Wednesday 04 July, 2012 - 16:25, edited 1 time in total.
Reason: Offensive language
SimonvdW
Posts: 47
Joined: Thursday 06 January, 2011 - 09:52

Re: Give one channel preference at the input strategy

Post by SimonvdW »

Hi,

What I understand from your question is that you want input queue 4 to be used as much as the input queues 1 until 3 together.
As you already expected, the input strategy is the location to arrange that.

The easiest way is to write in the input strategy : Bernoulli(50, 4, Bernoulli(33.33, 1, Bernoulli(50 , 2, 3))).
Half of the times input 4 is openend; the other inputs all have 1/6 change. This will however only work if there are always products in the queues. Otherwise the model waits until a product arrives in the queue you just openend.

If products are not always present you have to do something with a check, just as you can see in the code if you select option 'Longest waiting'. This code checks whether there are products waiting. If not all channels are opened and the system waits for the next arrival. If so, an index function is used to determine which queue (connected to an input channel of the server) contains the longest waiting product.

You can combine this code with the bernoulli as described above: for example 50% chance to open input 4 and the other channels according to the code based on longest waiting. Be aware to replace nric(c) in the code with 3 as you don't want to evaluate all inputchannels but only the first 3.


If you send product from input A to output a (for example through a label) you will get the output as desired.
Post Reply