Combining random products

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Jordivank
Posts: 5
Joined: Friday 17 January, 2014 - 11:39

Combining random products

Post by Jordivank »

Hello,

I have a problem concerning my servers.

I have 18 products with values going from 1 to 18. I have a question about randomly combing them.

Is it possible to set a script in my server that makes it possible to combine a certain amount of products until it reaches a total value of for example 30. The server needs to fill up from 3 different queues though.

The idea is to simulate 3 sealocks. So the situation is never the same. This is why it needs to be random.

For example:
In Queue 1 there are 6 ships, values 1, 6, 9, 3, 17 and 15.
In Queue 2 there are 3 ships, values 7, 9 and 2
In Queue 3 there are 5 ships values 4, 11, 13, 18 and 8

I need the server to do a FiFo pick, until it reaches the max of 30. So 1, 6, 9 and 3 will be picked. This however doesn't lead to the full 30. So to have an optimal utilization of the sealock it needs to automatically pick ships from the 2nd and 3th queue to fill it up.

To do this my server needs to automatically pick, 1, 6, 9 and 3 from queue 1, 7 from queue 2 and 4 from queue 3 to reach the set 30.

The numbers are made up and the queues can have a variation of numbers from 1 to 18.

I know it is hard to understand, and we've been struggling with the idea for a while now.

Through help from this forum the Sources and queues are finished and now the final stage is to get the 3 servers (sealocks) working probably.

Hope someone can be of help,
Jordi
SimonvdW
Posts: 47
Joined: Thursday 06 January, 2011 - 09:52

Re: Combining random products

Post by SimonvdW »

Hello Jordi,

The basic Server allows by default only one product (ship) to process.

An option for processing several ships is using a Multiservice. It has a parameter capacity, which is the maximum value. However it starts processing as soon as a product is in it. Each individual product gets its own process time.
By using the entry trigger and exit trigger in combination with functions closeinput, openinput, closeoutput and openoutput you can control when to allow ships from a queue and when not.

If you connect your 3 queues to the Lock (a Multiservice) you can control which input to use. By counting the values you decide when to close the output of this queue to the lock and try to allow a ship from another queue. The value must be below the capacity of the lock.
Once the batch is in the process time starts. After all ships have left (content 0) the lock can be opened again. Be aware to set the counting value to 0 again when the lock is emty and on rest of the model.

You describe you have 3 locks. They all have 1 queue but you allow to send a ship to another lock - to optimize the utilization - if it fits to the collection. Is this the case? Or didn't I understand it correctly?
Please let me know, so I can make an example for you.

Regards, Simon
Post Reply