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 |
Flexsim Student Forum Forum for discussion for Flexsim Students using the Flexsim Textbook. |
#1
|
|||
|
|||
User Commands
Hello everybody..
I just need some more insight into how exactly do user commands work. Specially the return type. By default the return type appears to be "num". What happens if I delete it and leave it empty. What other values can this field take and what would they mean.. |
#2
|
|||
|
|||
Some more details of what is happening. I have a multiprocessor on which I several processes. Since I am going to have many multiprocessors, I thought of using user commands for process times on each of the processors.
Now if I try to write the code inside a user command the process time that I try to return is not executed. i.e. the multiprocessor does not go into the process for the stipulated time instead jumps on to the process finish trigger straight away. If I write the same code directly on multiprocessor's process 1 field everything works fine. I have used user commands before but never before have I faced such a weird situation. At first I thought it has something to do with the return type that I am using on the user command but now I feel it has nothing to do with it since I tried using "num" as return type and then I tried using blank as well. For more reference I am attaching the model here |
#3
|
||||
|
||||
You aren't returning the process time that is returned by your user command.
You have: Code:
treenode current = ownerobject(c); treenode item = parnode(1); InitialNA(current,item); Code:
treenode current = ownerobject(c); treenode item = parnode(1); double processtime = InitialNA(current,item); return processtime; Code:
treenode current = ownerobject(c); treenode item = parnode(1); return InitialNA(current,item); |
#4
|
|||
|
|||
Ok Got it..Thanks a lot.. I knew it would be a very small thing.. I realized I had been using return in my previous model as well..
But out of curiosity could you tell me where using return is necessary and where not. Cause I believe if I use a user command on any of the triggers (on entry or onprocessfinish for example) it works fine.. So whats is the logic behind this.. And secondly could you answer my question related to return types in user commands.. by default its num.. What happens if I delete it and leave it blank.. What does it mean exactly..and are their any other types that can be used there.. |
#5
|
||||
|
||||
Triggers that return a value need to have a return value, otherwise they will return 0. For example: Process Time returns the process time, Send To Port returns the port to send to, and Use Transport returns a reference to the task executer to use for the transport. Some triggers don't use return values, such as the entry trigger and the onprocessfinish trigger.
If the pick options in the trigger return a value, then you can know that the trigger requires a return value. If the pick options don't return a value, then the trigger's return value is probably not used. The return value and parameter list are just used by the Flexscript parser to give you warnings if you are assigning values incorrectly. They follow the same format as the rest of the commands so you can look at the command documentation to see what values are available. |
Thread | Thread Starter | Forum | Replies | Last Post |
Excel table import using user commands | ardodul | Q&A | 6 | 04-27-2012 02:04 PM |
Transfer User Commands to a DLL | Stephan Seidel | Q&A | 4 | 02-03-2012 03:18 AM |
groups in user commands | Carsten Seehafer | Q&A | 2 | 07-08-2011 01:34 AM |
Table Commands Library | Brandon Peterson | User Development | 5 | 09-25-2008 09:25 AM |
What about the file read commands? | AlanZhang | Gripes and Goodies | 0 | 02-08-2008 05:17 PM |