PTest.FlowId, ProfileType.CompoundQ3RQnClass... added, clean-up, DB 3.8 => 3.9, ver. 3.9.2118

This commit is contained in:
Milan Hanajik 2023-10-31 14:22:57 +01:00
parent 45d138ece3
commit 4fd9030812
16 changed files with 669 additions and 291 deletions

View File

@ -199,13 +199,56 @@ namespace Common
QnClassColdWater,
QnClassHotWater,
QpQi,
Q3RCompound,
QnClassCompound,
QpQiCompound,
CompoundQ3RQ3R,
CompoundQnClassQnClass,
CompoundQ3RQnClass,
CompoundQnClassQ3R,
CompoundQpQiQpQi,
Manual,
Count,
}
public enum FlowId
{
Any,
Q4,
Q3,
Q2,
Q1,
Q4Main,
Q3Main,
Q2Main,
Q1Main,
Q4Aux,
Q3Aux,
Q2Aux,
Q1Aux,
Qmax,
Qn,
Qt,
Qmin,
QmaxMain,
QnMain,
QtMain,
QminMain,
QmaxAux,
QnAux,
QtAux,
QminAux,
Qp,
Qp10,
Qi,
QpMain,
Qp10Main,
QiMain,
QpAux,
Qp10Aux,
QiAux,
Qdetected,
Qfall,
Qrise,
}
public enum ErrorLimitType
{
Manual,

View File

@ -20,19 +20,23 @@ namespace Common
return (format == "F0") ? value.ToString("F0") : value.ToString(format).TrimEnd(new char[] { '0' });
}
public static FlowNames ProfileType2FlowNames(ProfileType pt)
public static FlowNames ProfileType2FlowNames(ProfileType pt, bool isAux = false)
{
switch (pt)
{
case ProfileType.Q3R:
case ProfileType.Q3RCompound:
case ProfileType.CompoundQ3RQ3R:
return FlowNames.Q3Q2Q1;
case ProfileType.CompoundQ3RQnClass:
return isAux ? FlowNames.QnQtQmin : FlowNames.Q3Q2Q1;
case ProfileType.QnClassColdWater:
case ProfileType.QnClassHotWater:
case ProfileType.QnClassCompound:
case ProfileType.CompoundQnClassQnClass:
return FlowNames.QnQtQmin;
case ProfileType.CompoundQnClassQ3R:
return isAux ? FlowNames.Q3Q2Q1 : FlowNames.QnQtQmin;
case ProfileType.QpQi:
case ProfileType.QpQiCompound:
case ProfileType.CompoundQpQiQpQi:
return FlowNames.QpQi;
default:
return FlowNames.Q3Q2Q1;

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
@ -16,7 +16,9 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
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 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 FlowId FlowId { get; set; }
public virtual double CoefQfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual double CoefQto { get; set; } /// Water flow high limit in [m3/h]
public virtual double ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
@ -186,6 +188,7 @@ namespace Config.Entities
output.WriteLine(Name);
output.WriteLine(Part);
output.WriteLine(((ushort)FlowId).ToString(ci));
output.WriteLine(CoefQfrom.ToString(ci));
output.WriteLine(CoefQto.ToString(ci));
output.WriteLine(ErrLimLo.ToString(ci));
@ -245,6 +248,7 @@ namespace Config.Entities
tst.Name = firstLine;
tst.Part = int.Parse(input.ReadLine());
tst.FlowId = (FlowId)ushort.Parse(input.ReadLine(), ci);
tst.CoefQfrom = double.Parse(input.ReadLine(), ci);
tst.CoefQto = double.Parse(input.ReadLine(), ci);
tst.ErrLimLo = double.Parse(input.ReadLine(), ci);
@ -306,6 +310,7 @@ namespace Config.Entities
if (Name != firstLine) { diff.AppendFormat(fmt, "Name", Name, firstLine); };
ln = inp.ReadLine(); if (ln != Part.ToString()) { diff.AppendFormat(fmt, "Part", Part.ToString(), ln); };
ln = inp.ReadLine(); if (ln != ((ushort)FlowId).ToString()){diff.AppendFormat(fmt, "FlowId", ((ushort)FlowId).ToString(), ln); };
ln = inp.ReadLine(); if (ln != CoefQfrom.ToString(ci)) { diff.AppendFormat(fmt, "CoefQfrom", CoefQfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != CoefQto.ToString(ci)) { diff.AppendFormat(fmt, "CoefQto", CoefQto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != ErrLimLo.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimLo", ErrLimLo.ToString(ci), ln); };

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
@ -14,6 +14,7 @@ namespace Config.Mappings
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
Map(x => x.FlowId);
Map(x => x.CoefQfrom);
Map(x => x.CoefQto);
Map(x => x.ErrLimLo);

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.8.2114.0")]
[assembly: AssemblyFileVersion("3.8.2114.0")]
[assembly: AssemblyVersion("3.9.2118.0")]
[assembly: AssemblyFileVersion("3.9.2118.0")]

View File

@ -55,8 +55,9 @@ namespace TBF.Rig
/// Public components
public static ControlBoard.IControlBoard ControlBoard;
public static TestMethods.CombinedWithDetection.TestMethod QriseQfallDetection;
public static GenericDevices.IAmbient Ambient;
public static TestMethods.CombinedWithDetection.TestMethod QriseDetection;
public static TestMethods.CombinedWithDetection.TestMethod QfallDetection;
public static GenericDevices.IAmbient Ambient;
public static IOperation BenchWaitingOp;
public static IOperation BenchErrorOp;
public static GenericDevices.IScaleOrTank Tank1;
@ -232,9 +233,16 @@ namespace TBF.Rig
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
if (cmpnt is IStatisticsMonitoring) ProcessData.StatisticsMonitoringComp = cmpnt as IStatisticsMonitoring;
if (cmpnt is TestMethods.CombinedWithDetection.TestMethod && QriseQfallDetection == null)
if (cmpnt is TestMethods.CombinedWithDetection.TestMethod)
{
QriseQfallDetection = cmpnt as TestMethods.CombinedWithDetection.TestMethod;
if ((cmpnt as TestMethods.CombinedWithDetection.TestMethod).IsRise)
{
if (QriseDetection == null) QriseDetection = cmpnt as TestMethods.CombinedWithDetection.TestMethod;
}
else
{
if (QfallDetection == null) QfallDetection = cmpnt as TestMethods.CombinedWithDetection.TestMethod;
}
}
if (cmpnt is SchematicDrawing.IDrawingItCmpntWithMeasuredVal)

View File

@ -21,8 +21,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
return CombinedWithDetectionSeq.CheckDeviceCaps(test, devices, out message);
}
readonly TestMethodCfg testMethodCfg;
public bool IsRise { get { return testMethodCfg != null ? testMethodCfg.IsRise : false; } }
public TestMethod() { }
///

View File

@ -124,6 +124,8 @@ namespace TBF.UI.Bench.TestProfiles
profileTypeRadioButton6.Enabled = false;
profileTypeRadioButton7.Enabled = false;
profileTypeRadioButton8.Enabled = false;
profileTypeRadioButton9.Enabled = false;
profileTypeRadioButton10.Enabled = false;
errorCalculationRadioButton1.Enabled = false;
errorCalculationRadioButton2.Enabled = false;
@ -190,10 +192,12 @@ namespace TBF.UI.Bench.TestProfiles
case ProfileType.QnClassColdWater: profileTypeRadioButton2.Checked = true; break;
case ProfileType.QnClassHotWater: profileTypeRadioButton3.Checked = true; break;
case ProfileType.QpQi: profileTypeRadioButton4.Checked = true; break;
case ProfileType.Q3RCompound: profileTypeRadioButton5.Checked = true; break;
case ProfileType.QnClassCompound: profileTypeRadioButton6.Checked = true; break;
case ProfileType.QpQiCompound: profileTypeRadioButton7.Checked = true; break;
case ProfileType.Manual: profileTypeRadioButton8.Checked = true; break;
case ProfileType.CompoundQ3RQ3R: profileTypeRadioButton5.Checked = true; break;
case ProfileType.CompoundQnClassQnClass: profileTypeRadioButton6.Checked = true; break;
case ProfileType.CompoundQ3RQnClass: profileTypeRadioButton7.Checked = true; break;
case ProfileType.CompoundQnClassQ3R: profileTypeRadioButton8.Checked = true; break;
case ProfileType.CompoundQpQiQpQi: profileTypeRadioButton9.Checked = true; break;
case ProfileType.Manual: profileTypeRadioButton10.Checked = true; break;
}
switch (LoadedProfile.ErrorLimitType)
@ -212,13 +216,15 @@ namespace TBF.UI.Bench.TestProfiles
LoadedProfile.Description = descriptionTextBox.Text;
LoadedProfile.ProfileType = profileTypeRadioButton1.Checked ? ProfileType.Q3R :
(profileTypeRadioButton2.Checked ? ProfileType.QnClassColdWater :
(profileTypeRadioButton3.Checked ? ProfileType.QnClassHotWater :
(profileTypeRadioButton4.Checked ? ProfileType.QpQi :
(profileTypeRadioButton5.Checked ? ProfileType.Q3RCompound :
(profileTypeRadioButton6.Checked ? ProfileType.QnClassCompound :
(profileTypeRadioButton7.Checked ? ProfileType.QpQiCompound
: ProfileType.Manual))))));
profileTypeRadioButton2.Checked ? ProfileType.QnClassColdWater :
profileTypeRadioButton3.Checked ? ProfileType.QnClassHotWater :
profileTypeRadioButton4.Checked ? ProfileType.QpQi :
profileTypeRadioButton5.Checked ? ProfileType.CompoundQ3RQ3R :
profileTypeRadioButton6.Checked ? ProfileType.CompoundQnClassQnClass :
profileTypeRadioButton7.Checked ? ProfileType.CompoundQ3RQnClass :
profileTypeRadioButton8.Checked ? ProfileType.CompoundQnClassQ3R :
profileTypeRadioButton9.Checked ? ProfileType.CompoundQpQiQpQi
: ProfileType.Manual;
LoadedProfile.ErrorLimitType = errorCalculationRadioButton1.Checked ? ErrorLimitType.Manual
: ErrorLimitType.QpClass;
@ -884,6 +890,8 @@ namespace TBF.UI.Bench.TestProfiles
profileTypeRadioButton6.Enabled = true;
profileTypeRadioButton7.Enabled = true;
profileTypeRadioButton8.Enabled = true;
profileTypeRadioButton9.Enabled = true;
profileTypeRadioButton10.Enabled = true;
errorCalculationRadioButton1.Enabled = true;
errorCalculationRadioButton2.Enabled = true;
@ -1090,9 +1098,11 @@ namespace TBF.UI.Bench.TestProfiles
(nameId > 4 && LoadedProfile.ProfileType == ProfileType.QnClassColdWater) ||
(nameId > 4 && LoadedProfile.ProfileType == ProfileType.QnClassHotWater) ||
(nameId > 3 && LoadedProfile.ProfileType == ProfileType.QpQi) ||
(nameId > 7 && LoadedProfile.ProfileType == ProfileType.Q3RCompound) ||
(nameId > 7 && LoadedProfile.ProfileType == ProfileType.QnClassCompound) ||
(nameId > 6 && LoadedProfile.ProfileType == ProfileType.QpQiCompound) ||
(nameId > 8 && LoadedProfile.ProfileType == ProfileType.CompoundQ3RQ3R) ||
(nameId > 8 && LoadedProfile.ProfileType == ProfileType.CompoundQnClassQnClass) ||
(nameId > 8 && LoadedProfile.ProfileType == ProfileType.CompoundQ3RQnClass) ||
(nameId > 8 && LoadedProfile.ProfileType == ProfileType.CompoundQnClassQ3R) ||
(nameId > 6 && LoadedProfile.ProfileType == ProfileType.CompoundQpQiQpQi) ||
LoadedProfile.ProfileType == ProfileType.Manual)
{
newName = Strings.New_test_name + nameId.ToString();
@ -1103,46 +1113,83 @@ namespace TBF.UI.Bench.TestProfiles
{
default:
case ProfileType.Q3R:
newName = string.Format("Q{0}", 5 - nameId);
newName = (nameId == 1) ? "Q4"
: (nameId == 2) ? "Q3"
: (nameId == 3) ? "Q2"
: "Q1";
break;
case ProfileType.QnClassColdWater:
case ProfileType.QnClassHotWater:
newName = (nameId == 1) ? "Qmax" : (nameId == 2) ? "Qn" : (nameId == 3) ? "Qt" : "Qmin";
newName = (nameId == 1) ? "Qmax"
: (nameId == 2) ? "Qn"
: (nameId == 3) ? "Qt"
: "Qmin";
break;
case ProfileType.QpQi:
newName = (nameId == 1) ? "qp" : (nameId == 2) ? "0,1qp" : "qi";
newName = (nameId == 1) ? "qp"
: (nameId == 2) ? "0,1qp"
: "qi";
break;
case ProfileType.Q3RCompound:
case ProfileType.CompoundQ3RQ3R:
newName = (nameId == 1) ? string.Format("Q4{0}", Strings._main)
: (nameId == 2) ? string.Format("Q3{0}", Strings._main)
: (nameId == 3) ? string.Format("Q2{0}", Strings._main)
: (nameId == 4) ? "Qrise-10%"
: (nameId == 5) ? "Qfall+10%"
: (nameId == 6) ? string.Format("Q2{0}", Strings._aux)
: (nameId == 4) ? string.Format("Q1{0}", Strings._main)
: (nameId == 5) ? "Qrise-10%"
: (nameId == 6) ? "Qfall+10%"
: (nameId == 7) ? string.Format("Q2{0}", Strings._aux)
: string.Format("Q1{0}", Strings._aux);
break;
case ProfileType.QnClassCompound:
case ProfileType.CompoundQnClassQnClass:
newName = (nameId == 1) ? string.Format("Qmax{0}", Strings._main)
: (nameId == 2) ? string.Format("Qn{0}", Strings._main)
: (nameId == 3) ? string.Format("Qt{0}", Strings._main)
: (nameId == 4) ? "Qrise-10%"
: (nameId == 5) ? "Qfall+10%"
: (nameId == 6) ? string.Format("Qt{0}", Strings._aux)
: (nameId == 4) ? string.Format("Qmin{0}", Strings._main)
: (nameId == 5) ? "Qrise-10%"
: (nameId == 6) ? "Qfall+10%"
: (nameId == 7) ? string.Format("Qt{0}", Strings._aux)
: string.Format("Qmin{0}", Strings._aux);
break;
case ProfileType.QpQiCompound:
newName = (nameId == 1) ? "qp_main" : (nameId == 2) ? "0,1qp_main" : (nameId == 3) ? "Qrise-10%" : (nameId == 4) ? "Qfall+10%" : (nameId == 5) ? "0,1qp_aux" : "qi_aux";
case ProfileType.CompoundQ3RQnClass:
newName = (nameId == 1) ? string.Format("Q4{0}", Strings._main)
: (nameId == 2) ? string.Format("Q3{0}", Strings._main)
: (nameId == 3) ? string.Format("Q2{0}", Strings._main)
: (nameId == 4) ? string.Format("Q1{0}", Strings._main)
: (nameId == 5) ? "Qrise-10%"
: (nameId == 6) ? "Qfall+10%"
: (nameId == 7) ? string.Format("Qt{0}", Strings._aux)
: string.Format("Qmin{0}", Strings._aux);
break;
case ProfileType.CompoundQnClassQ3R:
newName = (nameId == 1) ? string.Format("Qmax{0}", Strings._main)
: (nameId == 2) ? string.Format("Qn{0}", Strings._main)
: (nameId == 3) ? string.Format("Qt{0}", Strings._main)
: (nameId == 4) ? string.Format("Qmin{0}", Strings._main)
: (nameId == 5) ? "Qrise-10%"
: (nameId == 6) ? "Qfall+10%"
: (nameId == 7) ? string.Format("Q2{0}", Strings._aux)
: string.Format("Q1{0}", Strings._aux);
break;
case ProfileType.CompoundQpQiQpQi:
newName = (nameId == 1) ? "qp_main"
: (nameId == 2) ? "0,1qp_main"
: (nameId == 3) ? "Qrise-10%"
: (nameId == 4) ? "Qfall+10%"
: (nameId == 5) ? "0,1qp_aux"
: "qi_aux";
break;
}
}
bool notUsed = true;
foreach (var t in LoadedProfile.Tests) if (t.Name.Equals(newName)) notUsed = false;
foreach (var ptest in LoadedProfile.Tests) if (ptest.Name.Equals(newName)) notUsed = false;
if (notUsed) break;
}
@ -1150,92 +1197,152 @@ namespace TBF.UI.Bench.TestProfiles
/// Add a profile test
///
int count = listViewEx.Items.Count;
PTest ptest = new PTest(newName, count, LoadedProfile);
PTest t = new PTest(newName, count, LoadedProfile);
///
/// Upper and lower limits of flow
/// Set appropriate profile test parameters
///
switch (LoadedProfile.ProfileType)
{
case ProfileType.Q3R:
switch (count)
{
default:
case 0: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q4; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q3; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q2; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Q1; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.QnClassColdWater:
switch (count)
{
default:
case 0: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Qmax; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Qn; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Qt; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qmin; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.QnClassHotWater:
ptest.CoefQfrom = (count < 2) ? 0.9 : 1.0;
ptest.CoefQto = (count < 2) ? 1.0 : 1.1;
switch (count)
{
default:
case 0: t.ErrLimLo = -3; t.ErrLimHi = 3; t.FlowId = FlowId.Qmax; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -3; t.ErrLimHi = 3; t.FlowId = FlowId.Qn; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -3; t.ErrLimHi = 3; t.FlowId = FlowId.Qt; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qmin; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.QpQi:
ptest.CoefQfrom = (count < 1) ? 0.9 : 1.0;
ptest.CoefQto = (count < 1) ? 1.0 : 1.1;
switch (count)
{
default:
case 0: t.FlowId = FlowId.Qp; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.FlowId = FlowId.Qp10; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 2: t.FlowId = FlowId.Qi; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.Q3RCompound:
case ProfileType.QnClassCompound:
ptest.CoefQfrom = (count < 2) ? 0.9 : (count == 3) ? 0.825 : (count == 4) ? 1.1 : 1.0;
ptest.CoefQto = (count < 2) ? 1.0 : (count == 3) ? 0.91 : (count == 4) ? 1.21 : 1.1;
case ProfileType.CompoundQ3RQ3R:
switch (count)
{
default:
case 0: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q4Main; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q3Main; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q2Main; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Q1Main; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 4: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qrise; t.CoefQfrom = 0.825; t.CoefQto = 0.91; break;
case 5: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qfall; t.CoefQfrom = 1.1; t.CoefQto = 1.21; break;
case 6: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Q2Aux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 7: t.ErrLimLo = -10; t.ErrLimHi = 10; t.FlowId = FlowId.Q1Aux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.QpQiCompound:
ptest.CoefQfrom = (count < 1) ? 0.9 : (count == 2) ? 0.825 : (count == 3) ? 1.1 : 1.0;
ptest.CoefQto = (count < 1) ? 1.0 : (count == 2) ? 0.91 : (count == 3) ? 1.21 : 1.1;
case ProfileType.CompoundQnClassQnClass:
switch (count)
{
default:
case 0: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.QmaxMain; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.QnMain; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.QtMain; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.QminMain; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 4: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qrise; t.CoefQfrom = 0.825; t.CoefQto = 0.91; break;
case 5: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qfall; t.CoefQfrom = 1.1; t.CoefQto = 1.21; break;
case 6: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.QtAux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 7: t.ErrLimLo = -10; t.ErrLimHi = 10; t.FlowId = FlowId.QminAux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.CompoundQ3RQnClass:
switch (count)
{
default:
case 0: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q4Main; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q3Main; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.Q2Main; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Q1Main; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 4: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qrise; t.CoefQfrom = 0.825; t.CoefQto = 0.91; break;
case 5: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qfall; t.CoefQfrom = 1.1; t.CoefQto = 1.21; break;
case 6: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.QtAux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 7: t.ErrLimLo = -10; t.ErrLimHi = 10; t.FlowId = FlowId.QminAux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.CompoundQnClassQ3R:
switch (count)
{
default:
case 0: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.QmaxMain; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.QnMain; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 2: t.ErrLimLo = -2; t.ErrLimHi = 2; t.FlowId = FlowId.QtMain; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 3: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.QminMain; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 4: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qrise; t.CoefQfrom = 0.825; t.CoefQto = 0.91; break;
case 5: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Qfall; t.CoefQfrom = 1.1; t.CoefQto = 1.21; break;
case 6: t.ErrLimLo = -5; t.ErrLimHi = 5; t.FlowId = FlowId.Q2Aux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 7: t.ErrLimLo = -10; t.ErrLimHi = 10; t.FlowId = FlowId.Q1Aux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
case ProfileType.CompoundQpQiQpQi:
switch (count)
{
default:
case 0: t.FlowId = FlowId.QpMain; t.CoefQfrom = 0.9; t.CoefQto = 1.0; break;
case 1: t.FlowId = FlowId.Qp10Main; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 2: t.FlowId = FlowId.Qrise; t.CoefQfrom = 0.825; t.CoefQto = 0.91; break;
case 3: t.FlowId = FlowId.Qfall; t.CoefQfrom = 1.1; t.CoefQto = 1.21; break;
case 4: t.FlowId = FlowId.Qp10Aux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
case 5: t.FlowId = FlowId.QiAux; t.CoefQfrom = 1.0; t.CoefQto = 1.1; break;
}
break;
}
///
/// Upper and lower limits of relative error
///
switch (LoadedProfile.ProfileType)
if ((((LoadedProfile.ProfileType == ProfileType.CompoundQ3RQ3R ||
LoadedProfile.ProfileType == ProfileType.CompoundQnClassQnClass ||
LoadedProfile.ProfileType == ProfileType.CompoundQ3RQnClass ||
LoadedProfile.ProfileType == ProfileType.CompoundQnClassQ3R) && count == 4) ||
(LoadedProfile.ProfileType == ProfileType.CompoundQpQiQpQi && count == 2)) && Rig.StateMachine.QriseDetection != null)
{
case ProfileType.Q3R:
case ProfileType.QnClassColdWater:
switch (count)
{
default:
case 0: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break;
case 1: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break;
case 2: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break;
case 3: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break;
}
break;
case ProfileType.QnClassHotWater:
switch (count)
{
default:
case 0: ptest.ErrLimLo = -3; ptest.ErrLimHi = 3; break;
case 1: ptest.ErrLimLo = -3; ptest.ErrLimHi = 3; break;
case 2: ptest.ErrLimLo = -3; ptest.ErrLimHi = 3; break;
case 3: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break;
}
break;
case ProfileType.Q3RCompound:
case ProfileType.QnClassCompound:
switch (count)
{
default:
case 0: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break;
case 1: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break;
case 2: ptest.ErrLimLo = -2; ptest.ErrLimHi = 2; break;
case 3: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break;
case 4: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break;
case 5: ptest.ErrLimLo = -5; ptest.ErrLimHi = 5; break;
case 6: ptest.ErrLimLo = -10; ptest.ErrLimHi = 10; break;
}
break;
t.Method = Rig.StateMachine.QriseDetection.Name;
}
if (Rig.StateMachine.QriseQfallDetection != null &&
(((LoadedProfile.ProfileType == ProfileType.Q3RCompound || LoadedProfile.ProfileType == ProfileType.QnClassCompound) && (count == 3 || count == 4)) ||
(LoadedProfile.ProfileType == ProfileType.QpQiCompound && (count == 2 || count == 3))))
if ((((LoadedProfile.ProfileType == ProfileType.CompoundQ3RQ3R ||
LoadedProfile.ProfileType == ProfileType.CompoundQnClassQnClass ||
LoadedProfile.ProfileType == ProfileType.CompoundQ3RQnClass ||
LoadedProfile.ProfileType == ProfileType.CompoundQnClassQ3R) && count == 5) ||
(LoadedProfile.ProfileType == ProfileType.CompoundQpQiQpQi && count == 3)) && Rig.StateMachine.QfallDetection != null)
{
ptest.Method = Rig.StateMachine.QriseQfallDetection.Name;
t.Method = Rig.StateMachine.QfallDetection.Name;
}
LoadedProfile.Tests.Add(ptest);
AddToMetrologyTab(ptest);
AddToErrorFlagsTab(ptest);
AddToErrorFlags2Tab(ptest);
LoadedProfile.Tests.Add(t);
AddToMetrologyTab(t);
AddToErrorFlagsTab(t);
AddToErrorFlags2Tab(t);
if (listViewEx != null)
{

View File

@ -39,6 +39,8 @@ namespace TBF.UI.Bench.TestProfiles
this.errorCalculationRadioButton2 = new System.Windows.Forms.RadioButton();
this.errorCalculationRadioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.profileTypeRadioButton10 = new System.Windows.Forms.RadioButton();
this.profileTypeRadioButton9 = new System.Windows.Forms.RadioButton();
this.profileTypeRadioButton8 = new System.Windows.Forms.RadioButton();
this.profileTypeRadioButton7 = new System.Windows.Forms.RadioButton();
this.profileTypeRadioButton6 = new System.Windows.Forms.RadioButton();
@ -148,6 +150,8 @@ namespace TBF.UI.Bench.TestProfiles
//
// groupBox1
//
this.groupBox1.Controls.Add(this.profileTypeRadioButton10);
this.groupBox1.Controls.Add(this.profileTypeRadioButton9);
this.groupBox1.Controls.Add(this.profileTypeRadioButton8);
this.groupBox1.Controls.Add(this.profileTypeRadioButton7);
this.groupBox1.Controls.Add(this.profileTypeRadioButton6);
@ -160,6 +164,20 @@ namespace TBF.UI.Bench.TestProfiles
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// profileTypeRadioButton10
//
resources.ApplyResources(this.profileTypeRadioButton10, "profileTypeRadioButton10");
this.profileTypeRadioButton10.Name = "profileTypeRadioButton10";
this.profileTypeRadioButton10.TabStop = true;
this.profileTypeRadioButton10.UseVisualStyleBackColor = true;
//
// profileTypeRadioButton9
//
resources.ApplyResources(this.profileTypeRadioButton9, "profileTypeRadioButton9");
this.profileTypeRadioButton9.Name = "profileTypeRadioButton9";
this.profileTypeRadioButton9.TabStop = true;
this.profileTypeRadioButton9.UseVisualStyleBackColor = true;
//
// profileTypeRadioButton8
//
resources.ApplyResources(this.profileTypeRadioButton8, "profileTypeRadioButton8");
@ -402,5 +420,7 @@ namespace TBF.UI.Bench.TestProfiles
private System.Windows.Forms.RadioButton errorCalculationRadioButton2;
private System.Windows.Forms.TabPage errorFlags2TabPage;
private Common.Forms.ListViewEx errorFlags2ListViewEx;
private System.Windows.Forms.RadioButton profileTypeRadioButton10;
private System.Windows.Forms.RadioButton profileTypeRadioButton9;
}
}

View File

@ -219,6 +219,66 @@
<data name="&gt;&gt;groupBox2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="profileTypeRadioButton10.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="profileTypeRadioButton10.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="profileTypeRadioButton10.Location" type="System.Drawing.Point, System.Drawing">
<value>28, 217</value>
</data>
<data name="profileTypeRadioButton10.Size" type="System.Drawing.Size, System.Drawing">
<value>234, 17</value>
</data>
<data name="profileTypeRadioButton10.TabIndex" type="System.Int32, mscorlib">
<value>43</value>
</data>
<data name="profileTypeRadioButton10.Text" xml:space="preserve">
<value>Entering numbers and designations manually</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton10.Name" xml:space="preserve">
<value>profileTypeRadioButton10</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton10.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton10.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton10.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="profileTypeRadioButton9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="profileTypeRadioButton9.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="profileTypeRadioButton9.Location" type="System.Drawing.Point, System.Drawing">
<value>28, 195</value>
</data>
<data name="profileTypeRadioButton9.Size" type="System.Drawing.Size, System.Drawing">
<value>126, 17</value>
</data>
<data name="profileTypeRadioButton9.TabIndex" type="System.Int32, mscorlib">
<value>42</value>
</data>
<data name="profileTypeRadioButton9.Text" xml:space="preserve">
<value>Compound, qp and qi</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton9.Name" xml:space="preserve">
<value>profileTypeRadioButton9</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton9.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton9.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton9.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="profileTypeRadioButton8.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@ -229,13 +289,13 @@
<value>28, 173</value>
</data>
<data name="profileTypeRadioButton8.Size" type="System.Drawing.Size, System.Drawing">
<value>234, 17</value>
<value>254, 17</value>
</data>
<data name="profileTypeRadioButton8.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
</data>
<data name="profileTypeRadioButton8.Text" xml:space="preserve">
<value>Entering numbers and designations manually</value>
<value>Compound, main: Qn and Class , aux.: Q3 and R</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton8.Name" xml:space="preserve">
<value>profileTypeRadioButton8</value>
@ -247,7 +307,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton8.ZOrder" xml:space="preserve">
<value>0</value>
<value>2</value>
</data>
<data name="profileTypeRadioButton7.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -259,13 +319,13 @@
<value>28, 151</value>
</data>
<data name="profileTypeRadioButton7.Size" type="System.Drawing.Size, System.Drawing">
<value>128, 17</value>
<value>254, 17</value>
</data>
<data name="profileTypeRadioButton7.TabIndex" type="System.Int32, mscorlib">
<value>40</value>
</data>
<data name="profileTypeRadioButton7.Text" xml:space="preserve">
<value>qp and qi - compound</value>
<value>Compound, main: Q3 and R , aux.: Qn and Class</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton7.Name" xml:space="preserve">
<value>profileTypeRadioButton7</value>
@ -277,7 +337,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton7.ZOrder" xml:space="preserve">
<value>1</value>
<value>3</value>
</data>
<data name="profileTypeRadioButton6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -289,13 +349,13 @@
<value>28, 129</value>
</data>
<data name="profileTypeRadioButton6.Size" type="System.Drawing.Size, System.Drawing">
<value>147, 17</value>
<value>271, 17</value>
</data>
<data name="profileTypeRadioButton6.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
</data>
<data name="profileTypeRadioButton6.Text" xml:space="preserve">
<value>Qn and Class - compound</value>
<value>Compound, main: Qn and Class , aux.: Qn and Class</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton6.Name" xml:space="preserve">
<value>profileTypeRadioButton6</value>
@ -307,7 +367,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton6.ZOrder" xml:space="preserve">
<value>2</value>
<value>4</value>
</data>
<data name="profileTypeRadioButton5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -319,13 +379,13 @@
<value>28, 107</value>
</data>
<data name="profileTypeRadioButton5.Size" type="System.Drawing.Size, System.Drawing">
<value>130, 17</value>
<value>234, 17</value>
</data>
<data name="profileTypeRadioButton5.TabIndex" type="System.Int32, mscorlib">
<value>38</value>
</data>
<data name="profileTypeRadioButton5.Text" xml:space="preserve">
<value>Q3 and R - compound</value>
<value>Compound, main: Q3 and R, aux.: Q3 and R</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton5.Name" xml:space="preserve">
<value>profileTypeRadioButton5</value>
@ -337,7 +397,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton5.ZOrder" xml:space="preserve">
<value>3</value>
<value>5</value>
</data>
<data name="profileTypeRadioButton4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -367,7 +427,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton4.ZOrder" xml:space="preserve">
<value>4</value>
<value>6</value>
</data>
<data name="profileTypeRadioButton3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -397,7 +457,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton3.ZOrder" xml:space="preserve">
<value>5</value>
<value>7</value>
</data>
<data name="profileTypeRadioButton2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -427,7 +487,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton2.ZOrder" xml:space="preserve">
<value>6</value>
<value>8</value>
</data>
<data name="profileTypeRadioButton1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -457,13 +517,13 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;profileTypeRadioButton1.ZOrder" xml:space="preserve">
<value>7</value>
<value>9</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>23, 123</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>366, 203</value>
<value>366, 247</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
@ -775,7 +835,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="generalTabPage.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="generalTabPage.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -802,7 +862,7 @@
<value>0, 0</value>
</data>
<data name="metrologyListViewEx.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="metrologyListViewEx.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -823,7 +883,7 @@
<value>4, 34</value>
</data>
<data name="metrologyTabPage.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="metrologyTabPage.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -850,7 +910,7 @@
<value>0, 0</value>
</data>
<data name="errorFlagsListViewEx.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="errorFlagsListViewEx.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -871,7 +931,7 @@
<value>4, 34</value>
</data>
<data name="errorFlagsTabPage.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="errorFlagsTabPage.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
@ -898,7 +958,7 @@
<value>0, 0</value>
</data>
<data name="errorFlags2ListViewEx.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="errorFlags2ListViewEx.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -919,7 +979,7 @@
<value>4, 34</value>
</data>
<data name="errorFlags2TabPage.Size" type="System.Drawing.Size, System.Drawing">
<value>923, 366</value>
<value>923, 382</value>
</data>
<data name="errorFlags2TabPage.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
@ -949,7 +1009,7 @@
<value>0, 0</value>
</data>
<data name="tabControl.Size" type="System.Drawing.Size, System.Drawing">
<value>931, 404</value>
<value>931, 420</value>
</data>
<data name="tabControl.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -991,7 +1051,7 @@
<value>sharedButtons</value>
</data>
<data name="&gt;&gt;sharedButtons.Type" xml:space="preserve">
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.8.2099.0, Culture=neutral, PublicKeyToken=null</value>
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.8.2115.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;sharedButtons.Parent" xml:space="preserve">
<value>mainSplitContainer.Panel2</value>
@ -1012,7 +1072,7 @@
<value>1</value>
</data>
<data name="mainSplitContainer.Size" type="System.Drawing.Size, System.Drawing">
<value>1034, 404</value>
<value>1034, 420</value>
</data>
<data name="mainSplitContainer.SplitterDistance" type="System.Int32, mscorlib">
<value>931</value>
@ -1039,7 +1099,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>1034, 404</value>
<value>1034, 420</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>

View File

@ -1,39 +1,94 @@

///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
using Common;
using Config.Entities;
namespace TBF.UI.Procedures
{
public static class Formulas
{
public static double GetTargetQ(Config.Entities.PTest ptest, double qN, double qpQiRatio, string metroClass, Medium medium)
public static double GetTargetQ(PTest ptest, Medium medium,
double qN, double qpQiRatio, string metroClass,
double qNaux, double qpQiRatioAux, string metroClassAux)
{
if (ptest.Name.ToLower().Contains("q4") || ptest.Name.ToLower().Contains("qmax"))
switch (ptest.FlowId)
{
return Formulas.GetQ4Qmax(qN, metroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.ToLower().Contains("q3") || ptest.Name.ToLower().Contains("qn") || ptest.Name.ToLower().Equals("qp"))
{
return qN;
}
else if (ptest.Name.ToLower().Contains("q2") || ptest.Name.ToLower().Contains("qt"))
{
return Formulas.GetQ2Qt(qN, metroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.ToLower().Contains("q1") || ptest.Name.ToLower().Contains("qmin"))
{
return Formulas.GetQ1Qmin(qN, metroClass, medium, ptest.CoefQto);
}
else if (ptest.Name.ToLower().Contains("0,1qp") || ptest.Name.ToLower().Contains("0.1qp"))
{
return 0.1 * qN;
}
else if (ptest.Name.ToLower().Contains("qi"))
{
return qN / qpQiRatio;
}
else
{
return qN; /// Manual flow selection: CoefQfrom and CoefQto are used to calculate Qfrom and Qto from Qn
case FlowId.Qdetected:
case FlowId.Qrise:
case FlowId.Qfall:
return -1.0; /// Reserved value indicating flow detection
case FlowId.Q4:
case FlowId.Qmax:
case FlowId.Q4Main:
case FlowId.QmaxMain:
return GetQ4Qmax(qN, metroClass, medium, ptest.CoefQto);
case FlowId.Q4Aux:
case FlowId.QmaxAux:
return GetQ4Qmax(qNaux, metroClassAux, medium, ptest.CoefQto);
case FlowId.Q3:
case FlowId.Qn:
case FlowId.Q3Main:
case FlowId.QnMain:
return qN;
case FlowId.Q3Aux:
case FlowId.QnAux:
return qNaux;
case FlowId.Q2:
case FlowId.Qt:
case FlowId.Q2Main:
case FlowId.QtMain:
return GetQ2Qt(qN, metroClass, medium, ptest.CoefQto);
case FlowId.Q2Aux:
case FlowId.QtAux:
return GetQ2Qt(qNaux, metroClassAux, medium, ptest.CoefQto);
case FlowId.Q1:
case FlowId.Qmin:
case FlowId.Q1Main:
case FlowId.QminMain:
return GetQ1Qmin(qN, metroClass, medium, ptest.CoefQto);
case FlowId.Q1Aux:
case FlowId.QminAux:
return GetQ1Qmin(qNaux, metroClassAux, medium, ptest.CoefQto);
case FlowId.Qp10:
case FlowId.Qp10Main:
return 0.1 * qN;
case FlowId.Qp10Aux:
return 0.1 * qNaux;
case FlowId.Qi:
case FlowId.QiMain:
return qN / qpQiRatio;
case FlowId.QiAux:
return qNaux / qpQiRatioAux;
default:
return qN; /// Manual flow selection: CoefQfrom and CoefQto are used to calculate Qfrom and Qto from Qn
}
}

View File

@ -757,9 +757,11 @@ namespace TBF.UI.Procedures
var newProcedure = new Procedure(newName, Procedures.Count);
switch (pt)
{
case ProfileType.Q3RCompound:
case ProfileType.QnClassCompound:
case ProfileType.QpQiCompound:
case ProfileType.CompoundQ3RQ3R:
case ProfileType.CompoundQnClassQnClass:
case ProfileType.CompoundQ3RQnClass:
case ProfileType.CompoundQnClassQ3R:
case ProfileType.CompoundQpQiQpQi:
newProcedure.MetersKind = MetersKind.Combined;
break;
default:
@ -813,11 +815,11 @@ namespace TBF.UI.Procedures
else if (newProcedure.MetersKind == MetersKind.Combined && (wmIx % 2) == 1)
{
/// Aux. meter of a compound meter
wmParams.Qnames = Common.Utils.ProfileType2FlowNames(pt);
wmParams.Qnames = Common.Utils.ProfileType2FlowNames(pt, true);
wmParams.Qmax = (pt == ProfileType.Manual) ? 0 : Formulas.GetQ4Qmax(dlg.QnAux, dlg.MetroClassAux, medium);
wmParams.Qn = dlg.QnAux;
wmParams.Qt = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQiCompound) ? (0.1 * dlg.Qn) : Formulas.GetQ2Qt(dlg.QnAux, dlg.MetroClassAux, medium);
wmParams.Qmin = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQiCompound) ? dlg.Qn / dlg.QpQiRatio : Formulas.GetQ1Qmin(dlg.QnAux, dlg.MetroClassAux, medium);
wmParams.Qt = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.CompoundQpQiQpQi) ? (0.1 * dlg.Qn) : Formulas.GetQ2Qt(dlg.QnAux, dlg.MetroClassAux, medium);
wmParams.Qmin = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.CompoundQpQiQpQi) ? dlg.Qn / dlg.QpQiRatio : Formulas.GetQ1Qmin(dlg.QnAux, dlg.MetroClassAux, medium);
wmParams.MetrologicalClass = dlg.MetroClassAux;
wmParams.WaterTemp = medium;
}

View File

@ -128,24 +128,32 @@ namespace TBF.UI.Procedures.TestWizard
case ProfileType.Q3R:
qnLabel.Text = "Q3";
break;
case ProfileType.Q3RCompound:
qnLabel.Text = "Q3 main";
qnAuxLabel.Text = "Q3 aux";
break;
case ProfileType.QnClassColdWater:
case ProfileType.QnClassHotWater:
case ProfileType.Manual:
default:
qnLabel.Text = "Qn";
break;
case ProfileType.QnClassCompound:
case ProfileType.CompoundQ3RQ3R:
qnLabel.Text = "Q3 main";
qnAuxLabel.Text = "Q3 aux";
break;
case ProfileType.CompoundQnClassQnClass:
qnLabel.Text = "Qn main";
qnAuxLabel.Text = "Qn aux";
break;
case ProfileType.CompoundQ3RQnClass:
qnLabel.Text = "Q3 main";
qnAuxLabel.Text = "Qn aux";
break;
case ProfileType.CompoundQnClassQ3R:
qnLabel.Text = "Qn main";
qnAuxLabel.Text = "Q3 aux";
break;
case ProfileType.QpQi:
qnLabel.Text = "qp";
break;
case ProfileType.QpQiCompound:
case ProfileType.CompoundQpQiQpQi:
qnLabel.Text = "qp main";
qnAuxLabel.Text = "qp aux";
break;
@ -155,45 +163,67 @@ namespace TBF.UI.Procedures.TestWizard
void RedrawMClassCombo(Profile profile)
{
string oriText = metroClassComboBox.Text;
string oriTextAux = metroClassAuxComboBox.Text;
metroClassComboBox.Items.Clear();
metroClassAuxComboBox.Items.Clear();
bool clearTextFlag = true;
bool clearAuxTextFlag = true;
if (profile != null)
{
string[] mClasses;
string[] mClassesAux;
switch (profile.ProfileType)
{
default:
case ProfileType.Q3R:
case ProfileType.Q3RCompound:
mClasses = new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315",
"R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" };
case ProfileType.CompoundQ3RQ3R:
mClasses = mClassesAux =
new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315",
"R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" };
break;
case ProfileType.QnClassColdWater:
mClasses = new string[] { "A", "B", "C" };
mClasses = mClassesAux = new string[] { "A", "B", "C" };
break;
case ProfileType.QnClassHotWater:
mClasses = new string[] { "A", "B", "C", "D" };
mClasses = mClassesAux = new string[] { "A", "B", "C", "D" };
break;
case ProfileType.QnClassCompound:
case ProfileType.CompoundQnClassQnClass:
mClasses = mClassesAux = new string[] { "A", "B" };
break;
case ProfileType.CompoundQ3RQnClass:
mClasses =
new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315",
"R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" };
mClassesAux = new string[] { "A", "B" };
break;
case ProfileType.CompoundQnClassQ3R:
mClasses = new string[] { "A", "B" };
mClassesAux =
new string[] { "R40", "R50", "R63", "R80", "R100", "R125", "R160", "R200", "R250", "R315",
"R400", "R500", "R630", "R800", "R1000", "R1250", "R1600", "R2000", "R2500" };
break;
case ProfileType.QpQi:
case ProfileType.QpQiCompound:
mClasses = new string[] { "1", "2", "3" };
case ProfileType.CompoundQpQiQpQi:
mClasses = mClassesAux = new string[] { "1", "2", "3" };
break;
}
foreach (var mc in mClasses)
{
metroClassComboBox.Items.Add(mc);
if (mc == oriText) clearTextFlag = false;
}
foreach (var mc in mClassesAux)
{
metroClassAuxComboBox.Items.Add(mc);
if (oriText == mc) clearTextFlag = false;
if (mc == oriTextAux) clearAuxTextFlag = false;
}
}
if (clearTextFlag) metroClassComboBox.Text = string.Empty;
if (clearAuxTextFlag) metroClassAuxComboBox.Text = string.Empty;
}
@ -219,16 +249,15 @@ namespace TBF.UI.Procedures.TestWizard
test.Profile = (profile.ProfileType == ProfileType.QpQi)
? (protectedCheckBox.Checked ? TestProfile.ProtectedHeatMeter : TestProfile.UserDefinedHeatMeter)
: (profile.ProfileType == ProfileType.Q3RCompound || profile.ProfileType == ProfileType.QnClassCompound
|| profile.ProfileType == ProfileType.QpQiCompound)
: (profile.ProfileType == ProfileType.CompoundQ3RQ3R ||
profile.ProfileType == ProfileType.CompoundQnClassQnClass ||
profile.ProfileType == ProfileType.CompoundQ3RQnClass ||
profile.ProfileType == ProfileType.CompoundQnClassQ3R ||
profile.ProfileType == ProfileType.CompoundQpQiQpQi)
? (protectedCheckBox.Checked ? TestProfile.ProtectedCompound : TestProfile.UserDefinedCompound)
: (protectedCheckBox.Checked ? TestProfile.Protected : TestProfile.UserDefined);
test.Qtg = compoundDetection ? -1.0
: ptest.Name.Contains(Strings._aux) ? TBF.UI.Procedures.Formulas.GetTargetQ(ptest, QnAux, QpQiRatioAux, MetroClassAux, medium)
: ptest.Name.Contains(Strings._main) ? TBF.UI.Procedures.Formulas.GetTargetQ(ptest, Qn, QpQiRatio, MetroClass, medium)
: TBF.UI.Procedures.Formulas.GetTargetQ(ptest, Qn, QpQiRatio, MetroClass, medium);
test.Qtg = Formulas.GetTargetQ(ptest, medium, Qn, QpQiRatio, MetroClass, QnAux, QpQiRatioAux, MetroClassAux);
test.IsFromToInPct = test.Qtg <= 0 || Rig.Sequences.ProcessData.IsFromToInPct;
test.Qfrom = test.IsFromToInPct ? 100 * ptest.CoefQfrom : test.Qtg * ptest.CoefQfrom;
test.Qto = test.IsFromToInPct ? 100 * ptest.CoefQto : test.Qtg * ptest.CoefQto;
@ -312,9 +341,11 @@ namespace TBF.UI.Procedures.TestWizard
qpQiRatioGroupBox.Visible = (SelectedProfile.ProfileType == ProfileType.QpQi);
metroClassGroupBox.Visible = (SelectedProfile.ProfileType != ProfileType.Manual);
qnAuxLabel.Visible = qnAuxTextBox.Visible = metroClassAuxComboBox.Visible =
(SelectedProfile.ProfileType == ProfileType.Q3RCompound ||
SelectedProfile.ProfileType == ProfileType.QnClassCompound ||
SelectedProfile.ProfileType == ProfileType.QpQiCompound);
(SelectedProfile.ProfileType == ProfileType.CompoundQ3RQ3R ||
SelectedProfile.ProfileType == ProfileType.CompoundQnClassQnClass ||
SelectedProfile.ProfileType == ProfileType.CompoundQ3RQnClass ||
SelectedProfile.ProfileType == ProfileType.CompoundQnClassQ3R ||
SelectedProfile.ProfileType == ProfileType.CompoundQpQiQpQi);
profileTypeLabel.Text = (newProfile != null) ? newProfile.ProfileType.ToString() : string.Empty;
profileDescriptionLabel.Text = (newProfile != null) ? newProfile.Description : string.Empty;
@ -503,9 +534,11 @@ namespace TBF.UI.Procedures.TestWizard
bool IsFormValid()
{
bool isCompound = SelectedProfile.ProfileType == ProfileType.Q3RCompound ||
SelectedProfile.ProfileType == ProfileType.QnClassCompound ||
SelectedProfile.ProfileType == ProfileType.QpQiCompound;
bool isCompound = SelectedProfile.ProfileType == ProfileType.CompoundQ3RQ3R ||
SelectedProfile.ProfileType == ProfileType.CompoundQnClassQnClass ||
SelectedProfile.ProfileType == ProfileType.CompoundQ3RQnClass ||
SelectedProfile.ProfileType == ProfileType.CompoundQnClassQ3R ||
SelectedProfile.ProfileType == ProfileType.CompoundQpQiQpQi;
return IsProfileValid() && IsQnValid() && IsMetroClassValid() && IsQpQiRatioValid()
&& (!isCompound || (IsQnAuxValid() && IsMetroClassAuxValid()));

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2021-2022 Sensus Slovensko a.s.
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -193,15 +193,14 @@ namespace TBF.UI.Process
void InitializeTestDataTable(ListView lv, TestSelectedEventArgs args)
{
lv.Items.Clear();
ListViewItem lvi;
lv.Items.Add(lvi = new ListViewItem(new string[] {
lv.Items.Add(new ListViewItem(new string[] {
Strings.Test,
args != null ? args.Test.Name : "---",
string.Empty
}));
lv.Items.Add(lvi = new ListViewItem(new string[] {
lv.Items.Add(new ListViewItem(new string[] {
Strings.Repetition,
args != null ? string.Format("{0} / {1}", args.RepetitionNr, args.Test.Repeats) : "---",
string.Empty
@ -349,22 +348,22 @@ namespace TBF.UI.Process
///
/// Schematic drawing components
/// water
TBF.Rig.Various.Drawing.Tank.Configuration tankCfg; /// |
TBF.Rig.Modbus.PumpFM.DanfossVLT.PumpCfg pumpCfg; /// | setpoint, route based (initially bit nr. = 124)
TBF.Rig.Modbus.TempMeter.Groch.TempMeterCfg tempInCfg; /// | measured value
TBF.Rig.Modbus.PressureMeter.Meret.PressureMeterCfg pressUpCfg; /// | measured value
TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg wm1Cfg; /// |
TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg wm2Cfg; /// |
TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg wmLastCfg; /// |
TBF.Rig.Modbus.TempMeter.Groch.TempMeterCfg tempOutCfg; /// | measured value
TBF.Rig.Modbus.PressureMeter.Meret.PressureMeterCfg pressDnCfg; /// | measured value
TBF.Rig.BuiltIn.Valve.ValveCfg startValveCfg; /// | route based (initially bit nr. = 125)
TBF.Rig.Uni.FlowMeter.FlowMeterCfg flowMeterCfg; /// | measured value
TBF.Rig.Uni.RegValve.RegValveCfg regValveCfg; /// | setpoint
TBF.Rig.Modbus.TempMeter.Groch.TempMeterCfg tempDivCfg; /// | measured value
TBF.Rig.Uni.Diverter.DiverterCfg diverterCfg; /// | route based (initially bit nr. = 126)
TBF.Rig.Scales.MettlerToledo.ScaleCfg scaleCfg; /// | measured value
TBF.Rig.BuiltIn.Valve.ValveCfg drainValveCfg; /// v route based (initially bit nr. = 127)
Rig.Various.Drawing.Tank.Configuration tankCfg; /// |
Rig.Modbus.PumpFM.DanfossVLT.PumpCfg pumpCfg; /// | setpoint, route based (initially bit nr. = 124)
Rig.Modbus.TempMeter.Groch.TempMeterCfg tempInCfg; /// | measured value
Rig.Modbus.PressureMeter.Meret.PressureMeterCfg pressUpCfg; /// | measured value
Rig.WaterMeters.WaterMeter.WaterMeterCfg wm1Cfg; /// |
Rig.WaterMeters.WaterMeter.WaterMeterCfg wm2Cfg; /// |
Rig.WaterMeters.WaterMeter.WaterMeterCfg wmLastCfg; /// |
Rig.Modbus.TempMeter.Groch.TempMeterCfg tempOutCfg; /// | measured value
Rig.Modbus.PressureMeter.Meret.PressureMeterCfg pressDnCfg; /// | measured value
Rig.BuiltIn.Valve.ValveCfg startValveCfg; /// | route based (initially bit nr. = 125)
Rig.Uni.FlowMeter.FlowMeterCfg flowMeterCfg; /// | measured value
Rig.Uni.RegValve.RegValveCfg regValveCfg; /// | setpoint
Rig.Modbus.TempMeter.Groch.TempMeterCfg tempDivCfg; /// | measured value
Rig.Uni.Diverter.DiverterCfg diverterCfg; /// | route based (initially bit nr. = 126)
Rig.Scales.MettlerToledo.ScaleCfg scaleCfg; /// | measured value
Rig.BuiltIn.Valve.ValveCfg drainValveCfg; /// v route based (initially bit nr. = 127)
///
int scaleId, tankId, drainValveId, diverterId, regValveId, flowMeterId, startValveId;
int pumpId, tempInId, tempOutId, tempDivId, pressUpId, pressDownId;
@ -396,9 +395,9 @@ namespace TBF.UI.Process
/// Tank
processDrawingCtrl.AddItem(
tankCfg = new TBF.Rig.Various.Drawing.Tank.Configuration("Tank", new TBF.Rig.Various.Drawing.Tank.Factory())
tankCfg = new Rig.Various.Drawing.Tank.Configuration("Tank", new Rig.Various.Drawing.Tank.Factory())
{
Id = (tankId = id++),
Id = tankId = id++,
X = 570, Y = 410, Shape = Shape.Tank, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 33, LblY = 22, LblOrient = Orient.R,
});
@ -406,41 +405,41 @@ namespace TBF.UI.Process
/// Pump
pumpSetpIx = setpIx++;
processDrawingCtrl.AddItem(
pumpCfg = new TBF.Rig.Modbus.PumpFM.DanfossVLT.PumpCfg(new TBF.Rig.Modbus.PumpFM.DanfossVLT.Factory())
pumpCfg = new Rig.Modbus.PumpFM.DanfossVLT.PumpCfg(new Rig.Modbus.PumpFM.DanfossVLT.Factory())
{
Id = (pumpId = id++), Name = "P",
Id = pumpId = id++, Name = "P",
X = 450, Y = 480, Shape = Shape.PumpFM, Sz = Sz.L, Orient = Orient.L, Flip = false,
LblX = 0, LblY = -46, LblOrient = Orient.R,
SetpX = 0, SetpY = -24, SetpOrient = Orient.R, SetpFormat = "{0:F0} %", SetpUnit = Common.Unit.Pct,
SetpX = 0, SetpY = -24, SetpOrient = Orient.R, SetpFormat = "{0:F0} %", SetpUnit = Unit.Pct,
BitNr = DfltPumpBitNr,
Inverted = false,
});
/// Junctions
processDrawingCtrl.AddItem(new Configuration("J1", new Factory()) { Id=(j1=id++), Shape=Shape.Junction, X=50, Y=490, Sz=Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J2", new Factory()) { Id=(j2=id++), Shape=Shape.Junction, X=50, Y=370, Sz=Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J1", new Factory()) { Id=j1=id++, Shape=Shape.Junction, X=50, Y=490, Sz=Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J2", new Factory()) { Id=j2=id++, Shape=Shape.Junction, X=50, Y=370, Sz=Sz.L, });
/// T up
tempMtrUpMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
tempInCfg = new TBF.Rig.Modbus.TempMeter.Groch.TempMeterCfg(new TBF.Rig.Modbus.TempMeter.Groch.Factory())
tempInCfg = new Rig.Modbus.TempMeter.Groch.TempMeterCfg(new Rig.Modbus.TempMeter.Groch.Factory())
{
Id = (tempInId = id++), Name = "T in",
Id = tempInId = id++, Name = "T in",
X = 50, Y = 320, Shape = Shape.TempM, Sz = Sz.M, Orient = Orient.R, Flip = false,
LblX = 0, LblY = 2, LblOrient = Orient.R,
MsrdX = 0, MsrdY = 24, MsrdOrient = Orient.R, MsrdFormat = "{0:F1} °C", MsrdUnit = Common.Unit.C,
MsrdX = 0, MsrdY = 24, MsrdOrient = Orient.R, MsrdFormat = "{0:F1} °C", MsrdUnit = Unit.C,
MsrdValLimLo = 5, MsrdValLimHi = 95,
});
/// Pr up
pressMtrUpMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
pressUpCfg = new TBF.Rig.Modbus.PressureMeter.Meret.PressureMeterCfg(new TBF.Rig.Modbus.PressureMeter.Meret.Factory())
pressUpCfg = new Rig.Modbus.PressureMeter.Meret.PressureMeterCfg(new Rig.Modbus.PressureMeter.Meret.Factory())
{
Id = (pressUpId = id++), Name = "Pr up",
Id = pressUpId = id++, Name = "Pr up",
X = 50, Y = 270, Shape = Shape.PressM, Sz = Sz.M, Orient = Orient.R, Flip = false,
LblX = 0, LblY = 0, LblOrient = Orient.R,
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F2} bar", MsrdUnit = Common.Unit.bar,
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F2} bar", MsrdUnit = Unit.bar,
MsrdValLimLo = -0.1, MsrdValLimHi = 25,
});
@ -448,53 +447,53 @@ namespace TBF.UI.Process
{
/// WM 1 main
processDrawingCtrl.AddItem(
wm1Cfg = new TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg(new TBF.Rig.WaterMeters.WaterMeter.WaterMeterFactory())
wm1Cfg = new Rig.WaterMeters.WaterMeter.WaterMeterCfg(new Rig.WaterMeters.WaterMeter.WaterMeterFactory())
{
Id = (wm1Id = id++), Name = "WM1 main",
Id = wm1Id = id++, Name = "WM1 main",
X = 230, Y = 360, Shape = Shape.WaterM, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 0, LblY = -24, LblOrient = Orient.R,
});
/// WM 1 aux
processDrawingCtrl.AddItem(
wm2Cfg = new TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg(new TBF.Rig.WaterMeters.WaterMeter.WaterMeterFactory())
wm2Cfg = new Rig.WaterMeters.WaterMeter.WaterMeterCfg(new Rig.WaterMeters.WaterMeter.WaterMeterFactory())
{
Id = (wm2Id = id++), Name = "WM1 aux",
Id = wm2Id = id++, Name = "WM1 aux",
X = 230, Y = 240, Shape = Shape.WaterM, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 0, LblY = -24, LblOrient = Orient.R,
});
/// Junctions to connect Aux meter
processDrawingCtrl.AddItem(new Configuration("J3", new Factory()) { Id = (j3 = id++), Shape = Shape.Junction, X = 170, Y = 370, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J4", new Factory()) { Id = (j4 = id++), Shape = Shape.Junction, X = 170, Y = 250, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J5", new Factory()) { Id = (j5 = id++), Shape = Shape.Junction, X = 310, Y = 250, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J6", new Factory()) { Id = (j6 = id++), Shape = Shape.Junction, X = 310, Y = 370, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J3", new Factory()) { Id = j3 = id++, Shape = Shape.Junction, X = 170, Y = 370, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J4", new Factory()) { Id = j4 = id++, Shape = Shape.Junction, X = 170, Y = 250, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J5", new Factory()) { Id = j5 = id++, Shape = Shape.Junction, X = 310, Y = 250, Sz = Sz.L, });
processDrawingCtrl.AddItem(new Configuration("J6", new Factory()) { Id = j6 = id++, Shape = Shape.Junction, X = 310, Y = 370, Sz = Sz.L, });
}
else
{
/// WM 1
processDrawingCtrl.AddItem(
wm1Cfg = new TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg(new TBF.Rig.WaterMeters.WaterMeter.WaterMeterFactory())
wm1Cfg = new Rig.WaterMeters.WaterMeter.WaterMeterCfg(new Rig.WaterMeters.WaterMeter.WaterMeterFactory())
{
Id = (wm1Id = id++), Name = "WM1",
Id = wm1Id = id++, Name = "WM1",
X = 120, Y = 360, Shape = Shape.WaterM, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 0, LblY = -24, LblOrient = Orient.R,
});
/// WM 2
processDrawingCtrl.AddItem(
wm2Cfg = new TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg(new TBF.Rig.WaterMeters.WaterMeter.WaterMeterFactory())
wm2Cfg = new Rig.WaterMeters.WaterMeter.WaterMeterCfg(new Rig.WaterMeters.WaterMeter.WaterMeterFactory())
{
Id = (wm2Id = id++), Name = "WM2",
Id = wm2Id = id++, Name = "WM2",
X = 180, Y = 360, Shape = Shape.WaterM, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 0, LblY = -24, LblOrient = Orient.R,
});
/// WM last
processDrawingCtrl.AddItem(
wmLastCfg = new TBF.Rig.WaterMeters.WaterMeter.WaterMeterCfg(new TBF.Rig.WaterMeters.WaterMeter.WaterMeterFactory())
wmLastCfg = new Rig.WaterMeters.WaterMeter.WaterMeterCfg(new Rig.WaterMeters.WaterMeter.WaterMeterFactory())
{
Id = (wmLastId = id++), Name = "WMn",
Id = wmLastId = id++, Name = "WMn",
X = 310, Y = 360, Shape = Shape.WaterM, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 0, LblY = -24, LblOrient = Orient.R,
});
@ -503,9 +502,9 @@ namespace TBF.UI.Process
/// T down
tempMtrDownMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
tempOutCfg = new TBF.Rig.Modbus.TempMeter.Groch.TempMeterCfg(new TBF.Rig.Modbus.TempMeter.Groch.Factory())
tempOutCfg = new Rig.Modbus.TempMeter.Groch.TempMeterCfg(new Rig.Modbus.TempMeter.Groch.Factory())
{
Id = (tempOutId = id++), Name = "T out",
Id = tempOutId = id++, Name = "T out",
X = 370, Y = 320, Shape = Shape.TempM, Sz = Sz.M, Orient = Orient.R, Flip = false,
LblX = 0, LblY = 2, LblOrient = Orient.R,
MsrdX = 0, MsrdY = 24, MsrdOrient = Orient.R, MsrdFormat = "{0:F1} °C", MsrdUnit = Common.Unit.C,
@ -515,9 +514,9 @@ namespace TBF.UI.Process
/// Pr down
pressMtrDownMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
pressDnCfg = new TBF.Rig.Modbus.PressureMeter.Meret.PressureMeterCfg(new TBF.Rig.Modbus.PressureMeter.Meret.Factory())
pressDnCfg = new Rig.Modbus.PressureMeter.Meret.PressureMeterCfg(new Rig.Modbus.PressureMeter.Meret.Factory())
{
Id = (pressDownId = id++), Name = "Pr dn",
Id = pressDownId = id++, Name = "Pr dn",
X = 370, Y = 270, Shape = Shape.PressM, Sz = Sz.M, Orient = Orient.R, Flip = false,
LblX = 0, LblY = 0, LblOrient = Orient.R,
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F2} bar", MsrdUnit = Common.Unit.bar,
@ -529,9 +528,9 @@ namespace TBF.UI.Process
/// Start valve
processDrawingCtrl.AddItem(
startValveCfg = new TBF.Rig.BuiltIn.Valve.ValveCfg(new TBF.Rig.BuiltIn.Valve.ValveFactory())
startValveCfg = new Rig.BuiltIn.Valve.ValveCfg(new Rig.BuiltIn.Valve.ValveFactory())
{
Id = (startValveId = id++), Name = "VI",
Id = startValveId = id++, Name = "VI",
X = 450, Y = 280, Shape = Shape.Valve, Sz = Sz.L, Orient = Orient.Up, Flip = false,
LblX = 48, LblY = 9, LblOrient = Orient.R,
BitNr = DfltStartValveBitNr,
@ -541,9 +540,9 @@ namespace TBF.UI.Process
/// Flow meter
flowMeterMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
flowMeterCfg = new TBF.Rig.Uni.FlowMeter.FlowMeterCfg(new TBF.Rig.Uni.FlowMeter.Factory(), "I")
flowMeterCfg = new Rig.Uni.FlowMeter.FlowMeterCfg(new Rig.Uni.FlowMeter.Factory(), "I")
{
Id = (flowMeterId = id++),
Id = flowMeterId = id++,
X = 450, Y = 210, Shape = Shape.FlowM, Sz = Sz.L, Orient = Orient.Up, Flip = true,
LblX = 46, LblY = 0, LblOrient = Orient.R,
MsrdX = 46, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F3} m2/h", MsrdUnit = Common.Unit.m3ph,
@ -552,9 +551,9 @@ namespace TBF.UI.Process
/// Regulation valve
regValveSetpIx = setpIx++;
processDrawingCtrl.AddItem(
regValveCfg = new TBF.Rig.Uni.RegValve.RegValveCfg("VR", new TBF.Rig.Uni.RegValve.Factory())
regValveCfg = new Rig.Uni.RegValve.RegValveCfg("VR", new Rig.Uni.RegValve.Factory())
{
Id = (regValveId = id++),
Id = regValveId = id++,
X = 450, Y = 140, Shape = Shape.RegV, Sz = Sz.L, Orient = Orient.Up, Flip = true,
LblX = 46, LblY = 0, LblOrient = Orient.R,
SetpX = 46, SetpY = 22, SetpOrient = Orient.R,
@ -567,9 +566,9 @@ namespace TBF.UI.Process
/// T div
tempMtrDivMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
tempDivCfg = new TBF.Rig.Modbus.TempMeter.Groch.TempMeterCfg(new TBF.Rig.Modbus.TempMeter.Groch.Factory())
tempDivCfg = new Rig.Modbus.TempMeter.Groch.TempMeterCfg(new Rig.Modbus.TempMeter.Groch.Factory())
{
Id = (tempDivId = id++), Name = "T div",
Id = tempDivId = id++, Name = "T div",
X = 660, Y = 30, Shape = Shape.TempM, Sz = Sz.M, Orient = Orient.R, Flip = false,
LblX = 0, LblY = 0, LblOrient = Orient.R,
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F1} °C", MsrdUnit = Common.Unit.C,
@ -578,9 +577,9 @@ namespace TBF.UI.Process
/// Diverter
processDrawingCtrl.AddItem(
diverterCfg = new TBF.Rig.Uni.Diverter.DiverterCfg(new TBF.Rig.Uni.Diverter.Factory())
diverterCfg = new Rig.Uni.Diverter.DiverterCfg(new Rig.Uni.Diverter.Factory())
{
Id = (diverterId = id++), Name = "Div",
Id = diverterId = id++, Name = "Div",
X = 610, Y = 90, Shape = Shape.Div, Sz = Sz.L, Orient = Orient.R, Flip = false,
LblX = 50, LblY = -8, LblOrient = Orient.R,
DivNr1 = 1,
@ -591,9 +590,9 @@ namespace TBF.UI.Process
/// Scale
scaleMsrdIx = msrdIx++;
processDrawingCtrl.AddItem(
scaleCfg = new TBF.Rig.Scales.MettlerToledo.ScaleCfg("WT", new TBF.Rig.Scales.MettlerToledo.Factory())
scaleCfg = new Rig.Scales.MettlerToledo.ScaleCfg("WT", new Rig.Scales.MettlerToledo.Factory())
{
Id = (scaleId = id++),
Id = scaleId = id++,
X = 640, Y = 150, Shape = Shape.Scale, Sz = Sz.M, Orient = Orient.R, Flip = false,
LblX = 16, LblY = 40, LblOrient = Orient.R,
MsrdX = 16, MsrdY = 64, MsrdOrient = Orient.R, MsrdFormat = "{0:F3}", MsrdUnit = Common.Unit.kg,
@ -601,9 +600,9 @@ namespace TBF.UI.Process
/// Drain valve
processDrawingCtrl.AddItem(
drainValveCfg = new TBF.Rig.BuiltIn.Valve.ValveCfg(new TBF.Rig.BuiltIn.Valve.ValveFactory())
drainValveCfg = new Rig.BuiltIn.Valve.ValveCfg(new Rig.BuiltIn.Valve.ValveFactory())
{
Id = (drainValveId = id++), Name = "VB",
Id = drainValveId = id++, Name = "VB",
X = 660, Y = 270, Shape = Shape.Valve, Sz = Sz.M, Orient = Orient.Dn, Flip = false,
LblX = 40, LblY = 5, LblOrient = Orient.R,
BitNr = DfltDrainValveBitNr,
@ -611,8 +610,8 @@ namespace TBF.UI.Process
});
/// Junctions
processDrawingCtrl.AddItem(new Configuration("J10", new Factory()) { Id=(j10=id++), Shape=Shape.Junction, X=680, Y=390, Sz=Sz.None, });
processDrawingCtrl.AddItem(new Configuration("J11", new Factory()) { Id=(j11=id++), Shape=Shape.Junction, X=620, Y=390, Sz=Sz.None, });
processDrawingCtrl.AddItem(new Configuration("J10", new Factory()) { Id=j10=id++, Shape=Shape.Junction, X=680, Y=390, Sz=Sz.None, });
processDrawingCtrl.AddItem(new Configuration("J11", new Factory()) { Id=j11=id++, Shape=Shape.Junction, X=620, Y=390, Sz=Sz.None, });
processDrawingCtrl.MsrmntAvailableFlags = new bool[msrdIx];
processDrawingCtrl.MeasuredValues = new double[msrdIx];
@ -785,16 +784,16 @@ namespace TBF.UI.Process
/// Route based - pump
if (args.FeedingPath != null && args.FeedingPath.Pump != null &&
args.FeedingPath.Pump.Cfg is TBF.Rig.BuiltIn.Pump.PumpCfg)
args.FeedingPath.Pump.Cfg is Rig.BuiltIn.Pump.PumpCfg)
{
pumpCfg.BitNr = (args.FeedingPath.Pump.Cfg as TBF.Rig.BuiltIn.Pump.PumpCfg).BitNr;
pumpCfg.Inverted = (args.FeedingPath.Pump.Cfg as TBF.Rig.BuiltIn.Pump.PumpCfg).Inverted;
pumpCfg.BitNr = (args.FeedingPath.Pump.Cfg as Rig.BuiltIn.Pump.PumpCfg).BitNr;
pumpCfg.Inverted = (args.FeedingPath.Pump.Cfg as Rig.BuiltIn.Pump.PumpCfg).Inverted;
}
else if (args.FeedingPath != null && args.FeedingPath.Pump != null &&
args.FeedingPath.Pump.Cfg is TBF.Rig.Modbus.PumpFM.DanfossVLT.PumpCfg)
args.FeedingPath.Pump.Cfg is Rig.Modbus.PumpFM.DanfossVLT.PumpCfg)
{
pumpCfg.BitNr = (args.FeedingPath.Pump.Cfg as TBF.Rig.Modbus.PumpFM.DanfossVLT.PumpCfg).BitNr;
pumpCfg.Inverted = (args.FeedingPath.Pump.Cfg as TBF.Rig.Modbus.PumpFM.DanfossVLT.PumpCfg).Inverted;
pumpCfg.BitNr = (args.FeedingPath.Pump.Cfg as Rig.Modbus.PumpFM.DanfossVLT.PumpCfg).BitNr;
pumpCfg.Inverted = (args.FeedingPath.Pump.Cfg as Rig.Modbus.PumpFM.DanfossVLT.PumpCfg).Inverted;
}
else
{
@ -804,15 +803,15 @@ namespace TBF.UI.Process
/// Route based - start valve
if (args.OutputPath != null && args.OutputPath.StartValve1 != null &&
args.OutputPath.StartValve1.Cfg is TBF.Rig.BuiltIn.Valve.ValveCfg)
args.OutputPath.StartValve1.Cfg is Rig.BuiltIn.Valve.ValveCfg)
{
startValveCfg.BitNr = (args.OutputPath.StartValve1.Cfg as TBF.Rig.BuiltIn.Valve.ValveCfg).BitNr;
startValveCfg.Inverted = (args.OutputPath.StartValve1.Cfg as TBF.Rig.BuiltIn.Valve.ValveCfg).Inverted;
startValveCfg.BitNr = (args.OutputPath.StartValve1.Cfg as Rig.BuiltIn.Valve.ValveCfg).BitNr;
startValveCfg.Inverted = (args.OutputPath.StartValve1.Cfg as Rig.BuiltIn.Valve.ValveCfg).Inverted;
}
else if (args.OutputPath != null && args.OutputPath.StartValve1 != null &&
args.OutputPath.StartValve1.Cfg is TBF.Rig.BuiltIn.ValveEx.ValveCfg)
args.OutputPath.StartValve1.Cfg is Rig.BuiltIn.ValveEx.ValveCfg)
{
startValveCfg.BitNr = (args.OutputPath.StartValve1.Cfg as TBF.Rig.BuiltIn.ValveEx.ValveCfg).BitPosition;
startValveCfg.BitNr = (args.OutputPath.StartValve1.Cfg as Rig.BuiltIn.ValveEx.ValveCfg).BitPosition;
startValveCfg.Inverted = false;
}
else
@ -823,10 +822,10 @@ namespace TBF.UI.Process
/// Route based - diverter
if (args.OutputPath != null && args.OutputPath.Diverter != null &&
args.OutputPath.Diverter.Cfg is TBF.Rig.Uni.Diverter.DiverterCfg)
args.OutputPath.Diverter.Cfg is Rig.Uni.Diverter.DiverterCfg)
{
diverterCfg.BitNr = (args.OutputPath.Diverter.Cfg as TBF.Rig.Uni.Diverter.DiverterCfg).BitNr;
diverterCfg.Inverted = (args.OutputPath.Diverter.Cfg as TBF.Rig.Uni.Diverter.DiverterCfg).Inverted;
diverterCfg.BitNr = (args.OutputPath.Diverter.Cfg as Rig.Uni.Diverter.DiverterCfg).BitNr;
diverterCfg.Inverted = (args.OutputPath.Diverter.Cfg as Rig.Uni.Diverter.DiverterCfg).Inverted;
}
else
{
@ -836,10 +835,10 @@ namespace TBF.UI.Process
/// Route based - drain valve
if (args.OutputPath != null && args.OutputPath.Scale != null && args.OutputPath.Scale.DrainValve != null &&
args.OutputPath.Scale.DrainValve.Cfg is TBF.Rig.BuiltIn.Valve.ValveCfg)
args.OutputPath.Scale.DrainValve.Cfg is Rig.BuiltIn.Valve.ValveCfg)
{
drainValveCfg.BitNr = (args.OutputPath.Scale.DrainValve.Cfg as TBF.Rig.BuiltIn.Valve.ValveCfg).BitNr;
drainValveCfg.Inverted = (args.OutputPath.Scale.DrainValve.Cfg as TBF.Rig.BuiltIn.Valve.ValveCfg).Inverted;
drainValveCfg.BitNr = (args.OutputPath.Scale.DrainValve.Cfg as Rig.BuiltIn.Valve.ValveCfg).BitNr;
drainValveCfg.Inverted = (args.OutputPath.Scale.DrainValve.Cfg as Rig.BuiltIn.Valve.ValveCfg).Inverted;
}
else
{
@ -858,7 +857,7 @@ namespace TBF.UI.Process
cmpntWithSetpoint[regValveSetpIx] = args.OutputPath.RegValve as IDrawingItCmpntWithSetpoint;
cmpntWithSetpoint[pumpSetpIx] = args.FeedingPath.Pump as IDrawingItCmpntWithSetpoint;
UpdateRouteMsrdValuesAndSetpoints(TBF.Rig.StateMachine.ControlBoard != null ? TBF.Rig.StateMachine.ControlBoard.Route : 0);
UpdateRouteMsrdValuesAndSetpoints(Rig.StateMachine.ControlBoard != null ? Rig.StateMachine.ControlBoard.Route : 0);
processDrawingCtrl.SupressRedraws = false;
}
@ -893,7 +892,7 @@ namespace TBF.UI.Process
testDataListView.Items[massIx].SubItems[1].Text = "---";
}
if (TBF.Rig.StateMachine.ControlBoard.Activity == TBF.Rig.ControlBoard.Activity.FlyingStartStopTestWithDiverter)
if (Rig.StateMachine.ControlBoard.Activity == Rig.ControlBoard.Activity.FlyingStartStopTestWithDiverter)
{
double density = Formulas.WaterDensityFromTempPress((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2,
(ProcessData.PressUp.Val + ProcessData.PressDown.Val) / 2);
@ -907,7 +906,7 @@ namespace TBF.UI.Process
testDataListView.Items[volumeIx].SubItems[1].Text = converted.ToString(Common.Utils.SignificantDigitsToFmt(converted, 5));
testDataListView.Items[refErrorIx].SubItems[1].Text = refError.ToString(Common.Utils.SignificantDigitsToFmt(refError, 3));
}
else if (TBF.Rig.StateMachine.ControlBoard.Activity == TBF.Rig.ControlBoard.Activity.FlyingStartStopTest)
else if (Rig.StateMachine.ControlBoard.Activity == Rig.ControlBoard.Activity.FlyingStartStopTest)
{
double refVolume = (ProcessData.Devices != null && ProcessData.Devices.FlowMeter != null)
? ProcessData.Devices.FlowMeter.LtrPerPulse * ProcessData.RefPulses : 0;
@ -915,7 +914,7 @@ namespace TBF.UI.Process
testDataListView.Items[volumeIx].SubItems[1].Text = converted.ToString(Common.Utils.SignificantDigitsToFmt(converted, 5));
testDataListView.Items[refErrorIx].SubItems[1].Text = "---";
}
else if (TBF.Rig.StateMachine.ControlBoard.Activity == TBF.Rig.ControlBoard.Activity.StandingStartStopTest)
else if (Rig.StateMachine.ControlBoard.Activity == Rig.ControlBoard.Activity.StandingStartStopTest)
{
/// TODO: ???
//var converted = Units.ConvertTo(ProcessData.VolumeUnit, volumeCtv);
@ -934,9 +933,9 @@ namespace TBF.UI.Process
///
var rrs = ProcessData.RegisterReaders;
if (ProcessData.Devices != null && ProcessData.Devices.FlowMeter != null && rrs != null &&
(TBF.Rig.StateMachine.ControlBoard.Activity == TBF.Rig.ControlBoard.Activity.FlyingStartStopTest ||
TBF.Rig.StateMachine.ControlBoard.Activity == TBF.Rig.ControlBoard.Activity.FlyingStartStopTestWithDiverter ||
TBF.Rig.StateMachine.ControlBoard.Activity == TBF.Rig.ControlBoard.Activity.StandingStartStopTest))
(Rig.StateMachine.ControlBoard.Activity == Rig.ControlBoard.Activity.FlyingStartStopTest ||
Rig.StateMachine.ControlBoard.Activity == Rig.ControlBoard.Activity.FlyingStartStopTestWithDiverter ||
Rig.StateMachine.ControlBoard.Activity == Rig.ControlBoard.Activity.StandingStartStopTest))
{
if (metersKind == MetersKind.Single)
{
@ -961,10 +960,10 @@ namespace TBF.UI.Process
lvi.SubItems[(int)Column.RefPulses].Text = rr.WMRefPulses.ToString();
lvi.SubItems[(int)Column.PulsesPerLtr].Text = rr.PulsesPerLtr.ToString();
if (rr is TBF.Rig.RegisterReaders.S640Stream.S640Stream)
if (rr is Rig.RegisterReaders.S640Stream.S640Stream)
{
lvi.SubItems[(int)Column.SerialNr].Text =
(rr as TBF.Rig.RegisterReaders.S640Stream.S640Stream).PcbNumber.ToString();
(rr as Rig.RegisterReaders.S640Stream.S640Stream).PcbNumber.ToString();
}
}
}
@ -1175,7 +1174,7 @@ namespace TBF.UI.Process
private void ProcessTabPageCtrl_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Graphics formGraphics = this.CreateGraphics();
CreateGraphics();
}
}
}

View File

@ -38,6 +38,7 @@
this.upgradeDb_305_306_Button = new System.Windows.Forms.Button();
this.upgradeDb_306_307_Button = new System.Windows.Forms.Button();
this.upgradeDb_307_308_Button = new System.Windows.Forms.Button();
this.upgradeDb_308_309_Button = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// upgradeConfigDBCheckBox
@ -141,11 +142,22 @@
this.upgradeDb_307_308_Button.UseVisualStyleBackColor = true;
this.upgradeDb_307_308_Button.Click += new System.EventHandler(this.upgradeDb_307_308_Button_Click);
//
// upgradeDb_308_309_Button
//
this.upgradeDb_308_309_Button.Location = new System.Drawing.Point(12, 239);
this.upgradeDb_308_309_Button.Name = "upgradeDb_308_309_Button";
this.upgradeDb_308_309_Button.Size = new System.Drawing.Size(260, 22);
this.upgradeDb_308_309_Button.TabIndex = 30;
this.upgradeDb_308_309_Button.Text = "Upgrade DB from v.3.8 to v.3.9";
this.upgradeDb_308_309_Button.UseVisualStyleBackColor = true;
this.upgradeDb_308_309_Button.Click += new System.EventHandler(this.upgradeDb_308_309_Button_Click);
//
// UpgradeSelectionDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 597);
this.Controls.Add(this.upgradeDb_308_309_Button);
this.Controls.Add(this.upgradeDb_307_308_Button);
this.Controls.Add(this.upgradeDb_306_307_Button);
this.Controls.Add(this.upgradePipesButton);
@ -175,5 +187,6 @@
private System.Windows.Forms.Button upgradeDb_305_306_Button;
private System.Windows.Forms.Button upgradeDb_306_307_Button;
private System.Windows.Forms.Button upgradeDb_307_308_Button;
private System.Windows.Forms.Button upgradeDb_308_309_Button;
}
}

View File

@ -442,5 +442,33 @@ namespace TBF.UI.Settings
upgradeDb_307_308_Button.Enabled = false;
}
}
private void upgradeDb_308_309_Button_Click(object sender, EventArgs e)
{
string[] configDbCommands = new string[]
{
"ALTER TABLE `ptest` ADD `FlowId` VARCHAR(255) NOT NULL DEFAULT 'Q3' AFTER `Part`;",
};
string[] resultsDbCommands = new string[] { };
if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked)
{
MessageBox.Show("No database selected");
return;
}
ActivityStart();
if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 ||
ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) &&
(!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 ||
ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands)))
{
ActivityEnd();
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
upgradeDb_308_309_Button.Enabled = false;
}
}
}
}