Bug fixes in reading diverters: ReadDiverterTransitionOp, Elde.Diverter.Component, IControlCOm, IDiverter.
This commit is contained in:
@@ -27,6 +27,7 @@ namespace TBF.BenchControl.Dummy.Diverter
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public int DiverterNr { get { return 0; } }
|
||||
public bool State { get { return false; } }
|
||||
public int ThresholdGate { get { return 50; } }
|
||||
public int ThresholdLo { get { return 10; } }
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint BeginState(int wmNr0) { return controlCom.BeginState(wmNr0); }
|
||||
public double ReferenceFlow { get { return controlCom.ReferenceFlow; } }
|
||||
public float RValvePosition(int rvNr1) { return controlCom.RValvePosition(rvNr1); }
|
||||
public float DivSamples(int ms) { return controlCom.DivSamples(ms); }
|
||||
public float DivSamples(int time, int divIx0) { return controlCom.DivSamples(time, divIx0); } /// Time unit is 2 ms
|
||||
public int ScopeSamples(int i, int j, int k) { return controlCom.ScopeSamples(i, j, k); }
|
||||
public ulong DigitalInputs { get { return controlCom.DigitalInputs; } }
|
||||
public float AnalogInput(int adcNr0) { return controlCom.AnalogInput(adcNr0); }
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace TBF.BenchControl.Elde
|
||||
public float ReferenceFlow { get { return referenceFlow; } }
|
||||
|
||||
public float RValvePosition(int rvNr1) { return 0; }
|
||||
public float DivSamples(int ms) { return 0; }
|
||||
public float DivSamples(int ms, int divIx0) { return 0; }
|
||||
public int ScopeSamples(int i, int j, int k) { return 0; }
|
||||
public ulong DigitalInputs { get { return 0; } }
|
||||
public float AnalogInput(int adcNr0) { return 0; }
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace TBF.BenchControl.Elde
|
||||
//return ctrlBrdComponent.RValvePosition[rvNr1 - 1];
|
||||
return ctrlBrdComponent.Analogy[rvNr1 - 1]; /// Fixes bug: RValvePosition returns 0 all the time
|
||||
}
|
||||
public float DivSamples(int ms) { return ctrlBrdComponent.DIVSamples[ms, 0]; }
|
||||
public float DivSamples(int time, int divIx0) { return ctrlBrdComponent.DIVSamples[time, divIx0]; } /// Time unit is 2 ms
|
||||
public int ScopeSamples(int i, int j, int k) { return ctrlBrdComponent.ScopeSamples[i, j, k]; }
|
||||
public ulong DigitalInputs { get { return (ulong)ctrlBrdComponent.Vstupy; } }
|
||||
public float AnalogInput(int adcNr0) { return ctrlBrdComponent.Analogy[adcNr0]; }
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.Elde
|
||||
uint BeginState(int wmNr0);
|
||||
float ReferenceFlow { get; }
|
||||
float RValvePosition(int rvNr1);
|
||||
float DivSamples(int ms);
|
||||
float DivSamples(int time, int divIx0); /// time unit is 2 ms
|
||||
int ScopeSamples(int i, int j, int k);
|
||||
ulong DigitalInputs { get; }
|
||||
float AnalogInput(int adcNr0);
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -7,6 +7,12 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IDiverter : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 1-based diverter number in case of Elde control board connected diverter (>= 1)
|
||||
/// 0 = dummy diverter
|
||||
/// </summary>
|
||||
int DiverterNr { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Diverter state: true = to tank, false = bypass tank
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user