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-30-2014
Leandro Filippi Leandro Filippi is offline
Flexsim User
 
Join Date: Feb 2013
Posts: 2
Downloads: 1
Uploads: 0
Thanks: 4
Thanked 0 Times in 0 Posts
Rep Power: 0
Leandro Filippi is on a distinguished road
Default Tracking Variables

Hi,

Anyone knows if there's a way to track a variable in real time and then execute some code depending on the value of that variable?

Example:
Imagine that i have a variable "X" that represents a warehouse inventory. I'd like to take some action if X > 100. How can I track the values of X and execute the code if X > 100.

Thanks!
  #2  
Old 05-31-2014
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hello Leandro,

the keywords you are looking for: watch variable, watchlist. The functionality still exists and you find it in the maintree in the subtree Library.

But that is really advanced stuff, and it is strongly not recommended to use, if you aren't an advanced and experienced user. Better you use the triggers at the objects. Flexsim bases on real discrete events such as an item enters or exits an object. Then you can use the object's triggers to go into action.
Flexsim does not support well the functionality of a suspended method, that comes back if its condition comes true. If you have built simulation models with other simulation programs try firstly to get a feeling how Flexsim works, before you start to tweak it. The advantages, I think, are the dashboard, the whole concept of the mobile resources, the 3D view and the sampler.
So please try the triggers. They will work very well, if you give them a try.

Jörg
  #3  
Old 05-31-2014
sagar bolisetti's Avatar
sagar bolisetti sagar bolisetti is offline
Flexsim User
 
Join Date: Aug 2013
Location: Hyderabad,India
Posts: 160
Downloads: 145
Uploads: 0
Thanks: 124
Thanked 99 Times in 63 Posts
Rep Power: 150
sagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the rough
Default

Hello Leandro,

To calculate no.of items i am using the same default tracked variable"workinprogress".This is a count of all flowitems in the model at any given time.I am using a same variable to make a decision if flowitems are greater than 100.I just popup a screen message if the flowitems are greater than 100 in the model.This gives you just an idea
As jorg suggested you can use object's triggers to go into action.Here is the code

Code:
  /**Custom Code*/
  treenode item = parnode(1);
  treenode current = ownerobject(c);
  int port = parval(2);
  pr();pt(" Items in model:"); pd(gettrackedvariable("WorkInProgress"));
  int nrofitems=gettrackedvariable("WorkInProgress");
  if(nrofitems>100)
  {
         msg("nrof items in model= ", 
         numtostring(gettrackedvariable("WorkInProgress"),0,0));
         stop();
  }
    

Last edited by sagar bolisetti; 05-31-2014 at 11:54 AM.
The Following User Says Thank You to sagar bolisetti For This Useful Post:
Jörg Vogel (05-31-2014)
  #4  
Old 06-03-2014
Leandro Filippi Leandro Filippi is offline
Flexsim User
 
Join Date: Feb 2013
Posts: 2
Downloads: 1
Uploads: 0
Thanks: 4
Thanked 0 Times in 0 Posts
Rep Power: 0
Leandro Filippi is on a distinguished road
Default

Thanks you guys!
I think now I can figure out a way to continue my code.


Thread Thread Starter Forum Replies Last Post
Tracking into global table - Experimenter Simon Jutz Q&A 10 05-07-2014 07:20 AM
Global variables juan alberto Q&A 5 11-10-2010 05:47 PM
batchsize and currentbacthsize variables? Albert Munoz Q&A 1 10-28-2010 04:47 AM
Experimenter variables Xavier Jackson Gripes and Goodies 4 09-09-2008 10:00 AM
GUI & linked variables Iulian Marin Ion Q&A 2 11-27-2007 10:23 PM


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.