ATTENTIONThis 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 |
#1
|
|||
|
|||
Global Variable resetting
In ver 6 the behavior of global variables when resetmodel is called has been changes.
Previously the current value of the variable is unchanged (as stated in the command reference) but in ver 6 it seems that their values are being reset to a default. Define a global variable TwoSided then run this script with a command window open to demonstrate this, pr();pt("TwoSided Was = ");pf(TwoSided); if (TwoSided) TwoSided = 0; else TwoSided = 1; pr();pt("TwoSided Is = ");pf(TwoSided); resetmodel(0); pr();pt("TwoSided Now = ");pf(TwoSided); Thanks for the help Bill |
#2
|
||||
|
||||
That's correct. This was a specific request from several users. When the model resets, the values are set back to what the user defines in the Global Variables window.
|
#3
|
|||
|
|||
Note that you can still set the value in the model reset trigger (which you had to do previously to get the now default behaviour).
Consider using the new experimenter variables too as they are also global. |
#4
|
|||
|
|||
I guess I feel a rank coming on, this seems a little bit of a radical change in behavior. I've depended on global variables to set conditions that stay constant whenever I do a model reset, now I need to save these values some place every time their changed so that I can reset them to the expected values in the Model Rest Trigger, it seems to me that the former default behavior was much more intuitive.
Any way, can anyone suggest a simple solution for capturing the current global variable values so I won't need to modify my code extensively. |
Thread | Thread Starter | Forum | Replies | Last Post |
global variable in DLL (UserFuncs.h) | Esther Bennett | Q&A | 7 | 09-12-2012 07:02 PM |
Change Global Variable Permanently | Chris Moon | Q&A | 3 | 04-11-2011 07:46 PM |
Global variable & task sequence | Chris Moon | Q&A | 1 | 03-02-2011 10:46 AM |
Global variable as experiment variable | Matthias Hofmann | Q&A | 3 | 09-08-2009 09:42 AM |
Display Global Variable | Sung Kim | Q&A | 4 | 02-24-2008 11:24 PM |