ATTENTIONThis 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 |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
How to dynamically set virtual distance for Network Node
Hi,
I would like to dynamically set the virtual distance in "Path" tab for a Network Node depending on the flowitems's label value. For example, if one of flowitem has a label named "destination" with a value of 5, I would like to set the virtual distance for the path of my network 5 before it starts travel on the network by a transporter. I could not find a command to set the virtual distance directly. I think I might need to set virtual distance attribute of network node in a tree, but could not find which variable represents the virtual distance. Closest one I found is "virtualexits", but I don't think it is the right one. Could anyone can help me how to set the distance dynamically? Thank you in advance. |
#2
|
||||
|
||||
Updating a NetworkNode's Virtual Distance During Runtime
The node is called "user dist" and it is buried deep down in the connections/connectionsout attribute of a NetworkNode. Here is a code snipit that you can use to dynamically update the virtual distance of the 2nd path (edge) to a distance of 100 in the OnArrival trigger of a NetworkNode. Notice that it is necessary to re-run Diikstra's Shortest Distance algorithm by calling the optimizenetwork() command as well.
Code:
if(toedge == 2) { setnodenum(rank(rank(connectionsout(current), toedge),15), 100); optimizenetwork(); } |
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamically assigning 3D shapes to flowitems | Iulian Marin Ion | Q&A | 9 | 08-05-2013 08:17 PM |
Moving Network Node Information into a Table | Brandon Peterson | Q&A | 2 | 02-15-2008 09:46 AM |
Expertfit cannot find network key - Flexsim Network License | Kris Geisberger | Q&A | 0 | 02-05-2008 05:10 PM |
How to dynamically show/hide the imported 3D shape assigned to a VisualTool | Cliff King | Tips and Tricks | 0 | 09-18-2007 04:09 PM |