asaremi Posted August 7, 2014 Share Posted August 7, 2014 Hi I wonder how I can write the results of multiple replications of a model in a single file. In other words, Simio doesn't write over previous run data. Thanks Link to comment Share on other sites More sharing options...
asaremi Posted August 13, 2014 Author Share Posted August 13, 2014 Hi, So no one knows how to do it? Or it is too obvious? Thanks Link to comment Share on other sites More sharing options...
tulach Posted August 13, 2014 Share Posted August 13, 2014 I thought I would be easy to change Write step, but the fact each replication is in a separate file has a reason. Simio can run multiple replications at once. And using External it crates say 4 processess each with one replication. Each process can run in a different thread. But these processess cannot write in one file simultanously. So I recommend using this Makro to join files together. Sub LoopThroughFiles() Application.DisplayAlerts = False i = 0 Dim StrFile As String StrFile = Dir("C:\Users\.....\NameOfExcelFile*") Do While Len(StrFile) > 0 Workbooks.Open Filename:=StrFile Sheets("Sheet1").Activate Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks("vysledky_makro.xlsm").Activate Sheets("Sheet2").Activate If Range("A1") = "" Then Range("A1").Select Else Range("A1").End(xlDown).Offset(1, 0).Select End If Selection.PasteSpecial xlPasteAll i = i + 1 Workbooks(StrFile).Close StrFile = Dir Loop End Sub Link to comment Share on other sites More sharing options...
asaremi Posted August 13, 2014 Author Share Posted August 13, 2014 Thanks for your reply Tulach. I dont know how to tell Simio to record result of each replication in a separate file and not overwrite the previous rep. Can you let me know how? Thanks Link to comment Share on other sites More sharing options...
asaremi Posted August 13, 2014 Author Share Posted August 13, 2014 Should I code in a way that Simio changes the file element based on the replication number? Link to comment Share on other sites More sharing options...
tulach Posted August 14, 2014 Share Posted August 14, 2014 You dont have to do anything. Just run Experiment and if your ExcelConnect is file results.xlsx Experimenter will produce files results_Exp1_scen1_rep1.xlsx results_Exp1_scen2_rep4.xlsx and so on. If you have problem with overwriten data in excel you should probably increment some State e.q. ExcelRow(int) after Each use of ExcelWrite step. Link to comment Share on other sites More sharing options...
Recommended Posts