/// <summary> /// Mothod use to simulate. It will reset statistic if the current clock time is bigger than the warmup /// duration. It will only reset statistics once. /// </summary> public void Simulate() { while (Clock.CurrentTime < simulationDuration) { if (Clock.CurrentTime > warmupDurationForReset) { ResetStat(); warmupDurationForReset = MaxValue; } if (EventsList.NumberOfEvents() <= 0) { continue; } var currentEvent = nextEventChooserStrategy.Choose(EventsList, Clock.CurrentTime); if (Clock.CurrentTime < currentEvent.PossibleExecutionTimestamp.Time) { Clock.AddTime(currentEvent.PossibleExecutionTimestamp.Time - Clock.CurrentTime); } currentEvent.Execute(EventsList, Clock); executedEvent.Add(currentEvent); DumpSimulationStatus(streamWriter); } CleanStreamWriter(); }