diff --git a/src/.vs/HP 3478A/v16/.suo b/src/.vs/HP 3478A/v16/.suo
index 16b8f4a..096dcd4 100644
Binary files a/src/.vs/HP 3478A/v16/.suo and b/src/.vs/HP 3478A/v16/.suo differ
diff --git a/src/COM_Select_Window.xaml.cs b/src/COM_Select_Window.xaml.cs
index 687fe3c..f06aae3 100644
--- a/src/COM_Select_Window.xaml.cs
+++ b/src/COM_Select_Window.xaml.cs
@@ -525,7 +525,6 @@ private void Connect_Click(object sender, RoutedEventArgs e)
Info_Log.Text = String.Empty;
Info_Log.Inlines.Clear();
Data_Updater();
- (Owner as MainWindow).Serial_COM_Selected();
this.Close();
}
}
@@ -566,7 +565,7 @@ private void Data_Updater()
Serial_COM_Info.COM_RtsEnable = COM_RtsEnable;
Serial_COM_Info.GPIB_Address = COM_GPIB_Address_Value;
Serial_COM_Info.folder_Directory = folder_Directory;
- Serial_COM_Info.isChanged = true;
+ Serial_COM_Info.isConnected = true;
}
private void Info_Clear_Click(object sender, RoutedEventArgs e)
diff --git a/src/Graphing_Window.xaml b/src/Graphing_Window.xaml
index deab5d8..ee9901b 100644
--- a/src/Graphing_Window.xaml
+++ b/src/Graphing_Window.xaml
@@ -583,13 +583,13 @@
-
+
-
+
-
+
@@ -812,148 +812,206 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/src/Graphing_Window.xaml.cs b/src/Graphing_Window.xaml.cs
index 3e9027b..7cff55c 100644
--- a/src/Graphing_Window.xaml.cs
+++ b/src/Graphing_Window.xaml.cs
@@ -259,6 +259,7 @@ private void Update_Measurement_Unit()
Latest_Sample_Label_Unit.Content = Measurement_Unit;
Moving_Average_Label_Unit.Content = Measurement_Unit;
Graph.Plot.YLabel(Graph_Y_Axis_Label);
+ Measurement_Plot.Label = Measurement_Unit;
}));
}
@@ -4038,6 +4039,167 @@ private void Division_Button_Math_AllSamples_Click(object sender, RoutedEventArg
}
}
+ private void Percentage_Error_Button_AllSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool isValid, double Value) = Text_Num(Percentage_Error_TextBox_AllSamples.Text, true, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
+ if (isValid == true & isValidGraphColor == true)
+ {
+ if (Value != 0)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_AllSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_AllSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = Measurement_Count;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, Measurement_Data_Copy, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, Measurement_Data_DateTime, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = Math.Abs((Measurement_Data_Copy[i] - Value) / Value) * 100;
+ }
+ Create_Waveform_Window("% Error Math Waveform [All Samples]: |(Samples - " + Value + ") / " + Value + "| x 100", Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create % Error Math Waveform (All Samples). Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ Insert_Log("Cannot create % Error Math Waveform (All Samples): Value must not be " + Value, 1);
+ }
+ }
+ else
+ {
+ if (isValid == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (All Samples). Value must be a real number.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (All Samples). Graph Color values are not valid.", 1);
+ }
+ }
+ }
+
+ private void DB_Button_Math_AllSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool isValid_DB_1_Value, double DB_1_Value) = Text_Num(DB_1_Math_AllSamples.Text, true, false);
+ (bool isValid_DB_2_Value, double DB_2_Value) = Text_Num(DB_2_Math_AllSamples.Text, false, false);
+ (bool isValid_DB_3_Value, double DB_3_Value) = Text_Num(DB_3_Math_AllSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
+ if (isValid_DB_1_Value == true & isValid_DB_2_Value == true & isValid_DB_3_Value == true & isValidGraphColor == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_AllSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_AllSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = Measurement_Count;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, Measurement_Data_Copy, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, Measurement_Data_DateTime, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DB_1_Value) * (Math.Log(((Math.Abs(Measurement_Data_Copy[i])) / DB_3_Value), DB_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DB (All Samples Math Waveform): " + DB_1_Value + " x log" + DB_2_Value + " (Samples / " + DB_3_Value + ")", DB_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DB (All Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if ((isValid_DB_1_Value == false) || (isValid_DB_2_Value == false) || (isValid_DB_3_Value == false))
+ {
+ Insert_Log("Cannot create DB (All Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DB (All Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
+ private void DBM_Button_Math_AllSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool isValid_DBM_1_Value, double DBM_1_Value) = Text_Num(DBM_1_Math_AllSamples.Text, true, false);
+ (bool isValid_DBM_2_Value, double DBM_2_Value) = Text_Num(DBM_2_Math_AllSamples.Text, false, false);
+ (bool isValid_DBM_3_Value, double DBM_3_Value) = Text_Num(DBM_3_Math_AllSamples.Text, false, false);
+ (bool isValid_DBM_4_Value, double DBM_4_Value) = Text_Num(DBM_4_Math_AllSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
+ if (isValid_DBM_1_Value == true & isValid_DBM_2_Value == true & isValid_DBM_3_Value == true & isValid_DBM_4_Value == true & isValidGraphColor == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_AllSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_AllSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = Measurement_Count;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, Measurement_Data_Copy, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, Measurement_Data_DateTime, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DBM_1_Value) * (Math.Log(((((Math.Pow(Measurement_Data_Copy[i], 2)) / DBM_3_Value)) / DBM_4_Value), DBM_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DBM (All Samples Math Waveform): " + DBM_1_Value + " x log" + DBM_2_Value + " ((Samples^2 / " + DBM_3_Value + ") / " + DBM_4_Value + ")", DBM_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DBM (All Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if ((isValid_DBM_1_Value == false) || (isValid_DBM_2_Value == false) || (isValid_DBM_3_Value == false) || (isValid_DBM_4_Value == false))
+ {
+ Insert_Log("Cannot create DBM (All Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DBM (All Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
private void GraphColor_SetButton_Math_AllSamples_Click(object sender, RoutedEventArgs e)
{
(bool isValid, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
@@ -4490,6 +4652,183 @@ private void Division_Button_Math_NSamples_Click(object sender, RoutedEventArgs
}
}
+ private void Percentage_Error_Button_NSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool IsValidRange, int StartValue, int EndValue) = MathNsamples_Range();
+ (bool isValid, double Value) = Text_Num(Percentage_Error_TextBox_NSamples.Text, true, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
+ if (isValid == true & isValidGraphColor == true & IsValidRange == true)
+ {
+ if (Value != 0)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_NSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_NSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = (EndValue - StartValue) + 1;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, StartValue, Measurement_Data_Copy, 0, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, StartValue, Measurement_Data_DateTime, 0, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = Math.Abs((Measurement_Data_Copy[i] - Value) / Value) * 100;
+ }
+ Create_Waveform_Window("% Error Math Waveform [" + StartValue + ", " + EndValue + "]: |(Samples - " + Value + ") / " + Value + "| x 100", Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples): Value must not be " + Value, 1);
+ }
+ }
+ else
+ {
+ if (isValid == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Value must be a real number.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Graph Color values are not valid.", 1);
+ }
+ if (IsValidRange == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Check N Samples Start and End input values.", 1);
+ }
+ }
+ }
+
+ private void DB_Button_Math_NSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool IsValidRange, int StartValue, int EndValue) = MathNsamples_Range();
+ (bool isValid_DB_1_Value, double DB_1_Value) = Text_Num(DB_1_Math_NSamples.Text, true, false);
+ (bool isValid_DB_2_Value, double DB_2_Value) = Text_Num(DB_2_Math_NSamples.Text, false, false);
+ (bool isValid_DB_3_Value, double DB_3_Value) = Text_Num(DB_3_Math_NSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
+ if (isValid_DB_1_Value == true & isValid_DB_2_Value == true & isValid_DB_3_Value == true & isValidGraphColor == true & IsValidRange == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_NSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_NSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = (EndValue - StartValue) + 1;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, StartValue, Measurement_Data_Copy, 0, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, StartValue, Measurement_Data_DateTime, 0, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DB_1_Value) * (Math.Log(((Math.Abs(Measurement_Data_Copy[i])) / DB_3_Value), DB_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+
+ Create_Waveform_Window("DB (N Samples Math Waveform [" + StartValue + ", " + EndValue + "]): " + DB_1_Value + " x log" + DB_2_Value + " (Samples / " + DB_3_Value + ")", DB_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if (IsValidRange == false)
+ {
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. Check N Samples Start and End input values.", 1);
+ }
+ if ((isValid_DB_1_Value == false) || (isValid_DB_2_Value == false) || (isValid_DB_3_Value == false))
+ {
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
+ private void DBM_Button_Math_NSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool IsValidRange, int StartValue, int EndValue) = MathNsamples_Range();
+ (bool isValid_DBM_1_Value, double DBM_1_Value) = Text_Num(DBM_1_Math_NSamples.Text, true, false);
+ (bool isValid_DBM_2_Value, double DBM_2_Value) = Text_Num(DBM_2_Math_NSamples.Text, false, false);
+ (bool isValid_DBM_3_Value, double DBM_3_Value) = Text_Num(DBM_3_Math_NSamples.Text, false, false);
+ (bool isValid_DBM_4_Value, double DBM_4_Value) = Text_Num(DBM_4_Math_NSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
+ if (isValid_DBM_1_Value == true & isValid_DBM_2_Value == true & isValid_DBM_3_Value == true & isValid_DBM_4_Value == true & isValidGraphColor == true & IsValidRange == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_NSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_NSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = (EndValue - StartValue) + 1;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, StartValue, Measurement_Data_Copy, 0, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, StartValue, Measurement_Data_DateTime, 0, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DBM_1_Value) * (Math.Log(((((Math.Pow(Measurement_Data_Copy[i], 2)) / DBM_3_Value)) / DBM_4_Value), DBM_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DBM (N Samples Math Waveform [" + StartValue + ", " + EndValue + "]): " + DBM_1_Value + " x log" + DBM_2_Value + " ((Samples^2 / " + DBM_3_Value + ") / " + DBM_4_Value + ")", DBM_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if (IsValidRange == true)
+ {
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. Check N Samples Start and End input values.", 1);
+ }
+ if ((isValid_DBM_1_Value == false) || (isValid_DBM_2_Value == false) || (isValid_DBM_3_Value == false) || (isValid_DBM_4_Value == false))
+ {
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
private void GraphColor_SetButton_Math_NSamples_Click(object sender, RoutedEventArgs e)
{
(bool isValid, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
diff --git a/src/HP 3478A.csproj b/src/HP 3478A.csproj
index 4ab38b7..577b476 100644
--- a/src/HP 3478A.csproj
+++ b/src/HP 3478A.csproj
@@ -44,11 +44,11 @@
packages\Ookii.Dialogs.Wpf.3.1.0\lib\net45\Ookii.Dialogs.Wpf.dll
-
- packages\ScottPlot.4.1.13-beta\lib\net461\ScottPlot.dll
+
+ packages\ScottPlot.4.1.14\lib\net461\ScottPlot.dll
-
- packages\ScottPlot.WPF.4.1.13-beta\lib\net472\ScottPlot.WPF.dll
+
+ packages\ScottPlot.WPF.4.1.14\lib\net472\ScottPlot.WPF.dll
diff --git a/src/MainWindow.xaml b/src/MainWindow.xaml
index 4cd0f4e..52abb1a 100644
--- a/src/MainWindow.xaml
+++ b/src/MainWindow.xaml
@@ -12,7 +12,7 @@
-
+
@@ -374,19 +374,19 @@
-
+
@@ -409,16 +409,16 @@
@@ -442,24 +442,24 @@
-
+
@@ -473,14 +473,14 @@
@@ -501,35 +501,35 @@
@@ -553,56 +553,56 @@
@@ -621,21 +621,21 @@
@@ -654,21 +654,21 @@
@@ -696,21 +696,21 @@
-
+
@@ -728,14 +728,14 @@
@@ -757,38 +757,38 @@
-
+
@@ -809,14 +809,14 @@
@@ -824,14 +824,14 @@
@@ -909,7 +909,7 @@
-
+
diff --git a/src/MainWindow.xaml.cs b/src/MainWindow.xaml.cs
index 3711830..d14ce5d 100644
--- a/src/MainWindow.xaml.cs
+++ b/src/MainWindow.xaml.cs
@@ -25,7 +25,7 @@ namespace HP_3478A
{
public static class Serial_COM_Info
{
- public static bool isChanged = false;
+ public static bool isConnected = false;
//HP3478A COM Device Info
public static string COM_Port;
@@ -337,25 +337,23 @@ private void General_Timer()
public void Serial_COM_Selected()
{
- Connect.IsEnabled = false;
- unlockControls();
- Serial_Connect();
- this.Title = "HP 3478A " + Serial_COM_Info.COM_Port;
- DataSampling = true;
- saveOutputLog = true;
- saveMeasurements = true;
- Stop_Sampling.IsEnabled = true;
- VDC_Border.BorderBrush = Selected;
- VDC_Auto_Border.BorderBrush = Selected;
- Digit_Five_Border.BorderBrush = Selected;
- Trigger_Internal_Border.BorderBrush = Selected;
- UpdateSpeed_Default_Set_Border.BorderBrush = Selected;
- DataTimer.Enabled = true;
- StartDateTime = DateTime.Now;
- Data_process();
- saveMeasurements_Timer.Enabled = true;
- Sampling_Only.IsEnabled = true;
- DataLogger.IsEnabled = true;
+ if (Serial_COM_Info.isConnected == true)
+ {
+ Connect.IsEnabled = false;
+ unlockControls();
+ Serial_Connect();
+ this.Title = "HP 3478A " + Serial_COM_Info.COM_Port;
+ DataSampling = true;
+ saveOutputLog = true;
+ saveMeasurements = true;
+ Stop_Sampling.IsEnabled = true;
+ DataTimer.Enabled = true;
+ StartDateTime = DateTime.Now;
+ Data_process();
+ saveMeasurements_Timer.Enabled = true;
+ Sampling_Only.IsEnabled = true;
+ DataLogger.IsEnabled = true;
+ }
}
private void runtime_Update(object sender, EventArgs e)
@@ -938,7 +936,7 @@ private void Process_Measurement_Data(string data)
catch (Exception)
{
insert_Log("Could not add data to Table Window.", 2);
- insert_Log("This could happen if the table window was opened or closed recently.", 1);
+ insert_Log("This could happen if the table window was opened or closed recently.", 2);
}
}
@@ -951,7 +949,7 @@ private void Process_Measurement_Data(string data)
catch (Exception)
{
insert_Log("Could not add data to Graph Window.", 2);
- insert_Log("This could happen if the graph window was opened or closed recently.", 1);
+ insert_Log("This could happen if the graph window was opened or closed recently.", 2);
}
}
}
@@ -1135,7 +1133,7 @@ private void Connect_Click(object sender, RoutedEventArgs e)
if (COM_Select == null)
{
COM_Select = new COM_Select_Window();
- COM_Select.Closed += (a, b) => COM_Select = null;
+ COM_Select.Closed += (a, b) => { COM_Select = null; Serial_COM_Selected(); };
COM_Select.Owner = this;
COM_Select.Show();
}
@@ -2343,7 +2341,7 @@ private void Ohms_Auto_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to Auto.", 5);
+ insert_Log("Ohms Range set to Auto.", 5);
}
else
{
@@ -2359,7 +2357,7 @@ private void Ohms_30_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 30Ω.", 5);
+ insert_Log("Ohms Range set to 30Ω.", 5);
}
else
{
@@ -2375,7 +2373,7 @@ private void Ohms_300_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 300Ω.", 5);
+ insert_Log("Ohms Range set to 300Ω.", 5);
}
else
{
@@ -2391,7 +2389,7 @@ private void Ohms_3K_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 3KΩ.", 5);
+ insert_Log("Ohms Range set to 3KΩ.", 5);
}
else
{
@@ -2407,7 +2405,7 @@ private void Ohms_30K_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 30KΩ.", 5);
+ insert_Log("Ohms Range set to 30KΩ.", 5);
}
else
{
@@ -2423,7 +2421,7 @@ private void Ohms_300K_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 300KΩ.", 5);
+ insert_Log("Ohms Range set to 300KΩ.", 5);
}
else
{
@@ -2439,7 +2437,7 @@ private void Ohms_3M_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 3MΩ.", 5);
+ insert_Log("Ohms Range set to 3MΩ.", 5);
}
else
{
@@ -2455,7 +2453,7 @@ private void Ohms_30M_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("VAC Range set to 30MΩ.", 5);
+ insert_Log("Ohms Range set to 30MΩ.", 5);
}
else
{
@@ -2867,7 +2865,7 @@ private void Trigger_Single_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("Single Trigger Selected.", 3);
+ insert_Log("Single Trigger Selected. This trigger won't work with this software.", 3);
}
private void Trigger_Hold_Button_Click(object sender, RoutedEventArgs e)
@@ -2876,7 +2874,7 @@ private void Trigger_Hold_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("Hold Trigger Selected.", 3);
+ insert_Log("Hold Trigger Selected. This trigger won't work with this software.", 3);
}
private void Trigger_Fast_Button_Click(object sender, RoutedEventArgs e)
@@ -2885,7 +2883,7 @@ private void Trigger_Fast_Button_Click(object sender, RoutedEventArgs e)
lockControls();
isUserSendCommand = true;
Speedup_Interval();
- insert_Log("Fast Trigger Selected.", 3);
+ insert_Log("Fast Trigger Selected. This trigger won't work with this software.", 3);
}
private string Trigger_Selector(int Trigger)
@@ -3812,7 +3810,7 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
{
DataTimer.Stop();
DataTimer.Dispose();
- if (Serial_COM_Info.isChanged == true)
+ if (Serial_COM_Info.isConnected == true)
{
HP3478A.Close();
HP3478A.Dispose();
diff --git a/src/Math_Waveform.xaml b/src/Math_Waveform.xaml
index 193ee48..ccec25f 100644
--- a/src/Math_Waveform.xaml
+++ b/src/Math_Waveform.xaml
@@ -550,13 +550,13 @@
-
+
-
+
-
+
@@ -776,148 +776,206 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/src/Math_Waveform.xaml.cs b/src/Math_Waveform.xaml.cs
index 77a8622..dacebaa 100644
--- a/src/Math_Waveform.xaml.cs
+++ b/src/Math_Waveform.xaml.cs
@@ -3513,6 +3513,167 @@ private void Division_Button_Math_AllSamples_Click(object sender, RoutedEventArg
}
}
+ private void Percentage_Error_Button_AllSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool isValid, double Value) = Text_Num(Percentage_Error_TextBox_AllSamples.Text, true, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
+ if (isValid == true & isValidGraphColor == true)
+ {
+ if (Value != 0)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_AllSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_AllSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = Measurement_Count;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, Measurement_Data_Copy, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, Measurement_Data_DateTime, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = Math.Abs((Measurement_Data_Copy[i] - Value) / Value) * 100;
+ }
+ Create_Waveform_Window("% Error Math Waveform [All Samples]: |(Samples - " + Value + ") / " + Value + "| x 100", Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create % Error Math Waveform (All Samples). Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ Insert_Log("Cannot create % Error Math Waveform (All Samples): Value must not be " + Value, 1);
+ }
+ }
+ else
+ {
+ if (isValid == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (All Samples). Value must be a real number.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (All Samples). Graph Color values are not valid.", 1);
+ }
+ }
+ }
+
+ private void DB_Button_Math_AllSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool isValid_DB_1_Value, double DB_1_Value) = Text_Num(DB_1_Math_AllSamples.Text, true, false);
+ (bool isValid_DB_2_Value, double DB_2_Value) = Text_Num(DB_2_Math_AllSamples.Text, false, false);
+ (bool isValid_DB_3_Value, double DB_3_Value) = Text_Num(DB_3_Math_AllSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
+ if (isValid_DB_1_Value == true & isValid_DB_2_Value == true & isValid_DB_3_Value == true & isValidGraphColor == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_AllSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_AllSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = Measurement_Count;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, Measurement_Data_Copy, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, Measurement_Data_DateTime, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DB_1_Value) * (Math.Log(((Math.Abs(Measurement_Data_Copy[i])) / DB_3_Value), DB_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DB (All Samples Math Waveform): " + DB_1_Value + " x log" + DB_2_Value + " (Samples / " + DB_3_Value + ")", DB_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DB (All Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if ((isValid_DB_1_Value == false) || (isValid_DB_2_Value == false) || (isValid_DB_3_Value == false))
+ {
+ Insert_Log("Cannot create DB (All Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DB (All Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
+ private void DBM_Button_Math_AllSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool isValid_DBM_1_Value, double DBM_1_Value) = Text_Num(DBM_1_Math_AllSamples.Text, true, false);
+ (bool isValid_DBM_2_Value, double DBM_2_Value) = Text_Num(DBM_2_Math_AllSamples.Text, false, false);
+ (bool isValid_DBM_3_Value, double DBM_3_Value) = Text_Num(DBM_3_Math_AllSamples.Text, false, false);
+ (bool isValid_DBM_4_Value, double DBM_4_Value) = Text_Num(DBM_4_Math_AllSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
+ if (isValid_DBM_1_Value == true & isValid_DBM_2_Value == true & isValid_DBM_3_Value == true & isValid_DBM_4_Value == true & isValidGraphColor == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_AllSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_AllSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = Measurement_Count;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, Measurement_Data_Copy, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, Measurement_Data_DateTime, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DBM_1_Value) * (Math.Log(((((Math.Pow(Measurement_Data_Copy[i], 2)) / DBM_3_Value)) / DBM_4_Value), DBM_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DBM (All Samples Math Waveform): " + DBM_1_Value + " x log" + DBM_2_Value + " ((Samples^2 / " + DBM_3_Value + ") / " + DBM_4_Value + ")", DBM_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DBM (All Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if ((isValid_DBM_1_Value == false) || (isValid_DBM_2_Value == false) || (isValid_DBM_3_Value == false) || (isValid_DBM_4_Value == false))
+ {
+ Insert_Log("Cannot create DBM (All Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DBM (All Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
private void GraphColor_SetButton_Math_AllSamples_Click(object sender, RoutedEventArgs e)
{
(bool isValid, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_AllSamples_Check();
@@ -3965,6 +4126,182 @@ private void Division_Button_Math_NSamples_Click(object sender, RoutedEventArgs
}
}
+ private void Percentage_Error_Button_NSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool IsValidRange, int StartValue, int EndValue) = MathNsamples_Range();
+ (bool isValid, double Value) = Text_Num(Percentage_Error_TextBox_NSamples.Text, true, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
+ if (isValid == true & isValidGraphColor == true & IsValidRange == true)
+ {
+ if (Value != 0)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_NSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_NSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = (EndValue - StartValue) + 1;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, StartValue, Measurement_Data_Copy, 0, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, StartValue, Measurement_Data_DateTime, 0, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = Math.Abs((Measurement_Data_Copy[i] - Value) / Value) * 100;
+ }
+ Create_Waveform_Window("% Error Math Waveform [" + StartValue + ", " + EndValue + "]: |(Samples - " + Value + ") / " + Value + "| x 100", Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples): Value must not be " + Value, 1);
+ }
+ }
+ else
+ {
+ if (isValid == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Value must be a real number.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Graph Color values are not valid.", 1);
+ }
+ if (IsValidRange == false)
+ {
+ Insert_Log("Cannot create % Error Math Waveform (N Samples). Check N Samples Start and End input values.", 1);
+ }
+ }
+ }
+
+ private void DB_Button_Math_NSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool IsValidRange, int StartValue, int EndValue) = MathNsamples_Range();
+ (bool isValid_DB_1_Value, double DB_1_Value) = Text_Num(DB_1_Math_NSamples.Text, true, false);
+ (bool isValid_DB_2_Value, double DB_2_Value) = Text_Num(DB_2_Math_NSamples.Text, false, false);
+ (bool isValid_DB_3_Value, double DB_3_Value) = Text_Num(DB_3_Math_NSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
+ if (isValid_DB_1_Value == true & isValid_DB_2_Value == true & isValid_DB_3_Value == true & isValidGraphColor == true & IsValidRange == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_NSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_NSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = (EndValue - StartValue) + 1;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, StartValue, Measurement_Data_Copy, 0, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, StartValue, Measurement_Data_DateTime, 0, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DB_1_Value) * (Math.Log(((Math.Abs(Measurement_Data_Copy[i])) / DB_3_Value), DB_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DB (N Samples Math Waveform [" + StartValue + ", " + EndValue + "]): " + DB_1_Value + " x log" + DB_2_Value + " (Samples / " + DB_3_Value + ")", DB_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if (IsValidRange == false)
+ {
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. Check N Samples Start and End input values.", 1);
+ }
+ if ((isValid_DB_1_Value == false) || (isValid_DB_2_Value == false) || (isValid_DB_3_Value == false))
+ {
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DB (N Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
+ private void DBM_Button_Math_NSamples_Click(object sender, RoutedEventArgs e)
+ {
+ (bool IsValidRange, int StartValue, int EndValue) = MathNsamples_Range();
+ (bool isValid_DBM_1_Value, double DBM_1_Value) = Text_Num(DBM_1_Math_NSamples.Text, true, false);
+ (bool isValid_DBM_2_Value, double DBM_2_Value) = Text_Num(DBM_2_Math_NSamples.Text, false, false);
+ (bool isValid_DBM_3_Value, double DBM_3_Value) = Text_Num(DBM_3_Math_NSamples.Text, false, false);
+ (bool isValid_DBM_4_Value, double DBM_4_Value) = Text_Num(DBM_4_Math_NSamples.Text, false, false);
+ (bool isValidGraphColor, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
+ if (isValid_DBM_1_Value == true & isValid_DBM_2_Value == true & isValid_DBM_3_Value == true & isValid_DBM_4_Value == true & isValidGraphColor == true & IsValidRange == true)
+ {
+ string Graph_Title = GraphTitle_TextBox_Math_NSamples.Text;
+ string Y_Axis_Title = YAxis_TextBox_Math_NSamples.Text;
+ Task.Run(() =>
+ {
+ try
+ {
+ int Measurement_Count_Copy = (EndValue - StartValue) + 1;
+ double[] Measurement_Data_Copy = new double[Measurement_Count_Copy];
+ Array.Copy(Measurement_Data, StartValue, Measurement_Data_Copy, 0, Measurement_Count_Copy);
+
+ DateTime[] Measurement_Data_DateTime = new DateTime[Measurement_Count_Copy];
+ Array.Copy(Measurement_DateTime, StartValue, Measurement_Data_DateTime, 0, Measurement_Count_Copy);
+
+ for (int i = 0; i < Measurement_Count_Copy; i++)
+ {
+ Measurement_Data_Copy[i] = (DBM_1_Value) * (Math.Log(((((Math.Pow(Measurement_Data_Copy[i], 2)) / DBM_3_Value)) / DBM_4_Value), DBM_2_Value));
+ if (double.IsNaN(Measurement_Data_Copy[i]) || double.IsInfinity(Measurement_Data_Copy[i]))
+ {
+ Measurement_Data_Copy[i] = 0;
+ }
+ }
+ Create_Waveform_Window("DBM (N Samples Math Waveform [" + StartValue + ", " + EndValue + "]): " + DBM_1_Value + " x log" + DBM_2_Value + " ((Samples^2 / " + DBM_3_Value + ") / " + DBM_4_Value + ")", DBM_3_Value, 0, Measurement_Count_Copy, Graph_Title, Y_Axis_Title, Value_Red, Value_Green, Value_Blue, Measurement_Data_Copy, Measurement_Count_Copy, Measurement_Data_DateTime);
+ Measurement_Data_Copy = null;
+ Measurement_Data_DateTime = null;
+ }
+ catch (Exception Ex)
+ {
+ Insert_Log(Ex.Message, 1);
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. Try again.", 1);
+ }
+ });
+ }
+ else
+ {
+ if (IsValidRange == true)
+ {
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. Check N Samples Start and End input values.", 1);
+ }
+ if ((isValid_DBM_1_Value == false) || (isValid_DBM_2_Value == false) || (isValid_DBM_3_Value == false) || (isValid_DBM_4_Value == false))
+ {
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. The base and the argument of the logarithm must be positive. Check your inputted values.", 1);
+ }
+ if (isValidGraphColor == false)
+ {
+ Insert_Log("Cannot create DBM (N Samples) Math Waveform. Check your Graph Color values.", 1);
+ }
+ }
+ }
+
private void GraphColor_SetButton_Math_NSamples_Click(object sender, RoutedEventArgs e)
{
(bool isValid, int Value_Red, int Value_Green, int Value_Blue) = GraphColor_Math_NSamples_Check();
diff --git a/src/packages.config b/src/packages.config
index 38cf7b0..c31642b 100644
--- a/src/packages.config
+++ b/src/packages.config
@@ -2,8 +2,8 @@
-
-
+
+