question

Noah Z avatar image
2 Likes"
Noah Z asked Matthew Gillespie edited

Unused PeopleTables Stat Collectors slowing down model

After upgrading to 19.2 a model I'm working on got significantly slower to run. I enabled code profiling to see what was going on and it looks like the 4 biggest culprits are all related to "PeopleTables" history which I did not add and will not need for this model.

Is there a way to turn these off so that the model runs faster without breaking Flexsim? They don't show up under Stats Collectors within the Toolbox.

FlexSim 19.2.0
tablescode profilerpeopletable
· 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.

Braydn T avatar image Braydn T commented ·

@Noah Zenker Could you upload your model and tag me, and I'll take a look at it.

Thanks!

0 Likes 0 ·
Noah Z avatar image Noah Z Braydn T commented ·

@Braydn T

Unfortunately I am not able to share the model outside of my company.

0 Likes 0 ·

1 Answer

Matthew Gillespie avatar image
2 Likes"
Matthew Gillespie answered Matthew Gillespie edited

You can run this script to turn them all off:

treenode tables = Model.find("Tools/PeopleTables");
for(int i = 1; i <= tables.subnodes.length; i++) {
	tables.subnodes[i].find(">variables/replacements/Enabled").value = 0;
	function_s(tables.subnodes[i], "onApply");
}

You can also find them in the Toolbox under People Statistics Tables and turn them off by right clicking on a table and selecting Enabled.

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

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

That script won't disable them immediately. It needs one more line:

treenode tables = Model.find("Tools/PeopleTables");
for(int i = 1; i <= tables.subnodes.length; i++) {
	tables.subnodes[i].find(">variables/replacements/Enabled").value = 0;
	function_s(tables.subnodes[i], "onApply");
}
1 Like 1 ·
Noah Z avatar image Noah Z Jordan Johnson ♦♦ commented ·

That did it! The model runs lightening quick now. I have to accept a top level reply as the answer so I will accept Matt's reply above although it might be worthwhile to edit the code in that answer to include the "onApply" part for those who don't expand the comments fully when looking at this at some point in the future?

0 Likes 0 ·
Noah Z avatar image Noah Z commented ·

Thanks Matt. I was able to turn of the "enabled" checkbox for all of them at once using your code. However, it still looks like they are the biggest drain in the code profile (see updated screenshot). Does the live listener have anything to do with it?

My model has a multi-decade run span and it looks like those tables are set to update every 15 minutes of sim time. The screenshot is after I stopped the model 9 years into a run.

v2-code-profile-peopletables.png

0 Likes 0 ·