Uncertainty under construction, Results DB TestRslt table modified

This commit is contained in:
Milan Hanajik 2019-09-21 18:03:25 +02:00
parent 424be60a05
commit 7fd4966757
29 changed files with 850 additions and 1341 deletions

View File

@ -19,8 +19,9 @@ namespace Config.Entities
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool DoEvaluate { get; set; }
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual bool DoEvaluate { get; set; }
public virtual float Qtg { get; set; } /// Target water flow [m3/h]
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
@ -114,6 +115,7 @@ namespace Config.Entities
result.Part = Part;
result.Publish = Publish;
result.DoEvaluate = DoEvaluate;
result.Qtg = Qtg;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Volume = Volume;
@ -162,6 +164,7 @@ namespace Config.Entities
output.WriteLine(Part.ToString(ci));
output.WriteLine(Publish.ToString(ci));
output.WriteLine(DoEvaluate.ToString());
output.WriteLine(Qtg.ToString(ci));
output.WriteLine(Qfrom.ToString(ci));
output.WriteLine(Qto.ToString(ci));
output.WriteLine(Volume.ToString(ci));
@ -212,7 +215,8 @@ namespace Config.Entities
tst.Part = int.Parse(input.ReadLine(), ci);
tst.Publish = sbyte.Parse(input.ReadLine(), ci);
tst.DoEvaluate = bool.Parse(input.ReadLine());
tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qtg = float.Parse(input.ReadLine(), ci);
tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qto = float.Parse(input.ReadLine(), ci);
tst.Volume = float.Parse(input.ReadLine(), ci);
tst.TstTime = float.Parse(input.ReadLine(), ci);
@ -270,6 +274,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Part.ToString(ci)) { diff.AppendFormat(fmt, "Part", Part.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Publish.ToString(ci)) { diff.AppendFormat(fmt, "Publish", Publish.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoEvaluate.ToString(ci)) { diff.AppendFormat(fmt, "Evaluate", DoEvaluate.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qtg.ToString(ci)) { diff.AppendFormat(fmt, "Qtg", Qtg.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); };

View File

@ -17,7 +17,10 @@ namespace Config.Mappings
Map(x => x.Publish);
Map(x => x.DoEvaluate)
.Column("Evaluate");
Map(x => x.Qfrom);
#if TEST_PROFILES
Map(x => x.Qtg);
#endif
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Volume);
Map(x => x.TstTime);

View File

@ -50,14 +50,15 @@ namespace Results.Entities
public virtual TestData TestData() { return TestRslt.TestData; }
///
public virtual int Repeats() { return TestData().Repeats; }
public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
public virtual double Qtg() { return TestData().Qtg; } /// [m3/h]
public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
public virtual double Qto() { return TestData().Qto; } /// [m3/h]
public virtual double TargetVolume() { return TestData().TargetVolume; } /// [l]
public virtual double TargetTime() { return TestData().TargetTime; } /// [s]
public virtual string Method() { return TestData().Method; }
public virtual double ErrLimLo() { return TestData().ErrLimLo; } /// [%]
public virtual double ErrLimHi() { return TestData().ErrLimHi; } /// [%]
public virtual double Uncertainty() { return TestData().Uncertainty; } /// [%]
public virtual double Uncertainty() { return TestData().ErrLimMargin; } /// [%]
public virtual string ProcedureName() { return WaterMeter.Batch.ProcedureName; }
public virtual int BatchNr() { return WaterMeter.Batch.BatchNr; }

View File

@ -15,14 +15,15 @@ namespace Results.Entities
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual int Repeats { get; set; }
public virtual double Qfrom { get; set; } /// [m3/h] flow range low limit
public virtual double Qtg { get; set; } /// [m3/h] flow range low limit
public virtual double Qfrom { get; set; } /// [m3/h] flow range low limit
public virtual double Qto { get; set; } /// [m3/h] flow range high limit
public virtual double TargetVolume { get; set; } /// [l] target test volume
public virtual double TargetTime { get; set; } /// [s] target test time
public virtual string Method { get; set; }
public virtual double ErrLimLo { get; set; } /// [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual double ErrLimHi { get; set; } /// [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual double Uncertainty { get; set; } /// [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual double ErrLimMargin { get; set; } /// [%] makes error limits tighter: 0 <= ErrLimMargin <= abs(ErrLimXx)
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; }
public virtual float TempLimHi { get; set; }
@ -41,14 +42,15 @@ namespace Results.Entities
{
Name = test.Name;
Repeats = test.Repeats;
Qfrom = (double)test.Qfrom;
Qtg = (double)test.Qtg;
Qfrom = (double)test.Qfrom;
Qto = (double)test.Qto;
TargetVolume = (double)test.Volume;
TargetTime = (double)test.TstTime;
Method = test.Method;
ErrLimLo = (double)test.ErrLimLo;
ErrLimHi = (double)test.ErrLimHi;
Uncertainty = (double)test.Uncertainty;
ErrLimMargin = (double)test.Uncertainty;
DoControlWaterTemp = test.DoControlWaterTemp;
TempLimLo = test.TempLimLo;
TempLimHi = test.TempLimHi;
@ -66,14 +68,15 @@ namespace Results.Entities
{
if (!Name.Equals(td.Name)) return false;
if (Repeats != td.Repeats) return false;
if (Qfrom != td.Qfrom) return false;
if (Qtg != td.Qtg) return false;
if (Qfrom != td.Qfrom) return false;
if (Qto != td.Qto) return false;
if (TargetVolume != td.TargetVolume) return false;
if (TargetTime != td.TargetTime) return false;
if (!Method.Equals(td.Method)) return false;
if (ErrLimLo != td.ErrLimLo) return false;
if (ErrLimHi != td.ErrLimHi) return false;
if (Uncertainty != td.Uncertainty) return false;
if (ErrLimMargin != td.ErrLimMargin) return false;
if (DoControlWaterTemp != td.DoControlWaterTemp) return false;
if (DoControlWaterTemp)
{

View File

@ -115,6 +115,12 @@ namespace Results.Entities
public virtual float FlowMin { get; set; } /// [m3/h]
public virtual float FlowMax { get; set; } /// [m3/h]
public virtual float Uncertnt { get; set; } /// [%] Relative error uncertainty
public virtual float UncertntScale { get; set; } /// [%] Contribution to uncertainty from scale
public virtual float UncertntDensity { get; set; } /// [%] Contribution to uncertainty from density
public virtual float UncertntTemp { get; set; } /// [%] Contribution to uncertainty from temperature
public virtual float UncertntPressure { get; set; } /// [%] Contribution to uncertainty from pressure
public virtual float Custom1 { get; set; } /// [°C] T ref hi mean
public virtual float Custom2 { get; set; } /// [°C] T ref hi start
public virtual float Custom3 { get; set; } /// [°C] T ref hi end
@ -125,7 +131,7 @@ namespace Results.Entities
public virtual float Custom8 { get; set; } /// [°C] T ref lo end
public virtual float Custom9 { get; set; } /// [°C] T ref lo min
public virtual float Custom10 { get; set; } /// [°C] T ref lo max
/// Wrappers
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
public virtual int Repeats() { return TestData.Repeats; }
@ -202,7 +208,7 @@ namespace Results.Entities
}
}
public virtual double Uncertainty() { return TestData.Uncertainty; }
public virtual double ErrLimMargin() { return TestData.ErrLimMargin; }
public virtual float TempLimLo() { return TestData.TempLimLo; }
public virtual float TempLimHi() { return TestData.TempLimHi; }
public virtual bool Evaluate() { return TestData.Evaluate; }

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@ -12,7 +12,10 @@ namespace Results.Mappings
{
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Qfrom);
#if TEST_PROFILES
Map(x => x.Qtg);
#endif
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.TargetVolume);
Map(x => x.TargetTime);
@ -20,7 +23,7 @@ namespace Results.Mappings
Map(x => x.Method);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.Uncertainty);
Map(x => x.ErrLimMargin).Column("Uncertainty");
Map(x => x.Publish);
Map(x => x.Evaluate);
}

