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 07-29-2009
Dane Lee's Avatar
Dane Lee Dane Lee is offline
Flexsim User
 
Join Date: Jun 2009
Location: Beijing China
Posts: 23
Downloads: 187
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 134
Dane Lee is on a distinguished road
Smile about nodefunction

int port = parval(2); treenode view = parnode(1);
we see them ontriggers in object,I found parval() in commands,it get value from nodefunction(),but,I cann't found nodefunction,Where is nodefunction() written?
Hope your reply,thanks!
  #2  
Old 07-29-2009
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

What you can find in the triggers is normaly code from the library objects.
Mainly it is C++ code in the nodefuntions.
If you go into the library tree in an object there is a behaviour node. Under this node you can find cppfunctions where you can find OnReset(), OnDraw(), etc.
A Queue for example inherits from the FixedResource which inherits from the Flexsim Object.
The developer of the object gave us the treenodes to current and item to work with and sometimes some additional variables. But I guess this you already know, but I liked to mention it because in my training classes I always get the questions, what this stuff means.
Good thinking, that you figured out, that these are parameters from a nodefunction call.

I am not sure if I answered your questions. If not, please ask again.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
  #3  
Old 07-30-2009
Dane Lee's Avatar
Dane Lee Dane Lee is offline
Flexsim User
 
Join Date: Jun 2009
Location: Beijing China
Posts: 23
Downloads: 187
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 134
Dane Lee is on a distinguished road
Question

nodefunction(node thenode[,num par1, num par2, ... num par10])
Description: For developer use. This command executes a function that is defined on thenode. Thenode must be toggled as either a C++ node or a Flexscript node. If the node is C++, the model must be compiled before calling this command. Any parameters that need to be passed to the function are passed as par1, par2, etc. Up to 10 parameters may be passed. The values that are passed using this command must all be numbers, but can then be accessed and recast from within the function called using the commands parnode(x), parval(x) and parstr(x) where x is the number of the parameter.Example:nodefunction(node_v_entrytrigger,tonum(item),portn um);

Firstly,thanky you,onEntry trigger ,we can see:
treenode item = parnode(1);
treenode current = ownerobject(c);
int port = parval(2);
For example, treenode item = parnode(1),parnode(1) get first parameter from nodefounction(),but,how do I know what is first parameter in nodefunction()? Because,I cann't see nodefunction(),I did not define nodefuntion(),and I cann't find out the position that the nodefunction() was defined.
Hope your reply,thank you!
  #4  
Old 07-31-2009
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Dane,

I guess, then someone else need to reply to you.

Like said, the only things I know is that there are function calls from the library. The Developer of the object defines the function call and decide which parameter he will pass. That's why he defined the pointer for us like item, current, port, etc.

On the other hand, I do not understand, why do you want to know this stuff? I guess the only parameter which are passed are also defined for us. Who cares where the function is?
I work now more than three years with Flexsim but did not need it. I don't say it is not important, I just wonder for what do you need this to know.
What are you trying to do?
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
The Following User Says Thank You to Tom David For This Useful Post:
Dane Lee (08-03-2009)
  #5  
Old 08-03-2009
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

Dane,

When the node that that the trigger you are looking at is executed it is more than likely being executed with the nodefunction command. This is done by code deep within the object. When the trigger was called there were certain values that needed to be passed into the trigger so that you could use them. As you pointed out the nodefunction command can have upto 10 passed in. If the value is a node then you will see the parnode() command used to get that value back into a treenode format. If the value was a number then that is when you will see the parval() command used.

I hope that this answers your questions,
Brandon
__________________
thats not normal.
  #6  
Old 08-04-2009
Dane Lee's Avatar
Dane Lee Dane Lee is offline
Flexsim User
 
Join Date: Jun 2009
Location: Beijing China
Posts: 23
Downloads: 187
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 134
Dane Lee is on a distinguished road
Smile

