1222 lines
66 KiB
C#
1222 lines
66 KiB
C#
|
|
using System;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace GenesisZeroFlow
|
|||
|
|
{
|
|||
|
|
public static class DecodedDataHelper
|
|||
|
|
{
|
|||
|
|
public static DecodedData[] GetDefaultDecodedDataArray(Int32 count)
|
|||
|
|
{
|
|||
|
|
var ret = new DecodedData[count];
|
|||
|
|
for (Int32 i = 0; i < count; i++)
|
|||
|
|
{
|
|||
|
|
ret[i] = GetDefaultDecodedData();
|
|||
|
|
}
|
|||
|
|
return ret;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public static DecodedData GetDefaultDecodedData()
|
|||
|
|
{
|
|||
|
|
return new DecodedData()
|
|||
|
|
{
|
|||
|
|
DataValid = "0",
|
|||
|
|
MessageType = String.Empty,
|
|||
|
|
ProtocolVersion = String.Empty,
|
|||
|
|
Path = Constants.PATH0,
|
|||
|
|
DeltaTimeOfFlight = 0.0, // protocol version 'e'
|
|||
|
|
RawDeltaVolume = 0.0, // protocol version 'e'
|
|||
|
|
RawDeltaVolumeScaling = 0.0, // protocol version 'e'
|
|||
|
|
SampleInterval = 0,
|
|||
|
|
Flow = 0,
|
|||
|
|
Mode = String.Empty,
|
|||
|
|
DecodingSucceeded = false,
|
|||
|
|
DisplayVol = String.Empty,
|
|||
|
|
Time = 0,
|
|||
|
|
Crc = 0,
|
|||
|
|
#region G-Protocol
|
|||
|
|
AmplitudeUp = 0,
|
|||
|
|
AmplitudeDown = 0,
|
|||
|
|
PulsewidthRatioUp = 0,
|
|||
|
|
PulsewidthRatioDown = 0,
|
|||
|
|
Temperature = 0,
|
|||
|
|
TemperatureScale = 0,
|
|||
|
|
#endregion
|
|||
|
|
#region H-Protocol
|
|||
|
|
Error = DataError.NoError,
|
|||
|
|
TotalTimeOfFlightAverage = 0,
|
|||
|
|
TimeOfFlightUp = 0,
|
|||
|
|
TimeOfFlightDown = 0,
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static class Counters
|
|||
|
|
{
|
|||
|
|
/*
|
|||
|
|
public static void SetCounters(Boolean[] loggingIndicator, UInt16 meterNumber, UInt16 path, ref Int32[][] linecounter)
|
|||
|
|
{
|
|||
|
|
if ((loggingIndicator == null)||(linecounter == null))
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
#region Activity check for empty pipe test
|
|||
|
|
if (loggingIndicator[meterNumber])
|
|||
|
|
{
|
|||
|
|
if (linecounter[meterNumber][path] < Int32.MaxValue)
|
|||
|
|
linecounter[meterNumber][path]++;
|
|||
|
|
else
|
|||
|
|
linecounter[meterNumber][path] = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
linecounter[meterNumber][path] = 0;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
public static Int32 SetCounters(Boolean[] loggingIndicator, UInt16 meterNumber, UInt16 path, ref Int32[][] linecounter)
|
|||
|
|
{
|
|||
|
|
if ((loggingIndicator == null) || (linecounter == null))
|
|||
|
|
return linecounter[meterNumber][path];
|
|||
|
|
|
|||
|
|
#region Activity check for empty pipe test
|
|||
|
|
if (loggingIndicator[meterNumber])
|
|||
|
|
{
|
|||
|
|
if (linecounter[meterNumber][path] < Int32.MaxValue)
|
|||
|
|
linecounter[meterNumber][path]++;
|
|||
|
|
else
|
|||
|
|
linecounter[meterNumber][path] = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
linecounter[meterNumber][path] = 0;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
return linecounter[meterNumber][path];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public static Int32 SetCountersTempCal(Boolean loggingIndicator, UInt16 path, Int32[] linecounter)
|
|||
|
|
{
|
|||
|
|
if (linecounter == null)
|
|||
|
|
return linecounter[path];
|
|||
|
|
|
|||
|
|
#region Activity check for empty pipe test
|
|||
|
|
if (loggingIndicator)
|
|||
|
|
{
|
|||
|
|
if (linecounter[path] < Int32.MaxValue)
|
|||
|
|
linecounter[path]++;
|
|||
|
|
else
|
|||
|
|
linecounter[path] = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
linecounter[path] = 0;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
return linecounter[path];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static Boolean CrcCheck(Int32 crcObtained, String input)
|
|||
|
|
{
|
|||
|
|
if (input == null)
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
Boolean crcOk = false;
|
|||
|
|
Int32 crcCalculated = 0;
|
|||
|
|
|
|||
|
|
#region CRC check
|
|||
|
|
String[] crcTemp = input.Split(' ');
|
|||
|
|
String crcInputString = String.Empty;// = "@";
|
|||
|
|
for (UInt16 length = 0; length < crcTemp.Count() - 1; length++)
|
|||
|
|
crcInputString = crcInputString + crcTemp[length] + " ";
|
|||
|
|
Crc16Ccitt crc = new Crc16Ccitt(InitialCrcValue.Nonzero1);
|
|||
|
|
Byte[] data = Encoding.UTF8.GetBytes(crcInputString);
|
|||
|
|
crcCalculated = crc.ComputeChecksum(data);
|
|||
|
|
|
|||
|
|
if (crcObtained == crcCalculated)
|
|||
|
|
{
|
|||
|
|
//GenesisZeroFlow.Display.DebugCrcIndicatorText(true);
|
|||
|
|
crcOk = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//GenesisZeroFlow.Display.DebugCrcIndicatorText(false);
|
|||
|
|
crcOk = false;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
return crcOk;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class DecodedData : ICloneable
|
|||
|
|
{
|
|||
|
|
#region For all protocols
|
|||
|
|
public String DataValid { get; set; }
|
|||
|
|
public String MessageType { get; set; }
|
|||
|
|
public String ProtocolVersion { get; set; }
|
|||
|
|
public UInt16 Path { get; set; }
|
|||
|
|
#endregion
|
|||
|
|
#region E-protocol/ G-protocol
|
|||
|
|
public Double DeltaTimeOfFlight { get; set; } // protocol version 'e' and 'g'
|
|||
|
|
public Double RawDeltaVolume { get; set; } // protocol version 'e'
|
|||
|
|
public Double RawDeltaVolumeScaling { get; set; }// protocol version 'e'
|
|||
|
|
public Double RawDeltaVolumeAccu { get; set; } // protocol version 'e'
|
|||
|
|
public Double SampleInterval { get; set; }
|
|||
|
|
public Double Flow { get; set; }
|
|||
|
|
#endregion
|
|||
|
|
#region F-protocol
|
|||
|
|
public String DisplayVol { get; set; }
|
|||
|
|
public Int32 Time { get; set; }
|
|||
|
|
public Int32 Crc { get; set; }
|
|||
|
|
#endregion
|
|||
|
|
#region G-protocol
|
|||
|
|
public Double AmplitudeUp { get; set; }
|
|||
|
|
public Double AmplitudeDown { get; set; }
|
|||
|
|
public Double PulsewidthRatioUp { get; set; }
|
|||
|
|
public Double PulsewidthRatioDown { get; set; }
|
|||
|
|
public Int32 Temperature { get; set; }
|
|||
|
|
public Int32 TemperatureScale { get; set; }
|
|||
|
|
#endregion
|
|||
|
|
#region H-protocol
|
|||
|
|
public Double Error { get; set; }
|
|||
|
|
public Double TotalTimeOfFlightAverage { get; set; }
|
|||
|
|
public Double DeltaTimeOfFlightAverage { get; set; }
|
|||
|
|
public Double TimeOfFlightUp { get; set; }
|
|||
|
|
public Double TimeOfFlightDown { get; set; }
|
|||
|
|
#endregion
|
|||
|
|
#region Miscellaneous
|
|||
|
|
public String Mode { get; set; }
|
|||
|
|
public Boolean DecodingSucceeded { get; set; }
|
|||
|
|
public Double CalculatedTemperature { get; set; }
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//object Clone()
|
|||
|
|
//{
|
|||
|
|
// return this.MemberwiseClone();
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
public object Clone()
|
|||
|
|
{
|
|||
|
|
var toClone = (DecodedData)MemberwiseClone();
|
|||
|
|
//toClone.TofUp = (Double[])TofUp.Clone();
|
|||
|
|
//toClone.TofDown = (Double[])TofDown.Clone();
|
|||
|
|
//toClone.DifTof = (Double[])DifTof.Clone();
|
|||
|
|
|
|||
|
|
return toClone;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public partial class GenesisZeroFlow : Form
|
|||
|
|
{
|
|||
|
|
private String[] Output = new String[Constants.NumberOfMeters] { String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty };
|
|||
|
|
private Boolean[] ValidData = new Boolean[Constants.NumberOfMeters] { false, false, false, false, false, false, false, false, false, false};
|
|||
|
|
|
|||
|
|
|
|||
|
|
//private void MainLoopDataMeter1(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter1()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter1;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode dat
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// //remove roland
|
|||
|
|
// //DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// //DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// //DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
// private void MainLoopDataMeter2(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter2()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter2;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if(RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter3(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter3()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter3;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter4(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter4()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter4;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter5(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter5()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter5;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
// private void MainLoopDataMeter6(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter6()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter6;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter7(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter7()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter7;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter8(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter8()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter8;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter9(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter9()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter9;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// LineCounterEmptyPipeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//private void MainLoopDataMeter10(object sender, EventArgs e)
|
|||
|
|
////private void MainLoopDataMeter10()
|
|||
|
|
//{
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// const UInt16 MeterNumber = Constants.Meter10;
|
|||
|
|
// DecodedData[] decodingResult = DecodedDataHelper.GetDefaultDecodedDataArray(Constants.NumberOfPaths);
|
|||
|
|
// Int32 numberOfLines = (Int32)nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value;
|
|||
|
|
// decodingResult[Constants.PATH0].DecodingSucceeded = false;
|
|||
|
|
// String Temp = String.Empty;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Prepare data
|
|||
|
|
// for (UInt16 i = 0; i < RxDataBuffer[MeterNumber].Count(); i++)
|
|||
|
|
// {
|
|||
|
|
// if (RxDataBuffer[MeterNumber].ElementAt(0).ToString().Equals("@"))
|
|||
|
|
// {
|
|||
|
|
// if (!String.IsNullOrEmpty(Output[MeterNumber]))
|
|||
|
|
// {
|
|||
|
|
// Temp = "@" + Output[MeterNumber];
|
|||
|
|
// ValidData[MeterNumber] = true;
|
|||
|
|
// }
|
|||
|
|
// Output[MeterNumber] = String.Empty;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Output[MeterNumber] = Output[MeterNumber] + RxDataBuffer[MeterNumber].ElementAt(0);
|
|||
|
|
|
|||
|
|
// RxDataBuffer[MeterNumber] = RxDataBuffer[MeterNumber].Remove(0, 1);
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
// if (ValidData[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Definitions and initializations
|
|||
|
|
// Temp = Temp.Replace("\n", String.Empty);
|
|||
|
|
// UInt16 Path = Constants.PATH0;
|
|||
|
|
// ValidData[MeterNumber] = false;
|
|||
|
|
// #endregion
|
|||
|
|
// #region Logging (Zero flow test)
|
|||
|
|
// if (GetLoggingIndicatorZeroFlowTest()[MeterNumber] && (!String.IsNullOrEmpty(LoggingPathZeroFlowTest[MeterNumber])))
|
|||
|
|
// {
|
|||
|
|
// String time = DateTime.Now.ToString(Formats.RawDataDateTimeLogString, globalCulture);
|
|||
|
|
// SetDataToLog(MeterNumber, GetDataToLog()[MeterNumber] + time + Temp + "\n");
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Decode data
|
|||
|
|
// decodingResult = DecodeTelegram.DecodedDataDecodeTelegram(Temp, DecodedAllMeters[MeterNumber]);
|
|||
|
|
// Path = decodingResult[Constants.PATH0].Path; // Equal for Paths
|
|||
|
|
// Boolean CrcOk = Counters.CrcCheck(decodingResult[Path].Crc, Temp);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Add to list h-protocol
|
|||
|
|
// if (CrcOk)
|
|||
|
|
// {
|
|||
|
|
// #region Activity check for empty pipe test
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorEmptyPipeTest, MeterNumber, Path, LineCounterEmptyPipeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for amplitude test
|
|||
|
|
// if (LoggingIndicatorAmplitudeTest[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// totalTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].TotalTimeOfFlightAverage);
|
|||
|
|
// NewDataIndicatorAmplitudeTest[MeterNumber][Path] = true;
|
|||
|
|
// }
|
|||
|
|
// LineCounterAmplitudeTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorAmplitudeTest, MeterNumber, Path, LineCounterAmplitudeTest);
|
|||
|
|
// #endregion
|
|||
|
|
// #region Data for zero flow test
|
|||
|
|
// if (LineCounterZeroFlowTest[MeterNumber][Path] >= numberOfLines)
|
|||
|
|
// {
|
|||
|
|
// SetCalculationIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// SetLoggingIndicatorZeroFlowTest(false, MeterNumber);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (GetCalculationIndicatorZeroFlowTest()[MeterNumber])
|
|||
|
|
// {
|
|||
|
|
// #region Bad data check
|
|||
|
|
// if (decodingResult[Path].Error == DataError.NoError)
|
|||
|
|
// {
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = true;
|
|||
|
|
// AmplitudeValuesUp[MeterNumber][Path].Add(decodingResult[Path].AmplitudeUp);
|
|||
|
|
// AmplitudeValuesDown[MeterNumber][Path].Add(decodingResult[Path].AmplitudeDown);
|
|||
|
|
// DeltaTimeOfFlightAverage[MeterNumber][Path].Add(decodingResult[Path].DeltaTimeOfFlightAverage);
|
|||
|
|
// LineCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, LineCounterZeroFlowTest);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// BadDataCounterZeroFlowTest[MeterNumber][Path] = Counters.SetCounters(GetCalculationIndicatorZeroFlowTest(), MeterNumber, Path, BadDataCounterZeroFlowTest);
|
|||
|
|
// NewDataIndicatorZeroFlowTest[MeterNumber][Path] = false;
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Activity check for temperature pipe test
|
|||
|
|
// LineCounterTemperatureTest[MeterNumber][Path] = Counters.SetCounters(LoggingIndicatorTemperatureTest, MeterNumber, Path, LineCounterTemperatureTest);
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
// #endregion
|
|||
|
|
// #region Copy to global object
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH0] = ((DecodedData)(decodingResult[Constants.PATH0].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH1] = ((DecodedData)(decodingResult[Constants.PATH1].Clone()));
|
|||
|
|
// DecodedAllMeters[MeterNumber][Constants.PATH2] = ((DecodedData)(decodingResult[Constants.PATH2].Clone()));
|
|||
|
|
// #endregion
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|