53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
|
|
using System;
|
||
|
|
|
||
|
|
namespace DTS.Common.Classes.Sensors
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// public helper class for ZeroRefence in SIFs, which is serialized to an int
|
||
|
|
/// </summary>
|
||
|
|
public class ZeroRef
|
||
|
|
{
|
||
|
|
public enum ZeroType
|
||
|
|
{
|
||
|
|
AverageOverTime,
|
||
|
|
UsePreEventDiagnostics,
|
||
|
|
UseZeroMv
|
||
|
|
}
|
||
|
|
|
||
|
|
public ZeroType ZeroMethod { get; }
|
||
|
|
|
||
|
|
public ZeroRef(string zeroref)
|
||
|
|
{
|
||
|
|
switch (zeroref)
|
||
|
|
{
|
||
|
|
case "0":
|
||
|
|
ZeroMethod = ZeroType.AverageOverTime;
|
||
|
|
break;
|
||
|
|
case "1":
|
||
|
|
ZeroMethod = ZeroType.UsePreEventDiagnostics;
|
||
|
|
break;
|
||
|
|
case "2":
|
||
|
|
ZeroMethod = ZeroType.UseZeroMv;
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
throw new NotSupportedException("TDAS::ZeroRef Invalid ZeroRef " + zeroref);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
public ZeroRef(ZeroType type) { ZeroMethod = type; }
|
||
|
|
public override string ToString()
|
||
|
|
{
|
||
|
|
switch (ZeroMethod)
|
||
|
|
{
|
||
|
|
case ZeroType.AverageOverTime:
|
||
|
|
return "0";
|
||
|
|
case ZeroType.UsePreEventDiagnostics:
|
||
|
|
return "1";
|
||
|
|
case ZeroType.UseZeroMv:
|
||
|
|
return "2";
|
||
|
|
default:
|
||
|
|
throw new NotSupportedException("TDAS::ZeroRef Invalid ZeroRef " + ZeroMethod);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|