Custom units in MetrologyDlg tabs : Bug fixes : 1. Test after adding a value, 2. test of FlowMeter+rangeIx, ver. 2.29.1927
This commit is contained in:
parent
e7ab26669e
commit
ae348d13fd
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class MeasurementCorrection : Common.IMeasurementCorrection
|
||||
public class MeasurementCorrection : Common.IMeasurementCorrection, IComparable<MeasurementCorrection>
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int RangeIx { get; set; } /// 0..5
|
||||
@ -23,6 +23,10 @@ namespace Config.Entities
|
||||
RangeIx = rangeIx;
|
||||
}
|
||||
|
||||
public virtual int CompareTo(MeasurementCorrection other)
|
||||
{
|
||||
return (Measurement > other.Measurement) ? 1 : ((Measurement == other.Measurement) ? 0 : -1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates corrected value from a list of corrections by interpolation.
|
||||
@ -76,5 +80,10 @@ namespace Config.Entities
|
||||
/// rawValue is above the highest value in the correction table
|
||||
return corrections[corrections.Count - 1].Correction;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1} ({2})", Measurement, Correction, RangeIx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.29.1926.0")]
|
||||
[assembly: AssemblyFileVersion("2.29.1926.0")]
|
||||
[assembly: AssemblyVersion("2.29.1927.0")]
|
||||
[assembly: AssemblyFileVersion("2.29.1927.0")]
|
||||
|
||||
@ -18,7 +18,6 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgBalanceTab));
|
||||
|
||||
public const Unit DefaultUnit = Unit.kg;
|
||||
public const int SignifDigits = 5;
|
||||
|
||||
/// <summary>
|
||||
@ -86,7 +85,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
|
||||
currentUnit = DefaultUnit;
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.MassUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
InitializeColumns(listViewEx, currentUnit);
|
||||
RefreshAll();
|
||||
@ -418,7 +417,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
CultureInfo.InvariantCulture,
|
||||
out measured))
|
||||
{
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), meterEntity.Corrections);
|
||||
var corrections = new List<MeasurementCorrection>();
|
||||
foreach (var c in meterEntity.Corrections) corrections.Add(c);
|
||||
corrections.Sort();
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), corrections);
|
||||
correctedTextBox.Text = Units.ConvertTo(currentUnit, corrected).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgFlowMeterTab));
|
||||
|
||||
public const Unit DefaultUnit = Unit.m3ph;
|
||||
public const int SignifDigits = 5;
|
||||
|
||||
/// <summary>
|
||||
@ -101,7 +100,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
|
||||
currentUnit = DefaultUnit;
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.FlowUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
InitializeColumns(listViewEx, currentUnit);
|
||||
RefreshAll(rangeIx);
|
||||
@ -410,8 +409,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
CultureInfo.InvariantCulture,
|
||||
out measured))
|
||||
{
|
||||
double raw = Units.ConvertFrom(currentUnit, measured);
|
||||
double corrected = raw + MeasurementCorrection.GetCorrection(raw, MeterEntity.Corrections); /// !!! rangeIx is ignored
|
||||
var corrections = new List<MeasurementCorrection>();
|
||||
foreach (var c in meterEntity.Corrections) if (c.RangeIx == rangeIx) corrections.Add(c);
|
||||
corrections.Sort();
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), corrections);
|
||||
correctedTextBox.Text = Units.ConvertTo(currentUnit, corrected).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgPressMeterTab));
|
||||
|
||||
public const Unit DefaultUnit = Unit.bar;
|
||||
public const int SignifDigits = 5;
|
||||
|
||||
/// <summary>
|
||||
@ -86,7 +85,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
|
||||
currentUnit = DefaultUnit;
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.PressUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
InitializeColumns(listViewEx, currentUnit);
|
||||
RefreshAll();
|
||||
@ -395,7 +394,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
CultureInfo.InvariantCulture,
|
||||
out measured))
|
||||
{
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), meterEntity.Corrections);
|
||||
var corrections = new List<MeasurementCorrection>();
|
||||
foreach (var c in meterEntity.Corrections) corrections.Add(c);
|
||||
corrections.Sort();
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), corrections);
|
||||
correctedTextBox.Text = Units.ConvertTo(currentUnit, corrected).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgTempMeterTab));
|
||||
|
||||
public const Unit DefaultUnit = Unit.C;
|
||||
public const int SignifDigits = 5;
|
||||
|
||||
/// <summary>
|
||||
@ -86,7 +85,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
|
||||
currentUnit = DefaultUnit;
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.TempUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
InitializeColumns(listViewEx, currentUnit);
|
||||
RefreshAll();
|
||||
@ -395,7 +394,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
CultureInfo.InvariantCulture,
|
||||
out measured))
|
||||
{
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), meterEntity.Corrections);
|
||||
var corrections = new List<MeasurementCorrection>();
|
||||
foreach (var c in meterEntity.Corrections) corrections.Add(c);
|
||||
corrections.Sort();
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), corrections);
|
||||
correctedTextBox.Text = Units.ConvertTo(currentUnit, corrected).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user