} // end of CollectingMethodsPerControlUnitType

        #endregion

        //--------------------------------------------------------------------------------------------------
        // Interface Methods
        //--------------------------------------------------------------------------------------------------

        #region CreateCurrentState

        /// <summary>
        /// Creates the current state, for each triggered event the appropriate method is called if any
        /// is stored in the dictionaries, for all control units it is checked if a data collection method
        /// was stored, if so it is called
        /// </summary>
        /// <param name="currentEvents">List of events that have been triggered at current time of simulation</param>
        /// <param name="time">Current time of simulation</param>
        public void CreateCurrentState(List <Event> currentEvents, DateTime time)
        {
            if (time < EndOfWarmUpPeriod)
            {
                return;
            }

            foreach (Event ev in currentEvents)
            {
                if (ev is EventActivity)
                {
                    EventActivity activityEvent = ev as EventActivity;
                    Type          activityType  = activityEvent.ParentActivity.GetType();

                    if (activityEvent.EventType == EventType.Start)
                    {
                        if (CollectingMethodsPerActivityStartEventType.ContainsKey(activityType))
                        {
                            CollectingMethodsPerActivityStartEventType[activityType](activityEvent.ParentActivity, time);
                        }
                    }
                    else if (((EventActivity)ev).EventType == EventType.End)
                    {
                        if (CollectingMethodsPerActivityEndEventType.ContainsKey(activityType))
                        {
                            CollectingMethodsPerActivityEndEventType[activityType](activityEvent.ParentActivity, time);
                        }
                    } // end if
                }
                else
                {
                    if (CollectingMethodsPerStandaloneEventType.ContainsKey(ev.GetType()))
                    {
                        CollectingMethodsPerStandaloneEventType[ev.GetType()](ev, time);
                    }
                } // end if
            }     // end foreach

            foreach (ControlUnit control in ParentSimulationModel.ControlUnits.Values)
            {
                if (CollectingMethodsPerControlUnitType.ContainsKey(control.GetType()))
                {
                    CollectingMethodsPerControlUnitType[control.GetType()](control, time);
                }
            } // end foreach
        }     // end of CreateCurrentState
示例#2
0
        //--------------------------------------------------------------------------------------------------
        // Constructor
        //--------------------------------------------------------------------------------------------------

        #region Constructor

        /// <summary>
        /// Basic constructor, delegate dictionaries for event and control unit data collection
        /// methods are stored in dictionaries
        /// </summary>
        /// <param name="parentSimulationModel">Simulation model data is collected for</param>
        /// <param name="endOfWarmUpPeriod">Time after which data is collected</param>
        public SampleOutputGeneration(SimulationModel parentSimulationModel, DateTime endOfWarmUpPeriod) : base(parentSimulationModel, endOfWarmUpPeriod)
        {
            CollectingMethodsPerStandaloneEventType.Add(typeof(EventEmergencyPatientArrival), PatientArrivingAtEmergency);
            CollectingMethodsPerStandaloneEventType.Add(typeof(EventEmergencyPatientLeave), PatientLeavingAtEmergency);
            CollectingMethodsPerActivityStartEventType.Add(typeof(ActivityHealthCareAction <EmergencyActionTypeClass>), PatientFirstSeenByDoctor);
        } // end of