ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 01-22-2008
qin tian qin tian is offline
Flexsim User
 
Join Date: Dec 2007
Location: Shanghai, China
Posts: 137
Downloads: 115
Uploads: 0
Thanks: 59
Thanked 3 Times in 3 Posts
Rep Power: 161
qin tian is on a distinguished road
Default How to control path of travelers on network route?

Suppose that there are three networknodes in a network. The two connections are From NN1 to NN2, From NN1 to NN3.
I use TaskExecutorFlowItems as travelers.

When TEFlowitems arrive in NN1, I want 30% of them to go to NN2 and 70% of them to go to NN3. I don't know how to implent the control.
Please help. Thanks.
  #2  
Old 02-04-2008
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default Changing a TE's path v.s. Changing its destination

If the are trying to control which of two paths the traveler takes to get to the same destination as in this layout, then the solution is to return a value in the OnArrival trigger of NN2 equal to the edge number of the path you want the traveler to take. That's the nice thing about the OnArrival trigger's of NetworkNodes. If you return a value greater than 0, the traveler will be "nudged" to take the path numbered the same as the value. In this model, the edge number from NN2 to NN3 is 2, and the edge number from NN2 to NN4 is 3; therefore, it works to just use this expression in the OnArrival trigger of NN2:

if(fromedge == 1)
{
return bernoulli(30, 2, 3);
}

Click image for larger version
Name:	ControllingTravelerPaths.jpg
Views:	385
Size:	41.0 KB
ID:	108

The reason this works so easily is because all the travelers have a destination for their travel task of NN5 and of course the Sink4 is their destination for the final unload task. Therefore, no matter which of the two nodes they get nudged to (NN3 or NN4), they can still proceed forward from that point to their final destinationn of NN5.

If NN5 were removed from the network, and NN3 and NN4 were both connected to Sink4 as shown in the picture below, it would require a little different approach. In this case you would have to redirect the traveler to a different travel destination than possibly it was headed to when it left Source1.

Click image for larger version
Name:	ControllingTravelerDestination.jpg
Views:	371
Size:	41.2 KB
ID:	109

Don't be confused between the destination for their travel task, and the destination for their unload task. You might remember from training that there is both regular travel and "offset travel". The offset travel is the travel that occurs from the node to the unload/load station and is associated with the load/unload task, not the travel task.

To change the travel destination, there is a command called redirectnetworktraveler() that you can use. The code in NN2's OnArrival trigger will need to both nudge and redirect the destination and will look something like this:

if(fromedge == 1)
{
int newEdge = bernoulli(30, 2, 3);
treenode newDestination = outobject(current, newEdge);
redirectnetworktraveler(traveler, newDestination);
return newEdge;
}

The last situation you might come across is when you not only need to change the network travel destination, but also the unload destination (for instance you might have a Sink2 and a Sink3 in the above example model). In this case you would be forced to preempt the traveler's active tasksequence it was dispatched with at Source1 with a new tasksequence. Just remember if you need to preempt and dispatch another tasksequence to a traveler on the network, do not do it directly in the OnArrival trigger. Instead, call senddelayedmessage() in 0 seconds, and do your dispatching in the OnMessage trigger!
The Following 4 Users Say Thank You to Cliff King For This Useful Post:
Jay Chou (04-18-2013)
  #3  
Old 02-16-2008
qin tian qin tian is offline
Flexsim User
 
Join Date: Dec 2007
Location: Shanghai, China
Posts: 137
Downloads: 115
Uploads: 0
Thanks: 59
Thanked 3 Times in 3 Posts
Rep Power: 161
qin tian is on a distinguished road
Default

Hi, Cliff, you are so kind.

The solution is just what I want.
  #4  
Old 02-19-2008
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Good to know these tricks. So we can actually specify paths for each travelers. Nice!
__________________
Best,
Alan
  #5  
Old 02-20-2008
Martijn van Oostenbrugge's Avatar
Martijn van Oostenbrugge Martijn van Oostenbrugge is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Posts: 71
Downloads: 12
Uploads: 0
Thanks: 44
Thanked 44 Times in 24 Posts
Rep Power: 268
Martijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to all
Default

Hi Cliff,

As I found it very interesting I tried to reproduce your last example. However, after preemting the current task sequence with a new one the travel task isn't executed anymore and the TE starts with it offset travel. So the question is, what did I do wrong?

I know by placing the code at NN3 in my example I would solve the problem. However, then only the offset travel has to be executed. I would have expected it to work by preemting the task sequence at NN2.

Martijn
Attached Files
File Type: zip changingdirection.zip (47.2 KB, 326 views)

Last edited by Martijn van Oostenbrugge; 02-20-2008 at 05:02 AM.


Thread Thread Starter Forum Replies Last Post
How to get a full path of the current open Flexsim model file. Regan Blackett Tips and Tricks 7 04-17-2008 10:39 AM
shortest path algorithm Vinay Mehendiratta Q&A 5 01-25-2008 11:42 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.