} // end of InitializeVisualization #endregion #region Initialize /// <summary> /// Default initialization of model. Adds and initializes all control units /// and calls the custom initalize method /// </summary> /// <param name="simEngine"></param> public void Initialize(ISimulationEngine simEngine) { AddControlUnit(RootControlUnit); RootControlUnit.Initialize(StartTime, simEngine); CustomInitializeModel(); } // end of Initialize
/// <summary> /// Performs model's conditional rules (represented by the rule sets of control units) to be performed /// after triggering of scheduled events at specific time /// </summary> /// <param name="currentlyTriggeredScheduledEvents">Scheduled events triggered at current time</param> /// <param name="currentTime">Current time of model execution</param> /// <param name="simEngine">SimEngine responsible for simulation execution</param> public void PerformModelRules(IEnumerable <Event> currentlyTriggeredScheduledEvents, DateTime currentTime, ISimulationEngine simEngine) { RootControlUnit.SetRecursiveNeedsUpdateToFalse(); foreach (Event ev in currentlyTriggeredScheduledEvents) { ev.ParentControlUnit.BehaviorOccured = true; } // end foreach bool eventLaunched = true; // If new controlled behavior was launched we keep looping while (eventLaunched) { RootControlUnit.PerformRules(currentTime, out eventLaunched, simEngine); } // end while } // end of PerformModelRules