question

Marc R5 avatar image
0 Likes"
Marc R5 asked Jason Lightfoot commented

on model reset import + onset parameter afterwards

Hello,

I have set up the import of my data "on model reset", but then I also have code in "on set" parameter, which involves changes in this data (f.e : the order of production).

If the import involves the load of an excel sheet, how the "on set" reacts. Which acts first? is the "on set" change data properly after excel data is imported or is there a clash?

Thanks

FlexSim 22.1.1
excel importonmodelreseton set
· 5
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

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Jason Lightfoot commented

When you click the reset button, the very first thing that happens is the parameter OnSet triggers are fired. The "isReset" parameter is true (1) in this case. The model's OnReset trigger fires after this.

The OnSet trigger is also fired when you change the value of the parameter. In this case, the "isReset" flag is false (0).

In general, we advise against always importing data on reset. First, it usually isn't necessary. If the data hasn't changed since the last reset, then there's no reason to import it again. Consider running replications in the Experimenter or Optimizer; all of the replications will call the On Reset trigger, and they don't need to re-import the data.

Second, if you always import excel data on reset, then you'll be unable to use the Experimenter or Optimizer with more than one CPU. The current Excel import doesn't allow multiple processes to access a given sheet at exactly the same time, so the import will work for some replications, but not for others.

It is much better to add a custom button to your dashboard that says "import data", or something like that. You can then click that button when you want to refresh the data, and then reset the model. This avoids the timing issue you are seeing. If you plan to use this model operationally, you could add your import code to the On Model Open trigger as well. This would also avoid the conflict you have.

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