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 |
#1
|
||||
|
||||
how to make "senddelayedmessage" generic ??
Hello
We have a few network nodes (500), connected to each other to form a rail network. We are trying to make a trigger in the network nodes, so that as soon as a transporter exits one link ( a connection between two network nodes), the exiting network node (NN2) send a message back to the previous network node (NN1) making that link available for other transporters. this is the code we have developed which we have put as an on arrival trigger for NN2. senddelayedmessage(node("/Bondi Junction",model()),0,current,0,0,0); ( Bondi Junction being NN1) We would like to know how to make this generic, so that we wont have to edit each and every code with the NN1 name. Thanks |
#2
|
||||
|
||||
Please do not use constructs with a name (so node("/Bondi Junction") etc.) this is slow and especially with large models.
You might be able to create a hash table on reset. Simply go through the model (look at the forobject... functions) and make a column with the pointers as numbers to the previous objects and store on a label on the object the row nr of this table. to store a pointer write something like: settablenum( "HashTable", row, col, tonum( modelobject ) and on the node write a function like senddelayedmessage( tonode( getlabelnum( current, "RowLabel" ), 0, current, 0, 0, 0); (Even faster would be to use a ranknumber instead of "RowLabel" ) there are other ways for instance write a global function and call that function from every node and pass in the current. Or something completely different, write on a transporter a list of pointers of the nodes that the transported has passed and everytime it enters a new one send a message to the first of the list and remove that pointer. I hope that you have some ideas now. |
#3
|
|||
|
|||
Or send it to outobject(current,fromedge).
If the traveller has been idle at the node, fromedge may be zero so you'd need record it in the arrivaltrigger |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Phil BoBo (02-21-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
Is it possible one object comprised of the function of "combiner" and "separetor"? | Vic Li | Q&A | 1 | 08-19-2008 04:41 AM |
error message "Clock overflow, running stopped" | Martin Kooijman | Q&A | 11 | 04-17-2008 10:29 AM |
about "no select" and "show parameter window from side bar" | qin tian | Gripes and Goodies | 3 | 03-21-2008 08:10 AM |
Which variable stores "Properties -> General ->Flags -> Protected" information? | KelvinHo | Q&A | 1 | 03-06-2008 06:18 AM |
"Getting Started" and "Tutorial" models for v4.01 | Cliff King | Product Announcements | 0 | 12-10-2007 07:34 PM |