PocketProcessDataChartDataItem.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.ComponentModel;
  6. using Abt.Controls.SciChart.Visuals.Axes;
  7. using Abt.Controls.SciChart;
  8. using Abt.Controls.SciChart.Model.DataSeries;
  9. using System.Windows.Input;
  10. using Aitex.Core.Equipment.SusceptorDefine;
  11. using Aitex.Core.UI.MVVM;
  12. using System.Collections.ObjectModel;
  13. using Abt.Controls.SciChart.Visuals.RenderableSeries;
  14. using System.Windows;
  15. using Aitex.Core.UI.View.Smart;
  16. namespace Aitex.Core.UI.ControlDataContext
  17. {
  18. public class ProcessChartDataItem
  19. {
  20. public double[] averaged_temperature_on_wafer;
  21. public double[] averaged_temperature_off_wafer;
  22. public double[] averaged_reflection_on_wafer;
  23. public double[] averaged_curvature_on_wafer;
  24. public double[] reflection_each_wafer;
  25. public double[] temperature_each_wafer;
  26. public double[] curvature_each_wafer;
  27. };
  28. public class PocketProcessDataChartDataItem : INotifyPropertyChanged
  29. {
  30. public event PropertyChangedEventHandler PropertyChanged;
  31. public void InvokePropertyChanged(string propertyName)
  32. {
  33. if (PropertyChanged != null)
  34. {
  35. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  36. }
  37. }
  38. //public GridLength DataConfigPanelWidth { get; set; }
  39. //public bool IsDataConfigPanelVisable
  40. //{
  41. // get
  42. // {
  43. // return DataConfigPanelWidth.Value > 0;
  44. // }
  45. // set
  46. // {
  47. // if (value)
  48. // DataConfigPanelWidth = new GridLength(400, GridUnitType.Pixel);
  49. // else
  50. // DataConfigPanelWidth = new GridLength(0, GridUnitType.Pixel);
  51. // InvokePropertyChanged("IsDataConfigPanelVisable");
  52. // InvokePropertyChanged("DataConfigPanelWidth");
  53. // }
  54. //}
  55. public DelegateCommand<object> SeriesSelectAllCommand { get; private set; }
  56. public DelegateCommand<object> SeriesSelectNoneCommand { get; private set; }
  57. public DelegateCommand<object> SeriesSelectDefaultCommand { get; private set; }
  58. public ObservableCollection<IRenderableSeries> RenderableSeries { get; set; }
  59. private Susceptor _susceptorInfo;
  60. public Susceptor SusceptorInfo
  61. {
  62. get { return _susceptorInfo; }
  63. set
  64. {
  65. UpdateSusceptorInfo(value);
  66. }
  67. }
  68. //update data by value array
  69. ProcessChartDataItem _processData;
  70. Dictionary<string, Tuple<double[], int>> _dataMap = new Dictionary<string, Tuple<double[], int>>();
  71. //update data by table field
  72. public string ProcessInfo
  73. {
  74. get;
  75. set;
  76. }
  77. public bool EnableCurvature { get; set; }
  78. public PocketProcessDataChartDataItem()
  79. {
  80. EnableCurvature = true;
  81. SeriesSelectAllCommand = new DelegateCommand<object>(new Action<object>(OnSeriesSelectAll), null);
  82. SeriesSelectNoneCommand = new DelegateCommand<object>(new Action<object>(OnSeriesSelectNone), null);
  83. SeriesSelectDefaultCommand = new DelegateCommand<object>(new Action<object>(OnSeriesSelectDefault), null);
  84. RenderableSeries = new ObservableCollection<IRenderableSeries>();
  85. _processData = new ProcessChartDataItem()
  86. {
  87. averaged_temperature_on_wafer = new double[5],
  88. averaged_temperature_off_wafer = new double[5],
  89. averaged_reflection_on_wafer = new double[5],
  90. averaged_curvature_on_wafer = new double[5],
  91. reflection_each_wafer = new double[200],
  92. temperature_each_wafer = new double[200],
  93. curvature_each_wafer = new double[200]
  94. };
  95. _susceptorInfo = new Susceptor();
  96. ProcessInfo = "";
  97. }
  98. public void UpdateData(ProcessChartDataItem data)
  99. {
  100. if (data == null)
  101. return;
  102. data.averaged_temperature_on_wafer.CopyTo(_processData.averaged_temperature_on_wafer, 0);
  103. data.averaged_temperature_off_wafer.CopyTo(_processData.averaged_temperature_off_wafer, 0);
  104. data.averaged_reflection_on_wafer.CopyTo(_processData.averaged_reflection_on_wafer, 0);
  105. data.averaged_curvature_on_wafer.CopyTo(_processData.averaged_curvature_on_wafer, 0);
  106. data.reflection_each_wafer.CopyTo(_processData.reflection_each_wafer, 0);
  107. data.temperature_each_wafer.CopyTo(_processData.temperature_each_wafer, 0);
  108. data.curvature_each_wafer.CopyTo(_processData.curvature_each_wafer, 0);
  109. foreach (var item in RenderableSeries)
  110. {
  111. var series = item as SmartDataLine;
  112. if (series == null)
  113. continue;
  114. var dataSeries = series.DataSeries as XyDataSeries<DateTime, float>;
  115. dataSeries.Append(DateTime.Now, (float)(_dataMap[series.DisplayName].Item1[_dataMap[series.DisplayName].Item2]));
  116. }
  117. }
  118. public void ClearData()
  119. {
  120. foreach (var item in RenderableSeries)
  121. {
  122. var series = item as SmartDataLine;
  123. if (series == null)
  124. continue;
  125. var dataSeries = series.DataSeries as XyDataSeries<DateTime, float>;
  126. dataSeries.Clear();
  127. }
  128. }
  129. void UpdateSusceptorInfo(Susceptor susceptor)
  130. {
  131. if (susceptor.Type == _susceptorInfo.Type)
  132. return;
  133. _susceptorInfo = susceptor;
  134. RenderableSeries.Clear();
  135. _dataMap.Clear();
  136. //pyro
  137. string[] zone = _susceptorInfo.GetZoneNameList();
  138. int waferZoneIndex = 0;
  139. string susceptorType = "2Inch9";
  140. for (int i = 0; i < zone.Length; i++)
  141. {
  142. string seriesName = string.Format("温度_{0}区_Wafer温度", zone[i]);
  143. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Red, string.Format("ReactorA.Smart200.WaferTempAvg{0}", zone[i]), true) { YAxisId = "PyroAxisId" });
  144. _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_temperature_on_wafer, i));
  145. seriesName = string.Format("温度_{0}区_托盘温度", zone[i]);
  146. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Red, string.Format("ReactorA.Smart200.SuscTempAvg{0}", zone[i]), true) { YAxisId = "PyroAxisId" });
  147. _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_temperature_off_wafer, i));
  148. Notch[] notch = _susceptorInfo.GetZoneNotch(i);
  149. if (notch != null)
  150. {
  151. for (int j = 0; j < notch.Length; j++)
  152. {
  153. seriesName = string.Format("温度_{0}区_Wafer温度_{1}", zone[i], notch[j].DisplayIndex);
  154. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Red, string.Format("ReactorA.Smart200.{0}.Temp.Temp{1}_{2}", susceptorType, zone[i], notch[j].DisplayIndex.ToString("00")), false) { YAxisId = "PyroAxisId" });
  155. _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.temperature_each_wafer, waferZoneIndex++));
  156. }
  157. }
  158. }
  159. waferZoneIndex = 0;
  160. for (int i = 0; i < zone.Length; i++)
  161. {
  162. string seriesName = string.Format("反射率_{0}区_平均", zone[i]);
  163. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Blue, string.Format("ReactorA.Smart200.ReflectAvg{0}", zone[i]), true) { YAxisId = "ReflectAxisId" });
  164. _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_reflection_on_wafer, i));
  165. Notch[] notch = _susceptorInfo.GetZoneNotch(i);
  166. if (notch != null)
  167. {
  168. for (int j = 0; j < notch.Length; j++)
  169. {
  170. seriesName = string.Format("反射率_{0}区_{1}", zone[i], notch[j].DisplayIndex);
  171. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Blue, string.Format("ReactorA.Smart200.{0}.Reflect.Reflect{1}_{2}", susceptorType, zone[i], notch[j].DisplayIndex.ToString("00")), false) { YAxisId = "ReflectAxisId" });
  172. _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.reflection_each_wafer, waferZoneIndex++));
  173. }
  174. }
  175. }
  176. if (EnableCurvature)
  177. {
  178. waferZoneIndex = 0;
  179. for (int i = 0; i < zone.Length; i++)
  180. {
  181. string seriesName = string.Format("翘曲_{0}区_平均", zone[i]);
  182. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Green, string.Format("ReactorA.Smart200.CurvatureAvg{0}", zone[i]), true) { YAxisId = "CurvatureAxisId" });
  183. _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_curvature_on_wafer, i));
  184. Notch[] notch = _susceptorInfo.GetZoneNotch(i);
  185. if (notch != null)
  186. {
  187. for (int j = 0; j < notch.Length; j++)
  188. {
  189. seriesName = string.Format("翘曲_{0}区_{1}", zone[i], notch[j].DisplayIndex);
  190. RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Green, string.Format("ReactorA.Smart200.{0}.Curvature.Curvature{1}_{2}", susceptorType, zone[i], notch[j].DisplayIndex.ToString("00")),
  191. false) { YAxisId = "CurvatureAxisId" });
  192. _dataMap.Add(seriesName,
  193. new Tuple<double[], int>(_processData.curvature_each_wafer, waferZoneIndex++));
  194. }
  195. }
  196. }
  197. }
  198. }
  199. public void OnSeriesSelectAll(object param)
  200. {
  201. foreach (var item in RenderableSeries)
  202. {
  203. var series = item as SmartDataLine;
  204. if (series == null) continue;
  205. series.IsVisible = true;
  206. }
  207. }
  208. public void OnSeriesSelectNone(object param)
  209. {
  210. foreach (var item in RenderableSeries)
  211. {
  212. var series = item as SmartDataLine;
  213. if (series == null) continue;
  214. series.IsVisible = false;
  215. }
  216. }
  217. public void OnSeriesSelectDefault(object param)
  218. {
  219. foreach (var item in RenderableSeries)
  220. {
  221. var series = item as SmartDataLine;
  222. if (series == null) continue;
  223. series.IsVisible = series.IsDefaultVisable;
  224. series.SeriesColor = series.DefaultSeriesColor;
  225. series.LineThickness = 1;
  226. }
  227. }
  228. }
  229. }