question

Ssu Ying C3 avatar image
0 Likes"
Ssu Ying C3 asked Joerg Vogel commented

Global variable as experiment variable

Hello,

I use a global variable as experiment variable in the experimenter.

I want my scenario1: global variable=0

scenario2: global variable=1

scenario3: global variable=2

scenario4: global variable=3

scenario5: global variable=4...

But it seems that the global variable doesn't change.

If it can not be possible to change global variables with the experimenter, is there any idea that I can change variables which I wrote directly in the code of time triggers of some objects?

global variablesscenarioexperimenter variable
改變懲罰.png (20.8 KiB)
改變懲罰2.png (75.2 KiB)
改變懲罰0.png (16.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image
1 Like"
Phil BoBo answered Ssu Ying C3 commented

Changing global variables works perfectly fine with the experimenter. Your question does not show otherwise.

How are you using the "penalty" global variable in your model? Does it affect your "Makespan" performance measure?

If you post an example model, we can probably explain to you what is happening. Your question doesn't have enough detail to answer it.

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ssu Ying C3 avatar image Ssu Ying C3 commented ·

Hello,

My flexsim version is 7.1.4, This is my model. I use the "penalty" global variable in processor "Doctor" in put pull strategy. I want to find that under which value of the "penalty" global variable will have the shortest process time.

example.fsm

0 Likes 0 ·
example.fsm (27.8 KiB)
Phil BoBo avatar image Phil BoBo ♦♦ Ssu Ying C3 commented ·

The experimenter is changing the "penalty" global variable in each scenario appropriately, but the value of the "penalty" global variable does not affect the outcome of your model.

It never gets to line 10 in your Pull From Port code. You can put a breakpoint there and see that it never calls the line of code that is affected by that global variable.

The experimenter is working perfectly fine. Your model just doesn't change based on the value of the global variable.

1 Like 1 ·
Ssu Ying C3 avatar image Ssu Ying C3 Phil BoBo ♦♦ commented ·

So I have to move my Pull From Port code to another place like OnEntry before it can work?

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

Please select an object in your model or place an object without any other purpose than just holding labels. You use these labels instead of global variables. The reference might be a bit longer but they work.

· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ssu Ying C3 avatar image Ssu Ying C3 commented ·

Hello,
I have tried this method, but his results are still the same as the results of my above question.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Ssu Ying C3 commented ·

I can not support your statement: I tested a model in Flexsim 7.3.6

with a normal distribution as a process time build from label and global variable values:

The Experimenter scenarios vary the label and the global variable

PFM result summary is:

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Ssu Ying C3 commented ·

The global variable might not work in an earlier version, sadly I haven't installed 7.1 - I only have installed 5.1.4. Therein the variation of a global variable hasn't got an effect. But the variation of a label still works.

0 Likes 0 ·
Ssu Ying C3 avatar image Ssu Ying C3 Joerg Vogel commented ·

I'v set the label on may processor, I don't know because I put the code in Pull Strategy then it doesn't work. In my model the Pull Strategy code is the most important part that I can't remove it.

And this is my

treenode LQ = node("LQ", model());
treenode Queue = node("Queue", model());
if (content(LQ)==0 || content(Queue)==0){
	return 0;
}
if (content(LQ)!=0){
	if (getlabelnum(current,"count_port") == getlabelnum(current, "penalty")){
		return 2;
	}else {
		return 1;
	}
}
0 Likes 0 ·
模型長這樣.png (87.3 KiB)
Show more comments