示例#1
0
        } // end of ControlUnitOutpatient

        #endregion

        #region Initialize

        /// <summary>
        /// Overrides basic initialiing method. Besides standard operations a possible walk in stream of
        /// patients is
        /// </summary>
        /// <param name="startTime">Time the simulation starts</param>
        /// <param name="simEngine">SimEngine that handles the simulation run</param>
        public override void Initialize(DateTime startTime, ISimulationEngine simEngine)
        {
            base.Initialize(startTime, simEngine);

            EntityPatient nextPatient = null;
            DateTime      nextArrivalTime;

            if ((nextPatient = InputData.GetNextWalkInPatient(out nextArrivalTime, this, startTime)) != null)
            {
                EventOutpatientWalkInPatientArrival nextArrival = new EventOutpatientWalkInPatientArrival(this, InputData, nextPatient);

                simEngine.AddScheduledEvent(nextArrival, nextArrivalTime);
            } // end if
        }     // end of CustomInitialize
示例#2
0
        } // end of InputData

        #endregion

        //--------------------------------------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------------------------------------

        #region StateChange

        /// <summary>
        /// Overriden state change. Initializes a new arrival and patient paths and first action.
        /// </summary>
        /// <param name="time">Time the patient arrives</param>
        /// <param name="simEngine">SimEngine responsible for simulation execution</param>
        protected override void StateChange(DateTime time, ISimulationEngine simEngine)
        {
            Patient.OutpatientTreatmentPath =
                InputData.CreateOutpatientTreatmentPath(Patient,
                                                        null,
                                                        time,
                                                        true);

            ParentControlUnit.AddEntity(Patient);

            DateTime nextTime;;

            EntityPatient nextPatient = InputData.GetNextWalkInPatient(out nextTime, ParentControlUnit, time);

            EventOutpatientWalkInPatientArrival nextPatientArrival = new EventOutpatientWalkInPatientArrival(ParentControlUnit, InputData, nextPatient);

            simEngine.AddScheduledEvent(nextPatientArrival, nextTime);

            if (Patient.EmergencyTreatmentPath.TakeNextAction(simEngine, this, time, ParentControlUnit))
            {
                SequentialEvents.Add(Patient.StartWaitingActivity());
            } // end if
        }     // end of StateChange