View File

@ -103,6 +103,12 @@ namespace Results.Mappings
Map(x => x.FlowMin);
Map(x => x.FlowMax);
Map(x => x.Uncertnt);
Map(x => x.UncertntScale);
Map(x => x.UncertntDensity);
Map(x => x.UncertntTemp);
Map(x => x.UncertntPressure);
Map(x => x.Custom1);
Map(x => x.Custom2);
Map(x => x.Custom3);

View File

@ -313,7 +313,7 @@ namespace Results
///
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Lo, Strings.ErrLimLo + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimLo())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimHi())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimMargin())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error_corr, string.Format("{0} ref.corr. ()", Strings.VName_Error), "Relative error of the reference flow meter after correction using correction curve", Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", Config.Formulas.ErrorFromVolumes(w.GetTestRslt(t).ConstMasterCorr, w.GetTestRslt(t).ConstMaster))));
#if ORACLE_DB

View File

@ -1172,8 +1172,8 @@ namespace TBF.BenchControl.Sequences
sb.Append(";"); sb.Append(tstRslt.TargetVolume()); /// G
sb.Append(";"); sb.Append(tstRslt.Qfrom()); /// H
sb.Append(";"); sb.Append(tstRslt.Qto()); /// I
sb.Append(";"); sb.Append(tstRslt.ErrLimLo() + tstRslt.Uncertainty()); /// J
sb.Append(";"); sb.Append(tstRslt.ErrLimHi() - tstRslt.Uncertainty()); /// K
sb.Append(";"); sb.Append(tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()); /// J
sb.Append(";"); sb.Append(tstRslt.ErrLimHi() - tstRslt.ErrLimMargin()); /// K
sb.Append(";"); sb.AppendFormat("{0:F1}", tstRslt.TempLimLo()); /// L
sb.Append(";"); sb.AppendFormat("{0:F1}", tstRslt.TempLimHi()); /// M
sb.Append(";"); sb.Append("0"); /// N
@ -1522,8 +1522,8 @@ namespace TBF.BenchControl.Sequences
meterRslt.TimestampEnd = tstRslt.TargetTime();
meterRslt.TestTime = tstRslt.TargetTime();
meterRslt.Error = errorPct;
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
@ -1640,8 +1640,8 @@ namespace TBF.BenchControl.Sequences
meterRslt.TimestampEnd = tstRslt.TargetTime();
meterRslt.TestTime = tstRslt.TargetTime();
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV);
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
meterRslt.TestDone = true;
}
}
@ -1652,8 +1652,8 @@ namespace TBF.BenchControl.Sequences
compoundRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundRslt.TestTime = tstRslt.TargetTime();
compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV);
compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
compoundRslt.TestDone = true;
tstRslt.TestDone = true;
}
@ -1763,8 +1763,8 @@ namespace TBF.BenchControl.Sequences
volumeRslt.TestTime = tstRslt.TargetTime();
volumeRslt.Error = Formulas.ErrorFromVolumes(volumeMeter, tstRslt.VolumeCTV);
volumeRslt.Passed = !evaluateVolume ||
((errorPct >= tstRslt.ErrLimLo() + tstRslt.Uncertainty()) &&
(errorPct <= tstRslt.ErrLimHi() - tstRslt.Uncertainty()));
((errorPct >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()) &&
(errorPct <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin()));
volumeRslt.TestDone = true;
tstRslt.TestDone = true;
}

View File

@ -123,8 +123,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
string testName = args.TestName;
Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
errLimLo = tr.ErrLimLo() + tr.ErrLimMargin();
errLimHi = tr.ErrLimHi() - tr.ErrLimMargin();
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)

View File

@ -164,8 +164,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
string testName = args.TestName;
Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
errLimLo = tr.ErrLimLo() + tr.ErrLimMargin();
errLimHi = tr.ErrLimHi() - tr.ErrLimMargin();
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)

View File

