Ejemplo n.º 1
0
        /// <returns>
        /// The simulated time.
        /// TimeSpan.Zero if no time progress was achieved due to delta events.
        /// TimeSpan.MinValue if no events were available.
        /// </returns>
        private TimeSpan RunSignalAssignmentPhase(bool progressTime)
        {
            _phase = SchedulerPhase.SignalAssignment;
            TimeSpan simulatedTime = TimeSpan.Zero;

            while (progressTime && _deltaEvents.Count == 0)
            {
                TimeSpan timespan;
                if (_timeQueue.TryNextEventTime(out timespan))
                {
                    OnSimulationTimeProgress(timespan);
                    simulatedTime += timespan;
                }
                else
                {
                    _phase = SchedulerPhase.Idle;
                    return(TimeSpan.MinValue);
                }
            }

            while (_deltaEvents.Count > 0)
            {
                SignalEventItem item = _deltaEvents.Pop();
                if (item.SetValue(item.NewValue))
                {
                    _eventSignals.Add(item);
                }
            }

            _phase = SchedulerPhase.Idle;
            return(simulatedTime);
        }
Ejemplo n.º 2
0
 public void ScheduleDeltaEvent(SignalEventItem item)
 {
     _deltaEvents.Push(item);
 }
Ejemplo n.º 3
0
 public void ScheduleDeltaEvent(SignalEventItem item)
 {
     _deltaEvents.Push(item);
 }
Ejemplo n.º 4
0
 public TimedSignalEventItem(SignalEventItem item, TimeSpan timeSpan)
 {
     _item = item;
     _timeSpan = timeSpan;
 }
Ejemplo n.º 5
0
 public TimedSignalEventItem(SignalEventItem item, TimeSpan timeSpan)
 {
     _item     = item;
     _timeSpan = timeSpan;
 }