123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading.Tasks;
- using Wayne.FDCPOSLibrary;
- namespace Edge.Core.IndustryStandardInterface.ATG
- {
-
-
-
-
-
-
-
-
- public interface IAutoTankGaugeController
- {
-
-
-
-
- event EventHandler<AtgStateChangeEventArg> OnStateChange;
- event EventHandler<AtgAlarmEventArg> OnAlarm;
-
-
-
- string MetaConfigName { get; }
-
-
-
- int DeviceId { get; }
-
-
-
- IEnumerable<Tank> Tanks { get; }
-
-
-
- AtgState State { get; }
-
-
-
-
-
- Task<TankReading> GetTankReadingAsync(int tankNumber);
-
-
-
-
- Task<IEnumerable<TankReading>> GetTanksReadingAsync();
-
-
-
-
-
-
-
-
-
- Task<IEnumerable<Delivery>> GetTankDeliveryAsync(int tankNumber, int pageRowCount = 10, int pageIndex = 0, DateTime? filterTimestamp = null);
-
-
-
-
-
-
-
-
- Task<IEnumerable<Inventory>> GetTankInventoryAsync(int tankNumber, int pageRowCount = 10, int pageIndex = 0, DateTime? filterTimestamp = null);
-
-
-
-
-
-
-
-
- Task<IEnumerable<Alarm>> GetTankAlarmAsync(int tankNumber, int pageRowCount = 10, int pageIndex = 0, DateTime? filterTimestamp = null);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SystemUnit SystemUnit { get; }
- }
- public class Alarm
- {
- public Alarm() { }
- public Alarm(AlarmPriority priority, AlarmType type)
- {
- this.Priority = priority;
- this.Type = type;
- }
- public int Id { get; set; }
- public AlarmPriority Priority { get; set; }
-
-
-
- public byte TankNumber { get; set; }
- public AlarmType Type { get; set; }
- public DateTime CreatedTimeStamp { get; set; }
-
-
-
- public DateTime? ClearedTimeStamp { get; set; }
- public string Description { get; set; }
- }
- public enum AlarmPriority
- {
-
-
-
- Warning,
-
-
-
- Alarm,
- }
-
-
-
- public class Tank
- {
-
-
-
- public byte TankNumber { get; set; }
-
-
-
- public string Label { get; set; }
- public Product Product { get; set; }
- public TankLimit Limit { get; set; }
-
-
-
- public double? Diameter { get; set; }
-
-
- public TankState State { get; set; }
- public Probe Probe { get; set; }
- public override string ToString()
- {
- return $"Tank with No.: {TankNumber} has Label: {Label ?? ""}, ProductCode: {Product?.ProductCode ?? ""}, ProductLabel: {Product?.ProductLabel ?? ""}";
- }
- }
- public class TankLimit
- {
-
-
-
-
- public double MaxVolume { get; set; }
-
-
-
- public double FullVolume { get; set; }
-
-
-
-
- public double HighProduct { get; set; }
-
-
-
-
- public double LowProduct { get; set; }
-
-
-
-
- public double HighWaterWarning { get; set; }
-
-
-
-
- public double HighWaterAlarm { get; set; }
-
-
-
- public double FuelTemperatureLowLimit { get; set; }
-
-
-
- public double FuelTemperatureHighLimit { get; set; }
- }
- public class Product
- {
-
-
-
- public string ProductCode { get; set; }
-
-
-
- public string ProductLabel { get; set; }
- }
-
-
-
- public class Probe
- {
-
-
-
- public int DeviceId { get; set; }
-
-
-
- public string HardwareIdentity { get; set; }
-
-
-
- public double? ProbeLength { get; set; }
-
-
-
-
- public double ProbeOffset { get; set; }
-
-
-
- public double WaterOffset { get; set; }
-
-
-
- public string State { get; set; }
- }
- public class ProbeReading
- {
-
-
-
- public double? Height { get; set; }
-
-
-
-
- public double? Water { get; set; }
- public IEnumerable<double> Temperature { get; set; }
- public double? Density { get; set; }
- }
- public class TankReading
- {
- public int? TankNumber { get; set; }
-
-
-
- public double? Volume { get; set; }
-
-
-
-
-
-
-
-
-
- public double? TcVolume { get; set; }
-
-
-
-
-
-
- public double? Ullage { get; set; }
-
-
-
-
- public double? WaterVolume { get; set; }
- #region values read from real physical probe, all other business are actually rely on these hardware readings
-
-
-
- public double? Height { get; set; }
-
-
-
-
- public double? Water { get; set; }
- public double? Temperature { get; set; }
- public double? Density { get; set; }
- #endregion
- public override string ToString()
- {
- return "Product Height: " + (this?.Height ?? -1) +
- ", Product Volume: " + (this.Volume ?? -1) +
- ", Product TcVolume Volume: " + (this.TcVolume ?? -1) +
- ", Water Height: " + (this?.Water ?? -1) +
- ", Temperature: " + (this?.Temperature ?? -1) +
- ", Density: " + (this?.Density ?? -1);
- }
- }
- public enum SystemUnit
- {
- US = 1,
- Metric = 2,
- ImperialGallons = 3,
- }
- public enum SystemLanguage
- {
- English = 1,
- French = 2,
- Spanish = 3,
- German = 4,
- Portuguese = 5,
- Polish = 6,
- Swedish = 7,
- Janpanese = 8,
- Finnish = 9,
- }
- public enum AlarmType
- {
- #region VeederRoot defined
- TankSetupDataWarning = 1,
- TankLeakAlarm = 2,
- TankHighWaterAlarm = 3,
- TankOverfillAlarm = 4,
- TankLowProductAlarm = 5,
- TankSuddenLossAlarm = 6,
- TankHighProductAlarm = 7,
- TankInvalidFuelLevelAlarm = 8,
- TankProbeOutAlarm = 9,
- TankHighWaterWarning = 10,
- TankDeliveryNeededWarning = 11,
- TankMaximumProductAlarm = 12,
- TankGrossLeakTestFailAlarm = 13,
- TankPeriodicLeakTestFailAlarm = 14,
- TankAnnualLeakTestFailAlarm = 15,
- TankPeriodicTestNeededWarning = 16,
- TankAnnualTestNeedWarning = 17,
- TankPeriodicTestNeededAlarm = 18,
- TankAnnualTestNeededAlarm = 19,
- TankLeakTestActive = 20,
- TankNoCsldIdleTimeWarning = 21,
- TankSiphonBreakActiveWarning = 22,
- TankCsldRateIncreaseWarning = 23,
- TankAccuChartCalibrationWarning = 24,
- TankHrmReconciliationWarning = 25,
- TankHrmReconciliationAlarm = 26,
- TankColdTemperatureWarning = 27,
- TankMissingDeliveryTicketWarning = 28,
- TankLineGrossLeakAlarm = 29,
-
- TankHighTemperatureWarning = 5000,
- #endregion
- }
- public enum DeliveryReadingDataName
- {
- StartingVolume = 1,
- StartingTcVolume = 2,
- StartingWater = 3,
- StartingTemp = 4,
- EndingVolume = 5,
- EndingTcVolume = 6,
- EndingWater = 7,
- EndingTemp = 8,
- StartingHeight = 9,
- EndingHeight = 10,
- }
- public class Delivery
- {
- public byte TankNumber { get; set; }
- public DateTime StartingDateTime { get; set; }
- public double StartingFuelHeight { get; set; }
- public double StartingFuelVolume { get; set; }
- public double StartingFuelTCVolume { get; set; }
- public double StartingWaterHeight { get; set; }
- public double StartingTemperture { get; set; }
- public DateTime? EndingDateTime { get; set; }
- public double? EndingFuelHeight { get; set; }
- public double? EndingFuelVolume { get; set; }
- public double? EndingFuelTCVolume { get; set; }
- public double? EndingWaterHeight { get; set; }
- public double? EndingTemperture { get; set; }
- public string Description { get; set; }
- }
- public class Inventory
- {
- public int TankNumber { get; set; }
- public DateTime TimeStamp { get; set; }
- public double FuelHeight { get; set; }
- public double FuelVolume { get; set; }
- public double FuelTCVolume { get; set; }
- public double WaterHeight { get; set; }
- public double Temperture { get; set; }
- public string Description { get; set; }
- }
- }
|