Example #1
0
 internal int CompareTo(GenericValue SV)
 {
     int Res = 0;
     switch (SV.sValueType.ToUpper())
     {
         case "UINT16":
             {
                 UInt16.TryParse(this.sValueString, out UInt16 PvParseResult);
                 UInt16.TryParse(SV.sValueString, out UInt16 SvParseResult);
                 Res = PvParseResult.CompareTo(SvParseResult);
                 break;
             }
         case "INT16":
             {
                 Int16.TryParse(this.sValueString, out Int16 PvParseResult);
                 Int16.TryParse(SV.sValueString, out Int16 SvParseResult);
                 Res = PvParseResult.CompareTo(SvParseResult);
                 break;
             }
         default:
             {
                 //sInput.GenericTryParse<UInt16>(out UInt16 result);
                 //DataValue = result;
                 break;
             }
     }
     return Res;
 }
Example #2
0
        internal override void CustomizedAnalyze(string Line)
        {
            // Preparation Start
            //DataRow dicAnalysisResult = dtAnalysisResultFormat.NewRow();
            Dictionary <string, string> dicAnalysisResult = new Dictionary <string, string>();

            string[] LineSplits = Line.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
            Def.LineSplits = LineSplits;
            // Preparation End

            // Generate Dataline Analysis Result Start
            // 1. Prepare PresentValue
            string       ValueType   = Def.GetValueType("TG");
            string       ValueString = Def.GetValueString("TG");
            GenericValue PV          = new GenericValue(ValueType, ValueString);

            // 2. Prepare IJudge
            string       sAlarmHigh  = "230";                      // TODO: Get SpecValue Dynamically
            GenericValue AlarmHigh   = new GenericValue(ValueType, sAlarmHigh);
            AbsMaxAlarm  absMaxAlarm = new AbsMaxAlarm(AlarmHigh); // TODO: Create by Factory to decouple Modules

            // 3. Do IJudge.Judge(PresentValue)
            bool JudgeResult = absMaxAlarm.Judge(PV);

            if (JudgeResult)
            {
                //drAnalysisResult["STAID"] = Def.GetValueString("STAID");
                //drAnalysisResult["SOUID"] = Def.GetValueString("SOUID");
                //drAnalysisResult["DATE"] = Def.GetValueString("DATE");
                //drAnalysisResult["TG"] = Def.GetValueString("TG");
                //drAnalysisResult["Q_TG"] = Def.GetValueString("Q_TG");
                dicAnalysisResult.Add("STAID", Def.GetValueString("STAID"));
                dicAnalysisResult.Add("SOUID", Def.GetValueString("SOUID"));
                dicAnalysisResult.Add("DATE", Def.GetValueString("DATE"));
                dicAnalysisResult.Add("TG", Def.GetValueString("TG"));
                dicAnalysisResult.Add("Q_TG", Def.GetValueString("Q_TG"));
            }
            // Generate Dataline Analysis Result End

            // Store Dataline Analysis Result Start
            if (JudgeResult)
            {
                StoreAnalysisResult(dicAnalysisResult);
            }
            // Store Dataline Analysis Result End
        }
Example #3
0
        public bool Judge(GenericValue PV)
        {
            int  CompareResult = PV.CompareTo(AH);
            bool result;

            if (CompareResult > 0)
            {
                // PV > AlarmHigh
                result = true;
            }
            else if (CompareResult == 0)
            {
                // PV = AlarmHigh
                result = false;
            }
            else
            {
                // PV < AlarmHigh
                result = false;
            }
            return(result);
        }
Example #4
0
 public bool Judge(GenericValue PV)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public RelMinAlarm(GenericValue SV, GenericValue AL)
 {
     this.SV = SV;
     this.AL = AL;
 }
 public HysteresisMaxAlarm(GenericValue SV, GenericValue AH)
 {
     this.SV = SV;
     this.AH = AH;
 }
 public AbsMinMaxAlarm(GenericValue AL, GenericValue AH)
 {
     this.AL = AL;
     this.AH = AH;
 }
 public StandbyMinAlarm(GenericValue SV, GenericValue AL)
 {
     this.SV = SV;
     this.AL = AL;
 }
Example #9
0
 public RelMinMaxRevAlarm(GenericValue SV, GenericValue AL, GenericValue AH)
 {
     this.SV = SV;
     this.AL = AL;
     this.AH = AH;
 }
 public HysteresisMinAlarm(GenericValue SV, GenericValue AL)
 {
     this.SV = SV;
     this.AL = AL;
 }
Example #11
0
 public AbsMaxAlarm(GenericValue AH)
 {
     this.AH = AH;
 }
 public StandbyMaxAlarm(GenericValue SV, GenericValue AH)
 {
     this.SV = SV;
     this.AH = AH;
 }
 public AbsMinAlarm(GenericValue AL)
 {
     this.AL = AL;
 }
Example #14
0
 public RelMaxAlarm(GenericValue SV, GenericValue AH)
 {
     this.SV = SV;
     this.AH = AH;
 }