//产生越限报警消息 public void GetELimitAlarmMsg(string StaName, ELimitState node) { int i = (int)node; string Recorder; EAlarmPriority priority; if (i >= 0 && i <= 3) { priority = sLimt[i].priority; Recorder = sLimt[i].text; } else if (i >= 4 && i <= 7) { priority = sLimt[i - 4].priority; Recorder = sLimt[i - 4].text + " 恢复"; } else { return; } frmMain.staAlarm.cAlarmMsg.AddMsg(StaName, Recorder, EAlarmType.OverLimit, priority); }
public void GetELimitAlarm(Int64 ValueInt64, string StaName) { int DeadValue = 0; if (Deadbandenabled) { DeadValue = Deadbandvalue; } switch (eLimitState) { case ELimitState.NN: if (sLimt[0].enabled) { if (ValueInt64 < sLimt[0].value - DeadValue) { eLimitState = ELimitState.LL; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[1].enabled) { if (ValueInt64 < sLimt[1].value - DeadValue) { eLimitState = ELimitState.LO; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[3].enabled) { if (ValueInt64 > sLimt[3].value + DeadValue) { eLimitState = ELimitState.HH; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[2].enabled) { if (ValueInt64 > sLimt[2].value + DeadValue) { eLimitState = ELimitState.HI; GetELimitAlarmMsg(StaName, eLimitState); break; } } break; case ELimitState.LO: if (sLimt[0].enabled) { if (ValueInt64 < sLimt[0].value - DeadValue) { eLimitState = ELimitState.LL; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[1].enabled) { if (ValueInt64 > sLimt[1].value + DeadValue) { eLimitState = ELimitState.NN; GetELimitAlarmMsg(StaName, ELimitState.LORe); } } if (sLimt[3].enabled) { if (ValueInt64 > sLimt[3].value + DeadValue) { eLimitState = ELimitState.HH; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[2].enabled) { if (ValueInt64 > sLimt[2].value + DeadValue) { eLimitState = ELimitState.HI; GetELimitAlarmMsg(StaName, eLimitState); break; } } break; case ELimitState.LL: if (sLimt[0].enabled) { if (ValueInt64 > sLimt[0].value + DeadValue) { eLimitState = ELimitState.LO; GetELimitAlarmMsg(StaName, ELimitState.LLRe); } else { break; } } if (sLimt[1].enabled) { if (ValueInt64 > sLimt[1].value + DeadValue) { eLimitState = ELimitState.NN; GetELimitAlarmMsg(StaName, ELimitState.LORe); } else if (ValueInt64 < sLimt[1].value - DeadValue) { eLimitState = ELimitState.LO; GetELimitAlarmMsg(StaName, ELimitState.LO); break; } } if (sLimt[3].enabled) { if (ValueInt64 > sLimt[3].value + DeadValue) { eLimitState = ELimitState.HH; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[2].enabled) { if (ValueInt64 > sLimt[2].value + DeadValue) { eLimitState = ELimitState.HI; GetELimitAlarmMsg(StaName, eLimitState); break; } } break; case ELimitState.HI: if (sLimt[3].enabled) { if (ValueInt64 > sLimt[3].value + DeadValue) { eLimitState = ELimitState.HH; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[2].enabled) { if (ValueInt64 < sLimt[2].value - DeadValue) { eLimitState = ELimitState.NN; GetELimitAlarmMsg(StaName, ELimitState.HIRe); } } if (sLimt[0].enabled) { if (ValueInt64 < sLimt[0].value - DeadValue) { eLimitState = ELimitState.LL; GetELimitAlarmMsg(StaName, eLimitState); break; } } if (sLimt[1].enabled) { if (ValueInt64 < sLimt[1].value - DeadValue) { eLimitState = ELimitState.LO; GetELimitAlarmMsg(StaName, eLimitState); break; } } break; case ELimitState.HH: if (sLimt[3].enabled) { if (ValueInt64 < sLimt[3].value - DeadValue) { eLimitState = ELimitState.HI; GetELimitAlarmMsg(StaName, ELimitState.HHRe); } else { break; } } if (sLimt[2].enabled) { if (ValueInt64 < sLimt[2].value - DeadValue) { eLimitState = ELimitState.NN; GetELimitAlarmMsg(StaName, ELimitState.HIRe); //HI Re } else if (ValueInt64 > sLimt[2].value + DeadValue) { eLimitState = ELimitState.HI; GetELimitAlarmMsg(StaName, ELimitState.HI); break; } } if (sLimt[0].enabled) { if (ValueInt64 < sLimt[0].value - DeadValue) { eLimitState = ELimitState.LL; GetELimitAlarmMsg(StaName, ELimitState.LL); break; } } if (sLimt[1].enabled) { if (ValueInt64 < sLimt[1].value - DeadValue) { eLimitState = ELimitState.LO; GetELimitAlarmMsg(StaName, ELimitState.LO); break; } } break; default: break; } }