123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.ComponentModel;
- using Abt.Controls.SciChart.Visuals.Axes;
- using Abt.Controls.SciChart;
- using Abt.Controls.SciChart.Model.DataSeries;
- using System.Windows.Input;
- using Aitex.Core.Equipment.SusceptorDefine;
- using Aitex.Core.UI.MVVM;
- using System.Collections.ObjectModel;
- using Abt.Controls.SciChart.Visuals.RenderableSeries;
- using System.Windows;
- using Aitex.Core.UI.View.Smart;
- namespace Aitex.Core.UI.ControlDataContext
- {
- public class ProcessChartDataItem
- {
- public double[] averaged_temperature_on_wafer;
- public double[] averaged_temperature_off_wafer;
- public double[] averaged_reflection_on_wafer;
- public double[] averaged_curvature_on_wafer;
- public double[] reflection_each_wafer;
- public double[] temperature_each_wafer;
- public double[] curvature_each_wafer;
- };
- public class PocketProcessDataChartDataItem : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- public void InvokePropertyChanged(string propertyName)
- {
- if (PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- //public GridLength DataConfigPanelWidth { get; set; }
- //public bool IsDataConfigPanelVisable
- //{
- // get
- // {
- // return DataConfigPanelWidth.Value > 0;
- // }
- // set
- // {
- // if (value)
- // DataConfigPanelWidth = new GridLength(400, GridUnitType.Pixel);
- // else
- // DataConfigPanelWidth = new GridLength(0, GridUnitType.Pixel);
- // InvokePropertyChanged("IsDataConfigPanelVisable");
- // InvokePropertyChanged("DataConfigPanelWidth");
- // }
- //}
- public DelegateCommand<object> SeriesSelectAllCommand { get; private set; }
- public DelegateCommand<object> SeriesSelectNoneCommand { get; private set; }
- public DelegateCommand<object> SeriesSelectDefaultCommand { get; private set; }
- public ObservableCollection<IRenderableSeries> RenderableSeries { get; set; }
- private Susceptor _susceptorInfo;
- public Susceptor SusceptorInfo
- {
- get { return _susceptorInfo; }
- set
- {
- UpdateSusceptorInfo(value);
- }
- }
- //update data by value array
- ProcessChartDataItem _processData;
- Dictionary<string, Tuple<double[], int>> _dataMap = new Dictionary<string, Tuple<double[], int>>();
- //update data by table field
- public string ProcessInfo
- {
- get;
- set;
- }
- public bool EnableCurvature { get; set; }
- public PocketProcessDataChartDataItem()
- {
- EnableCurvature = true;
- SeriesSelectAllCommand = new DelegateCommand<object>(new Action<object>(OnSeriesSelectAll), null);
- SeriesSelectNoneCommand = new DelegateCommand<object>(new Action<object>(OnSeriesSelectNone), null);
- SeriesSelectDefaultCommand = new DelegateCommand<object>(new Action<object>(OnSeriesSelectDefault), null);
- RenderableSeries = new ObservableCollection<IRenderableSeries>();
- _processData = new ProcessChartDataItem()
- {
- averaged_temperature_on_wafer = new double[5],
- averaged_temperature_off_wafer = new double[5],
- averaged_reflection_on_wafer = new double[5],
- averaged_curvature_on_wafer = new double[5],
- reflection_each_wafer = new double[200],
- temperature_each_wafer = new double[200],
- curvature_each_wafer = new double[200]
- };
- _susceptorInfo = new Susceptor();
- ProcessInfo = "";
- }
- public void UpdateData(ProcessChartDataItem data)
- {
- if (data == null)
- return;
- data.averaged_temperature_on_wafer.CopyTo(_processData.averaged_temperature_on_wafer, 0);
- data.averaged_temperature_off_wafer.CopyTo(_processData.averaged_temperature_off_wafer, 0);
- data.averaged_reflection_on_wafer.CopyTo(_processData.averaged_reflection_on_wafer, 0);
- data.averaged_curvature_on_wafer.CopyTo(_processData.averaged_curvature_on_wafer, 0);
- data.reflection_each_wafer.CopyTo(_processData.reflection_each_wafer, 0);
- data.temperature_each_wafer.CopyTo(_processData.temperature_each_wafer, 0);
- data.curvature_each_wafer.CopyTo(_processData.curvature_each_wafer, 0);
- foreach (var item in RenderableSeries)
- {
- var series = item as SmartDataLine;
- if (series == null)
- continue;
- var dataSeries = series.DataSeries as XyDataSeries<DateTime, float>;
- dataSeries.Append(DateTime.Now, (float)(_dataMap[series.DisplayName].Item1[_dataMap[series.DisplayName].Item2]));
- }
- }
- public void ClearData()
- {
- foreach (var item in RenderableSeries)
- {
- var series = item as SmartDataLine;
- if (series == null)
- continue;
- var dataSeries = series.DataSeries as XyDataSeries<DateTime, float>;
- dataSeries.Clear();
- }
- }
- void UpdateSusceptorInfo(Susceptor susceptor)
- {
- if (susceptor.Type == _susceptorInfo.Type)
- return;
- _susceptorInfo = susceptor;
- RenderableSeries.Clear();
- _dataMap.Clear();
- //pyro
- string[] zone = _susceptorInfo.GetZoneNameList();
- int waferZoneIndex = 0;
- string susceptorType = "2Inch9";
- for (int i = 0; i < zone.Length; i++)
- {
- string seriesName = string.Format("温度_{0}区_Wafer温度", zone[i]);
- RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Red, string.Format("ReactorA.Smart200.WaferTempAvg{0}", zone[i]), true) { YAxisId = "PyroAxisId" });
- _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_temperature_on_wafer, i));
- seriesName = string.Format("温度_{0}区_托盘温度", zone[i]);
- RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Red, string.Format("ReactorA.Smart200.SuscTempAvg{0}", zone[i]), true) { YAxisId = "PyroAxisId" });
- _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_temperature_off_wafer, i));
- Notch[] notch = _susceptorInfo.GetZoneNotch(i);
- if (notch != null)
- {
- for (int j = 0; j < notch.Length; j++)
- {
- seriesName = string.Format("温度_{0}区_Wafer温度_{1}", zone[i], notch[j].DisplayIndex);
- 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" });
- _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.temperature_each_wafer, waferZoneIndex++));
- }
- }
- }
- waferZoneIndex = 0;
- for (int i = 0; i < zone.Length; i++)
- {
- string seriesName = string.Format("反射率_{0}区_平均", zone[i]);
- RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Blue, string.Format("ReactorA.Smart200.ReflectAvg{0}", zone[i]), true) { YAxisId = "ReflectAxisId" });
- _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_reflection_on_wafer, i));
- Notch[] notch = _susceptorInfo.GetZoneNotch(i);
- if (notch != null)
- {
- for (int j = 0; j < notch.Length; j++)
- {
- seriesName = string.Format("反射率_{0}区_{1}", zone[i], notch[j].DisplayIndex);
- 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" });
- _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.reflection_each_wafer, waferZoneIndex++));
- }
- }
- }
- if (EnableCurvature)
- {
- waferZoneIndex = 0;
- for (int i = 0; i < zone.Length; i++)
- {
- string seriesName = string.Format("翘曲_{0}区_平均", zone[i]);
- RenderableSeries.Add(new SmartDataLine(seriesName, System.Windows.Media.Colors.Green, string.Format("ReactorA.Smart200.CurvatureAvg{0}", zone[i]), true) { YAxisId = "CurvatureAxisId" });
- _dataMap.Add(seriesName, new Tuple<double[], int>(_processData.averaged_curvature_on_wafer, i));
- Notch[] notch = _susceptorInfo.GetZoneNotch(i);
- if (notch != null)
- {
- for (int j = 0; j < notch.Length; j++)
- {
- seriesName = string.Format("翘曲_{0}区_{1}", zone[i], notch[j].DisplayIndex);
- 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")),
- false) { YAxisId = "CurvatureAxisId" });
- _dataMap.Add(seriesName,
- new Tuple<double[], int>(_processData.curvature_each_wafer, waferZoneIndex++));
- }
- }
- }
- }
- }
- public void OnSeriesSelectAll(object param)
- {
- foreach (var item in RenderableSeries)
- {
- var series = item as SmartDataLine;
- if (series == null) continue;
- series.IsVisible = true;
- }
- }
- public void OnSeriesSelectNone(object param)
- {
- foreach (var item in RenderableSeries)
- {
- var series = item as SmartDataLine;
- if (series == null) continue;
- series.IsVisible = false;
- }
- }
- public void OnSeriesSelectDefault(object param)
- {
- foreach (var item in RenderableSeries)
- {
- var series = item as SmartDataLine;
- if (series == null) continue;
- series.IsVisible = series.IsDefaultVisable;
- series.SeriesColor = series.DefaultSeriesColor;
- series.LineThickness = 1;
- }
- }
- }
- }
|