|
@@ -58,6 +58,8 @@ namespace SCADA_DAQ.Customer.Service
|
|
|
|
|
|
public bool[] Result = new bool[8];
|
|
|
|
|
|
+ private int OutOfRangeCount = 0;
|
|
|
+
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
@@ -132,11 +134,30 @@ namespace SCADA_DAQ.Customer.Service
|
|
|
var currentTemp = TempTransfer(data.temperature[i].TcTempString, out Result[i]) * (double)gain.Gain + (double)gain.Offset;
|
|
|
if (FirstScan)
|
|
|
{
|
|
|
- Temps[i] = Math.Abs( currentTemp - OldTemps[i]) / 5 < CustomerEnv.TempSettingModelValue.Rate ? currentTemp : OldTemps[i];
|
|
|
+ if (Math.Abs(currentTemp - OldTemps[i]) / 5 < CustomerEnv.TempSettingModelValue.Rate)
|
|
|
+ {
|
|
|
+ Temps[i] = currentTemp;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OutOfRangeCount++;
|
|
|
+ if (OutOfRangeCount > 2)
|
|
|
+ {
|
|
|
+ Temps[i] = currentTemp;
|
|
|
+ OutOfRangeCount = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Temps[i] = OldTemps[i];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Temps[i] = currentTemp;
|
|
|
+ Temps[i] = currentTemp;
|
|
|
+
|
|
|
}
|
|
|
OldTemps[i] = Temps[i];
|
|
|
if (Result[i])
|