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 04-22-2008
Jan Brandau Jan Brandau is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 10
Downloads: 14
Uploads: 0
Thanks: 1
Thanked 1 Time in 1 Post
Rep Power: 149
Jan Brandau is on a distinguished road
Default Accessing Data of a Recorder and Referencing Nodes in the Tree

Hello everyone!

My name is Jan Brandau an I am currently working on my master thesis with the help of Flexsim.

I now like to access a certain node/variable of a recorder. I want to export the "AvgValue" to my custom statistics and therefore want it access this value. The parameter is highligthed in the picture.

My question now is, if this is possible and how it is done. What I am able to do is to access the variable "histomax" for example, but I could not use the functions "getvarnode" or "getnodenum" on my problem. In this case they only return zero.

I hope anyone can help me,

Best regards,

Jan Brandau
Attached Thumbnails
Click image for larger version
Name:	tree_recorder_avgvalue.jpg
Views:	343
Size:	109.6 KB
ID:	223  
  #2  
Old 04-22-2008
tobias.biemueller tobias.biemueller is offline
Flexsim User
 
Join Date: Aug 2007
Location: Bielefeld, Germany
Posts: 42
Downloads: 22
Uploads: 0
Thanks: 23
Thanked 18 Times in 16 Posts
Rep Power: 164
tobias.biemueller is on a distinguished road
Default

Hi Jan,

I dont know if i understand your problem right, but i think you did a wrong use of the command.
What i mean:
To access a node in the tree you can use the ranks or the names ie.
Code:
getnodenum(node(">variables/maxspeed",current));
but in this case its a little bit difficult, cause of the name of the parentnode.
( MAIN:/project/model...).
Cause of the structure of the tree its possible to take the rank command to combine it with your getnodenum..
Code:
getnodenum(rank(first(node(">variables/graphdata",centerobject(current,1))),5);
Declaration:
- node("variables/graphdata",..) = reference to the graphdata node
- first(..) = reference to the first node in the graphdatanode (MAIN:/project/model...)
- rank(first(..),5) = reference to the 5. node in the first node

This is the code out of the samplemodel where it is implemented in the Textdisplay of the Visualtool.
I hope you understand what i mean, its maybe not the best solution, but it works.
I also have build up a short samplemodel for showing the Value.
Wish you good luck with your work.

Best regards
Tobias
Attached Files
File Type: zip nodereference.zip (35.1 KB, 302 views)

Last edited by tobias.biemueller; 04-22-2008 at 05:39 AM. Reason: structure and layout
The Following 2 Users Say Thank You to tobias.biemueller For This Useful Post:
Martijn van Oostenbrugge (04-22-2008)
  #3  
Old 04-22-2008
Martijn van Oostenbrugge's Avatar
Martijn van Oostenbrugge Martijn van Oostenbrugge is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Posts: 71
Downloads: 12
Uploads: 0
Thanks: 44
Thanked 44 Times in 24 Posts
Rep Power: 268
Martijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to all
Default

Nice support Tobias. For Jan's understanding. The getvarnode function can also be used instead of
node("variables/graphdata",..).

Martijn
The Following User Says Thank You to Martijn van Oostenbrugge For This Useful Post:
Cliff King (04-22-2008)
  #4  
Old 04-22-2008
Jan Brandau Jan Brandau is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 10
Downloads: 14
Uploads: 0
Thanks: 1
Thanked 1 Time in 1 Post
Rep Power: 149
Jan Brandau is on a distinguished road
Default

Thanks a lot, that was quick and helpful, exactly what I needed.

I think I should pay more attention to that "rank" command and the Tree Access commands in general. That might be useful, especially as I have many nodes that need to be accessed and searched.

So, thank your very much!

Jan
  #5  
Old 04-22-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

If you are using the node command you can also use the ranknumbers in stead of the names. So in case of :
getnodenum(rank(first(node(">variables/graphdata",centerobject(current,1))),5);
you can also enter:
getnodenum(node(">variables/graphdata/1/5",centerobject(current,1)));

Steven
The Following 2 Users Say Thank You to Steven Hamoen For This Useful Post:
tobias.biemueller (04-23-2008)
  #6  
Old 04-22-2008
Jan Brandau Jan Brandau is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 10
Downloads: 14
Uploads: 0
Thanks: 1
Thanked 1 Time in 1 Post
Rep Power: 149
Jan Brandau is on a distinguished road
Default

That's even better, looks quite elegant now an fits into the rest of my program.

Code:
int i = 42
while(i>0)
{
treenode recorder = node("/Recorder",model()); double number = getnodenum(node(concat(">variables/graphdata/",numtostring(i,0,0),"/5"),recorder)); settablenum("DLZ",gettablerows("DLZ"),6,number); i --;
}
I have already recognized, that there are many ways to solve a problem in Flexsim, some more obvious, some not.

Thank you!


Thread Thread Starter Forum Replies Last Post
The nodes in active view tree don't have unique names. Tom David Gripes and Goodies 7 01-31-2013 07:01 AM
Find all nodes toggled as C++ Brandon Peterson Tips and Tricks 0 04-18-2008 03:36 PM
Access to the tree variables Iulian Marin Ion Q&A 2 02-06-2008 09:15 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.