Jump to content
Simio Forum

Writing results of different replications in the same file?


Recommended Posts

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 post
Share on other sites

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 post
Share on other sites
×
×
  • Create New...