Recipe.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Diagnostics;
  7. namespace Venus_Core
  8. {
  9. public enum RecipeType
  10. {
  11. Chuck,
  12. Dechuck,
  13. Process,
  14. Clean,
  15. }
  16. public enum StepType
  17. {
  18. Time,
  19. Stable,
  20. EndPoint,
  21. OverEtch,
  22. }
  23. public enum ProcessModule
  24. {
  25. Pressure,
  26. TCP, // Transformer Coupled Plasma (转换耦合等离子)
  27. Bias,
  28. Gas,
  29. ESC,
  30. Process,
  31. Compound,
  32. }
  33. public enum GeneratorMode
  34. {
  35. Pulsing,
  36. CW,
  37. }
  38. public class RecipeHead
  39. {
  40. public string Name { get; set; }
  41. public string Version { get; set; }
  42. public RecipeType Type { get; set; }
  43. public string ChuckRecipe { get; set; }
  44. public string DechuckRecipe { get; set; }
  45. public string CreateTime { get; set; }
  46. public string LastModifiedBy { get; set; }
  47. public string Barcode { get; set; }
  48. public string BasePressure { get; set; }
  49. public string ChillerTemp { get; set; }
  50. }
  51. public class ProcessUnitBase
  52. {
  53. public Func<ProcessUnitBase, RecipeStep, RState> checker;
  54. public Func<ProcessUnitBase, RecipeStep, RState> starter;
  55. public string Name { get; set; }
  56. public ProcessModule Moudle { get; set; }
  57. public RState Start(RecipeStep step)
  58. {
  59. if (starter != null)
  60. return starter(this, step);
  61. return RState.Running;
  62. }
  63. public RState Run(RecipeStep step)
  64. {
  65. if (checker != null)
  66. return checker(this, step);
  67. return RState.Running;
  68. }
  69. }
  70. public class RecipeStep
  71. {
  72. public StepType Type { get; set; }
  73. public int Time { get; set; }
  74. public int MinEndPointTime { get; set; }
  75. public int MaxEndPointTime { get; set; }
  76. public bool CycleStart { get; set; }
  77. public bool CycleEnd { get; set; }
  78. public int CycleNumber { get; set; }
  79. public RState Start()
  80. {
  81. foreach(var unit in lstUnit)
  82. {
  83. var state = unit.Start(this);
  84. if (state != RState.Running)
  85. return state;
  86. }
  87. _stepTimer.Restart();
  88. return RState.Running;
  89. }
  90. public RState Run()
  91. {
  92. if (Type == StepType.Time && _stepTimer.ElapsedMilliseconds >= Time * 1000)
  93. return RState.End;
  94. foreach (var unit in lstUnit)
  95. {
  96. var state = unit.Run(this);
  97. if (state != RState.Running)
  98. return state;
  99. }
  100. return RState.Running;
  101. }
  102. public void AppendUnit(ProcessUnitBase unit)
  103. {
  104. lstUnit.Append(unit);
  105. }
  106. public double RampFactor()
  107. {
  108. return (double)_stepTimer.ElapsedMilliseconds / (Time * 1000.0);
  109. }
  110. private List<ProcessUnitBase> lstUnit = new List<ProcessUnitBase>();
  111. private Stopwatch _stepTimer = new Stopwatch();
  112. }
  113. public class Recipe
  114. {
  115. public RecipeHead Header { get; set; }
  116. public Dictionary<int, RecipeStep> Steps = new Dictionary<int, RecipeStep>();
  117. public static Recipe Load(string recipeFile)
  118. {
  119. return null;
  120. }
  121. public bool Validate()
  122. {
  123. return true;
  124. }
  125. public bool Save(string recipeFile)
  126. {
  127. return true;
  128. }
  129. }
  130. }