コード例 #1
0
ファイル: Simulator.cs プロジェクト: rNdm74/C-
        /// <summary>
        /// Run the simulation
        /// </summary>
        public void RunSimulation()
        {
            while (!(activeEvent is EndSimulationEvent))
            {
                // Get next event from calender
                activeEvent = calender.GetNextEvent();

                // Update global clock
                Global.Clock = activeEvent.EventTime;

                if (activeEvent is ArrivalEvent)
                {
                    // Tell event to execute
                    activeEvent.Execute(calender, resourceManager, statistics, rGen, entityFactory, eventFactory);
                }

                if (activeEvent is SwitchCompleteEvent)
                {
                    // Tell event to execute
                    activeEvent.Execute(calender, resourceManager, statistics, rGen, entityFactory, eventFactory);
                }

                if (activeEvent is ProcessingCompleteEvent)
                {
                    // Tell event to execute
                    activeEvent.Execute(calender, resourceManager, statistics, rGen, entityFactory, eventFactory);
                }

                // Update simulation statistics
                statistics.UpdateLists(calender, resourceManager);
                statistics.NotifyDisplays();

                // Control the speed of the loop
                System.Threading.Thread.Sleep(Global.SimulationSpeed);
            }

            // Gives user feedback at the end of the simulation
            if (Global.ExportCSV)
            {
                OpenSaveFileDialog();
            }
            else
            {
                MessageBox.Show("The simulation completed successfully", "Simulation Complete");
            }
        }
コード例 #2
0
ファイル: Simulator.cs プロジェクト: rNdm74/C-
        /// <summary>
        /// Run the simulation
        /// </summary>
        public void RunSimulation()
        {
            while (!(activeEvent is EndSimulationEvent))
            {
                // Get next event from calender
                activeEvent = calender.GetNextEvent();

                // Update global clock
                Global.Clock = activeEvent.EventTime;

                if (activeEvent is ArrivalEvent)
                {
                    // Tell event to execute
                    activeEvent.Execute(calender, resourceManager, statistics, rGen, entityFactory, eventFactory);
                }

                if (activeEvent is SwitchCompleteEvent)
                {
                    // Tell event to execute
                    activeEvent.Execute(calender, resourceManager, statistics, rGen, entityFactory, eventFactory);
                }

                if(activeEvent is ProcessingCompleteEvent)
                {
                    // Tell event to execute
                    activeEvent.Execute(calender, resourceManager, statistics, rGen, entityFactory, eventFactory);
                }

                // Update simulation statistics
                statistics.UpdateLists(calender, resourceManager);
                statistics.NotifyDisplays();

                // Control the speed of the loop
                System.Threading.Thread.Sleep(Global.SimulationSpeed);
            }

            // Gives user feedback at the end of the simulation
            if(Global.ExportCSV)
                OpenSaveFileDialog();
            else
                MessageBox.Show("The simulation completed successfully", "Simulation Complete");
        }