Jump to content

Using excelRead process step multiple times during simulation


ebabtain
 Share

Recommended Posts

Hi everyone,


I'm a freshman university student and am new to Simio, so please correct me if I make any beginner mistakes or say anything wrong. Also, I apologize for posting this in the general section - I didn't know where to post it.


In my simulation, I am trying to use excelRead and excelWrite to input and output data to an excel file. I am also using labels to show the exact values. During the simulation, I would like to run a MATLAB script to modify the data in the excel sheet, and read it back into Simio. I have no trouble at all running a MATLAB function using the CallMATLAB step. The problem is reading the modified file back into Simio, which is not explained by the simbit or online tutorials, as far as I know.


For example, the values initially in the spreadsheet were all 1's. The first time I use excelRead to read a file, Simio shows the data without a problem. After that, I change the values to 2's, but when excelRead process is triggered, Simio doesn't show changes. Note that the data in the excel file did change. Once I completely stop the simulation and run it again, Simio finally shows the new values.


I apologize if I am completely incorrect, but I have been thinking of what the problem might be. It appears to me that the first time Simio uses excelRead to read a file, it somehow stores a copy of it and works only with it, and when it stops it somehow copies it back? I'm really confused about what's happenning. The point is that I just cannot read the same file more than once.


Is it possible to modify and read an excel sheet several times while the simulation is running, or is it just not possible using excel files? If so, what would be some solutions to this issue? If I decide to use mySQL databases instead of excel files, would I face the same issue? Please note that I am not familiar with databases, and would like to use excel files if possible.


Thank you all. Please let me know if my question is unclear or if you need any more information.

Link to comment
Share on other sites

Hi ebabtain,


Your instincts are correct. The ExcelReadWrite Add-In only reads in each worksheet once. This is by design, since the steps are generally executed many times and very quickly, and re-reading the file would consume a great deal of time.


Within the ExcelReadWrite Add-In there is a worksheet cache of sheets (called _sheets) that is checked against and does not bother to read the file if the worksheet if it is already cached.


So, I would suggest a few possibilities:

1. Modify the Add-In to remove the caching. or

2. Use another Add-In (such as text file read-write... this has less overhead)


In either case, make sure your logic in the simulation does not call the step more than - say - once a second.


Let me know if you have more questions and/or if I am missing the mark.


Cheers,

Dan

Link to comment
Share on other sites

×
×
  • Create New...