Files
DP44/Common/DTS.Common/Classes/Sensors/ZeroRef.cs

53 lines
1.5 KiB
C#
Raw Normal View History

2026-04-17 14:55:32 -04:00
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);
}
}
}
}