WaitTankContainsMoreThenOp, related Various.TankWithLevelMsrmnt and TankDraining changes, ver. 2.18.1064

This commit is contained in:
Milan Hanajik
2018-11-14 13:07:37 +01:00
parent 7d1d95305f
commit 3ffdf4e2cc
16 changed files with 510 additions and 266 deletions
@@ -81,7 +81,11 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
drainValve2ComboBox.Text = string.IsNullOrEmpty(config.DrainValve2) ? "---" : config.DrainValve2;
drainTimeTextBox.Text = config.DrainTimeSec.ToString();
levelMeasurementComboBox.Text = string.IsNullOrEmpty(config.LevelMeasurement) ? "---" : config.LevelMeasurement;
calibrationTableTextBox.Text = config.CalibrationTable;
thresholdLevel1TextBox.Text = config.ThldLevel1.ToString();
thresholdLevel2TextBox.Text = config.ThldLevel2.ToString();
thresholdLevel3TextBox.Text = config.ThldLevel3.ToString();
thresholdLevel4TextBox.Text = config.ThldLevel4.ToString();
calibrationTableTextBox.Text = config.CalibrationTable;
}
public void Unlock()
@@ -93,7 +97,11 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
drainValve2ComboBox.Enabled = true;
drainTimeTextBox.Enabled = true;
levelMeasurementComboBox.Enabled = true;
calibrationTableTextBox.Enabled = true;
thresholdLevel1TextBox.Enabled = true;
thresholdLevel2TextBox.Enabled = true;
thresholdLevel3TextBox.Enabled = true;
thresholdLevel4TextBox.Enabled = true;
calibrationTableTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -101,13 +109,13 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
float mass;
if (!Utils.TryParseUFloat(capacityTextBox.Text, out mass) || mass <= 0)
float ftmp;
if (!Utils.TryParseUFloat(capacityTextBox.Text, out ftmp) || ftmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Capacity' is not valid";
}
if (!Utils.TryParseUFloat(emptyTextBox.Text, out mass) || mass <= 0)
if (!Utils.TryParseUFloat(emptyTextBox.Text, out ftmp) || ftmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty' is not valid";
@@ -132,6 +140,26 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, levelMeasurementLabel.Text);
}
if (!Utils.TryParseUFloat(thresholdLevel1TextBox.Text, out ftmp) || ftmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Threshold level 1' is not valid";
}
if (!Utils.TryParseUFloat(thresholdLevel2TextBox.Text, out ftmp) || ftmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Threshold level 2' is not valid";
}
if (!Utils.TryParseUFloat(thresholdLevel3TextBox.Text, out ftmp) || ftmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Threshold level 3' is not valid";
}
if (!Utils.TryParseUFloat(thresholdLevel4TextBox.Text, out ftmp) || ftmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Threshold level 4' is not valid";
}
return flags;
}
@@ -149,7 +177,11 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
config.DrainValve = drainValveComboBox.Text.Equals("---") ? string.Empty : drainValveComboBox.Text;
config.DrainValve2 = drainValve2ComboBox.Text.Equals("---") ? string.Empty : drainValve2ComboBox.Text;
config.LevelMeasurement = levelMeasurementComboBox.Text.Equals("---") ? string.Empty : levelMeasurementComboBox.Text;
config.CalibrationTable = calibrationTableTextBox.Text;
config.ThldLevel1 = Utils.ParseUFloat(thresholdLevel1TextBox.Text);
config.ThldLevel2 = Utils.ParseUFloat(thresholdLevel2TextBox.Text);
config.ThldLevel3 = Utils.ParseUFloat(thresholdLevel3TextBox.Text);
config.ThldLevel4 = Utils.ParseUFloat(thresholdLevel4TextBox.Text);
config.CalibrationTable = calibrationTableTextBox.Text;
return flags;
}