using Edge.Core.IndustryStandardInterface.ATG;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Application.ATG_Classic_App.Model
{
public abstract class BaseConfig
{
[Key]
public int Id { get; set; }
///
///
public DateTime CreatedTimeStamp { get; set; }
public DateTime? ModifiedTimeStamp { get; set; }
}
///
/// the config shared by all tanks, so one copy for a ATG system.
///
public class TankOverallConfig : BaseConfig
{
public enum DeliveryOperationMode
{
Manual,
Automatic
}
///
/// TC温度补偿值参考(TC Reference, by centigrade),float, 最多3位小数,可以为正负,
/// 用于计算温度补偿后的油品体积。
/// 此值与地域有关, 典型值15C. 当探棒所测量温度与此值发生偏差,则结束Termal Coefficient进行
/// “温度补偿体积”计算。即当实际测量温度与参考基准值不一样时,统一通过算法补正到基准值下的体积。
///
public double TcReference { get; set; }
///
/// the interval to read inventory data and save to db.
/// default 60 seconds, by ms.
///
public int InventorySamplingInterval { get; set; } = 60000;
public DeliveryOperationMode DeliveryMode { get; set; }
}
public class TankLimitConfig : BaseConfig
{
///
/// The max volume of this tank can safely save material, by Liter.
/// by considering the material expansion along with temp rise, the Max volume must less than Full Volume.
///
public double MaxVolume { get; set; }
///
/// 100% volume of this tank, by Liter.
///
public double FullVolume { get; set; }
///
/// % of the Max Volume, typical value 0.9
/// above this value will trigger high product alarm.
///
public double HighProduct { get; set; }
///
/// Liter of the low product threashold value, by Liter, typical value 30.
/// lower thatn this value will trigger low product alarm.
///
public double LowProduct { get; set; }
///
/// mm of the high water warning threashold value, by mm, typical value 100.
/// higher than this value will trigger high water warning.
///
public double HighWaterWarning { get; set; }
///
/// mm of the high water alarm threashold value, by mm, typical value 125.
/// higher than this value will trigger high water alarm.
///
public double HighWaterAlarm { get; set; }
///
/// by centigrade(celsius), typical value -50
///
public double FuelTemperatureLowLimit { get; set; }
///
/// by centigrade(celsius), typical value 60
///
public double FuelTemperatureHighLimit { get; set; }
}
public class ProductConfig : BaseConfig
{
///
/// Each tank must have a product code defined.
///
[Required]
public string ProductCode { get; set; }
///
/// descriptive info for the product.
///
public string ProductLabel { get; set; }
}
public class ProbeConfig : BaseConfig
{
///
/// used for correlating the DeviceHandler of ProGauge_StartItaliana_Probe.Handler.DeviceId
///
public int DeviceId { get; set; }
///
/// the lowest point of the probe may not reached the bottom of the tank, this is the length of this distance.
/// the fuel and water height readings will combine with this value before send out for ATG client applications.
///
public double ProbeOffset { get; set; }
///
/// user may want to 'hidden' some water in a tank, this is the value of the water height reading need to be substracted.
///
public double WaterOffset { get; set; }
}
///
/// Also known as Tank strapping table or chart.
///
public class TankProfileData
{
[Key]
public int Id { get; set; }
///
/// used to grouping a set of Data.
///
public string BatchLabel { get; set; }
[ForeignKey("TankConfig")]
public int TankConfigId { get; set; }
public TankConfig TankConfig { get; set; }
public double Height { get; set; }
public double Volume { get; set; }
///
/// when measured height dropped from nearest height(>= measured height), how many Volume dropped.
/// say at 2000mm, the volume is 2000L, and the nearst profile lower point has height 1900mm, and the Volume is 1800L, then ValumeChange is 200L.
/// NOT USED for now, just see it in VR console, not sure how to use it.
///
public double? VolumeChange { get; set; }
}
///
/// the config for an individual tank.
///
public class TankConfig : BaseConfig
{
///
/// Gets or sets the tank number which assigned in device internal
///
public byte TankNumber { get; set; }
///
/// descriptive info for this Tank.
///
public string Label { get; set; }
///
/// by mm.
///
public double Diameter { get; set; }
///
/// by liter/centigrade, typical value 0.0007
///
public double ThermalCoefficient { get; set; }
///
/// after a deliver done, system will delay this time(by seconds) and then caculate
/// the deliver data to generate a record.
/// this is good for wait the level stablize and avoid false alarms.
///
public int DeliveryDelay { get; set; }
public List TankProfileDatas { get; set; }
[ForeignKey("ProductConfig")]
public int? ProductConfigId { get; set; }
public ProductConfig ProductConfig { get; set; }
[ForeignKey("TankLimitConfig")]
public int? TankLimitConfigId { get; set; }
public TankLimitConfig TankLimitConfig { get; set; }
[ForeignKey("ProbeConfig")]
public int? ProbeConfigId { get; set; }
public ProbeConfig ProbeConfig { get; set; }
}
}