(1) Graphs : DivSamples on test START and END, (2) div. transition times calculated from samples.

This commit is contained in:
Milan Hanajik
2018-06-11 12:52:08 +02:00
parent c4c221f58c
commit f3c0da79e8
17 changed files with 559 additions and 345 deletions
+6 -18
View File
@@ -26,8 +26,6 @@ namespace TBF.BenchControl.Elde.Diverter
}
public static int DivertersCount { get { return nextIdx; } }
public static GenericDevices.IDiverter[] Diverters;
public static int[] DivStartingLevelPct;
public static int[] DivStoppingLevelPct;
readonly int diverterNr0; /// 0-based diverter number
public int DiverterNr { get { return diverterNr0 + 1; } } /// 1-based public diverter number
@@ -42,10 +40,11 @@ namespace TBF.BenchControl.Elde.Diverter
readonly IOperation diverterToSinkOp;
public bool State
{
get { return (controlBoard.Route & mask) != 0; }
}
public bool State { get { return (controlBoard.Route & mask) != 0; } }
public int ThresholdGate { get { return diverterCfg.StartingLevel; } }
public int ThresholdLo { get { return diverterCfg.ThresholdLo; } }
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }
public Diverter()
{
@@ -69,26 +68,15 @@ namespace TBF.BenchControl.Elde.Diverter
if (Diverters == null || Diverters.Length < nextIdx)
{
GenericDevices.IDiverter[] divertersSoFar = Diverters;
int[] startingLevelsSoFar = DivStartingLevelPct;
int[] stoppingLevelsSoFar = DivStoppingLevelPct;
Diverters = new GenericDevices.IDiverter[nextIdx];
DivStartingLevelPct = new int[nextIdx];
DivStoppingLevelPct = new int[nextIdx];
if (divertersSoFar != null)
{
for (int i = 0; i < divertersSoFar.Length; i++)
{
Diverters[i] = divertersSoFar[i];
DivStartingLevelPct[i] = startingLevelsSoFar[i];
DivStoppingLevelPct[i] = stoppingLevelsSoFar[i];
}
for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i];
}
Diverters[nextIdx - 1] = this;
DivStartingLevelPct[nextIdx - 1] = diverterCfg.StartingLevel;
DivStoppingLevelPct[nextIdx - 1] = diverterCfg.StoppingLevel;
}
/// Prepare arguments of SendCalibData()
@@ -23,7 +23,8 @@ namespace TBF.BenchControl.Elde.Diverter
public int AdcValueToSink; /// 0..1023
public int AdcValueToTank; /// 0..1023
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
public int StoppingLevel; /// 0..100 in %, threshold for the ADC value to start the test
public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured
public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured
/// Private parameterless constructor invoked by all other (public) constructors
DiverterCfg()
@@ -35,8 +36,9 @@ namespace TBF.BenchControl.Elde.Diverter
AdcValueToSink = 100;
AdcValueToTank = 500;
StartingLevel = 50;
StoppingLevel = 50;
}
ThresholdLo = 10;
ThresholdHi = 90;
}
public DiverterCfg(IComponentFactory factory)
: this()
@@ -46,7 +48,7 @@ namespace TBF.BenchControl.Elde.Diverter
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Bit={2}, ADC#={3}, ADC2Sink={4}, ADC2Tank={5}, StartingLevel={6}%, StoppingLevel={7}%",
return string.Format("Name={0}, Parent={1}, Bit={2}, ADC#={3}, ADC2Sink={4}, ADC2Tank={5}, Gate={6}%, Lo={7}%, Lo={8}%",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
BitPosition,
@@ -54,7 +56,8 @@ namespace TBF.BenchControl.Elde.Diverter
AdcValueToSink,
AdcValueToTank,
StartingLevel,
StoppingLevel);
ThresholdLo,
ThresholdHi);
}
}
}
+54 -19
View File
@@ -40,8 +40,8 @@ namespace TBF.BenchControl.Elde.Diverter
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.startingEdgeTextBox = new System.Windows.Forms.TextBox();
this.startingEdgeLabel = new System.Windows.Forms.Label();
this.stoppingEdgeTextBox = new System.Windows.Forms.TextBox();
this.stoppingEdgeLabel = new System.Windows.Forms.Label();
this.thresholdLoTextBox = new System.Windows.Forms.TextBox();
this.thresholdLoLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.startButton = new System.Windows.Forms.Button();
@@ -70,6 +70,9 @@ namespace TBF.BenchControl.Elde.Diverter
this.adcTextBox1 = new System.Windows.Forms.TextBox();
this.adcNrTextBox = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.thresholdHiTextBox = new System.Windows.Forms.TextBox();
this.thresholdHiLabel = new System.Windows.Forms.Label();
this.groupBox4.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -153,22 +156,22 @@ namespace TBF.BenchControl.Elde.Diverter
this.startingEdgeLabel.TabIndex = 13;
this.startingEdgeLabel.Text = "Starting level";
//
// stoppingEdgeTextBox
// thresholdLoTextBox
//
this.stoppingEdgeTextBox.Enabled = false;
this.stoppingEdgeTextBox.Location = new System.Drawing.Point(137, 203);
this.stoppingEdgeTextBox.Name = "stoppingEdgeTextBox";
this.stoppingEdgeTextBox.Size = new System.Drawing.Size(46, 20);
this.stoppingEdgeTextBox.TabIndex = 17;
this.thresholdLoTextBox.Enabled = false;
this.thresholdLoTextBox.Location = new System.Drawing.Point(137, 203);
this.thresholdLoTextBox.Name = "thresholdLoTextBox";
this.thresholdLoTextBox.Size = new System.Drawing.Size(46, 20);
this.thresholdLoTextBox.TabIndex = 17;
//
// stoppingEdgeLabel
// thresholdLoLabel
//
this.stoppingEdgeLabel.AutoSize = true;
this.stoppingEdgeLabel.Location = new System.Drawing.Point(27, 206);
this.stoppingEdgeLabel.Name = "stoppingEdgeLabel";
this.stoppingEdgeLabel.Size = new System.Drawing.Size(74, 13);
this.stoppingEdgeLabel.TabIndex = 16;
this.stoppingEdgeLabel.Text = "Stopping level";
this.thresholdLoLabel.AutoSize = true;
this.thresholdLoLabel.Location = new System.Drawing.Point(27, 206);
this.thresholdLoLabel.Name = "thresholdLoLabel";
this.thresholdLoLabel.Size = new System.Drawing.Size(69, 13);
this.thresholdLoLabel.TabIndex = 16;
this.thresholdLoLabel.Text = "Threshold Lo";
//
// label2
//
@@ -430,10 +433,39 @@ namespace TBF.BenchControl.Elde.Diverter
this.label7.TabIndex = 7;
this.label7.Text = "Analog input #";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(190, 228);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(15, 13);
this.label8.TabIndex = 29;
this.label8.Text = "%";
//
// thresholdHiTextBox
//
this.thresholdHiTextBox.Enabled = false;
this.thresholdHiTextBox.Location = new System.Drawing.Point(137, 226);
this.thresholdHiTextBox.Name = "thresholdHiTextBox";
this.thresholdHiTextBox.Size = new System.Drawing.Size(46, 20);
this.thresholdHiTextBox.TabIndex = 28;
//
// thresholdHiLabel
//
this.thresholdHiLabel.AutoSize = true;
this.thresholdHiLabel.Location = new System.Drawing.Point(27, 229);
this.thresholdHiLabel.Name = "thresholdHiLabel";
this.thresholdHiLabel.Size = new System.Drawing.Size(67, 13);
this.thresholdHiLabel.TabIndex = 27;
this.thresholdHiLabel.Text = "Threshold Hi";
//
// DiverterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label8);
this.Controls.Add(this.thresholdHiTextBox);
this.Controls.Add(this.thresholdHiLabel);
this.Controls.Add(this.adcNrTextBox);
this.Controls.Add(this.label7);
this.Controls.Add(this.groupBox4);
@@ -448,8 +480,8 @@ namespace TBF.BenchControl.Elde.Diverter
this.Controls.Add(this.startButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.label2);
this.Controls.Add(this.stoppingEdgeTextBox);
this.Controls.Add(this.stoppingEdgeLabel);
this.Controls.Add(this.thresholdLoTextBox);
this.Controls.Add(this.thresholdLoLabel);
this.Controls.Add(this.startingEdgeTextBox);
this.Controls.Add(this.startingEdgeLabel);
this.Controls.Add(this.parentNameComboBox);
@@ -484,8 +516,8 @@ namespace TBF.BenchControl.Elde.Diverter
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.TextBox startingEdgeTextBox;
private System.Windows.Forms.Label startingEdgeLabel;
private System.Windows.Forms.TextBox stoppingEdgeTextBox;
private System.Windows.Forms.Label stoppingEdgeLabel;
private System.Windows.Forms.TextBox thresholdLoTextBox;
private System.Windows.Forms.Label thresholdLoLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button startButton;
@@ -514,5 +546,8 @@ namespace TBF.BenchControl.Elde.Diverter
private System.Windows.Forms.TextBox adcTextBox1;
private System.Windows.Forms.TextBox adcNrTextBox;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox thresholdHiTextBox;
private System.Windows.Forms.Label thresholdHiLabel;
}
}
@@ -77,7 +77,8 @@ namespace TBF.BenchControl.Elde.Diverter
adcToSinkTextBox.Text = config.AdcValueToSink.ToString();
adcToTankTextBox.Text = config.AdcValueToTank.ToString();
startingEdgeTextBox.Text = config.StartingLevel.ToString();
stoppingEdgeTextBox.Text = config.StoppingLevel.ToString();
thresholdLoTextBox.Text = config.ThresholdLo.ToString();
thresholdHiTextBox.Text = config.ThresholdHi.ToString();
adcTextBox1.Text = adc1.ToString();
adcTextBox2.Text = adc2.ToString();
@@ -94,8 +95,9 @@ namespace TBF.BenchControl.Elde.Diverter
adcToSinkTextBox.Enabled = true;
adcToTankTextBox.Enabled = true;
startingEdgeTextBox.Enabled = true;
stoppingEdgeTextBox.Enabled = true;
}
thresholdLoTextBox.Enabled = true;
thresholdHiTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
@@ -137,12 +139,17 @@ namespace TBF.BenchControl.Elde.Diverter
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Starting Edge' should be between 0 and 100%";
}
if (!int.TryParse(stoppingEdgeTextBox.Text, out dummy) || dummy < 0 || dummy > 100)
if (!int.TryParse(thresholdLoTextBox.Text, out dummy) || dummy < 0 || dummy > 100)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Stopping Edge' should be between 0 and 100%";
message += Environment.NewLine + "'Threshold LO' should be between 0 and 100%";
}
return flags;
if (!int.TryParse(thresholdHiTextBox.Text, out dummy) || dummy < 0 || dummy > 100)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Threshold HI' should be between 0 and 100%";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
@@ -200,13 +207,20 @@ namespace TBF.BenchControl.Elde.Diverter
flags |= CfgUpdateFlags.RestartRqrd;
}
tmp = int.Parse(stoppingEdgeTextBox.Text);
if (config.StoppingLevel != tmp)
tmp = int.Parse(thresholdLoTextBox.Text);
if (config.ThresholdLo != tmp)
{
config.StoppingLevel = tmp;
config.ThresholdLo = tmp;
flags |= CfgUpdateFlags.RestartRqrd;
}
tmp = int.Parse(thresholdHiTextBox.Text);
if (config.ThresholdHi != tmp)
{
config.ThresholdHi = tmp;
flags |= CfgUpdateFlags.RestartRqrd;
}
return flags;
}