Introduction of Program.CompoundWMsCount, fix in DataEntry.Combined.CycleBeginningForm, version 1.5.68.

This commit is contained in:
Milan Hanajik
2015-07-09 16:24:55 +02:00
parent 563141fbbe
commit 95c05078de
15 changed files with 74 additions and 73 deletions
@@ -50,7 +50,7 @@ namespace TBF.BenchControl.DataEntry.Combined
checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3 };
enabledComboBoxes = new List<ComboBox>();
this.WaterMetersCount = Program.WMsCount / 2; /// Default number of compound water meters
this.WaterMetersCount = Program.CompoundWMsCount; /// Default number of compound water meters
completed = false;
StartForceCloseHandler();
@@ -63,7 +63,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public CycleBeginningForm(int compoundWaterMetersCount)
: this()
{
this.WaterMetersCount = compoundWaterMetersCount; /// = Program.WMsCount / 2
this.WaterMetersCount = compoundWaterMetersCount; /// = Program.CompondWMsCount
MainSNText = new string[compoundWaterMetersCount];
AuxSNText = new string[compoundWaterMetersCount];
Disabled = new bool[compoundWaterMetersCount];
@@ -93,20 +93,22 @@ namespace TBF.BenchControl.DataEntry.Combined
if (WaterMetersCount >= 2) groupBox2.Visible = true;
if (WaterMetersCount >= 3) groupBox3.Visible = true;
if (Program.LocalSettings.LastMainSNTextsCount == TextBoxesCount &&
Program.LocalSettings.LastAuxSNTextsCount == TextBoxesCount)
for (int i = 0; i < TextBoxesCount; i++)
{
for (int i = 0; i < TextBoxesCount; i++)
mainLabels[i].Visible = mainComboBoxes[i].Visible = true;
auxLabels[i].Visible = auxComboBoxes[i].Visible = true;
checkBoxes[i].Visible = true;
enabledComboBoxes.Add(mainComboBoxes[i]);
enabledComboBoxes.Add(auxComboBoxes[i]);
if (Program.LocalSettings.LastMainSNTextsCount == TextBoxesCount &&
Program.LocalSettings.LastAuxSNTextsCount == TextBoxesCount)
{
mainComboBoxes[i].Items.Add(Program.LocalSettings.LastMainSNTexts[i]);
auxComboBoxes[i].Items.Add(Program.LocalSettings.LastAuxSNTexts[i]);
mainLabels[i].Visible = mainComboBoxes[i].Visible = true;
auxLabels[i].Visible = auxComboBoxes[i].Visible = true;
checkBoxes[i].Visible = true;
enabledComboBoxes.Add(mainComboBoxes[i]);
enabledComboBoxes.Add(auxComboBoxes[i]);
}
}
}
void Localize()
@@ -34,10 +34,10 @@ namespace TBF.BenchControl.DataEntry.Combined
{
InitializeComponent();
MainStateText = new string[Program.WMsCount / 2];
AuxStateText = new string[Program.WMsCount / 2];
QRise = new float[Program.WMsCount / 2];
QFall = new float[Program.WMsCount / 2];
MainStateText = new string[Program.CompoundWMsCount];
AuxStateText = new string[Program.CompoundWMsCount];
QRise = new float[Program.CompoundWMsCount];
QFall = new float[Program.CompoundWMsCount];
completed = false;
StartForceCloseHandler();
@@ -76,7 +76,7 @@ namespace TBF.BenchControl.DataEntry.Combined
qRise1TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3);
qFall1TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3);
if (Program.WMsCount / 2 >= 2)
if (Program.CompoundWMsCount >= 2)
{
qRise2TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3);
qFall2TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3);
@@ -87,7 +87,7 @@ namespace TBF.BenchControl.DataEntry.Combined
Height = 305;
}
if (Program.WMsCount / 2 >= 3)
if (Program.CompoundWMsCount >= 3)
{
qRise3TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3);
qFall3TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3);
@@ -108,7 +108,7 @@ namespace TBF.BenchControl.DataEntry.Combined
if (Utils.TryParseUFloat(qRise1TextBox.Text, out ftmp)) { QRise[0] = ftmp; } else { allOK = false; }
if (Utils.TryParseUFloat(qFall1TextBox.Text, out ftmp)) { QFall[0] = ftmp; } else { allOK = false; }
if (Program.WMsCount / 2 >= 2)
if (Program.CompoundWMsCount >= 2)
{
MainStateText[1] = mainState2TextBox.Text;
AuxStateText[1] = auxState2TextBox.Text;
@@ -116,7 +116,7 @@ namespace TBF.BenchControl.DataEntry.Combined
if (Utils.TryParseUFloat(qFall2TextBox.Text, out ftmp)) { QFall[1] = ftmp; } else { allOK = false; }
}
if (Program.WMsCount / 2 >= 3)
if (Program.CompoundWMsCount >= 3)
{
MainStateText[2] = mainState3TextBox.Text;
AuxStateText[2] = auxState3TextBox.Text;
@@ -69,12 +69,12 @@ namespace TBF.BenchControl.DataEntry.Combined
public EntryForm(EntryFormCfg cfg)
: base(cfg)
{
serialNr = new string[Program.WMsCount / 2 * 2];
disabled = new bool[Program.WMsCount / 2];
wmStartState = new float[Program.WMsCount / 2 * 2];
wmStartStateStr = new string[Program.WMsCount / 2 * 2];
wmEndState = new float[Program.WMsCount / 2 * 2];
wmCycleEndState = new string[Program.WMsCount / 2 * 2];
serialNr = new string[Program.CompoundWMsCount * 2];
disabled = new bool[Program.CompoundWMsCount];
wmStartState = new float[Program.CompoundWMsCount * 2];
wmStartStateStr = new string[Program.CompoundWMsCount * 2];
wmEndState = new float[Program.CompoundWMsCount * 2];
wmCycleEndState = new string[Program.CompoundWMsCount * 2];
entryFormCfg = cfg;
currentOp = CurrentOp.None;
@@ -122,7 +122,7 @@ namespace TBF.BenchControl.DataEntry.Combined
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Program.WMsCount / 2);
myRef.modelessDlg = new CycleBeginningForm(Program.CompoundWMsCount);
modelessDlg.Show();
}
///
@@ -135,20 +135,20 @@ namespace TBF.BenchControl.DataEntry.Combined
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new TestStartEndForm(Program.WMsCount / 2, disabled);
myRef.modelessDlg = new TestStartEndForm(Program.CompoundWMsCount, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
string[] mainStartSateStr = new string[Program.WMsCount / 2];
string[] auxStartSateStr = new string[Program.WMsCount / 2];
for (int i = 0; i < Program.WMsCount / 2; i++)
string[] mainStartSateStr = new string[Program.CompoundWMsCount];
string[] auxStartSateStr = new string[Program.CompoundWMsCount];
for (int i = 0; i < Program.CompoundWMsCount; i++)
{
mainStartSateStr[i] = wmStartStateStr[2 * i];
auxStartSateStr[i] = wmStartStateStr[2 * i + 1];
}
myRef.modelessDlg = new TestStartEndForm(Program.WMsCount / 2, mainStartSateStr, auxStartSateStr, disabled, refVolume, errLimLo, errLimHi);
myRef.modelessDlg = new TestStartEndForm(Program.CompoundWMsCount, mainStartSateStr, auxStartSateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
@@ -132,9 +132,9 @@ namespace TBF.BenchControl.DataEntry.Combined
/// </summary>
void ShuffleTextBoxes()
{
if (Program.WMsCount / 2 < TextBoxesCount)
if (Program.CompoundWMsCount < TextBoxesCount)
{
TextBoxesCount = Program.WMsCount / 2;
TextBoxesCount = Program.CompoundWMsCount;
}
}
@@ -26,13 +26,13 @@ namespace TBF.BenchControl.DataEntry.Munich
{
InitializeComponent();
MainSNText = new string[Program.WMsCount / 2];
AuxSNText = new string[Program.WMsCount / 2];
MainSNText = new string[Program.CompoundWMsCount];
AuxSNText = new string[Program.CompoundWMsCount];
completed = false;
StartForceCloseHandler();
if (Program.WMsCount / 2 < 2) Height = 200;
else if (Program.WMsCount / 2 < 3) Height = 355;
if (Program.CompoundWMsCount < 2) Height = 200;
else if (Program.CompoundWMsCount < 3) Height = 355;
Localize();
}
@@ -57,13 +57,13 @@ namespace TBF.BenchControl.DataEntry.Munich
MainSNText[0] = mainSN1TextBox.Text;
AuxSNText[0] = auxSN1TextBox.Text;
if (Program.WMsCount / 2 >= 2)
if (Program.CompoundWMsCount >= 2)
{
MainSNText[1] = mainSN2TextBox.Text;
AuxSNText[1] = auxSN2TextBox.Text;
}
if (Program.WMsCount / 2 >= 3)
if (Program.CompoundWMsCount >= 3)
{
MainSNText[2] = mainSN3TextBox.Text;
AuxSNText[2] = auxSN3TextBox.Text;
@@ -34,10 +34,10 @@ namespace TBF.BenchControl.DataEntry.Munich
{
InitializeComponent();
MainStateText = new string[Program.WMsCount / 2];
AuxStateText = new string[Program.WMsCount / 2];
QRise = new float[Program.WMsCount / 2];
QFall = new float[Program.WMsCount / 2];
MainStateText = new string[Program.CompoundWMsCount];
AuxStateText = new string[Program.CompoundWMsCount];
QRise = new float[Program.CompoundWMsCount];
QFall = new float[Program.CompoundWMsCount];
completed = false;
StartForceCloseHandler();
@@ -76,7 +76,7 @@ namespace TBF.BenchControl.DataEntry.Munich
qRise1TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3);
qFall1TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3);
if (Program.WMsCount / 2 >= 2)
if (Program.CompoundWMsCount >= 2)
{
qRise2TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3);
qFall2TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3);
@@ -87,7 +87,7 @@ namespace TBF.BenchControl.DataEntry.Munich
Height = 305;
}
if (Program.WMsCount / 2 >= 3)
if (Program.CompoundWMsCount >= 3)
{
qRise3TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3);
qFall3TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3);
@@ -108,7 +108,7 @@ namespace TBF.BenchControl.DataEntry.Munich
if (Utils.TryParseUFloat(qRise1TextBox.Text, out ftmp)) { QRise[0] = ftmp; } else { allOK = false; }
if (Utils.TryParseUFloat(qFall1TextBox.Text, out ftmp)) { QFall[0] = ftmp; } else { allOK = false; }
if (Program.WMsCount / 2 >= 2)
if (Program.CompoundWMsCount >= 2)
{
MainStateText[1] = mainState2TextBox.Text;
AuxStateText[1] = auxState2TextBox.Text;
@@ -116,7 +116,7 @@ namespace TBF.BenchControl.DataEntry.Munich
if (Utils.TryParseUFloat(qFall2TextBox.Text, out ftmp)) { QFall[1] = ftmp; } else { allOK = false; }
}
if (Program.WMsCount / 2 >= 3)
if (Program.CompoundWMsCount >= 3)
{
MainStateText[2] = mainState3TextBox.Text;
AuxStateText[2] = auxState3TextBox.Text;
@@ -174,9 +174,9 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
if (combined)
{
for (int wmNr = 1; wmNr <= Program.WMsCount / 2; wmNr++) /// wmNr is 1-based
for (int wmNr = 0; wmNr < Program.CompoundWMsCount; wmNr++) /// wmNr is 0-based
{
nextWmTop += PrintCombinedWM(e, wmNr, nextWmTop);
nextWmTop += PrintCombinedWM(e, wmNr + 1, nextWmTop);
}
}
else
@@ -225,7 +225,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
///--------
if (combined)
{
for (int wmNr = 1; wmNr <= Program.WMsCount / 2; wmNr++) WriteCombinedWM(wmNr); /// wmNr is 1-based
for (int wmNr = 0; wmNr < Program.CompoundWMsCount; wmNr++) WriteCombinedWM(wmNr + 1); /// wmNr is 0-based
}
else
{
@@ -292,7 +292,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq,
cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow);
for (int i = 0; i < (Program.WMsCount / 2) * 2; i++)
for (int i = 0; i < Program.CompoundWMsCount * 2; i++)
{
logstr += string.Format(" M{0}=({1},{2})", i + 1, WMRefPulses[i], WMPulses[i]);
}
@@ -300,7 +300,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress);
for (int i = 0; i < Program.WMsCount / 2; i++)
for (int i = 0; i < Program.CompoundWMsCount; i++)
{
data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
+ data.TestResult.Meters[2 * i + 1].VolumeMeter;
@@ -415,7 +415,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
for (int iCmbnd = 0; iCmbnd < Program.WMsCount / 2; iCmbnd++)
for (int iCmbnd = 0; iCmbnd < Program.CompoundWMsCount; iCmbnd++)
{
tstRslt.CombinedMeters[iCmbnd].VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
@@ -20,9 +20,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public IList<Event> Execute(Entities.Test test, CombinedWithDetTestParams testParams)
{
if (test.Part < 1 || test.Part > (Program.WMsCount / 2))
if (test.Part < 1 || test.Part > Program.CompoundWMsCount)
{
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be 1 .. {0}", Program.WMsCount / 2));
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be 1 .. {0}", Program.CompoundWMsCount));
IList<Event> retval = new List<Event>(1);
retval.Add(Event.ConfigurationError);
return retval;
@@ -31,7 +31,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
/// Specific for combined meters
int[] lastWMPulses = new int[Program.WMsCount];
int[] lastWMPulses = new int[2 * Program.CompoundWMsCount];
IList<Event> e = new List<Event>(); /// Events from currently running operations
@@ -220,7 +220,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
while (!e.Contains(Event.PositionReached));
// Last pulses are kept to calculate differences
for (int i = 0; i < Program.WMsCount; i++) lastWMPulses[i] = WMPulses[i];
for (int i = 0; i < 2 * Program.CompoundWMsCount; i++) lastWMPulses[i] = WMPulses[i];
// Shift data in the detection buffers
for (int i = DetectionBufferSize - 2; i >= 0; i--)
@@ -466,7 +466,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq,
cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow);
for (int i = 0; i < (Program.WMsCount / 2) * 2; i++)
for (int i = 0; i < Program.CompoundWMsCount * 2; i++)
{
logstr += string.Format(" M{0}=({1},{2})", i + 1, WMRefPulses[i], WMPulses[i]);
}
@@ -475,7 +475,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress);
for (int i = 0; i < Program.WMsCount / 2; i++)
for (int i = 0; i < Program.CompoundWMsCount; i++)
{
data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
+ data.TestResult.Meters[2 * i + 1].VolumeMeter;
@@ -595,7 +595,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
for (int iCmbnd = 0; iCmbnd < Program.WMsCount / 2; iCmbnd++)
for (int iCmbnd = 0; iCmbnd < Program.CompoundWMsCount; iCmbnd++)
{
for (int i = 2 * iCmbnd; i < 2 * iCmbnd + 2; i++)
{
@@ -369,7 +369,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress);
for (int i = 0; i < Program.WMsCount / 2; i++)
for (int i = 0; i < Program.CompoundWMsCount; i++)
{
data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
+ data.TestResult.Meters[2 * i + 1].VolumeMeter;
@@ -486,7 +486,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
while (!e.Contains(Event.ModelessFormClosed));
for (int i = 0; i < Program.WMsCount / 2 * 2; i++)
for (int i = 0; i < Program.CompoundWMsCount * 2; i++)
{
tstRslt.Meters[i].VolumeEnd = dataEntryCmpnt.WMEndState(i);
@@ -547,7 +547,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
for (int iCmbnd = 0; iCmbnd < Program.WMsCount / 2; iCmbnd++)
for (int iCmbnd = 0; iCmbnd < Program.CompoundWMsCount; iCmbnd++)
{
tstRslt.CombinedMeters[iCmbnd].VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
tstRslt.CombinedMeters[iCmbnd].PulsesMaster = tstRslt.PulsesMaster;