@ -170,8 +170,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
if (tr != null)
{
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
errLimLo = tr.ErrLimLo() + tr.ErrLimMargin();
errLimHi = tr.ErrLimHi() - tr.ErrLimMargin();
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)

View File

@ -1364,16 +1364,7 @@ namespace TBF.Resources {
return ResourceManager.GetString("Drain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Drift per year.
/// </summary>
internal static string Drift_per_year {
get {
return ResourceManager.GetString("Drift_per_year", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Draining after.
/// </summary>
@ -1392,6 +1383,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Drift per year.
/// </summary>
internal static string Drift_per_year {
get {
return ResourceManager.GetString("Drift_per_year", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Leak duration [s].
/// </summary>
@ -3750,6 +3750,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Q tg [m3/h].
/// </summary>
internal static string Q_tg_m3h {
get {
return ResourceManager.GetString("Q_tg_m3h", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Q to [l/h].
/// </summary>

View File

@ -2089,4 +2089,7 @@
<data name="Draining_before" xml:space="preserve">
<value>Draining before</value>
</data>
<data name="Q_tg_m3h" xml:space="preserve">
<value>Q tg [m3/h]</value>
</data>
</root>

View File

@ -1987,12 +1987,6 @@
<Compile Include="UI\Bench\Components\SelectComponentClassDlg.designer.cs">
<DependentUpon>SelectComponentClassDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Conditions\ConditionsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Bench\Conditions\ConditionsDlg.designer.cs">
<DependentUpon>ConditionsDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\IMetrologyDlgTab.cs" />
<Compile Include="UI\Bench\Metrology\MetrologyDlg.cs">
<SubType>Form</SubType>
@ -2081,6 +2075,12 @@
<Compile Include="UI\Bench\Paths\PathsOutputCtrl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Bench\TestProfiles\TestProfilesDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Bench\TestProfiles\TestProfilesDlg.designer.cs">
<DependentUpon>TestProfilesDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Transitions\TransitionsDlg.cs">
<SubType>Form</SubType>
</Compile>
@ -2094,12 +2094,6 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\IUncetaintiesDlgTab.cs" />
<Compile Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.designer.cs">
<DependentUpon>UncertntDlgBuoyancyTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.cs">
<SubType>UserControl</SubType>
</Compile>
@ -3068,9 +3062,6 @@
<EmbeddedResource Include="UI\Bench\Components\SelectComponentClassDlg.resx">
<DependentUpon>SelectComponentClassDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Conditions\ConditionsDlg.resx">
<DependentUpon>ConditionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlg.resx">
<DependentUpon>MetrologyDlg.cs</DependentUpon>
</EmbeddedResource>
@ -3107,12 +3098,12 @@
<EmbeddedResource Include="UI\Bench\Paths\PathsDlg.resx">
<DependentUpon>PathsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\TestProfiles\TestProfilesDlg.resx">
<DependentUpon>TestProfilesDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Transitions\TransitionsDlg.resx">
<DependentUpon>TransitionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgBuoyancyTab.resx">
<DependentUpon>UncertntDlgBuoyancyTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Uncertainties\UncertntDlgDensityTab.resx">
<DependentUpon>UncertntDlgDensityTab.cs</DependentUpon>
</EmbeddedResource>

View File

@ -16,11 +16,11 @@ using TBF.Resources;
using TBF.UI.Shared;
using TBF.UI.Bench.Transitions; /// TODO: Remove
namespace TBF.UI.Bench.Conditions
namespace TBF.UI.Bench.TestProfiles
{
public partial class ConditionsDlg : Form, IParentOfListViewEx
public partial class TestProfilesDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(ConditionsDlg));
static readonly ILog log = LogManager.GetLogger(typeof(TestProfilesDlg));
/// Used when re-scaling the dialog: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi
public readonly int Dpi;
@ -60,7 +60,7 @@ namespace TBF.UI.Bench.Conditions
IList<ITabWithListViewEx> seqStepsCtrls;
public ConditionsDlg()
public TestProfilesDlg()
{
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
Dpi = (int)this.CreateGraphics().DpiX;

View File

@ -1,9 +1,9 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Conditions
namespace TBF.UI.Bench.TestProfiles
{
partial class ConditionsDlg
partial class TestProfilesDlg
{
/// <summary>
/// Required designer variable.
@ -31,7 +31,7 @@ namespace TBF.UI.Bench.Conditions
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConditionsDlg));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestProfilesDlg));
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
this.tabControl = new System.Windows.Forms.TabControl();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();

View File

@ -77,20 +77,6 @@ namespace TBF.UI.Bench.Uncertainties
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-page buoyancy
if (factory is BenchControl.DataContainers.Buoyancy.ComponentFactory)
{
fixedCount++;
TabPage tabPage = new TabPage(" Buoyancy ");
UncertntDlgBuoyancyTab uiControl = new UncertntDlgBuoyancyTab();
uiControl.MeterEntity = cmpnt;
uiControl.BuoyancyCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.DataContainers.Buoyancy.ComponentCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
uncertaintiesTabControl.TabPages.Add(tabPage);
}
/// Tab-pages for scales
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
factory is BenchControl.MettlerToledo.Standard.BalanceOldFactory ||

View File

@ -1,132 +0,0 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.Resources;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgBuoyancyTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgBuoyancyTab));
/// <summary>
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
/// <summary>
/// Buoyancy configuration
/// </summary>
public BenchControl.DataContainers.Buoyancy.ComponentCfg BuoyancyCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
bool unlocked;
public UncertntDlgBuoyancyTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
}
private void MetrologyDlgBuoyancyTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
buoyancyLabel.Text = "Buoyancy";
/// Panel2
RefreshAll();
}
void RefreshAll()
{
buoyancyTextBox.Text = Config.Data.Buoyancy.ToString("F5");
}
public void Unlock()
{
unlocked = true;
buoyancyTextBox.Enabled = true;
}
public void OkBtnClicked()
{
if (BuoyancyCfg != null)
{
try
{
double buoyancy = Utils.ParseUDouble(buoyancyTextBox.Text);
global::Results.WMeterRsltItemSpec.Buoyancy =
Config.Data.Buoyancy = BuoyancyCfg.Buoyancy = buoyancy;
Component modified = BuoyancyCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_buoyancy_parameter_Correct_pls,
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()
{
}
public void AddOne()
{
}
public void RemoveSelected()
{
}
public void MoveUpSelected()
{
}
public void MoveDownSelected()
{
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
}
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
}
}

View File

@ -1,97 +0,0 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Uncertainties
{
partial class UncertntDlgBuoyancyTab
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.buoyancyTextBox = new System.Windows.Forms.TextBox();
this.buoyancyLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.buoyancyTextBox);
this.splitContainer1.Panel1.Controls.Add(this.buoyancyLabel);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
//
// buoyancyTextBox
//
this.buoyancyTextBox.Enabled = false;
this.buoyancyTextBox.Location = new System.Drawing.Point(189, 51);
this.buoyancyTextBox.Name = "buoyancyTextBox";
this.buoyancyTextBox.Size = new System.Drawing.Size(110, 20);
this.buoyancyTextBox.TabIndex = 1;
//
// buoyancyLabel
//
this.buoyancyLabel.AutoSize = true;
this.buoyancyLabel.Location = new System.Drawing.Point(41, 54);
this.buoyancyLabel.Name = "buoyancyLabel";
this.buoyancyLabel.Size = new System.Drawing.Size(54, 13);
this.buoyancyLabel.TabIndex = 0;
this.buoyancyLabel.Text = "Buoyancy";
//
// MetrologyDlgBuoyancyTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgBuoyancyTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgBuoyancyTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox buoyancyTextBox;
private System.Windows.Forms.Label buoyancyLabel;
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,16 +1,19 @@
///
/// Copyright (c) 2019 Senus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Uncertainties
{
public partial class UncertntDlgDensityTab : UserControl, IUncetaintiesDlgTab
public partial class UncertntDlgDensityTab : UserControl, IUncetaintiesDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(UncertntDlgDensityTab));
@ -18,95 +21,164 @@ namespace TBF.UI.Bench.Uncertainties
/// Component entity that has a list of 'measurement-correction' pairs
/// to be updated in the database on OK.
/// </summary>
Component meterEntity;
public Component MeterEntity
{
get { return meterEntity; }
set { meterEntity = value; }
}
Component meterEntity;
get { return meterEntity; }
set { meterEntity = value; }
}
/// <summary>
/// Density configuration
/// Balance configuration (with buoyancy parameters)
/// </summary>
public BenchControl.DataContainers.Density.ComponentCfg DensityCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
public IList<Uncertainty> ToBeRemoved
public IList<Uncertainty> ToBeRemoved
{
get { return toBeRemoved; }
set { toBeRemoved = value; }
}
IList<Uncertainty> toBeRemoved;
IList<Uncertainty> toBeRemoved;
UncertaintiesDlg parent;
UncertaintiesDlg parent;
bool unlocked;
Control[] textBoxes;
public UncertntDlgDensityTab()
{
InitializeComponent();
toBeRemoved = new List<Uncertainty>();
unlocked = false;
toBeRemoved = new List<Uncertainty>();
}
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
private void UncertntDlgTempMeterTab_Load(object sender, System.EventArgs e)
{
if (meterEntity == null) return;
if (meterEntity == null) return;
parent = ParentForm as UncertaintiesDlg;
/// Panel1
densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Config.Unit.kgpm3.ToDescription());
temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Config.Unit.C.ToDescription());
densityCorrLabel.Text = string.Format("{0} [{1}]", Strings.Density_correction, Config.Unit.kgpm3.ToDescription());
cmpntLabel.Text = Strings.Component;
cmpntNameLabel.Text = meterEntity.Name;
/// Panel2
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 40 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Main_uncertainty), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Resolution), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3/year]", Strings.Drift_per_year), Width = 120 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Conditions), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/m3]", Strings.Uncertainty_of_correction), Width = 160 });
textBoxes = new TextBox[listViewEx.Columns.Count];
for (int i = 1; i < textBoxes.Length; i++)
{
this.Controls.Add(textBoxes[i] = new TextBox());
}
RefreshAll();
}
void RefreshAll()
{
densityTextBox.Text = Config.Data.RealDensity.ToString("F4");
temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2");
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5");
listViewEx.Items.Clear();
foreach (var uncrtnty in MeterEntity.Uncertainties) AddOneLVI(uncrtnty);
}
void AddOneLVI(Uncertainty corr)
{
int nr = listViewEx.Items.Count + 1;
ListViewItem lvi = new ListViewItem(nr.ToString());
lvi.Tag = corr;
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.MainUncertainty).ToString());
lvi.SubItems.Add((1000 * corr.Resolution).ToString());
lvi.SubItems.Add((1000 * corr.DriftPerYr).ToString());
lvi.SubItems.Add((1000 * corr.Conditions).ToString());
lvi.SubItems.Add((1000 * corr.UncertaintyOfCorrection).ToString());
listViewEx.Items.Add(lvi);
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem >= 1) && (e.SubItem < listViewEx.Columns.Count))
{
/// This is not the first column
listViewEx.StartEditing(textBoxes[e.SubItem], e.Item, e.SubItem);
}
}
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
/// New value is NOK, revert the original text
e.DisplayText = e.Item.Text;
e.Cancel = true;
}
/// <summary>
/// Parse text of a ListViewItem
/// </summary>
/// <returns>true = value parsed OK</returns>
bool ParseItem(ListViewItem item, int subItem, string strValue)
{
Uncertainty uncrtnty = item.Tag as Uncertainty;
double dblValue = 0;
if ((uncrtnty != null) && Utils.TryParseEDouble(strValue, out dblValue) && (dblValue >= 0))
{
double inDefaultUnits = dblValue / 1000;
switch (subItem)
{
case 1:
uncrtnty.Measurement = (float)dblValue;
return true;
case 2:
uncrtnty.MainUncertainty = (float)inDefaultUnits;
return true;
case 3:
uncrtnty.Resolution = (float)inDefaultUnits;
return true;
case 4:
uncrtnty.DriftPerYr = (float)inDefaultUnits;
return true;
case 5:
uncrtnty.Conditions = (float)inDefaultUnits;
return true;
case 6:
uncrtnty.UncertaintyOfCorrection = (float)inDefaultUnits;
return true;
default:
return false;
}
}
else
{
return false;
}
}
public void Unlock()
{
unlocked = true;
densityTextBox.Enabled = true;
temperatureTextBox.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
listViewEx.Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
public void OkBtnClicked()
{
if (DensityCfg != null)
{
try
{
double realDensity = Utils.ParseUDouble(densityTextBox.Text);
double atTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
global::Results.WMeterRsltItemSpec.RealDensity =
Config.Data.RealDensity = DensityCfg.RealDensity = realDensity;
global::Results.WMeterRsltItemSpec.AtTemperature =
Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature;
Component modified = DensityCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_density_parameter_Correct_pls,
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()
@ -115,10 +187,38 @@ namespace TBF.UI.Bench.Uncertainties
public void AddOne()
{
Uncertainty uncrtnty = new Uncertainty();
MeterEntity.Uncertainties.Add(uncrtnty);
AddOneLVI(uncrtnty);
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
public void RemoveSelected()
{
if (listViewEx.SelectedItems.Count != 1) return;
int removeItemNr = listViewEx.SelectedIndices[0];
Uncertainty selected =
(Uncertainty)listViewEx.SelectedItems[0].Tag;
if (selected.Id != 0) toBeRemoved.Add(selected);
MeterEntity.Corrections.RemoveAt(removeItemNr);
RefreshAll();
if (removeItemNr < listViewEx.Items.Count)
{
listViewEx.Focus();
listViewEx.Items[removeItemNr].Selected = true;
listViewEx.Items[removeItemNr].EnsureVisible();
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
}
public void MoveUpSelected()
@ -129,6 +229,34 @@ namespace TBF.UI.Bench.Uncertainties
{
}
/// <summary>
/// Event handler that indicates the selected item position
/// and updates 'Remove', 'Up' and 'Down' buttons in the parent dialog.
/// </summary>
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewEx.SelectedItems.Count != 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
}
else
{
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
}
}
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
{
return string.Empty;
@ -137,26 +265,5 @@ namespace TBF.UI.Bench.Uncertainties
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
{
}
private void densityTextBox_TextChanged(object sender, EventArgs e)
{
UpdateDensityCorrectionDisplay();
}
private void temperatureTextBox_TextChanged(object sender, EventArgs e)
{
UpdateDensityCorrectionDisplay();
}
void UpdateDensityCorrectionDisplay()
{
double density;
double temp;
if (Utils.TryParseUDouble(densityTextBox.Text, out density) &&
Utils.TryParseUDouble(temperatureTextBox.Text, out temp))
{
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString();
}
}
}
}

View File

@ -32,14 +32,12 @@ namespace TBF.UI.Bench.Uncertainties
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.densityCorrTextBox = new System.Windows.Forms.TextBox();
this.densityCorrLabel = new System.Windows.Forms.Label();
this.temperatureTextBox = new System.Windows.Forms.TextBox();
this.temperatureLabel = new System.Windows.Forms.Label();
this.densityTextBox = new System.Windows.Forms.TextBox();
this.densityLabel = new System.Windows.Forms.Label();
this.cmpntLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new global::Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
@ -53,79 +51,60 @@ namespace TBF.UI.Bench.Uncertainties
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.densityCorrTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityCorrLabel);
this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox);
this.splitContainer1.Panel1.Controls.Add(this.temperatureLabel);
this.splitContainer1.Panel1.Controls.Add(this.densityTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 120;
this.splitContainer1.TabIndex = 1;
this.splitContainer1.SplitterDistance = 40;
this.splitContainer1.TabIndex = 2;
//
// densityCorrTextBox
// componentLabel
//
this.densityCorrTextBox.Enabled = false;
this.densityCorrTextBox.Location = new System.Drawing.Point(185, 86);
this.densityCorrTextBox.Name = "densityCorrTextBox";
this.densityCorrTextBox.Size = new System.Drawing.Size(110, 20);
this.densityCorrTextBox.TabIndex = 5;
this.cmpntLabel.AutoSize = true;
this.cmpntLabel.Location = new System.Drawing.Point(14, 12);
this.cmpntLabel.Name = "componentLabel";
this.cmpntLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntLabel.TabIndex = 1;
this.cmpntLabel.Text = "Component:";
//
// densityCorrLabel
// cmpntNameLabel
//
this.densityCorrLabel.AutoSize = true;
this.densityCorrLabel.Location = new System.Drawing.Point(37, 89);
this.densityCorrLabel.Name = "densityCorrLabel";
this.densityCorrLabel.Size = new System.Drawing.Size(132, 13);
this.densityCorrLabel.TabIndex = 4;
this.densityCorrLabel.Text = "Density correction [kg/m3]";
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "componentName";
//
// temperatureTextBox
// listViewEx
//
this.temperatureTextBox.Enabled = false;
this.temperatureTextBox.Location = new System.Drawing.Point(185, 43);
this.temperatureTextBox.Name = "temperatureTextBox";
this.temperatureTextBox.Size = new System.Drawing.Size(110, 20);
this.temperatureTextBox.TabIndex = 3;
this.temperatureTextBox.TextChanged += new System.EventHandler(this.temperatureTextBox_TextChanged);
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(420, 256);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// temperatureLabel
//
this.temperatureLabel.AutoSize = true;
this.temperatureLabel.Location = new System.Drawing.Point(37, 46);
this.temperatureLabel.Name = "temperatureLabel";
this.temperatureLabel.Size = new System.Drawing.Size(112, 13);
this.temperatureLabel.TabIndex = 2;
this.temperatureLabel.Text = "@Temperature [degC]";
//
// densityTextBox
//
this.densityTextBox.Enabled = false;
this.densityTextBox.Location = new System.Drawing.Point(185, 17);
this.densityTextBox.Name = "densityTextBox";
this.densityTextBox.Size = new System.Drawing.Size(110, 20);
this.densityTextBox.TabIndex = 1;
this.densityTextBox.TextChanged += new System.EventHandler(this.densityTextBox_TextChanged);
//
// densityLabel
//
this.densityLabel.AutoSize = true;
this.densityLabel.Location = new System.Drawing.Point(37, 20);
this.densityLabel.Name = "densityLabel";
this.densityLabel.Size = new System.Drawing.Size(82, 13);
this.densityLabel.TabIndex = 0;
this.densityLabel.Text = "Density [kg/m3]";
//
// MetrologyDlgDensityTab
// UncertntDlgDensityTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgDensityTab";
this.Name = "UncertntDlgDensityTab";
this.Size = new System.Drawing.Size(420, 300);
this.Load += new System.EventHandler(this.MetrologyDlgDensityTab_Load);
this.Load += new System.EventHandler(this.UncertntDlgTempMeterTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
@ -135,11 +114,9 @@ namespace TBF.UI.Bench.Uncertainties
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox temperatureTextBox;
private System.Windows.Forms.Label temperatureLabel;
private System.Windows.Forms.TextBox densityTextBox;
private System.Windows.Forms.Label densityLabel;
private System.Windows.Forms.TextBox densityCorrTextBox;
private System.Windows.Forms.Label densityCorrLabel;
private System.Windows.Forms.Label cmpntLabel;
private System.Windows.Forms.Label cmpntNameLabel;
private global::Results.Forms.ListViewEx listViewEx;
}
}

View File

@ -79,8 +79,8 @@ namespace TBF.UI
this.benchPathsTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchTransitionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchMetrologyTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchConditionsTSMItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchUncertaintyTSMItem = new System.Windows.Forms.ToolStripMenuItem();
this.benchTestProfilesTSMItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.homeTSMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -138,7 +138,6 @@ namespace TBF.UI
((System.ComponentModel.ISupportInitialize)(this.rightHorizSplitContainer)).BeginInit();
this.rightHorizSplitContainer.Panel1.SuspendLayout();
this.rightHorizSplitContainer.SuspendLayout();
this.measurementTabPage.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.mainMenuStrip.SuspendLayout();
this.SuspendLayout();
@ -385,6 +384,11 @@ namespace TBF.UI
this.progressFlowLayoutPanel.BackColor = System.Drawing.SystemColors.Control;
this.progressFlowLayoutPanel.Name = "progressFlowLayoutPanel";
//
// measurementTabPage
//
resources.ApplyResources(this.measurementTabPage, "measurementTabPage");
this.measurementTabPage.Name = "measurementTabPage";
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -423,8 +427,8 @@ namespace TBF.UI
this.benchPathsTSMenuItem,
this.benchTransitionsToolStripMenuItem,
this.benchMetrologyTSMenuItem,
this.benchConditionsTSMItem,
this.benchUncertaintyTSMItem,
this.benchTestProfilesTSMItem,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.benchTSMenuItem.Name = "benchTSMenuItem";
@ -454,18 +458,18 @@ namespace TBF.UI
resources.ApplyResources(this.benchMetrologyTSMenuItem, "benchMetrologyTSMenuItem");
this.benchMetrologyTSMenuItem.Click += new System.EventHandler(this.benchMetrologyTSMItem_Click);
//
// benchConditionsTSMItem
//
this.benchConditionsTSMItem.Name = "benchConditionsTSMItem";
resources.ApplyResources(this.benchConditionsTSMItem, "benchConditionsTSMItem");
this.benchConditionsTSMItem.Click += new System.EventHandler(this.benchConditionsTSMItem_Click);
//
// benchUncertaintyTSMItem
//
this.benchUncertaintyTSMItem.Name = "benchUncertaintyTSMItem";
resources.ApplyResources(this.benchUncertaintyTSMItem, "benchUncertaintyTSMItem");
this.benchUncertaintyTSMItem.Click += new System.EventHandler(this.benchUncertaintyTSMItem_Click);
//
// benchTestProfilesTSMItem
//
this.benchTestProfilesTSMItem.Name = "benchTestProfilesTSMItem";
resources.ApplyResources(this.benchTestProfilesTSMItem, "benchTestProfilesTSMItem");
this.benchTestProfilesTSMItem.Click += new System.EventHandler(this.benchTestProfilesTSMItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -672,7 +676,6 @@ namespace TBF.UI
this.rightHorizSplitContainer.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.rightHorizSplitContainer)).EndInit();
this.rightHorizSplitContainer.ResumeLayout(false);
this.measurementTabPage.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.mainMenuStrip.ResumeLayout(false);
@ -773,7 +776,7 @@ namespace TBF.UI
private System.Windows.Forms.ToolStripMenuItem backUpTSMItem;
private System.Windows.Forms.ToolStripMenuItem backUpConfigTSMItem;
private System.Windows.Forms.ToolStripMenuItem backUpResultsTSMItem;
private System.Windows.Forms.ToolStripMenuItem benchConditionsTSMItem;
private System.Windows.Forms.ToolStripMenuItem benchTestProfilesTSMItem;
private System.Windows.Forms.ToolStripMenuItem benchUncertaintyTSMItem;
}
}

