question

Patrick Zweekhorst avatar image
1 Like"
Patrick Zweekhorst asked Patrick Zweekhorst commented

Change in update mode calulated table between 18.2 and 19.0

Hi,

I updated a model from 18.2 to 19.0 and noticed that is was much slower in 19.0. After a little bit of searching I found that there is a difference in when the calculated table with update mode always is updated.
In my model I have a calculated table that does a query on a stats collector and calls a userCommand. When the dashboard that shows that calculated table is closed the table is not updated in 18.2. Only when opening the dashboard the table is updated.
In 19.0 the table is updated each time something happens to the stats collector where it is reading its information from. This is even the case when the dashboard is closed. Is it intended that the update mode always updates even when the dashboard is closed and nothing happens with the results of the calculated table?

Attached is a simple example model. There is a global variable that keep track of how many time the calculated table is updated.

Thanks,

Patrick

calculatedtablecall.fsm

Note, it is not possible to select 19.0.3 in the software version.

FlexSim 19.0.2
calculated tableupdate mode
· 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.

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

@Ben Wilson @Paul Toone Can you guys check on the version option, and make sure you can select 19.0.3?

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ Jordan Johnson ♦♦ commented ·

@jordan.johnson, @Patrick Zweekhorst,

Sorry for the delay. 19.0.3 is now added to the version selector.

0 Likes 0 ·

1 Answer

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Patrick Zweekhorst commented

Hi Patrick,

The behavior is correct, for 19.0. In 18.2, the Always mode causes the query to be totally reevaluated, and the result table re constructed, every time you ask for a value from the table. If you have a chart or table open, then that can be very slow.

In 19.0, we made it so that in Always mode, the Calculated Table will check the query to see if incrementally updating is an option (among other qualifications, all FROM tables must be Statistics Collectors). If so, the Calculated Table will listen to the Statistics Collector events and incrementally update the result as the input tables change.

So here's the performance difference. Open the attached model, and make sure the view for the Calculated Table is open. In 18.0, it took 120 seconds to run the model to the stop time. In 19.0, it took about 35 seconds of the time. In 18.0, you will notice that the performance gets worse and worse as time goes on, because every time the screen paints, the query must be totally re-evaluated. In 19.0, performance may be slightly slower for the first bit, but it is consistent, and in the end is much faster.

Basically, in 19.0, we try to amortize the cost of the query across the whole model run, for more predictable performance.

So if you are only updating a query rarely, then I would recommend a different update mode, like By Interval. If you want complete control over when the query runs, you can either use Table.query() or you can tell the Calculated Table to update manually:

function_s(myCalcTable, "update", 1)

testalwaysspeed.fsm


testalwaysspeed.fsm (24.1 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.

Patrick Zweekhorst avatar image Patrick Zweekhorst commented ·

Hi @jordan.johnson,

Thanks for your answer. It looks like you made the calculated table a bit to smart for my original model from 18.2. I will change the update mode for the model in 19.0 and use the function_s.

0 Likes 0 ·