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 |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
How to get the "loadtime" value of TaskExecuter by using code?
Hi, all.
In my projects, I want to get the "loadtime" value of TaskExecuter, the loadtime is on the TE's attribute tree, and here is my code: int loadtime = getnodenum(node("/BasicTE1>variables/loadtime/1",model())); BasicTE1 is name of object in my model. The aboving code returns 0, but I have set the value of "loadtime" of BasicTE1 to 120 (for example). That is to say, I cann't get the correct value of "loadtime" by using the aboving code. How to do that? Thanks in advance. |
#2
|
|||
|
|||
Code:
treenode item=<an item>; //loadtime expects an item to be passed in treenode station=<anobject>; // loadtime expects a station treenode te=node("/BasicTE1",model()); // if you can assume it's located in the model - if it travels on networks within a hierarchy you cannot assume this. double loadtime = nodefunction(getvarnode(te,"loadtime"),item,station); |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Frans Zeng (08-23-2011) |
#3
|
|||
|
|||
thanks
Thanks Jason, I appreciate your advice. It is exactly what I am looking for!
But I have another question, I don't catch the meaning of the two parameters, i.e. 'item' and 'station' in your code. I have checked the Flexsim Command Documentation and found the following words about nodefunction, "Any parameters that need to be passed to the function are passed as par1, par2, etc." In my opinion, the loadtime is an inherent attribute of TaskExecuter, so I don't need to pass any parameters to the function. The last question, can I use the similar code to get other variables of TE, such as maxspeed and maxcontent? |
#4
|
||||
|
||||
Think for maxspeed and maxcontent it would be possible to use getvarnum() because both are variables that are setted as numbers.
__________________
Hemmi |
The Following 2 Users Say Thank You to Sebastian Hemmann For This Useful Post: | ||
Kris Geisberger (08-24-2011) |
#5
|
|||
|
|||
Frans,
Quote:
|
The Following 2 Users Say Thank You to Kris Geisberger For This Useful Post: | ||
Sebastian Hemmann (08-24-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
Taskexecuter state "blocked"? | Tom David | Q&A | 4 | 03-09-2012 12:56 PM |
Is it possible one object comprised of the function of "combiner" and "separetor"? | Vic Li | Q&A | 1 | 08-19-2008 04:41 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 |