question

Sebastian Hemmann avatar image
0 Likes"
Sebastian Hemmann asked Jordan Johnson answered

Add data from one table to another after each replication

Hi @jordan.johnson,

attached an example model that shows a very small example of what I´m looking for.

Global Table 1 includes the parameter that has to be changed by every Scenario.

Global Table 2 includes some results I´m writing during my simulation runs (replications).

Global Table 3 should show a mix of Standard results (that works) and the values of other tables (cells stay empty).

experimenter-results-and-parameter-overview.fsm

FlexSim 19.0.2
global tableexperimenter
5 |100000

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

1 Answer

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered

I don't know what the final table you want looks like, so I can't help you write the code to make it. However, here is the general idea:

When OnEndReplication fires in the child experiment, the expfolder variable does not exist. That is how you can test for whether this trigger is running on the child process, or on the master process (the master process has your final post-experiment table). However, the entire contents of the node Tools/Experimenter is copied from the child process to the parent. So if the expfolder node does not exist, the OnEndReplication is asking you to add any data that you want to the Tools/Experimenter node in the model. You get to decide what data to add, and where that data lives. The pick option you have used asserts a subnode called "savedtables", and copied data into that node, but you could add your own subnode, or as many subnodes as you need. Then you can copy the data you need from your model into those subnodes. As long as you copy the data somewhere into the Tools/Experimenter node, it will be sent to the master/parent process.

Once the data is sent to the master process, the OnEndReplication folder fires again. This time, the expfolder variable exists. This is the Tools/Experiment folder that was sent from the child process to the parent process. At this point, you can copy the data that you added to anywhere in the model. In the pickoption you used, a value is copied out of the table is saved in the "savedtables" node, and written to a global table in the parent process.

From the sound of your question, you have

  • Input variables (per scenario)
  • Output values (per replication and per scenario)
  • Output tables (per replication and per scenario)

And somehow, you would like to see all those values in a single table, all at once. That is totally possible. You can use the OnEndReplication trigger to first, copy data from the replication to the Tools/Experimenter folder in the child process, and second, to copy data from that folder (now stored in the expfolder variable) to anywhere in your model, including into any global table (or set of global tables).

5 |100000

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