Add uncertainty field to measurement corrections
Introduce a new "uncertainty" field to measurement correction entities and integrate it across various UI tabs and database structures. This includes adding uncertainty input fields, handling editing and display logic, updating configurations, and adjusting mappings. Additionally, add a ReadMe file with instructions for the database update.
This commit is contained in:
parent
a20b0761fd
commit
78bc9e264b
@ -7,5 +7,6 @@ namespace Common
|
||||
int RangeIx { get; set; }
|
||||
double Measurement { get; set; }
|
||||
double Correction { get; set; }
|
||||
double Uncertainty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ namespace Config.Entities
|
||||
public virtual int RangeIx { get; set; } /// 0..5
|
||||
public virtual double Measurement { get; set; }
|
||||
public virtual double Correction { get; set; }
|
||||
public virtual double Uncertainty { get; set; }
|
||||
|
||||
public MeasurementCorrection()
|
||||
{
|
||||
@ -84,7 +85,7 @@ namespace Config.Entities
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1} ({2})", Measurement, Correction, RangeIx);
|
||||
return string.Format("{0} {1} ({2}) {3}", Measurement, Correction, RangeIx, Uncertainty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ namespace Config.Mappings
|
||||
Map(x => x.RangeIx);
|
||||
Map(x => x.Measurement);
|
||||
Map(x => x.Correction);
|
||||
Map(x => x.Uncertainty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
<LangVersion>4</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\micha\git\tbf\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll" />
|
||||
</AssemblyExplorer></s:String>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files\JetBrains\JetBrains Rider 2024.1.6\tools\MSBuild\Current\Bin\amd64\MSBuild.exe</s:String>
|
||||
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1114112</s:Int64>
|
||||
<s:Boolean x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/ShowAdvancedOptions/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=743DF7DB_002DC7B6_002D42EB_002D986D_002D0F485E5588E4/@EntryIndexedValue">77EB589F-C670-4489-AAD6-2A3C02061FD1</s:String>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=8648FD92_002DCDA1_002D4C3A_002DB5F9_002DFE547CE1FA48/@EntryIndexedValue">77EB589F-C670-4489-AAD6-2A3C02061FD1</s:String>
|
||||
|
||||
12
TBF/ReadMe.md
Normal file
12
TBF/ReadMe.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Information about new inserted functionality
|
||||
|
||||
|
||||
## Version
|
||||
|
||||
Document start on version `3.9.2144.1`
|
||||
|
||||
### v3.9.2144 Uncertainty
|
||||
#### Database update
|
||||
```
|
||||
alter table measurementcorrection add Uncertainty float null;
|
||||
```
|
||||
@ -3586,6 +3586,7 @@
|
||||
</Content>
|
||||
<Content Include="Pictures\sample.bmp" />
|
||||
<None Include="Resources\Barcode.png" />
|
||||
<Content Include="ReadMe.md" />
|
||||
<Content Include="Resources\empty.png" />
|
||||
<None Include="Resources\qrcode-48x48.png" />
|
||||
<Content Include="Resources\switch-off.png" />
|
||||
|
||||
@ -52,6 +52,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
Unit currentUnit;
|
||||
|
||||
@ -81,6 +82,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(measurementTextBox = new TextBox());
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
this.Controls.Add(uncertaintyTextBox = new TextBox());
|
||||
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.ElectricUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
@ -99,6 +101,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Current, unit.ToDescription()), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
|
||||
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
|
||||
@ -132,6 +135,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
: Units.ConvertTo(currentUnit, trueValue) - Units.ConvertTo(currentUnit, corr.Measurement);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(difference, SignifDigits));
|
||||
|
||||
//error
|
||||
if (corr.Measurement == 0)
|
||||
{
|
||||
lvi.SubItems.Add(Strings.NaN);
|
||||
@ -141,6 +145,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
|
||||
}
|
||||
|
||||
//uncertainty
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(corr.Uncertainty, SignifDigits));
|
||||
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -158,6 +166,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 4)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +193,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
double difference; /// Correction in selected unit
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
double uncertainty = 0;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
{
|
||||
@ -248,6 +261,19 @@ namespace TBF.UI.Bench.Metrology
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 4 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out uncertainty)))
|
||||
{
|
||||
if (strValue == Strings.NaN)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = uncertainty;
|
||||
item.SubItems[4].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
bool unlocked;
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
|
||||
public MetrologyDlgDiverterTab()
|
||||
@ -76,8 +77,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
/// Panel2
|
||||
measurementTextBox = new TextBox();
|
||||
correctionTextBox = new TextBox();
|
||||
uncertaintyTextBox = new TextBox();
|
||||
this.Controls.Add(measurementTextBox);
|
||||
this.Controls.Add(correctionTextBox);
|
||||
this.Controls.Add(uncertaintyTextBox);
|
||||
|
||||
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
@ -86,6 +89,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [m3/h]", Strings.Flow), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [ms]", Strings.Correction), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() {Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100});
|
||||
|
||||
RefreshAll();
|
||||
}
|
||||
@ -119,6 +123,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
ListViewItem lvi = new ListViewItem(nr.ToString());
|
||||
lvi.SubItems.Add(corr.Measurement.ToString());
|
||||
lvi.SubItems.Add((1000 * corr.Correction).ToString());
|
||||
lvi.SubItems.Add(corr.Uncertainty.ToString());
|
||||
lvi.Tag = corr;
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -133,11 +138,15 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void listViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (!unlocked || e.SubItem < 1 || e.SubItem > 2) return;
|
||||
if (!unlocked || e.SubItem < 1 || e.SubItem > 3) return;
|
||||
|
||||
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
|
||||
Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
|
||||
@ -189,6 +198,12 @@ namespace TBF.UI.Bench.Metrology
|
||||
(item.Tag as MeasurementCorrection).Correction = fvalue / 1000;
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 3 && Utils.TryParseEFloat(value, out fvalue))
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = fvalue ;
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
bool unlocked;
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
|
||||
public MetrologyDlgEvaporationTab()
|
||||
@ -76,8 +77,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
/// Panel2
|
||||
measurementTextBox = new TextBox();
|
||||
correctionTextBox = new TextBox();
|
||||
uncertaintyTextBox = new TextBox();
|
||||
this.Controls.Add(measurementTextBox);
|
||||
this.Controls.Add(correctionTextBox);
|
||||
this.Controls.Add(uncertaintyTextBox);
|
||||
|
||||
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
@ -86,6 +89,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/hour]", Strings.Evaporation), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
RefreshAll();
|
||||
}
|
||||
@ -116,6 +120,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
ListViewItem lvi = new ListViewItem(nr.ToString());
|
||||
lvi.SubItems.Add(corr.Measurement.ToString());
|
||||
lvi.SubItems.Add((1000 * corr.Correction).ToString());
|
||||
lvi.SubItems.Add(corr.Uncertainty.ToString());
|
||||
lvi.Tag = corr;
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -130,6 +135,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void listViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
|
||||
@ -186,6 +195,11 @@ namespace TBF.UI.Bench.Metrology
|
||||
(item.Tag as MeasurementCorrection).Correction = fvalue / 1000;
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 3 && Utils.TryParseEFloat(value, out fvalue))
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = fvalue;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -52,6 +52,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
readonly int rangeIx; /// 0 (no range) or 1..5 (range #)
|
||||
readonly bool isLastFlowMeterRange; /// true when this is the last range of this flow meter.
|
||||
/// This is to prevent double saving of the meter entity to a DB
|
||||
@ -96,6 +97,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(measurementTextBox = new TextBox());
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
this.Controls.Add(uncertaintyTextBox = new TextBox());
|
||||
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.FlowUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
@ -114,6 +116,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Flow, unit.ToDescription()), Width = 120 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 150 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
|
||||
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
|
||||
@ -163,6 +166,8 @@ namespace TBF.UI.Bench.Metrology
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
|
||||
}
|
||||
|
||||
lvi.SubItems.Add(corr.Uncertainty.ToString());
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
|
||||
@ -179,6 +184,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 4)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,6 +211,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
double difference; /// Correction in selected unit
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
double uncertainty;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
{
|
||||
@ -269,6 +279,21 @@ namespace TBF.UI.Bench.Metrology
|
||||
|
||||
return true;
|
||||
}
|
||||
if (subItem == 4 && Utils.TryParseEDouble(strValue, out uncertainty))
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = uncertainty;
|
||||
|
||||
if (uncertainty == 0.0f)
|
||||
{
|
||||
item.SubItems[3].Text = Strings.NaN;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SubItems[3].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -48,6 +48,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
bool unlocked;
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
|
||||
public MetrologyDlgLevelMeterTab()
|
||||
@ -76,8 +77,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
/// Panel2
|
||||
measurementTextBox = new TextBox();
|
||||
correctionTextBox = new TextBox();
|
||||
uncertaintyTextBox = new TextBox();
|
||||
this.Controls.Add(measurementTextBox);
|
||||
this.Controls.Add(correctionTextBox);
|
||||
this.Controls.Add(uncertaintyTextBox);
|
||||
|
||||
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
@ -86,6 +89,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mm]", Strings.Level), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mm]", Strings.Correction), Width = 100 });
|
||||
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
RefreshAll();
|
||||
}
|
||||
@ -116,6 +120,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
ListViewItem lvi = new ListViewItem(nr.ToString());
|
||||
lvi.SubItems.Add(corr.Measurement.ToString());
|
||||
lvi.SubItems.Add((corr.Correction).ToString());
|
||||
lvi.SubItems.Add((corr.Uncertainty).ToString());
|
||||
lvi.Tag = corr;
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -186,6 +191,11 @@ namespace TBF.UI.Bench.Metrology
|
||||
(item.Tag as MeasurementCorrection).Correction = fvalue;
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 3 && Utils.TryParseEFloat(value, out fvalue))
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = fvalue;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -52,6 +52,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
Unit currentUnit;
|
||||
|
||||
@ -81,6 +82,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(measurementTextBox = new TextBox());
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
this.Controls.Add(uncertaintyTextBox = new TextBox());
|
||||
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.PressUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
@ -99,6 +101,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Pressure, unit.ToDescription()), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
|
||||
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
|
||||
@ -132,6 +135,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
: Units.ConvertTo(currentUnit, trueValue) - Units.ConvertTo(currentUnit, corr.Measurement);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(difference, SignifDigits));
|
||||
|
||||
//error
|
||||
if (corr.Measurement == 0)
|
||||
{
|
||||
lvi.SubItems.Add(Strings.NaN);
|
||||
@ -141,6 +145,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
|
||||
}
|
||||
|
||||
//uncertainty
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(corr.Uncertainty, SignifDigits));
|
||||
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -158,6 +166,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 4)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +193,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
double difference; /// Correction in selected unit
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
double uncertaitity;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
{
|
||||
@ -248,6 +261,19 @@ namespace TBF.UI.Bench.Metrology
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 4 && (Utils.TryParseEDouble(strValue, out uncertaitity)))
|
||||
{
|
||||
if (strValue == Strings.NaN)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = uncertaitity;
|
||||
item.SubItems[4].Text = Common.Utils.ToNiceString(uncertaitity, SignifDigits);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -53,6 +53,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
Unit currentUnit;
|
||||
|
||||
@ -82,6 +83,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(measurementTextBox = new TextBox());
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
this.Controls.Add(uncertaintyTextBox = new TextBox());
|
||||
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.MassUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
@ -100,6 +102,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Mass, unit.ToDescription()), Width = 120 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 150 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
|
||||
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
|
||||
@ -156,6 +159,8 @@ namespace TBF.UI.Bench.Metrology
|
||||
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
|
||||
}
|
||||
|
||||
lvi.SubItems.Add(corr.Uncertainty.ToString());
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -173,6 +178,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 4)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,6 +205,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
double difference; /// Correction in selected unit
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
double uncertainty;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
{
|
||||
@ -263,6 +273,20 @@ namespace TBF.UI.Bench.Metrology
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 4 && Utils.TryParseEDouble(strValue, out uncertainty))
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = uncertainty;
|
||||
|
||||
if (uncertainty != 0)
|
||||
{
|
||||
item.SubItems[3].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SubItems[3].Text = Strings.NaN;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -52,7 +52,8 @@ namespace TBF.UI.Bench.Metrology
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
|
||||
Control uncertaintyTextBox;
|
||||
|
||||
Unit currentUnit;
|
||||
|
||||
public MetrologyDlgTempMeterTab()
|
||||
@ -81,6 +82,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(measurementTextBox = new TextBox());
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
this.Controls.Add(uncertaintyTextBox = new TextBox());
|
||||
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.TempUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
@ -99,6 +101,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Temperature, unit.ToDescription()), Width = 120 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 150 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() {Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
|
||||
|
||||
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
|
||||
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
|
||||
@ -144,6 +147,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
|
||||
}
|
||||
lvi.SubItems.Add(corr.Uncertainty.ToString());
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
@ -161,6 +165,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 4)
|
||||
{
|
||||
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,6 +192,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
double difference; /// Correction in selected unit
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
double uncertainty;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
{
|
||||
@ -251,6 +260,20 @@ namespace TBF.UI.Bench.Metrology
|
||||
|
||||
return true;
|
||||
}
|
||||
if (subItem == 4 && Utils.TryParseEDouble(strValue, out uncertainty))
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Uncertainty = uncertainty;
|
||||
|
||||
if (strValue == Strings.NaN)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SubItems[2].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user