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 > Flexsim Student Forum
Downloads

Flexsim Student Forum Forum for discussion for Flexsim Students using the Flexsim Textbook.

  #1  
Old 05-01-2013
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 119
mearjun will become famous soon enough
Default 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  
Old 05-01-2013
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 119
mearjun will become famous soon enough
Default

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
Attached Files
File Type: fsm exp.fsm (43.7 KB, 125 views)
  #3  
Old 05-01-2013
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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);
It needs to be
Code:
treenode current = ownerobject(c);
treenode item = parnode(1);
double processtime = InitialNA(current,item);
return processtime;
or
Code:
treenode current = ownerobject(c);
treenode item = parnode(1);
return InitialNA(current,item);
  #4  
Old 05-01-2013
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 119
mearjun will become famous soon enough
Default

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  
Old 05-01-2013
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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


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.