View File

@ -471,12 +471,12 @@ namespace TBF.UI
}
private void benchComponentsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Components.ComponentsManagerDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchPathsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Paths.PathsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchPathsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Paths.PathsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchTransitionsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Transitions.TransitionsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchMetrologyTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Metrology.MetrologyDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchConditionsTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Conditions.ConditionsDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchUncertaintyTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Uncertainties.UncertaintiesDlg().ShowDialog(); Cursor = Cursors.Default; }
private void proceduresTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Procedures.ProceduresDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchUncertaintyTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Bench.Uncertainties.UncertaintiesDlg().ShowDialog(); Cursor = Cursors.Default; }
private void benchTestProfilesTSMItem_Click(object s, EventArgs e){ Cursor = Cursors.WaitCursor; new TBF.UI.Bench.TestProfiles.TestProfilesDlg().ShowDialog(); Cursor = Cursors.Default; }
private void proceduresTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new TBF.UI.Procedures.ProceduresDlg().ShowDialog(); Cursor = Cursors.Default; }
private void usersTSMItem_Click(object s, EventArgs e)
{

File diff suppressed because it is too large Load Diff

View File

@ -664,14 +664,18 @@ namespace TBF.UI.Procedures
{
Name,
Part,
Qfrom,
#if TEST_PROFILES
Qtg,
#endif
Qfrom,
Qto,
Volume,
TestTime,
ErrLimLo,
ErrLimHi,
Method,
Repeats,
TempLimLo,
TempLimHi,
Method,
CoulumnsCount
}
@ -680,15 +684,18 @@ namespace TBF.UI.Procedures
ListViewEx lv = metrology1ListViewEx;
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_from_m3h, Width = 80 });
#if TEST_PROFILES
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_tg_m3h, Width = 80 });
#endif
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_from_m3h, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_to_m3h, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Volume + " [l]", Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_time_s_chdr, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 });
//lv.Columns.Add(new ColumnHeader { Text = Strings.Zeroing_chdr, Width = 50 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Method_chdr, Width = 200 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_hi_chdr), Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Method_chdr, Width = 200 });
methodCBox = new ComboBox();
foreach (var m in TestMethods) methodCBox.Items.Add(m.Cfg.Name);
@ -697,14 +704,18 @@ namespace TBF.UI.Procedures
{
new TextBox(), /// Name
new TextBox(), /// Part
#if TEST_PROFILES
new TextBox(), /// Qtg
#endif
new TextBox(), /// Qfrom
new TextBox(), /// Qto
new TextBox(), /// Volume
new TextBox(), /// Test time
new TextBox(), /// Err.Lim. -
new TextBox(), /// Err.Lim. +
new TextBox(), /// Temp.Lim. -
new TextBox(), /// Temp.Lim. +
methodCBox, /// Method
new TextBox(), /// Repeats count
};
foreach (var ctrl in metrology1Editors)
@ -732,15 +743,18 @@ namespace TBF.UI.Procedures
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
#if TEST_PROFILES
lvi.SubItems.Add(test.Qtg.ToString()); /// Q_tg (target flow)
#endif
lvi.SubItems.Add(test.Qfrom.ToString()); /// Q_from
lvi.SubItems.Add(test.Qto.ToString()); /// Q_to
lvi.SubItems.Add(test.Volume.ToString()); /// VOlume
lvi.SubItems.Add(test.TstTime.ToString());
lvi.SubItems.Add(test.ErrLimLo.ToString());
lvi.SubItems.Add(test.ErrLimHi.ToString());
//lvi.SubItems.Add(test.Zeroing ? Strings.yes : Strings.no);
lvi.SubItems.Add(test.TempLimLo.ToString());
lvi.SubItems.Add(test.TempLimHi.ToString());
lvi.SubItems.Add((test.Method != null) ? test.Method.ToString() : string.Empty);
lvi.SubItems.Add(test.Repeats.ToString());
metrology1ListViewEx.Items.Add(lvi);
}
@ -766,27 +780,32 @@ namespace TBF.UI.Procedures
}
float tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qfrom].Text, out tmp)) entity.Qfrom = tmp;
#if TEST_PROFILES
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qtg].Text, out tmp)) entity.Qtg = tmp;
#endif
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qfrom].Text, out tmp)) entity.Qfrom = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Qto].Text, out tmp)) entity.Qto = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Volume].Text, out tmp)) entity.Volume = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TestTime].Text,out tmp)) entity.TstTime = tmp;
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp;
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
if (methodCBox.Items.Contains(lvi.SubItems[(int)MtrlgyClmn.Method].Text))
{
entity.Method = lvi.SubItems[(int)MtrlgyClmn.Method].Text;
}
int itmp;
if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Repeats].Text, out itmp)) entity.Repeats = itmp;
}
}
private void metrology1ListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && (e.SubItem < (int)MtrlgyClmn.CoulumnsCount))
#if TEST_PROFILES
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
#endif
if (unlocked && (e.SubItem < (int)MtrlgyClmn.CoulumnsCount))
{
metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
}
@ -794,6 +813,9 @@ namespace TBF.UI.Procedures
void metrology1ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
{
#if TEST_PROFILES
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
#endif
if (!unlocked || e.SubItem >= (int)MtrlgyClmn.CoulumnsCount) return;
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
@ -842,21 +864,23 @@ namespace TBF.UI.Procedures
}
}
if ((e.SubItem == (int)MtrlgyClmn.Repeats) && !int.TryParse(e.DisplayText, out dummy))
{
#if TEST_PROFILES
float fdummy;
if ((e.SubItem == (int)MtrlgyClmn.Qtg) && !Utils.TryParseUFloat(e.DisplayText, out fdummy))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
#endif
if ((e.SubItem != (int)MtrlgyClmn.Qfrom) &&
if ((e.SubItem != (int)MtrlgyClmn.Qfrom) &&
(e.SubItem != (int)MtrlgyClmn.Qto) &&
(e.SubItem != (int)MtrlgyClmn.Volume) &&
(e.SubItem != (int)MtrlgyClmn.TestTime))
{
return;
}
float Qfrom = 1.0f;
float Qto = 1.0f;
float volume = 0.0f;
@ -918,9 +942,8 @@ namespace TBF.UI.Procedures
Name,
Part,
Uncertainty,
ControlWaterTemp,
TempLimLo,
TempLimHi,
Repeats,
ControlWaterTemp,
ShortPulses,
Publish,
Evaluate,
@ -935,15 +958,11 @@ namespace TBF.UI.Procedures
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Uncertainty_pct_chdr, Width = 90 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Control_water_temp_chdr, Width = 110 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_hi_chdr), Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Control_water_temp_chdr, Width = 110 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Short_pulses, Width = 100 }); /// Strings.Tol_red_pct_chdr
lv.Columns.Add(new ColumnHeader { Text = Strings.Publish, Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Evaluate, Width = 100 });
//lv.Columns.Add(new ColumnHeader { Text = Strings.Red_type_chdr, Width = 80 });
//lv.Columns.Add(new ColumnHeader { Text = Strings.Err_cor_neg_pct_chdr, Width = 90 });
//lv.Columns.Add(new ColumnHeader { Text = Strings.Err_cor_pos_pct_chdr, Width = 90 });
ComboBox publishCBox = new ComboBox(); /// control for Publish
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
@ -964,9 +983,8 @@ namespace TBF.UI.Procedures
new TextBox(), /// Name
new TextBox(), /// Part
new TextBox(), /// Uncertainty
new TextBox(), /// Repeats count
yesNo2CBox, /// Control water temp.
new TextBox(), /// Temp. lim. lo
new TextBox(), /// Temp. lim. hi
new TextBox(), /// Short pulses
publishCBox, /// Publish
yesNo3CBox, /// Evaluate
@ -998,9 +1016,8 @@ namespace TBF.UI.Procedures
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
lvi.SubItems.Add(test.Uncertainty.ToString());
lvi.SubItems.Add(test.Repeats.ToString());
lvi.SubItems.Add(test.DoControlWaterTemp ? Strings.yes : Strings.no);
lvi.SubItems.Add(test.TempLimLo.ToString());
lvi.SubItems.Add(test.TempLimHi.ToString());
lvi.SubItems.Add(test.TolerRed.ToString());
lvi.SubItems.Add(((Config.Entities.Publish)test.Publish).ToDescription());
lvi.SubItems.Add(test.DoEvaluate ? Strings.yes : Strings.no);
@ -1012,42 +1029,32 @@ namespace TBF.UI.Procedures
{
for (int i = 0; i < metrology2ListViewEx.Items.Count; i++)
{
ListViewItem lvi = metrology2ListViewEx.Items[i];
Test entity = (Test)lvi.Tag;
try
{
ListViewItem lvi = metrology2ListViewEx.Items[i];
Test entity = (Test)lvi.Tag;
entity.ItemNr = i;
entity.Name = lvi.SubItems[(int)Mtrlgy2Clmn.Name].Text;
entity.Part = lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text.Equals("-") ? 0 : int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text);
entity.Uncertainty = Utils.ParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Uncertainty].Text);
entity.Repeats = int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.Repeats].Text);
entity.DoControlWaterTemp = lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.yes);
entity.TolerRed = (double)Utils.ParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.ShortPulses].Text);
entity.DoEvaluate = lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.yes);
entity.Name = lvi.Text;
entity.ItemNr = i;
int part = entity.Part;
if (lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text.Equals("-"))
{
entity.Part = 0;
}
else if (int.TryParse(lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text, out part))
{
entity.Part = part;
}
if (lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.yes)) entity.DoControlWaterTemp = true;
else if (lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.no)) entity.DoControlWaterTemp = false;
float tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Uncertainty].Text, out tmp)) entity.Uncertainty = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.ShortPulses].Text, out tmp)) entity.TolerRed = (double)tmp;
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
{
if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(pb.ToDescription()))
{
entity.Publish = (sbyte)pb;
break;
}
}
if (lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.yes)) entity.DoEvaluate = true;
else if (lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.no)) entity.DoEvaluate = false;
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
{
if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(pb.ToDescription()))
{
entity.Publish = (sbyte)pb;
break;
}
}
}
catch (Exception exc)
{
MessageBox.Show(string.Format("Unexpected problem: {0}", exc.Message));
}
}
}
@ -1102,20 +1109,6 @@ namespace TBF.UI.Procedures
}
}
if ((e.SubItem == (int)Mtrlgy2Clmn.ControlWaterTemp) && !(metrology2Editors[(int)Mtrlgy2Clmn.ControlWaterTemp] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
if ((e.SubItem == (int)Mtrlgy2Clmn.Evaluate) && !(metrology2Editors[(int)Mtrlgy2Clmn.Evaluate] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
int dummy;
if (e.SubItem == (int)Mtrlgy2Clmn.Part)
{
@ -1127,15 +1120,32 @@ namespace TBF.UI.Procedures
return; /// NOK
}
}
if (e.SubItem == (int)Mtrlgy2Clmn.Publish)
if ((e.SubItem == (int)Mtrlgy2Clmn.Repeats) && !int.TryParse(e.DisplayText, out dummy))
{
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
{
if (e.DisplayText.Equals(pb.ToDescription())) return;
}
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return; /// NOK
return;
}
float fdummy;
if ((e.SubItem == (int)Mtrlgy2Clmn.ShortPulses) && !Utils.TryParseUFloat(e.DisplayText, out fdummy))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
/// Combo boxes
if ((e.SubItem == (int)Mtrlgy2Clmn.ControlWaterTemp) || (e.SubItem == (int)Mtrlgy2Clmn.Publish) || (e.SubItem == (int)Mtrlgy2Clmn.Evaluate))
{
if (!(metrology2Editors[e.SubItem] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
}

View File

@ -611,9 +611,15 @@ namespace TBF.UI.Settings
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;",
};
string[] resultsDbCommands = new string[]
{
"ALTER TABLE `testrslt` ADD `Uncertnt` FLOAT NOT NULL DEFAULT '0' AFTER `FlowMax`, ADD `UncertntScale` FLOAT NOT NULL DEFAULT '0' AFTER `Uncertnt`, ADD `UncertntDensity` FLOAT NOT NULL DEFAULT '0' AFTER `UncertntScale`, ADD `UncertntTemp` FLOAT NOT NULL DEFAULT '0' AFTER `UncertntDensity`, ADD `UncertntPressure` FLOAT NOT NULL DEFAULT '0' AFTER `UncertntTemp`;",
};
ActivityStart();
if (!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands))
if ((!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) &&
(!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands)))
{
ActivityEnd();
MessageBox.Show("DB succesfully upgraded." + Environment.NewLine +