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
|
|||
|
|||
Experimenter - Flexsim 7
Hi all!
I have two question regarding the Experimenter tool in Flexsim 7: 1) The Advanced tab in the previous versions of Flexsim showed the Trigger fields "Start of Scenario" and "End of Scenario". In my model I have the input parameters for the different scenarios in a global table. At the beginning of each scenario I want the Experimenter to grab these input parameters and use it throughout the simulation of the scenario. Once the scenario is finished, I want the Experimenter to update the varibales defined with the next input parameter and so on... E.g. in an older version of Flexsim I programmed in the "Start of Scenario"-Trigger for one particular variable: Code:
setnodenum ( var_s(node("/WS1", model()), "batchsize"), gettablenum("Scenario",scenario,1) ); BTW: I don't replicate one scenario several times. Each scenario is simulated only once. Is the "Start of Replication"-Trigger then a synonym for the "Start of Scenario"-Trigger? 2) Is it correct, that after each scenario the model automatically is reset and the new input parameters are used to update the variables defined? Thank you for your kind help! All the best! simon |
#2
|
||||
|
||||
Hello Simon,
Quote:
But as stated before, please try to build a small and simple model, test your questions on your own. Tell us what worked and which problems you still have. Jörg |
The Following 2 Users Say Thank You to Jörg Vogel For This Useful Post: | ||
Simon Jutz (06-16-2014) |
#3
|
|||
|
|||
Hi Jörg!
Thanks! I tried a simple model and have the following questions: In the "StartofReplication"-Trigger I put the following loop: Code:
/**Update Input Parameters*/ double replication = parval(1); double scenario = parval(2); for(scenario=1;scenario<=2;scenario++) { //Global Table - BatchSize MS1 settablenum("BatchSize",1,1,gettablenum("Scenario", scenario,1)); //Global Table - BatchSize MS2 settablenum("BatchSize",1,2,gettablenum("Scenario", scenario,2)); } Each time I reset the model, the batch sizes in the WHOLE model get updated by the values in the global table "BatchSize". This is done for convenience as I dont't want to update all the labels in the model manually. ;-) In the "StartofScenario" Trigger of the older version the reset and the update are made automatically as a new scenario gets started (with the code I showed in the previous post). How is this done in Flexsim7? I checked the loop above several times - didn't work... I intentionally added the number of scenarios I want to investigate in the Scenario Tab of the Experimenter and left them blank. The parameters should not be entered there but come into the model via the global table "Scenario". Sorry to make you so much trouble but this is making me serious troubles... The simple model with the relevant code is attached! Thanks for your help! |
#4
|
||||
|
||||
Hello Simon,
you are trying actively to manipulate a scenario which the Flexsim engine doesn't even know that it will exist in the future. The trigger is executed each time when an replication starts. But the parsed variables scenario or replication are different each time. If you react on the changed variables instead of changing them, the engine will do what you want. It should like the following description: if the variable scenario is one and the replication is one, too, then you update the labels for the first scenario. if the scenario is two and the replication is one again, then you update the labels for the second scenario. If you like a tidier code use the switch structure. Jörg |
The Following 2 Users Say Thank You to Jörg Vogel For This Useful Post: | ||
Simon Jutz (06-17-2014) |
#5
|
|||
|
|||
Hi Jörg!
Tried it with the switch structure! Works perfectely!! But the switch structure seems to be rather cumbersome if you have for instance 80 scenarios in a global table. For a very simple model I programmed the following: Code:
/**Custom Code*/ double replication = parval(1); double scenario = parval(2); switch(scenario) { case 1: { resetmodel(); settablenum("BatchSize",1,1,gettablenum("Scenario", scenario,1)); } case 2: { resetmodel(); settablenum("BatchSize",1,1,gettablenum("Scenario", scenario,1)); } case 3: { resetmodel(); settablenum("BatchSize",1,1,gettablenum("Scenario", scenario,1)); } case 4: { resetmodel(); settablenum("BatchSize",1,1,gettablenum("Scenario", scenario,1)); } } Thanks for the hint! |
#6
|
||||
|
||||
Your switch structure doesn't do anything because of the missing break command. The last case will always be executed.
Explanation: The "case" is the entrance of the lines with the code. The "break" is the exit of lines with the code. P.e. if your scenario in your code is 2 your code will execute also the code for case 3 and 4. But I'm not sure why you use a switch command?! Your code is in all cases the same... |
#7
|
|||
|
|||
Hi Carsten!
Don't know if I understood you right? I tried this code in a simple model (attached) and it works. The scenarios are located in a global table where the different lines depict the different scenarios. I thought that the number of the cases refers to the the respective scenario in the global table?! I tried the different batch sizes individually without using the experimenter and the results are the same. I additionally entered the command "default" and the code executes the different scenario settings automatically. Just as I wanted it to work. The only thing you have to be aware of is that you define the number of scenarios in the "Scenarios" tab of the experimenter according to the lines in the global table (Scenario). But maybe I am completely wrong and the result is just randomly correct?! |
#8
|
||||
|
||||
CaseBreakDifference.fsm in this model you see different approaches for the switch statement by reseting the model.
Last edited by Jörg Vogel; 12-03-2014 at 03:12 AM. |
The Following 3 Users Say Thank You to Jörg Vogel For This Useful Post: | ||
Simon Jutz (06-18-2014) |
Thread | Thread Starter | Forum | Replies | Last Post |
Experimenter analysis | Flavio Brito | Q&A | 0 | 11-30-2012 12:13 PM |
Experimenter in Flexsim 6 | Esther Bennett | Q&A | 3 | 05-23-2012 10:01 AM |
Using the Experimenter | dabombchibz | Q&A | 2 | 04-02-2009 07:48 AM |
I can't use the Experimenter for the MultiPoccessor | Vic Li | Q&A | 1 | 11-17-2008 03:11 AM |