/// <summary>
        /// Initialization: Patient arrival stream for waiting list patients is initialized.
        /// If dispatching is done at discrete events this stream is initialized as well.
        /// </summary>
        /// <param name="startTime">Time the simulation starts</param>
        /// <param name="simEngine">SimEngine that handles the simulation run</param>
        protected override void CustomInitialize(DateTime startTime, ISimulationEngine simEngine)
        {
            WaitingListSchedule.Initialize(startTime);

            AddEntity((EntityWaitingListSchedule)WaitingListSchedule);

            DateTime      nextArrivalTime;
            Admission     admission;
            EntityPatient newPatient = InputData.GetNextWaitingListPatient(out nextArrivalTime, out admission, this, startTime);

            if (newPatient != null)
            {
                EventOutpatientWaitingListPatientArrival nextArrival =
                    new EventOutpatientWaitingListPatientArrival(this,
                                                                 (ControlUnitOutpatient)ParentControlUnit,
                                                                 newPatient,
                                                                 admission,
                                                                 InputData);

                simEngine.AddScheduledEvent(nextArrival, nextArrivalTime);
            } // end if

            WaitingListSchedule.ReadyForDispatch = true;

            if (AssigningSlotsAtEvents)
            {
                EventOutpatientStartDispatching nextDispatch = new EventOutpatientStartDispatching(this, WaitingListSchedule, InputData);

                simEngine.AddScheduledEvent(nextDispatch, InputData.NextDispatching(startTime));

                WaitingListSchedule.ReadyForDispatch = false;
            }
        } // end of Initialize
Exemplo n.º 2
0
        } // end of ControlUnit

        #endregion

        #region Initialize

        /// <summary>
        /// Just adds the waiting list schedule to the controlled entities and intializes it
        /// </summary>
        /// <param name="startTime">Start time of the simulation model</param>
        /// <param name="simEngine">SimEngine responsible for simulation execution</param>
        protected override void CustomInitialize(DateTime startTime, ISimulationEngine simEngine)
        {
            AddEntity(WaitingListSchedule);

            WaitingListSchedule.Initialize(startTime);
        } // end of Initialize