question

Rahul R avatar image
1 Like"
Rahul R asked Rahul R commented

Open ended question on sim output aggregation and visualization

Hi Flexsim community,

I am looking for some tips and thoughts on best practices to aggregate and visualize simulation output. Our team has multiple engineers working on simulation project for the same customer and we often have simulation outputs aggregated in different ways (non-standard). Some use excel post processing of data collected in global tables, others use Flexsim statistics collector and dashboard for visualization. We also want to be able to easily reuse these for the new (similar) models we are building to the extend possible. Below are some of the options I have short listed -

1. Statistics collector [Pros- Within Flexsim, flexible to collect most data without adding additional logic, can use Flexsim dashboard visualizations; Cons- Not sure if these are easily transferable to new(similar) models]

2. Global tables and excel post processing

3. Global tables and use python for post processing and visualization [Pros - Can re-use python script easily for multiple models, Python has extensive data visualization libraries, Can connect python to Flexsim to automate script runs after model stop; Cons- Additional maintenance effort, dependent on structure of global tables, slow to transfer large dataset between python and FlexSim]

While these are very good options, I am looking to hear their take on preferred data aggregation and visualization.


FlexSim 22.2.4
statisctis collectorinteraction between flexsim and pythondata visualization
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
1 Like"
Jordan Johnson answered Rahul R commented

I can answer part of your question. You mentioned that one con of Statistics Collectors is that they aren't easy to transfer to similar models. That is normally true. However, the only thing that can't be transferred is a pointer to an object. Fortunately, it is possible to make a Statistics Collector that doesn't use pointers, which makes it possible to copy/paste or add it to a user library.

The biggest change is how how define events. Normally, events have a pointer to an object or a group. However, you can use a "By Requirement Event" to specify objects by path, by class, or as members of a group.

Normally, you'd use a Requirement event to listen to all objects that pass some test, and you specify the test. On Reset, the stats collector iterates over all the objects looking for the ones that pass the test. This is mentioned in the documentation. So usually the requirement returns 1 or 0: listen to the object passed in or not.

What is not documented is the following: instead of returning a 1 or a zero, you can return an array of objects that you want to listen to. Then, to indicate that the stats collector should stop searching the model, you can append a -1 to the array. So if you have a group that has the same name in all your models, you can listen to the objects of that group with this requirement:

Array result = Group("MyGroup").toFlatArray();
result.push(-1);
return result;

Since there are no pointers involved, this will work in any model that has that group (assuming that the objects in the group hare the same type).

That's a long answer to say "there's ways to make your stats collectors without using pointers which makes them reusable". Hopefully that makes sense.

· 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.

Rahul R avatar image Rahul R commented ·
Hello @Jordan Johnson , this is super insightful! Thank you. One follow up - Is there a way to transfer statistics collector build in one model to another like a user library ?
0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Rahul R commented ·

You can add a stats collector to a user library. I made an example : StatsCollectorUserLibrary.fsl

To make this, you copy/paste the stats collector you want from its folder in the tree to the user library node. In my example, I put the stats collector in the newmodelinstall node, so that new models, or models where the library is loaded, just get the stats collector. Here's what the tree looks like:

1678297305629.png

I learned from this example that there isn't default support for stats collectors, meaning you have to add a custom dropscript. Here is the code of that dropscript. It's just there to add the stats collector into the proper Tools folder instead of as a subnode of the Model node.

treenode object = ownerobject(c);

treenode onto = param(1);
double x = param(2);
double y = param(3);
double z = param(4);
treenode ontoView = param(5);

treenode statsCollectorFolder = Model.find("Tools").subnodes.assert("StatisticsCollectors");
int newRank = statsCollectorFolder.subnodes.length + 1;
treenode existing = statsCollectorFolder.find(object.name);
if (existing) {
    newRank = existing.rank;
    existing.destroy();
}

treenode newCollector = object.copy(statsCollectorFolder);
newCollector.rank = newRank;
return newCollector;
0 Likes 0 ·
Rahul R avatar image Rahul R Jordan Johnson ♦♦ commented ·
thank you!
0 Likes 0 ·