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 > User Development
Downloads

User Development User developed add-ons to Flexsim

  #1  
Old 09-03-2008
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 WatchExpressionList

This model was put together to solve Nico Zahn's problem about how to put a global variable in a watchlist (in another forum thread)

In the attached model I've changed an instance of the standard watchlist to evaluate Flexscript expressions instead. It can be edited from the Watchlist option of the tools menu. The object is called WatchExpressionList inside /Tools/Watchers and can be copied between models (or saved and loaded as a .t file).

The examples I've used trigger the watch when the queue size is greater (or no longer greater) than 4, or when the global variable 'variable1' changes (I used a script window to increment it manually for testing).

Be aware that these can slow the model down quite a bit, because they fire for every event and the expressions are switched as Flexscript.

It would be nice to be able to toggle between C and Flexscript, and provide an edit window instead of typing into the table cell, which would mean some watchtable GUI changes. If I get a chance to update it with those changes I will post it here.

Jason
Attached Files
File Type: zip watchExpression.zip (43.5 KB, 491 views)
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (09-03-2008)
  #2  
Old 08-01-2009
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

Attached is a .t file containing the node that should go into /Tools/Watchers within the model by editing the tree and using Load Into Node. You will need to run updatetoolsmenu to get it to show in the Watchlist entries, then just open it for editing as normal through the Tools menu. If you don't have a Watcher folder within /Tools, the easiest method would be to add a watch list via the Flexsim Tools menu and then load into the Watchlist object that it creates.

The example watchexpression within the object will fire for the first events with a new time that is greater than 20 time units (secs).

This was added to offer another answer to the question posed here:
http://www.flexsim.com/community/for...ead.php?t=1026

Note that the action code only fires when the value of the expression is evaluted to have changed. If the expression was just time()>20 the action code would fire only once - at the first event past 20.

If you want the code to fire for every event (including those with duplicate times) change the expression to !getnodenum(next(c))) which will just toggle the value returned - ensuring it changes every time.
Attached Files
File Type: zip WatchExpressionNode.zip (2.2 KB, 252 views)

Last edited by Jason Lightfoot; 08-01-2009 at 06:55 AM.
  #3  
Old 08-04-2009
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default

treenode current = ownerobject(c);
treenode watchtablerow = parnode(1);
double newval = parval(2);
treenode olditem = parnode(3); // node containing old value
double oldval = getnodenum(olditem);

i often see "ownerobject(c) parval() parnode(); "
what mean "ownerobject(c)"?
How should I use them("ownerobject(c) parval() parnode(); ")?
thank you

Last edited by Tom David; 08-06-2009 at 01:37 AM. Reason: Useless Quote
  #4  
Old 08-04-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

Please have a look into this thread:

http://www.flexsim.com/community/for...ead.php?t=1020
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
  #5  
Old 11-09-2010
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 v5 Update

Updated the .t file to prevent v5 type checking errors and provide a better message format.
Attached Files
File Type: zip WatchExpression_v5.zip (1.1 KB, 195 views)
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Nico Zahn (11-11-2010)



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.