Beispiel #1
0
 protected override void OnActive(SubCondition condition, Storage value, DateTime timeStamp)
 {
     if (condition.SubAlarmType != ActiveSubCondition)
     {
         if (condition.SubAlarmType != _tempType)
         {
             _timeStamp = timeStamp;
             _tempType  = condition.SubAlarmType;
         }
         if (_delay == 0 || (timeStamp - _timeStamp).TotalMilliseconds > _delay)
         {
             if (ActiveSubCondition == SubAlarmType.None)
             {
                 _active         = true;
                 _condLastActive = timeStamp;
             }
             _ack = false;
             ActiveSubCondition = condition.SubAlarmType;
             _current.Duration  = timeStamp - SubCondLastActive;
             _current           = new AlarmItem(timeStamp, condition.Message, _tag.GetValue(value), ActiveSubCondition, condition.Severity, _id, _source);
             if (AlarmActive != null)
             {
                 foreach (AlarmEventHandler deleg in AlarmActive.GetInvocationList())
                 {
                     deleg.BeginInvoke(this, _current, null, null);
                 }
             }
             RaiseChanged("Value");
         }
     }
     else
     {
         RaiseChanged("Value");
     }
 }
Beispiel #2
0
 public virtual void Dispose()
 {
     _current    = null;
     AlarmAck    = null;
     AlarmActive = null;
     ;
 }
Beispiel #3
0
 protected ICondition(int id, ConditionType conditionType, string source, string comment, float para, float deadBand, int delay)
 {
     this._id            = id;
     this._conditionType = conditionType;
     this._para          = para;
     this._source        = source;
     this._comment       = comment;
     this._deadBand      = deadBand;
     this._delay         = delay;
     this._current       = new AlarmItem();
 }
Beispiel #4
0
 protected override void OnInActive(Storage value)
 {
     if (ActiveSubCondition != SubAlarmType.None)
     {
         _active            = false;
         ActiveSubCondition = SubAlarmType.None;
         _current.Duration  = DateTime.Now - LastActive;
         _current           = new AlarmItem(DateTime.Now, string.Concat("【", Comment, "】", ALARMSTOP), 0, SubAlarmType.None, Severity.Normal, _id, _source);
         if (AlarmActive != null)
         {
             foreach (AlarmEventHandler deleg in AlarmActive.GetInvocationList())
             {
                 deleg.BeginInvoke(this, _current, null, null);
             }
         }
     }
 }
Beispiel #5
0
 protected override void OnActive(SubCondition condition, Storage value, DateTime timeStamp)
 {
     if (ActiveSubCondition == SubAlarmType.None)
     {
         _active         = true;
         _condLastActive = timeStamp;
     }
     _ack = false;
     ActiveSubCondition = condition.SubAlarmType;
     _current           = new AlarmItem(timeStamp, condition.Message, value.Int16, ActiveSubCondition, condition.Severity, _id, _source);
     if (AlarmActive != null)
     {
         foreach (AlarmEventHandler deleg in AlarmActive.GetInvocationList())
         {
             deleg.BeginInvoke(this, _current, null, null);
         }
     }
     RaiseChanged("Value");
 }