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
|
||||
|
||||
Get model run time when a task is executed
Hello Communitiy,
i want a TaskExecuter to set a table cell with the model time. By using the comand inserttask(ts,TASKTYPE_SETNODENUM,QuelleLabel_Ende ,NULL,time()); i am getting the time when the tasksequence was created but i want the time when the task comand is executed. Can someone give me a hind to get the right time, please? Greetings, Floian |
#2
|
|||
|
|||
I'd use a TASKTYPE_NODEFUNCTION where you pass in the node with your code as Involved1 and the node you want to store the time as Involved2.
then the code node just has: setnodenum(parnode(1),time()); I'd probably make it a user command too, and have another command getUserCommandNode("storeTimeOnNode") to find the code node based on the user command name. Essentially getUserCommandNode is just: (you could add error checks and warning messages if the command name isn't found) return node(concat("/Tools/UserCommands/",parstr(1),"/1"),model()); So the task creation line would be this: Code:
inserttask(ts,TASKTYPE_NODEFUNCTION,getUserCommandNode("storeTimeOnNode"),QuelleLabel_Ende); Last edited by Jason Lightfoot; 05-16-2011 at 04:12 AM. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
shafizad (05-21-2012) |
#3
|
||||
|
||||
Hello Jason,
thank you for answer. My question now is, when / how to call the comand setnodenum(parnode(1),time()); When i write this comand in thr "onMessge"-Trigger, i will receive the time when the onMessage-Trigger was fired/the tasksequence was created, but not when a certain task of the tasksequence was executed by the taskexecuter. I hope I explained my problem sufficent enough. If not, let me know, please. Greetings, Florian |
#4
|
|||
|
|||
Nodefunction removes the need for a message. See attached model where the label 'done' on the source is set at the end of the sequence.
Using a message works too, but I find it nicer to look at the nodefunction task in the tree, as it lists the command and parameters in a way that's easy to read. Using a message means you're often passing a number to indicate which case to use and then you're left with fewer parameters to use. Using cases means interpreting the message task sequence isn't as immediate. Last edited by Jason Lightfoot; 05-16-2011 at 06:13 AM. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
shafizad (05-21-2012) |
#5
|
|||
|
|||
Other Ways..
The other option I would look at depending on the tasks being executed is you might be able to use the On Triggers in the task executer (Load/Unload etc)
|
The Following 2 Users Say Thank You to michaelsmith For This Useful Post: | ||
Jason Lightfoot (05-16-2011) |
#6
|
||||
|
||||
Hi Michael,
ofcourse, you are right. This was the thing i thought about bevore posting here. Unfortunatly there is no trigger that would fit well in my eyes. At the moment I'm having a little bit trouble with the software, thats why i wasn't able to look at Jasons solution. I will remind myself to keep reporting here Greetings, Florian |
#7
|
||||
|
||||
Hello,
i looked at the solution of Jason. I will keep that in mind! Because the model is also used for absolut new flexsim user, i decided to use a simple but not that elegant solution. I'm sending a message by TASKTYPE_SENDMESSAGE and let the time set by receicing the message. Thanks for your help! Greetings, Florian |
Tags |
model, table, taskexecuter, tasksequence, time |
Thread | Thread Starter | Forum | Replies | Last Post |
Displaying the simulation time with the various date/time formats. | Regan Blackett | Tips and Tricks | 12 | 11-12-2012 08:01 AM |
How to interrupt active task and implement another task? | Ilivid zheng | Q&A | 2 | 01-15-2011 02:30 AM |
All time related values 0,0000001 time units delayed | Patrick Cap | Q&A | 2 | 05-01-2009 01:50 AM |
total time boxes are in the model | bsantens | Q&A | 1 | 04-05-2009 03:11 PM |
Model Runs slower over time, when using experimenter | Jan Brandau | Q&A | 1 | 06-17-2008 07:03 AM |