示例#1
0
        } // end of CreateModel

        #endregion

        //--------------------------------------------------------------------------------------------------
        // Button Click Methods
        //--------------------------------------------------------------------------------------------------

        #region PlaySimulation_Click

        private void PlaySimulation_Click(object sender, RoutedEventArgs e)
        {
            // this is needed as pause and run are handled by the same button
            if (!SimulationInitialized)
            {
                if (SimulationModel == null)
                {
                    CreateModel();
                }

                // initialize visualization system
                SimulationModel.InitializeVisualization(DrawingSystem);

                // initialize drawing engine
                SimulationModel.SimulationDrawingEngine.InitializeModelVisualizationAtTime(SimulationModel.StartTime, SimulationModel);

                // times are set
                _currentTime        = SimulationModel.StartTime;
                _nextSimulationTime = SimulationModel.StartTime;
                _nextTimerTime      = SimulationModel.StartTime + ConstantTimerStep;

                _simulationInitialized = true;
            } // end if


            SimulationTimer.Interval = TimeSpan.FromMilliseconds(SimulationSpeed);

            if (SimulationRunning)
            {
                ButtonPlaySimulation.Content = FindResource("Play");

                StopSimulation(true);
            }
            else
            {
                ButtonPlaySimulation.Content = FindResource("Pause");

                RunSimulation();
            }
        } // end of SimulationSpeed
示例#2
0
        }         // end of

        #endregion

        #region CreateModel

        public void CreateModel()
        {
            //_simulationModel = new SimulationModelQueuing((DateTime)DatePickerStartDate.SelectedDate,
            //    (DateTime)DatePickerEndDate.SelectedDate,
            //    2,
            //    3,
            //    5,
            //    10);

            DrawingSystem.ClearSystem();


            _simulationModel = new HospitalSimulationModelWithVisualization((DateTime)DatePickerStartDate.SelectedDate,
                                                                            (DateTime)DatePickerEndDate.SelectedDate);

            _simulationEngine = new SimulationEngine();
            SimulationEngine.LoggingEngine   = new BaseLoggingEngine(SimulationModel);
            SimulationEngine.CreateEventLog  = true;
            SimulationEngine.SimulationModel = SimulationModel;
            SimulationModel.Initialize(SimulationEngine);
            SimulationModel.InitializeVisualization(DrawingSystem);
        } // end of CreateModel