Page 1 of 1

Modeling a system with multiple products

Posted: Wednesday 07 January, 2015 - 21:57
by murmillo
Hi!
I need help with modeling a system which has multiple products that are flowing through the system. And different products have different routing through the system. And different products have different arrival time into the system
For example, I have 10 products that will arrive into the system after 30 min from the start of the simulation and that 10 products will go to server 1, then to server 3 and finally to server 5...after that i have 4 products that will arrive into the system after 1 hour from the start of the simulation and that four products will go to server 1, then server 2 then server 4...and so on. So i need help with this arrival thing of my different products into the system and with labels that will route my products through the system. Can anybody help me?

Thanks

Re: Modeling a system with multiple products

Posted: Thursday 08 January, 2015 - 10:15
by HarryBunnik
Hello,

It sounds as if you can use an Arrival list to create the products in the correct order and amount.

As far as the routing goes, you indeed will have to use labels, which you can set on the OnExit trigger of the ArrivalList indicating which product they are and which route they have to take. These you can then use in the SendTo statements in the servers and queues to manipulate the routing. The small snippet of code below decides on basis of the value of the label [Route] which exit channel should be taken.

Code: Select all

If(
  Label([Route], first(c)) = 1, {Route 1} 
  1, 
  2
)
I hope this helps you starting.

Cheers,

Harry

Re: Modeling a system with multiple products

Posted: Thursday 08 January, 2015 - 11:38
by murmillo
Thanks for help but I don't fully understand this. I've tried to make model with labels like you wrote but something is wrong. Can you upload an example with 2 different products and couple of servers so that different products will go on different servers so I can se what I'm doing wrong with labeling. Because from some reason, my queue doesn't read label and products stay at the queue. Is it possible that server reads more than 1 label and than decides where to send product?

Re: Modeling a system with multiple products

Posted: Thursday 08 January, 2015 - 15:17
by HarryBunnik
Hello,

I've made a very simple model. The source produces 3 products and gives them respectively routes 1, 2 and 3. Route 1 uses only server 1.Route 2 uses servers 1 and 2. Route 3 uses all 3 servers. The code checking the route is placed on the SendTo statements of the servers. The assigning of the routes is done on the onExit trigger of the Source.
ExampleRouting.mod
(11.75 KiB) Downloaded 399 times
In the moment I wrote it hard in the SendTo statements of the servers on code, but a nicer solution would be to use a Routing Table. In such a table you can take up a column per server and a row per route and indicate which exit channel must be taken. That would in the end be the most easy way to create and maintain it I think.

Code: Select all

Cell(label([Route], first(c)), 3 {Server3}, refRoutingTable)
I hope this helps you further! Good luck!

Harry

Re: Modeling a system with multiple products

Posted: Thursday 08 January, 2015 - 18:50
by murmillo
Thanks for this! but I have here more complicated problem. I will upload you to see. Here I have 3 products with same label and different label value. In send to parameter of queue i wrote this

do(if(label([product],first(c))=1,1),
if(label([product],first(c))=2,2),
if(label([product],first(c))=3,3))

but it doesn't work. it only works for when I wrote for 1 product...for example if(label([product], first(c))=1,1 then queue sends my product to channel 1, but when I wrote for three products it doesn't work. Can you tell me where is the problem?

Thanks in advance! :)

Re: Modeling a system with multiple products

Posted: Friday 09 January, 2015 - 10:04
by HarryBunnik
Hello,

The fact that is goes wrong (except for the first product, and only when it comes from the third source) is a result of the construction of your SendTo statement on the Queue. The SendTo channel is chosen based on the result of the code. So even when the first if statement you've written returns a true and as answer channel 1, it will be overruled by the second and third statement that are returning a zero. When you do something like this, it's better to use a case statement, which is always returning a value. That way the result you've found, can't be overruled by other checks.:

Code: Select all

Case(
  WhichIsTrue(
    label([product], first(c))=1, 
    label([product], first(c))=2, 
    label([product], first(c))=3
  ), 
  1, 
  2, 
  3
)
But in your current case it's easier. You already have the product codes 1,2 and 3 on the label([Product], ..). So all you have to do is place the "label([product], first(c))" in the SendTo statement. Then it also works. (This is also one of the predefined logics available in the SendTo statement (nr. 7)).

Cheers,

Harry

Re: Modeling a system with multiple products

Posted: Friday 09 January, 2015 - 10:33
by murmillo
Thanks! :) This is really helpful. I also find a way. I write nested If command. For example:

if(label([product]),first(c)=1,1,
if(label([product]),first(c)=2,2,
if(label([product]),first(c)=3,3)

I know that this doesn't have to be written in this way because we have option in Send to to read label directionally but this is just example.

One more time, thanks!

Best regards!