Esempio n. 1
0
        //-------------------------------------------------------------------
        //- METHODS                                                         -
        //-------------------------------------------------------------------

        /// <summary>
        /// Creates a new instance of the CallArriveProcessArgs class
        /// </summary>
        /// <param name="eventFactory">The instance of the EventFactory class</param>
        /// <param name="queueManager">The instance of the QueueManager class</param>
        /// <param name="callFactory">The instance of the CallFactory class</param>
        /// <param name="productTypes">The list of product types</param>
        /// <param name="callArriveMultiplier">The call arrival multiplier</param>
        /// <param name="switchDelayMultiplier">The switch delay multiplier</param>
        /// <exception cref="ArgumentNullException">Thrown when any one of the arguments is null</exception>
        public CallArriveProcessArgs(EventFactory eventFactory, QueueManager queueManager, CallFactory callFactory, List <ProductType> productTypes, double callArriveMultiplier, double switchDelayMultiplier)
            : base(eventFactory, queueManager)
        {
            //Check that eventFactory is not null
            if (eventFactory != null)
            {
                //Check that queueManager is not null
                if (queueManager != null)
                {
                    //Check that callFactory is not null
                    if (callFactory != null)
                    {
                        //Check that the list of product types is not null
                        if (productTypes != null)
                        {
                            this.callFactory           = callFactory;
                            this.productTypes          = productTypes;
                            this.callArriveMultiplier  = callArriveMultiplier;
                            this.switchDelayMultiplier = switchDelayMultiplier;
                        }
                        else // The list of ProductTypes was null
                        {
                            throw new ArgumentNullException("productTypes", "Attempted to pass null ProductType List to CallArriveProcessArgs constructor");
                        }
                    }
                    else // The given call factory was null
                    {
                        throw new ArgumentNullException("callFactory", "Attempted to pass null CallFactory to CallArriveProcessArgs constructor");
                    }
                }
                else // The given QueueManager was null
                {
                    throw new ArgumentNullException("queueManager", "Attempted to pass null QueueManager to CallArriveProcessArgs constructor");
                }
            }
            else // The given EventFactory was null
            {
                throw new ArgumentNullException("eventFactory", "Attempted to pass null EventFactory to CallArriveProcessArgs constructor");
            }
        }
Esempio n. 2
0
        //-------------------------------------------------------------------
        //- 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);
        }
Esempio n. 3
0
 //-------------------------------------------------------------------
 //- METHODS                                                         -
 //-------------------------------------------------------------------
 /// <summary>
 /// Creates a new instance of the EventProcessArgs class
 /// </summary>
 /// <param name="eventFactory">The instance of the EventFactory class</param>
 /// <param name="queueManager">The instance of the QueueManager class</param>
 public EventProcessArgs(EventFactory eventFactory, QueueManager queueManager)
 {
     this.eventFactory = eventFactory;
     this.queueManager = queueManager;
 }