Пример #1
0
        /// <summary>
        /// Executes a single Simulation run with the given parameters
        /// </summary>
        public void ExecuteSimulation()
        {
            //Create the simulator using the parameters
            Simulator         sim     = new Simulator(beginTime, duration, callArrivalMultiplier, switchDelayMultiplier, productTypes, maxQueueLength, singleQueueLength, excessiveWait, repNums);
            RunningDisplay    rd      = new RunningDisplay(0, 0, sim);
            StatisticsManager statMan = new StatisticsManager(sim);
            StatisticsDisplay sd      = new StatisticsDisplay(rd.Location.X, (rd.Location.Y + rd.Height), statMan);

            rd.Show();
            sd.Show();

            //Run the simulator
            sim.RunSimulation(SIMULATION_SLEEP);
            rd.Hide();
            rd.Dispose();
        }
Пример #2
0
        }//End SetDefaultOptions.

        /************************************************************************
         * Initializes all the data and components necessary to run a simulation.
         ***********************************************************************/
        private void LoadSimulation()
        {
            //Get the user input values from number selectors
            //for the global variables used in the simulation.
            int maxHold          = Convert.ToInt16(selectMaxHoldLen.Value);
            int excessWait       = Convert.ToInt16(selectExcessWait.Value);
            int carStereoReps    = Convert.ToInt16(selectCarStereoReps.Value);
            int otherReps        = Convert.ToInt16(selectOtherReps.Value);
            int eventPause       = Convert.ToInt16(selectEventPause.Value);
            int simTime          = Convert.ToInt16(selectSimTime.Value);
            int percentCarStereo = Convert.ToInt16(selectPercentCarStereo.Value);

            //Get the user input values from radio buttons
            //for the global variables used in the simulation.
            double delayArrivals  = FetchDelayArrival();
            double delayIvr       = FetchDelayIvr();
            double delayCarStereo = FetchDelayCarStero();
            double delayOther     = FetchDelayOther();

            //Initialize a product type list.
            string[] productTypes = new string[] { ProductData.CAR_STEREO_PRODUCT, ProductData.OTHER_PRODUCT };

            //Create a new simulation.
            sim = new Simulation(simTime, maxHold, eventPause, carStereoReps, otherReps,
                                 delayCarStereo, delayOther, delayArrivals, delayIvr,
                                 r, percentCarStereo, excessWait, productTypes);

            //Create a calendar display.
            calendarOut = new EventDisplay(eventDisplay, sim.Calendar);

            //Create a display for other queue.
            otherQueue = new QueueDisplay(otherDisplay, sim.Calendar, ProductData.OTHER_PRODUCT);

            //Create a display for car stereo queue.
            carStereoQueue = new QueueDisplay(carDisplay, sim.Calendar, ProductData.CAR_STEREO_PRODUCT);

            //Create a graphical display for the simulation.
            visualDisplay = new GraphicDisplay(displayPanel, sim.Calendar, maxHold, carStereoReps, otherReps, displayPanel.Width, displayPanel.Height);

            //Create a text display for the statistics handler.
            statistics = new StatisticsDisplay(statsDisplay, sim.stats);
        }//End LoadSimulation.