Brandon:
Thank you.
I understand that you talk about.
I wanted to found out where nodefunction() is written, Because, when I want to use this command ,I must kown what point at that parval(1)、parval(2)、parval(3)、parval(4)... ...or parnode(1)、parnode(2)、parnode(3)、parnode(4)... ...,and should I use parval() or parnode()?
Dane Lee
  #7  
Old 08-05-2009
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 Dane,

you can create your own nodefunction in an objects label node.
I build a short example model to show it.

The declaration at the beginning of the triggers (i.e. treenode item = parnode(1), etc.) are used by the objectlogic. That means that in the programming of the objects are internal logics which use this for referencing to the items and the own object. You should not change anything in the internal thing.

If you pass objectinformation (i.e. tonum(item)) then use parnode (equal to treenode), if you only want to pass a value (i.e. an calculated value, or a processnumber etc.) then use parval.

Hope this help you a little bit to understand the command.



Best regards
Tobias
Attached Files
File Type: zip nodefunction.zip (37.8 KB, 241 views)
The Following 2 Users Say Thank You to tobias.biemueller For This Useful Post:
shafizad (03-14-2012)
  #8  
Old 03-14-2012
shafizad shafizad is offline
ProcSim Consulting
 
Join Date: Jul 2010
Location: Switzerland
Posts: 75
Downloads: 18
Uploads: 0
Thanks: 90
Thanked 2 Times in 2 Posts
Rep Power: 126
shafizad is on a distinguished road
Thumbs down Re opening this topic

It matters in my opinion to know where "nodefunction" is run from? Actually, my question is about the internal dynamics of Flexsim. I would like to know who calls a node (so that upon this call, the function on this node is executed).

Is there any way to know more about this internal dynamics? To take a look at the code at that level so that me as a modeler can modify internal logic to meet my expectations.

For the example above, who calls "nodefunc" script node? Why such a node in label is run? who triggers (calls) this node?
  #9  
Old 03-14-2012
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

But you just asked this question in this thread: http://www.flexsim.com/community/for...ead.php?t=2093 and Phil gave you an answer.

If you want an example of the nodefunction, take a look at the OnSend method of the Fixed resource. (MAIN:/project/library/FixedResource>behaviour/cppfunctions/OnSend(fsnode* item, int port))
There you will find an example of the nodefunction calling the onexit trigger as there are many other examples to be found in the library objects.
You can go one class higher by looking at FlexsimObject and see what events are triggered by the object but there it stops. How Flexsim programs it's base objects is Flexsim's secret. But for the rest you can look at every object exactly how it behaves and why.
The Following User Says Thank You to Steven Hamoen For This Useful Post:
shafizad (03-15-2012)
  #10  
Old 03-15-2012
shafizad shafizad is offline
ProcSim Consulting
 
Join Date: Jul 2010
Location: Switzerland
Posts: 75
Downloads: 18
Uploads: 0
Thanks: 90
Thanked 2 Times in 2 Posts
Rep Power: 126
shafizad is on a distinguished road
Default Hmmm

Thanks for the reply. I was wondering how the program calls cppfunctions.
Because in all the codes for FixedResource (other similar basic libraries), you find a lot variables that are a bit surprising, say on your own example OnSend(fsnode* item, int port)

we have:
nodefunction(node_v_exittrigger, tonum(item), port, v_nroftransportsin, v_nroftransportsout);

and it is not clear to me node_v_exittrigger stands for what?
I agree that you don't need to know these details to program a functioning simulation; but it is bugging me that I don't have a good grasp of how this magic blackbox (flexsim) works. if there are some other posts in the forum that might help I would appreciate your mention.
My regards in advance
  #11  
Old 03-15-2012
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

Currently there is no documentation that explains the inner workings, so you have to find out by testing and asking. For instance here:
v_ points to a variable so a node under variables.
node_v_x returns the pointer to that node
v_x returns the value

b_ stands for attributes (which is basically all other nodes in an object tree except the variables)

Hope this helps a bit to be able to read it
The Following 4 Users Say Thank You to Steven Hamoen For This Useful Post:
shafizad (03-15-2012)



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.