Difficult input strategy

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Anon
Posts: 1
Joined: Monday 11 June, 2012 - 12:10

Difficult input strategy

Post by Anon »

Hi, we got the following problem.
There are 2 servers. Each ist connected to all 6 queues.
Each server has to pull products out of a queue. But it is not allowed, that both servers use the same queue.

Example:
server 1 pulls products from queue 1
server 2 pulls products from queue 2
queue 1 gets empty
server 1 searchs another queue with products (input strategy: openallic(c))
server 1 pulls products from queue 5 now
queue 2 gets empty
server 2 searchs another queue with products (input strategy: openallic(c))
server 2 pulls products from queue 5 now, too (! not allowed)

Image

A solution would be, to CloseOC 2 of e.g. queue 1 when server 1 already pulls out of this queue.
But it is not working. Only CloseOutput is working, but this closes all OCs.

Any ideas?

Greetings
SimonvdW
Posts: 47
Joined: Thursday 06 January, 2011 - 09:52

Re: Difficult input strategy

Post by SimonvdW »

Hi,

Controlling the oc with closeoc is difficult, then internally the oc is openend again when a product leaves the Queue and there are still other products in it (all oc's will be opened automatically to check whether they can leave the Queue also).

Therefore you should use the input strategy of the servers to assign one of the available queues. Instead of the standard rule (Any input channel) you should define a rule that does not include the input connected to the queue that is being emptied by the other server.

You can use a label or a table to keep track of which queue is being served by any server at the moment: write the number as value on that label or in the corresponding cell of the table.
In the 4D script window of the server's Input strategy you can use a loop (with while or loopuntil statement) to test whether a queue is currently assigned to the server (use the the label or cell value in the evaluation) or that it has to search for a new queue that is not assigned to the other server (so the label or cell value is not equal to the value of the other server).
Don't forget to reset the label or cell value (set to 0) when the queue is emptied.

Good luck.
Post Reply