FormulationClass.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using CCDCount.MODEL.ConfigModel;
  2. using CCDCount.MODEL.PlcModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace CCDCount.DLL
  9. {
  10. public static class FormulationClass
  11. {
  12. /// <summary>
  13. /// 初始化配方数据
  14. /// </summary>
  15. /// <param name="cameraConfig"></param>
  16. /// <param name="shuLiConfig"></param>
  17. /// <returns></returns>
  18. public static FormulationConfigClass InitFormulation(CameraConfig cameraConfig, ShuLiConfigClass shuLiConfig, PlcParaModelClass plcParaModel)
  19. {
  20. var result = new FormulationConfigClass()
  21. {
  22. Channel = shuLiConfig.Channel,
  23. ExposureTimeValue = cameraConfig.ExposureTimeValue,
  24. AcquistionLineRateValue = cameraConfig.AcquistionLineRateValue,
  25. DeviceName = cameraConfig.DeviceName,
  26. FormulationName = string.Empty,
  27. //IdentifyStartX = shuLiConfig.IdentifyStartX,
  28. //IdentifyStopX = shuLiConfig.IdentifyStopX,
  29. //IsIdentifyRoiOpen = shuLiConfig.IsIdentifyRoiOpen,
  30. MaxArea = shuLiConfig.MaxArea,
  31. MinArea = shuLiConfig.MinArea,
  32. NoiseFilter_Threshold = shuLiConfig.NoiseFilter_Threshold,
  33. PandingCode = shuLiConfig.PandingCode,
  34. RegionThreshold = shuLiConfig.RegionThreshold,
  35. MAX_GAP = shuLiConfig.MAX_GAP,
  36. MAX_Object_LENGTH = shuLiConfig.MAX_Object_LENGTH,
  37. MIN_Object_LENGTH = shuLiConfig.MIN_Object_LENGTH,
  38. ScaleX = shuLiConfig.ScaleX,
  39. ScaleY = shuLiConfig.ScaleY,
  40. };
  41. if(plcParaModel != null)
  42. {
  43. result.FillingMode = plcParaModel.FillingMode;
  44. result.BeltsSpeed = plcParaModel.BeltsSpeed;
  45. result.ShakeTable1H_FillingSpeed = plcParaModel.ShakeTable1H_FillingSpeed;
  46. result.ShakeTable2H_FillingSpeed = plcParaModel.ShakeTable2H_FillingSpeed;
  47. result.ShakeTable3H_FillingSpeed = plcParaModel.ShakeTable3H_FillingSpeed;
  48. result.ShakeTable1M_FillingSpeed = plcParaModel.ShakeTable1M_FillingSpeed;
  49. result.ShakeTable2M_FillingSpeed = plcParaModel.ShakeTable2M_FillingSpeed;
  50. result.ShakeTable3M_FillingSpeed = plcParaModel.ShakeTable3M_FillingSpeed;
  51. result.ShakeTable1L_FillingSpeed = plcParaModel.ShakeTable1L_FillingSpeed;
  52. result.ShakeTable2L_FillingSpeed = plcParaModel.ShakeTable2L_FillingSpeed;
  53. result.ShakeTable3L_FillingSpeed = plcParaModel.ShakeTable3L_FillingSpeed;
  54. result.ShakeTable1H_CacheSpeed = plcParaModel.ShakeTable1H_CacheSpeed;
  55. result.ShakeTable2H_CacheSpeed = plcParaModel.ShakeTable2H_CacheSpeed;
  56. result.ShakeTable3H_CacheSpeed = plcParaModel.ShakeTable3H_CacheSpeed;
  57. result.ShakeTable1M_CacheSpeed = plcParaModel.ShakeTable1M_CacheSpeed;
  58. result.ShakeTable2M_CacheSpeed = plcParaModel.ShakeTable2M_CacheSpeed;
  59. result.ShakeTable3M_CacheSpeed = plcParaModel.ShakeTable3M_CacheSpeed;
  60. result.ShakeTable1L_CacheSpeed = plcParaModel.ShakeTable1L_CacheSpeed;
  61. result.ShakeTable2L_CacheSpeed = plcParaModel.ShakeTable2L_CacheSpeed;
  62. result.ShakeTable3L_CacheSpeed = plcParaModel.ShakeTable3L_CacheSpeed;
  63. result.FillingH_SpeedRatio = plcParaModel.FillingH_SpeedRatio;
  64. result.FillingM_SpeedRatio = plcParaModel.FillingM_SpeedRatio;
  65. result.FillingL_SpeedRatio = plcParaModel.FillingL_SpeedRatio;
  66. result.CacheH_SpeedRatio = plcParaModel.CacheH_SpeedRatio;
  67. result.CacheM_SpeedRatio = plcParaModel.CacheM_SpeedRatio;
  68. result.CacheL_SpeedRatio = plcParaModel.CacheL_SpeedRatio;
  69. result.ScrewJogSpeed = plcParaModel.ScrewJogSpeed;
  70. result.InBottleSpeed = plcParaModel.InBottleSpeed;
  71. result.BottlePosSpeed = plcParaModel.BottlePosSpeed;
  72. result.BottlePosPosition = plcParaModel.BottlePosPosition;
  73. result.FillingValveOpenSpeed = plcParaModel.FillingValveOpenSpeed;
  74. result.FillingValveOpenPosition = plcParaModel.FillingValveOpenPosition;
  75. result.FillingValveCloseSpeed = plcParaModel.FillingValveCloseSpeed;
  76. result.FillingValveClosePosition = plcParaModel.FillingValveClosePosition;
  77. result.FillingValveCacheSpeed = plcParaModel.FillingValveCacheSpeed;
  78. result.FillingValueCachePosition = plcParaModel.FillingValueCachePosition;
  79. result.FillingValueJogSpeed = plcParaModel.FillingValueJogSpeed;
  80. result.MachineDelayFunneDownTime = plcParaModel.MachineDelayFunneDownTime;
  81. result.MachineDelayFunneUpTime = plcParaModel.MachineDelayFunneUpTime;
  82. result.MachineDelayFillingValveOpenTime = plcParaModel.MachineDelayFillingValveOpenTime;
  83. result.MachineDelayFillingValveCloseTime = plcParaModel.MachineDelayFillingValveCloseTime;
  84. result.MachineDelayInBottleTime = plcParaModel.MachineDelayInBottleTime;
  85. result.ValveDelytime = plcParaModel.ValveDelytime;
  86. result.BottValueSet = plcParaModel.BottValueSet;
  87. result.CacheShutdownValue = plcParaModel.CacheShutdownValue;
  88. }
  89. else
  90. {
  91. result = null;
  92. }
  93. return result;
  94. }
  95. /// <summary>
  96. /// 更新配方数据
  97. /// </summary>
  98. /// <param name="formulationConfig"></param>
  99. /// <param name="cameraConfig"></param>
  100. /// <param name="shuLiConfig"></param>
  101. public static void UpdateFormulation(ref FormulationConfigClass formulationConfig,CameraConfig cameraConfig, ShuLiConfigClass shuLiConfig)
  102. {
  103. formulationConfig.Channel = shuLiConfig.Channel;
  104. formulationConfig.ExposureTimeValue = cameraConfig.ExposureTimeValue;
  105. formulationConfig.AcquistionLineRateValue = cameraConfig.AcquistionLineRateValue;
  106. formulationConfig.DeviceName = cameraConfig.DeviceName;
  107. //formulationConfig.IdentifyStartX = shuLiConfig.IdentifyStartX;
  108. //formulationConfig.IdentifyStopX = shuLiConfig.IdentifyStopX;
  109. //formulationConfig.IsIdentifyRoiOpen = shuLiConfig.IsIdentifyRoiOpen;
  110. formulationConfig.MaxArea = shuLiConfig.MaxArea;
  111. formulationConfig.MinArea = shuLiConfig.MinArea;
  112. formulationConfig.NoiseFilter_Threshold = shuLiConfig.NoiseFilter_Threshold;
  113. formulationConfig.PandingCode = shuLiConfig.PandingCode;
  114. formulationConfig.RegionThreshold = shuLiConfig.RegionThreshold;
  115. formulationConfig.MAX_GAP = shuLiConfig.MAX_GAP;
  116. formulationConfig.MAX_Object_LENGTH = shuLiConfig.MAX_Object_LENGTH;
  117. formulationConfig.MIN_Object_LENGTH = shuLiConfig.MIN_Object_LENGTH;
  118. formulationConfig.ScaleX = shuLiConfig.ScaleX;
  119. formulationConfig.ScaleY = shuLiConfig.ScaleY;
  120. }
  121. }
  122. }