question

Tuan avatar image
0 Likes"
Tuan asked Joerg Vogel commented

Flexscript for experimenter

My version is 2020


Wait for the experiment to end in flexscript

and get the value of the experiment result in flexscript

The above two things about flexscript are my problem

擷取.png

I've set up the scenario in flexscript and the performance measures manually

and I'm going to run the experiment


I want to write the code to wait for the experiment to end

How to do in flexscript ? (first question

The experiment is over

and the result of the experiment is 5

How to get the value of 5 in flexscript ? (second question


I tried to write the code but didn't work

If available can you demonstrate how to write the code ?

experimenter test.fsm

FlexSim 20.0.10
experimeterflexscrip
擷取.png (209.9 KiB)
experimenter-test.fsm (153.5 KiB)
· 1
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

The character of an Experiment is, you can’t manipulate any already dispatched scenario or replication after run start. It is because of the parallel execution on different threads and processor cores. There is only the tool optquest to perform such tasks while an experiment is running.

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Jordan Johnson commented

To run code when the experimenter finishes, you can use the End of Experiment trigger, on the Advanced tab of the Experimenter.

To get the value of a performance measure, you can query the Experiment.PerformanceMeasures table:

Table.query("SELECT AVG([Source1 output]) WHERE Scenario = 1 FROM Experiment.PerformanceMeasures")[1][1]
· 2
5 |100000

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

Tuan avatar image Tuan commented ·

@Jordan Johnson

How about first question?

How to write the code?

Thank you!


Table.query("SELECT AVG([Source1 output]) WHERE Scenario = 1 FROM Experiment.PerformanceMeasures")[1][1]

where to put the code in Flexsim ?

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Tuan commented ·

There isn't a way to write code that waits for the experimenter to end. But you don't need to write code that waits. It sounds like you want to execute FlexScript when the experimenter finishes. This is the purpose of the On End of Experiment. Whatever FlexScript code you put in that trigger will execute when you want it to.

1666635524877.png

1 Like 1 ·
1666635524877.png (36.1 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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