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 06-16-2014
Simon Jutz Simon Jutz is offline
Flexsim User
 
Join Date: Nov 2013
Location: Innsbruck/Austria
Posts: 33
Downloads: 29
Uploads: 0
Thanks: 25
Thanked 5 Times in 4 Posts
Rep Power: 83
Simon Jutz is on a distinguished road
Default 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) );








Is there a way to perfom this technique aswell in Flexsim7? Now in Flexsim 7 I cannot find the "Start of Scenario"-Trigger. Do I have to write the commands now in the "Start of experimenter"-Trigger? Doesn't make much sense as this Trigger is for the whole experiment?!
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  
Old 06-16-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 Simon,

Quote:
1) The Advanced tab in the previous versions of Flexsim showed the Trigger fields "Start of Scenario" and "End of Scenario".
In the Start and End of Replication you find a pointer to the scenario(Edit: Sorry, not a pointer, but a number). Use it to define what you want. Each scenario has got a minimum of one replication.

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  
Old 06-16-2014
Simon Jutz Simon Jutz is offline
Flexsim User
 
Join Date: Nov 2013
Location: Innsbruck/Austria
Posts: 33
Downloads: 29
Uploads: 0
Thanks: 25
Thanked 5 Times in 4 Posts
Rep Power: 83
Simon Jutz is on a distinguished road
Default

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));
}
My intention is to update the global table values (BatchSize for MS1 and MS2) by the values in another global table called "Scenario".
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!
Attached Files
File Type: fsm DDP_2S_2_Grouping.fsm (79.7 KB, 49 views)
  #4  
Old 06-16-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 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  
Old 06-17-2014
Simon Jutz Simon Jutz is offline
Flexsim User
 
Join Date: Nov 2013
Location: Innsbruck/Austria
Posts: 33
Downloads: 29
Uploads: 0
Thanks: 25
Thanked 5 Times in 4 Posts
Rep Power: 83
Simon Jutz is on a distinguished road
Default

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));
	}
}
This works! But is there a way (e.g. loop) to shorten this code? Or is "copy/pasting" the whole thing 80 times the only way to get this to work? This is why I came up with the "for-loop" in my post above...

Thanks for the hint!
  #6  
Old 06-17-2014
Carsten Seehafer's Avatar
Carsten Seehafer Carsten Seehafer is offline
FlexSim Geek
 
Join Date: Oct 2008
Location: Ritterhude, Deutschland
Posts: 230
Downloads: 45
Uploads: 1
Thanks: 474
Thanked 320 Times in 143 Posts
Rep Power: 379
Carsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud of
Default

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  
Old 06-17-2014
Simon Jutz Simon Jutz is offline
Flexsim User
 
Join Date: Nov 2013
Location: Innsbruck/Austria
Posts: 33
Downloads: 29
Uploads: 0
Thanks: 25
Thanked 5 Times in 4 Posts
Rep Power: 83
Simon Jutz is on a distinguished road
Default

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?!
Attached Files
File Type: fsm test_experimenter.fsm (18.7 KB, 36 views)
  #8  
Old 06-17-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

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


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.