question

Ahmed Azab avatar image
0 Likes"
Ahmed Azab asked Joerg Vogel edited

Why Global Table is cleared after each replication even when "clear on Reset" box is unchecked ?

i am collecting the the item time reaches to a queue .. and i want to record every item arrival time to this queue in a global table.. i used trigger On Entry to do this , but the global table is cleared after each replication,, the code i used as follows:

  1. /**Custom Code*/
  2. treenode item = parnode(1);
  3. treenode current = ownerobject(c);
  4. int port = parval(2);
  5. string tablename = /**/"Terminal_Arr"/**/;
  6.  
  7.  
  8. /** \nNumber of Columns: */ int columns = /**/1/**/;
  9. /** \nColumn Format (1 = number, 2 = string): */ intarray array = makearray(columns);
  10. fillarray(array,/**/1/**/);
  11.  
  12.  
  13. if(getinput(current) == 1) {
  14. settablesize(tablename,1,columns);
  15. for(int index=1; index<=columns; index++) {
  16. nodeadddata(gettablecell(tablename,1,index),array[index]);
  17. }
  18. }
  19. else {
  20. settablesize(tablename,gettablerows(tablename)+1,columns);
  21. }
  22.  
  23. double rows = gettablerows(tablename);
  24. /** \nCommands to set the data in the new row:*/ /**/
  25.  
  26. settablenum("Terminal_Arr",gettablerows("Terminal_Arr"),1,time);
Choose One
global tabletriggersqueues
· 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.

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Joerg Vogel edited

The source code line " if(getinput(current) == 1) " set the tablesize again to a table with only one row. That way it looks like the global table is reset, too, after reseting the model and starting the next model run.

5 |100000

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