question

max avatar image
0 Likes"
max asked max commented

FlexSimPy: Performance Measure "TotalProducts" Always Returns 1.0 and None

Hi all,

I am a student and needed assistance urgently for my project

I'm using FlexSim 2024 integrated with FlexSimPy to extract data after simulation. I’ve set up a Statistics Collector (ProductOutputCount) linked to the Sink (on entry), with Row Value = 1 and a Performance Measure (TotalProducts) referencing it. In the FlexSim GUI, "TotalProducts" correctly shows values like 841 after a simulation run, but when I call

total = controller.getPerformanceMeasure("TotalProducts")

from Python, it always returns 1.0.

I’ve verified that:

  • The simulation runs and ends correctly.

  • The global variable/stat mechanism in FlexSim updates as expected.

  • I've called updateallperfmvalues() from Python prior to reading the performance measure.

  • All node paths are correct.

  • 1744580363924.png1744580400686.png1744580475770.png

Has anyone encountered this issue or can suggest a workaround to force the performance measure to aggregate correctly via FlexSimPy?

FlexSim 24.2.3
flexsimpyinteraction between flexsim and pythonpython connection with flexsim
· 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.

1 Answer

Kavika F avatar image
0 Likes"
Kavika F answered max commented

Hey @max, after looking at your python script, everything looks good. It's in the model that the problem is occurring. Your Statistics Collector "ProductOutputCount" is only ever outputing the value "1", no matter how long you run the model. If all you want is the input of the Sink, I suggest you change the Performance Measurement's value to reference the sink's input.

1744750973749.png

When saved and ran in the Python script, it gives me good values.

1744751015555.png

If you want to do it through the Statistics Collector anyway, then you may want to look at some of the tutorials we have on different setups for Stats Collectors.


1744750973749.png (15.0 KiB)
1744751015555.png (28.0 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.