diff options
| author | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
| commit | 00a491d93733d4625ad329b2ba8237f445364b3f (patch) | |
| tree | 4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis | |
| parent | 124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff) | |
| download | Tango-00a491d9.tar.gz Tango-00a491d9.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis')
12 files changed, 0 insertions, 511 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs deleted file mode 100644 index 54431968f..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs +++ /dev/null @@ -1,74 +0,0 @@ -using OxyPlot; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class AnalyzerResultChartData : ExtendedObject - { - public ObservableCollection<DataPoint> Points { get; set; } - - public string Title { get; set; } - - private int _step; - public int XStep - { - get { return _step; } - set { _step = value; RaisePropertyChangedAuto(); } - } - - private double _fromXAxis; - public double FromXAxis - { - get { return _fromXAxis; } - set { _fromXAxis = value; RaisePropertyChangedAuto(); } - } - - private double _toXAxis; - public double ToXAxis - { - get { return _toXAxis; } - set { _toXAxis = value; RaisePropertyChangedAuto(); } - } - - private double _fromYAxis; - public double FromYAxis - { - get { return _fromYAxis; } - set { _fromYAxis = value; RaisePropertyChangedAuto(); } - } - - private double _toYAxis; - public double ToYAxis - { - get { return _toYAxis; } - set { _toYAxis = value; RaisePropertyChangedAuto(); } - } - - public void UpdateData() - { - _toYAxis = Points.Max(x => x.Y) + 2; - _fromYAxis = Points.Min(x => x.Y) - 1; - _toXAxis = Points.Max(x => x.X); - _fromXAxis = Points.Min(x => x.X); - - RaisePropertyChanged("Title"); - RaisePropertyChanged("Points"); - } - - public AnalyzerResultChartData() - { - Points = new ObservableCollection<DataPoint>(); - _fromYAxis = 0; - _fromXAxis = 0; - _toYAxis = 1; - _toXAxis = 1; - XStep = 1; - } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisPlotValue.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisPlotValue.cs deleted file mode 100644 index 3c9fe8cab..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisPlotValue.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class AnalysisPlotValue - { - public double X { get; set; } - public double Y { get; set; } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs deleted file mode 100644 index 0dbf9a83e..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Tango.CSV; -using Tango.DispenserAnalyzer.UI.Models; -using System.Windows.Controls; -using System.Windows.Media; -using System.IO; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class AnalysisService - { - public static dynamic GetAnalyzer(String fileName) - { - string filename = Path.GetFileNameWithoutExtension(fileName); - - var analyzerTypes = typeof(AnalysisService).Assembly.GetTypes().Where(x => typeof(IBaseAnalyzer).IsAssignableFrom(x)).ToList(); - var analyzerType = analyzerTypes.FirstOrDefault(x => filename.StartsWith(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) ); - if(analyzerType == null) - {//in case name of test is not first word - analyzerType = analyzerTypes.FirstOrDefault(x => filename.IndexOf(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) >= 0); - } - - return (analyzerType != null) ? Activator.CreateInstance(analyzerType) : null; - - } - public static string GetTestName(String fileName) - { - var analyzerTypes = typeof(AnalysisService).Assembly.GetTypes().Where(x => typeof(IBaseAnalyzer).IsAssignableFrom(x)).ToList(); - var analyzerType = analyzerTypes.FirstOrDefault(x => fileName.IndexOf(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) >= 0); - - return analyzerType.GetCustomAttribute<AnalyzerAttribute>().Name; - } - } - -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerAttribute.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerAttribute.cs deleted file mode 100644 index 2a1d3323e..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface)] - public class AnalyzerAttribute : Attribute - { - public string Name { get; set; } - - public AnalyzerAttribute(string name) - { - Name = name; - } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs deleted file mode 100644 index bc82d2215..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Globalization; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using OxyPlot; -using Tango.Core; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class AnalyzerResultBase : ExtendedObject, IAnalyzerResult - { - public AnalyzerResultValue Result { get; set; } - // public List<AnalysisPlotValue> PlotValues { get; set; } - //public ObservableCollection<DataPoint> Points { get; set; } - - public List<AnalyzerResultProperty> Properties - { - get - { - List<AnalyzerResultProperty> props = new List<AnalyzerResultProperty>(); - if (this.GetType() == typeof(AnalyzerResultBase)) - return props; - - foreach (var prop in this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).OrderByAlphaNumeric(x => x.Name)) - { - AnalyzerResultProperty aProp = new AnalyzerResultProperty(); - if (aProp.GetType() == typeof(IEnumerable<>)) - { - continue; - } - if (prop.GetCustomAttribute<DescriptionAttribute>() != null) - { - aProp.Name = prop.GetCustomAttribute<DescriptionAttribute>().Description; - //} - //else - //{ - // aProp.Name = prop.Name; - //} - object val = prop.GetValue(this); - aProp.Value = (val is double) ? ((double)val).ToString("F") : val.ToString(); - props.Add(aProp); - } - - } - - return props; - } - } - - public bool IsShowPlotResult { get; set; } - public bool IsShowLineChartResult { get; set; } - public AnalyzerResultChartData RangeToCountChart { get; set; } - public AnalyzerResultChartData RangeToTimeChart { get; set; } - public AnalyzerResultChartData LineChart { get; set; } - public bool BackgroundMode { get; set; } - - - public AnalyzerResultBase() - { - //PlotValues = new List<AnalysisPlotValue>(); - Result = AnalyzerResultValue.Undetermined; - IsShowPlotResult = false; - IsShowLineChartResult = false; - RangeToCountChart = new AnalyzerResultChartData(); - RangeToTimeChart = new AnalyzerResultChartData(); - LineChart = new AnalyzerResultChartData(); - BackgroundMode = false; - } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultProperty.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultProperty.cs deleted file mode 100644 index f2548746e..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultProperty.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class AnalyzerResultProperty - { - public String Name { get; set; } - public String Value { get; set; } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultValue.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultValue.cs deleted file mode 100644 index a0cc2c2c7..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultValue.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public enum AnalyzerResultValue - { - //Undetermined - [Description("Information")] - Undetermined, - [Description("Check")] - Passed, - [Description("CloseCircle")] - Failed, - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs deleted file mode 100644 index e62af4e46..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.CSV; -using Tango.DispenserAnalyzer.UI.Models; -using OxyPlot.Annotations; -using System.Windows.Media; -using System.Diagnostics; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class DispenserReader: IReader<DispenserSample> - { - public List<DispenserSample> ReadScvFile(String filePath, List<OxyPlot.Wpf.LineAnnotation> annotations) - { - List<DispenserCsvRow> data = CsvFile.Read<DispenserCsvRow>(new CsvSource(filePath)).ToList(); - List<DispenserSample> samples = new List<DispenserSample>(); - int index = 0; - int last_labelIndex = 0; - foreach (var item in data) - { - double pressure = 0; - if (item.Label == "Label") - { - item.Pressure = "0"; - item.Command = "Label"; - if (last_labelIndex == 0 || last_labelIndex < (index + 5)) - { - last_labelIndex = index; - - OxyPlot.Wpf.LineAnnotation _line = new OxyPlot.Wpf.LineAnnotation() - { - StrokeThickness = 1, - Color = Color.FromRgb(255, 5, 5), - Type = LineAnnotationType.Vertical, - Text = index.ToString(), - X = index, - }; - annotations.Add(_line); - - } - } - if (double.TryParse(item.Pressure, out pressure) || !String.IsNullOrWhiteSpace(item.Command)) - { - samples.Add(new DispenserSample() - { - Pressure = pressure, - Command = String.IsNullOrWhiteSpace(item.Command) ? null : item.Command, - Index = index - }); - index++; - } - } - return samples; - } - - public List<string> GetTitles(String filePath) - { - string xAxistitle = "Time[100 msec]"; - string yAxistitle = "Pressure [mbar]"; - return new List<string>() { xAxistitle, yAxistitle }; - } - - public bool PrintResultsToPDFFile() - { - return true ; - } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs deleted file mode 100644 index fd3b3c267..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.DispenserAnalyzer.UI.Models; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - [Analyzer("BaseInterface")] - public interface IBaseAnalyzer - { - - } - [Analyzer("INTERFACE")] - public interface IAnalyzer<T>: IBaseAnalyzer - { - IReader<T> Reader { get; set; } - Task<List<IAnalyzerResult>> Process(List<T> csvRows, bool backgroundMode); - void GetPoints(List<T> samples, IList<OxyPlot.DataPoint> points); - } - [Analyzer("DISPENSERINTERFACE")] - public interface IDispenserDispenserAnalyser : IAnalyzer<DispenserSample> - { - } - [Analyzer("PROCESSINTERFACE")] - public interface IProcessAnalyzer : IAnalyzer<ProcessSample> - { - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs deleted file mode 100644 index 5203828e5..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs +++ /dev/null @@ -1,21 +0,0 @@ -using OxyPlot; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public interface IAnalyzerResult - { - AnalyzerResultValue Result { get; set; } - - bool BackgroundMode { get; set; } - //List<AnalysisPlotValue> PlotValues { get; set; } - - //AnalyzerResultChartData RangeToCountChart { get; set; } - //AnalyzerResultChartData RangeToTimeChart { get; set; } - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs deleted file mode 100644 index 35c7f8f76..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public interface IReader<T> - { - List<T> ReadScvFile(String filePath, List<OxyPlot.Wpf.LineAnnotation> annotations); - - List<string> GetTitles(String filePath); - - bool PrintResultsToPDFFile(); - } -} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs deleted file mode 100644 index b2e6f0388..000000000 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs +++ /dev/null @@ -1,116 +0,0 @@ -using OxyPlot; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.CSV; -using Tango.DispenserAnalyzer.UI.Models; -using OxyPlot.Annotations; -using System.Windows.Media; - - -namespace Tango.DispenserAnalyzer.UI.Analysis -{ - public class ProcessReader: IReader<ProcessSample> - { - public List<ProcessSample> ReadScvFile(String filePath, List<OxyPlot.Wpf.LineAnnotation> annotations) - { - List<ProcessSample> samples = new List<ProcessSample>(); - try - { - List<ProcessCsvRow> data = CsvFile.Read<ProcessCsvRow>(new CsvSource(filePath)).ToList(); - - double index = 0; - double delta = 0; - if (data.Count > 2) - { - DateTime time1; - DateTime time2; - if (DateTime.TryParse(data[0].Time, out time1) && DateTime.TryParse(data[1].Time, out time2)) - { - int m1 = time1.Millisecond; - int m2 = time2.Millisecond; - delta = (time2 - time1).Milliseconds / 100; - } - } - delta = Settings.GetValueByName(AnalyzerSettingsEnum.TimeInterval); - if(delta == 0) - return samples; - - int endPoint = (int)(Settings.GetValueByName(AnalyzerSettingsEnum.EndCalculation) / delta); - foreach (var item in data) - { - double dValue = 0; - - if (double.TryParse(item.Value, out dValue)) - { - DateTime time; - DateTime.TryParse(item.Time, out time); - int mil = time.Millisecond; - samples.Add(new ProcessSample() - { - Time = time, - Value = dValue, - TimeIntervalSec = index, - }); - index += delta; - } - } - OxyPlot.Wpf.LineAnnotation _line1 = new OxyPlot.Wpf.LineAnnotation() - { - StrokeThickness = 1, - Color = Color.FromRgb(255, 5, 5), - Type = LineAnnotationType.Vertical, - Text = index.ToString(), - X = Settings.GetValueByName(AnalyzerSettingsEnum.StartCalculation) - }; - annotations.Add(_line1); - OxyPlot.Wpf.LineAnnotation _line2 = new OxyPlot.Wpf.LineAnnotation() - { - StrokeThickness = 1, - Color = Color.FromRgb(255, 5, 5), - Type = LineAnnotationType.Vertical, - Text = index.ToString(), - X = Settings.GetValueByName(AnalyzerSettingsEnum.EndCalculation) - }; - annotations.Add(_line2); - - - return samples; - } - catch (Exception ex) - { - Debug.Write("Exception in ProcessReader ReadScvFile" + ex.Message); - return samples; - } - } - - public List<string> GetScvColumns(String filePath) - { - try - { - return CsvFile.GetColumns<ProcessCsvRow>(new CsvSource(filePath)).ToList(); - } - catch (Exception ex) - { - Debug.Write("Exception in ProcessReader ReadScvFile" + ex.Message); - return null; - } - } - - public List<string> GetTitles(String filePath) - { - List<string> columns = GetScvColumns(filePath); - string xAxistitle = "Time [sec]"; - string yAxistitle = columns!= null && columns.Count > 1 ? columns[1] : "Values"; - return new List<string>() { xAxistitle, yAxistitle }; - } - - public bool PrintResultsToPDFFile() - { - return false; - } - } -} |
