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 > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 05-16-2011
FlorianK's Avatar
FlorianK FlorianK is offline
Flexsim User
 
Join Date: Jan 2011
Location: Erfurt, Germany
Posts: 27
Downloads: 10
Uploads: 0
Thanks: 16
Thanked 3 Times in 3 Posts
Rep Power: 115
FlorianK is on a distinguished road
Post 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  
Old 05-16-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 05-16-2011
FlorianK's Avatar
FlorianK FlorianK is offline
Flexsim User
 
Join Date: Jan 2011
Location: Erfurt, Germany
Posts: 27
Downloads: 10
Uploads: 0
Thanks: 16
Thanked 3 Times in 3 Posts
Rep Power: 115
FlorianK is on a distinguished road
Default

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  
Old 05-16-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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.
Attached Files
File Type: fsm SetTimeTask.fsm (78.6 KB, 164 views)

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  
Old 05-16-2011
michaelsmith michaelsmith is offline
TMN Simulation -Australia
 
Join Date: Aug 2007
Location: Hobart Tasmania
Posts: 62
Downloads: 7
Uploads: 0
Thanks: 31
Thanked 19 Times in 12 Posts
Rep Power: 170
michaelsmith will become famous soon enough
Default 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  
Old 05-17-2011
FlorianK's Avatar
FlorianK FlorianK is offline
Flexsim User
 
Join Date: Jan 2011
Location: Erfurt, Germany
Posts: 27
Downloads: 10
Uploads: 0
Thanks: 16
Thanked 3 Times in 3 Posts
Rep Power: 115
FlorianK is on a distinguished road
Default

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  
Old 05-24-2011
FlorianK's Avatar
FlorianK FlorianK is offline
Flexsim User
 
Join Date: Jan 2011
Location: Erfurt, Germany
Posts: 27
Downloads: 10
Uploads: 0
Thanks: 16
Thanked 3 Times in 3 Posts
Rep Power: 115
FlorianK is on a distinguished road
Default

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


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.