question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked Ben Wilson commented

is there a way to update a calculated table using some sort of trigger?

Hi. I noticed that there are BY INTERVAL and BY LAZY INTERVAL, but my model may change the simulation time window depending on the user's input. Is it possible to update the calculated table by using a message or a command, -let's say, in my process flow-?

FlexSim 20.1.1
flexsim 20.1.1calculated table
· 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @enrique.elizaga, was tanner.p's answer helpful? If so, please click the red "Accept" button on their answer. Or if you still have questions, add a comment and we'll continue the conversation.

0 Likes 0 ·

1 Answer

·
tannerp avatar image
1 Like"
tannerp answered tannerp commented

@enrique.elizaga,

You can manually update a Calculated Table using this code:

treenode table = Model.find("Tools/CalculatedTables/CalculatedTable1");
function_s(table, "update", 1);

This can be implemented using Process Flow as in the example model I've attached.

manually update table_1.fsm


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

Enrique Elizaga avatar image Enrique Elizaga commented ·

Hey @tanner.p this is cool and works perfectly. Two followup questions.

  1. My calculated tables are tied to graphs, so when I reset the model they keep the last values. I tried to use the same code on reset, then repaintall but i get an error.
  2. Once the update variable is set to 1, do I need to set it back to 0 to avoid the calculated tables to update ALWAYS? I am trying to only update on every PFLOW pass...
0 Likes 0 ·
tannerp avatar image tannerp Enrique Elizaga commented ·

@enrique.elizaga,

Good questions. I'll do my best to answer both as they are tied to the same thing.

The function_s command that we're calling in this case is running a one-time update on the table, not changing a variable so that the table is "always" updating. That variable is actually called "updateMode" and is left unchanged by this method.

What we're doing when we call the function_s command in this case is updating/repainting the table all at once. I updated your model so that the "On Reset" trigger includes the proper code and I added tokens that will update the table every 30 seconds. Notice that the table does not update except for when a new token triggers an update.

manually update table_2.fsm

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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