Configurations.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using Edge.Core.IndustryStandardInterface.ATG;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.ComponentModel.DataAnnotations.Schema;
  6. using System.Text;
  7. namespace Application.ATG_Classic_App.Model
  8. {
  9. public abstract class BaseConfig
  10. {
  11. [Key]
  12. public int Id { get; set; }
  13. /// <summary>
  14. /// </summary>
  15. public DateTime CreatedTimeStamp { get; set; }
  16. public DateTime? ModifiedTimeStamp { get; set; }
  17. }
  18. /// <summary>
  19. /// the config shared by all tanks, so one copy for a ATG system.
  20. /// </summary>
  21. public class TankOverallConfig : BaseConfig
  22. {
  23. public enum DeliveryOperationMode
  24. {
  25. Manual,
  26. Automatic
  27. }
  28. /// <summary>
  29. /// TC温度补偿值参考(TC Reference, by centigrade),float, 最多3位小数,可以为正负,
  30. /// 用于计算温度补偿后的油品体积。
  31. /// 此值与地域有关, 典型值15C. 当探棒所测量温度与此值发生偏差,则结束Termal Coefficient进行
  32. /// “温度补偿体积”计算。即当实际测量温度与参考基准值不一样时,统一通过算法补正到基准值下的体积。
  33. /// </summary>
  34. public double TcReference { get; set; }
  35. /// <summary>
  36. /// the interval to read inventory data and save to db.
  37. /// default 60 seconds, by ms.
  38. /// </summary>
  39. public int InventorySamplingInterval { get; set; } = 60000;
  40. public DeliveryOperationMode DeliveryMode { get; set; }
  41. }
  42. public class TankLimitConfig : BaseConfig
  43. {
  44. /// <summary>
  45. /// The max volume of this tank can safely save material, by Liter.
  46. /// by considering the material expansion along with temp rise, the Max volume must less than Full Volume.
  47. /// </summary>
  48. public double MaxVolume { get; set; }
  49. /// <summary>
  50. /// 100% volume of this tank, by Liter.
  51. /// </summary>
  52. public double FullVolume { get; set; }
  53. /// <summary>
  54. /// % of the Max Volume, typical value 0.9
  55. /// above this value will trigger high product alarm.
  56. /// </summary>
  57. public double HighProduct { get; set; }
  58. /// <summary>
  59. /// Liter of the low product threashold value, by Liter, typical value 30.
  60. /// lower thatn this value will trigger low product alarm.
  61. /// </summary>
  62. public double LowProduct { get; set; }
  63. /// <summary>
  64. /// mm of the high water warning threashold value, by mm, typical value 100.
  65. /// higher than this value will trigger high water warning.
  66. /// </summary>
  67. public double HighWaterWarning { get; set; }
  68. /// <summary>
  69. /// mm of the high water alarm threashold value, by mm, typical value 125.
  70. /// higher than this value will trigger high water alarm.
  71. /// </summary>
  72. public double HighWaterAlarm { get; set; }
  73. /// <summary>
  74. /// by centigrade(celsius), typical value -50
  75. /// </summary>
  76. public double FuelTemperatureLowLimit { get; set; }
  77. /// <summary>
  78. /// by centigrade(celsius), typical value 60
  79. /// </summary>
  80. public double FuelTemperatureHighLimit { get; set; }
  81. }
  82. public class ProductConfig : BaseConfig
  83. {
  84. /// <summary>
  85. /// Each tank must have a product code defined.
  86. /// </summary>
  87. [Required]
  88. public string ProductCode { get; set; }
  89. /// <summary>
  90. /// descriptive info for the product.
  91. /// </summary>
  92. public string ProductLabel { get; set; }
  93. }
  94. public class ProbeConfig : BaseConfig
  95. {
  96. /// <summary>
  97. /// used for correlating the DeviceHandler of ProGauge_StartItaliana_Probe.Handler.DeviceId
  98. /// </summary>
  99. public int DeviceId { get; set; }
  100. /// <summary>
  101. /// the lowest point of the probe may not reached the bottom of the tank, this is the length of this distance.
  102. /// the fuel and water height readings will combine with this value before send out for ATG client applications.
  103. /// </summary>
  104. public double ProbeOffset { get; set; }
  105. /// <summary>
  106. /// user may want to 'hidden' some water in a tank, this is the value of the water height reading need to be substracted.
  107. /// </summary>
  108. public double WaterOffset { get; set; }
  109. }
  110. /// <summary>
  111. /// Also known as Tank strapping table or chart.
  112. /// </summary>
  113. public class TankProfileData
  114. {
  115. [Key]
  116. public int Id { get; set; }
  117. /// <summary>
  118. /// used to grouping a set of Data.
  119. /// </summary>
  120. public string BatchLabel { get; set; }
  121. [ForeignKey("TankConfig")]
  122. public int TankConfigId { get; set; }
  123. public TankConfig TankConfig { get; set; }
  124. public double Height { get; set; }
  125. public double Volume { get; set; }
  126. /// <summary>
  127. /// when measured height dropped from nearest height(>= measured height), how many Volume dropped.
  128. /// 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.
  129. /// NOT USED for now, just see it in VR console, not sure how to use it.
  130. /// </summary>
  131. public double? VolumeChange { get; set; }
  132. }
  133. /// <summary>
  134. /// the config for an individual tank.
  135. /// </summary>
  136. public class TankConfig : BaseConfig
  137. {
  138. /// <summary>
  139. /// Gets or sets the tank number which assigned in device internal
  140. /// </summary>
  141. public byte TankNumber { get; set; }
  142. /// <summary>
  143. /// descriptive info for this Tank.
  144. /// </summary>
  145. public string Label { get; set; }
  146. /// <summary>
  147. /// by mm.
  148. /// </summary>
  149. public double Diameter { get; set; }
  150. /// <summary>
  151. /// by liter/centigrade, typical value 0.0007
  152. /// </summary>
  153. public double ThermalCoefficient { get; set; }
  154. /// <summary>
  155. /// after a deliver done, system will delay this time(by seconds) and then caculate
  156. /// the deliver data to generate a record.
  157. /// this is good for wait the level stablize and avoid false alarms.
  158. /// </summary>
  159. public int DeliveryDelay { get; set; }
  160. public List<TankProfileData> TankProfileDatas { get; set; }
  161. [ForeignKey("ProductConfig")]
  162. public int? ProductConfigId { get; set; }
  163. public ProductConfig ProductConfig { get; set; }
  164. [ForeignKey("TankLimitConfig")]
  165. public int? TankLimitConfigId { get; set; }
  166. public TankLimitConfig TankLimitConfig { get; set; }
  167. [ForeignKey("ProbeConfig")]
  168. public int? ProbeConfigId { get; set; }
  169. public ProbeConfig ProbeConfig { get; set; }
  170. }
  171. }