//------------------------------------------------------------------- //- METHODS - //------------------------------------------------------------------- /// <summary> /// Creates a new instance of the Simulator class with the given parameters /// </summary> /// <param name="beginTime">The time that simulation is set to begin</param> /// <param name="runningTime">The duration that the simulation will run for</param> /// <param name="callArriveMultiplier">The multiplier used to calculate the time between calls</param> /// <param name="switchDelayMultiplier">The multiplier used to calculate the time calls spend at the switch</param> /// <param name="productTypes">The List of all product types</param> /// <param name="maxQueueLength">The maximum number of calls in a queue</param> /// <param name="singleQueueLength">Whether or not the QueueManager is set to count all queues as one or not</param> /// <param name="excessiveWaitTime">The TimeSpan that beyond which a call is considered having waited to long</param> /// <param name="representativeNumbers">The Dictionary containing the Types and numbers of SalesRepresentatives</param> public Simulator( DateTime beginTime, TimeSpan runningTime, double callArriveMultiplier, double switchDelayMultiplier, List <ProductType> productTypes, int maxQueueLength, bool singleQueueLength, TimeSpan excessiveWaitTime, Dictionary <SalesRepType, int> representativeNumbers) { this.beginTime = beginTime; this.callArriveMultiplier = callArriveMultiplier; this.switchDelayMultiplier = switchDelayMultiplier; this.productTypes = productTypes; this.calendar = new Calendar(); this.callFactory = new CallFactory(); this.eventFactory = new EventFactory(); this.clock = beginTime; this.excessiveWaitTime = excessiveWaitTime; this.queueManager = new QueueManager(maxQueueLength, productTypes, singleQueueLength); this.salesManager = new SalesForceManager(representativeNumbers); this.processArgsFactory = new ProcessArgsFactory(this); //Create the end simulation event DateTime finishingTime = beginTime + runningTime; Event endReplication = eventFactory.CreateEvent(EEventType.EndReplication, finishingTime, null); calendar.AddEvent(endReplication); //Create the first call arrive event Call call = callFactory.CreateCall(); Event firstCall = eventFactory.CreateEvent(EEventType.CallArrive, beginTime, call); calendar.AddEvent(firstCall); }