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
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2008
Matthias Hofmann Matthias Hofmann is offline
Flexsim User
 
Join Date: Jun 2008
Posts: 15
Downloads: 1
Uploads: 0
Thanks: 11
Thanked 0 Times in 0 Posts
Rep Power: 145
Matthias Hofmann is on a distinguished road
Default Global variable as experiment variable

Hello,

I use a global variable as experiment variable in the experimenter. But it seems that the global variable doesn't change. I can use all possible values but the simulation takes always the value which stays originally in the global variable.
If it should not be possible to change global variables with the experimenter, do you have an idea how I can change variables which I wrote directly in the code of time triggers of some objects?

thanks in advance
Matthias
Reply With Quote
  #2  
Old 11-04-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi Matthias,

If it is not to much work I should suggest that you replace the Global Variable with a label.
What I sometimes do is using a BasicFR which I have a Global Variable pointing to.
The I can use getlablenum(GV_Node,"xxxx"); to read a label value, where GV_Node is the global variable to the BasicFR.

If you use the global variable in many place you can try to define a label which value then assign to the global variable.
You should do the assign OnReset on a object.

This is 2 way I directly can come up with, there are probably more ways to do it.

Lars-Olof
Reply With Quote
The Following User Says Thank You to Lars-Olof Leven For This Useful Post:
Matthias Hofmann (11-06-2008)
  #3  
Old 09-08-2009
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 270
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

Hello Matthias and other Flexsim Users,

An easy way to use a 'Global Variable' as an experiment variable is to define a Global Table that contains the value. You can refer to a cell of a Global Table in your experimenter path.

Esther
Reply With Quote
The Following User Says Thank You to Esther Bennett For This Useful Post:
Steven Hamoen (09-08-2009)
  #4  
Old 09-08-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: 489
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

Matthias,

I know that this is an old thread but I think that these solutions may be valuable to others.

If you wanted to change a global variable value then you could accomplish this in one of three ways, all of which use the experimenter triggers. The triggers you will want to use are the Start of Scenario and Start of Replication triggers.

The first method would be to just set the global variable in the trigger based off of a global table look up or off of a hard coded set of values. This is a little harder to change because the values are not located on the experimenter.

The second method would be to have the experimenter change a label or some other node value in the model and then use the trigger to set the global variable based on that value. The nodes that are changed by the experimenter are updated prior to the execution of the triggers so this would work well and you can update the values in the experimenter. It is very similar to the solution from Lars but you still get to use the global variable in your code.

The third method would be to set the global variable based on the values listed in the experimener table editor directly. In the triggers you can get to the values through the use of the following code:

double scenario = parval(2); //This is a default line in the trigger
int column = 1; //The column that holds the data in the table editor
value = getnodenum(rank(rank(node("/ExperimentVariables", up(c)), scenario + 1), column));

The third method is a little harder to grasp but once you get it, it should be very effective for you.

Good Luck,
Brandon
__________________
thats not normal.
Reply With Quote
The Following 5 Users Say Thank You to Brandon Peterson For This Useful Post:
Carsten Seehafer (09-09-2009), Congshi Wang (11-04-2010), Lars-Olof Leven (09-08-2009), Leandro Filippi (02-08-2013), Phil BoBo (09-08-2009)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit Value of Variable in Flexscript Node Joe Allen Q&A 19 09-17-2008 05:39 PM
Using a Variable number of Operators for Processing Brandon Peterson Tips and Tricks 4 07-16-2008 09:16 AM
Auto check of variable type ranges RalfGruber Gripes and Goodies 0 06-14-2008 02:15 PM
Assign an array to a variable AlanZhang Q&A 6 04-24-2008 01:59 PM
Display Global Variable Sung Kim Q&A 4 02-24-2008 11:24 PM


All times are GMT -6. The time now is 06:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.