Bug fixes in reading diverters: ReadDiverterTransitionOp, Elde.Diverter.Component, IControlCOm, IDiverter.

This commit is contained in:
Milan Hanajik
2018-06-12 17:07:15 +02:00
parent b5383a445e
commit 7c2135a8fe
7 changed files with 40 additions and 28 deletions
@@ -10,7 +10,10 @@ namespace TBF.BenchControl.Elde
public class ReadDiverterTransitionOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ReadDiverterTransitionOp));
public override string ToString() { return string.Format("ReadDiverterTransitionOp()"); }
public override string ToString()
{
return string.Format("ReadDiverterTransitionOp(.,{0},{1},{2},...)", div.Name, runsCountWhenSendingCmd, runsCountWhenReadingDiv);
}
const int SamplesCount = 240; /// Should be less then or equal to 256
float[] samples;
@@ -68,16 +71,16 @@ namespace TBF.BenchControl.Elde
{
counter = 0;
if (plotter == null)
if (runsCountWhenSendingCmd == 0 && div.DiverterNr > 0)
{
if (div is TBF.BenchControl.Elde.Diverter.Diverter && runsCountWhenSendingCmd == 0)
{
SendCommand();
}
SendCommand();
log.DebugFormat("Start() ... Sending a command to read diverter {0}", div.Name);
}
else
if (plotter != null)
{
plotter.Start(batchNr, testName, repetition);
log.DebugFormat("Start() ... plotter.Start({0}, {1}, {2})", batchNr, testName, repetition);
}
}
@@ -89,29 +92,31 @@ namespace TBF.BenchControl.Elde
{
counter++;
if (div is TBF.BenchControl.Elde.Diverter.Diverter)
if (counter == runsCountWhenSendingCmd && div.DiverterNr > 0)
{
if (counter == runsCountWhenSendingCmd)
SendCommand();
log.DebugFormat("Run() ... Sending a command to read diverter {0}", div.Name);
}
else if (counter == runsCountWhenReadingDiv && div.DiverterNr > 0)
{
if (plotter == null)
{
if (plotter == null) SendCommand();
ReadDiverterTransitionTimes();
log.DebugFormat("Run() ... Reading diverter {0} transition times: {1}s", div.Name, transitionTimeSec.Val);
}
else if (counter == runsCountWhenReadingDiv)
else
{
if (plotter == null)
log.DebugFormat("Run() ... Reading diverter {0} samples", div.Name);
for (int i = 0; i < SamplesCount; i++)
{
ReadDiverterTransitionTimes();
float oneSample = controlBoard.DivSamples(i, div.DiverterNr - 1);
samples[i] = oneSample;
plotter.Update(oneSample);
}
else
{
for (int i = 0; i < SamplesCount; i++)
{
float oneSample = controlBoard.DivSamples(i);
samples[i] = oneSample;
plotter.Update(oneSample);
}
plotter.Stop();
CalculateDiverterTransitionTimes();
}
log.DebugFormat("Run() ... Calculating diverter {0} transition times: {1}s", div.Name, transitionTimeSec.Val);
CalculateDiverterTransitionTimes();
}
}
@@ -121,7 +126,7 @@ namespace TBF.BenchControl.Elde
/// <summary>Stop this operation</summary>
public void Stop()
{
if (plotter != null) plotter.Stop();
log.DebugFormat("Stop()");
}
void SendCommand()