IperlHead cleanup : No side effect on ProcessData.CompleteTestInfos

This commit is contained in:
Milan Hanajik 2020-12-10 11:13:23 +01:00
parent 6226fbedfc
commit fd9a08406f

View File

@ -63,31 +63,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
get
{
if (ConfigStruct != null) return configStruct.GetPcbNrString();
if (ConfigStruct != null) return ConfigStruct.GetPcbNrString();
else return string.Empty;
}
set { }
}
public bool Disabled
{
get { return disabled; }
set { disabled = value; }
}
bool disabled;
public bool CommFailed
{
get { return commFailed; }
set { commFailed = value; }
}
bool commFailed;
public int ResultCode
{
get { return resultCode; }
}
int resultCode;
public bool Disabled;
public bool CommFailed;
public int ResultCode;
/// <summary>
@ -101,29 +85,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public bool PositiveCounting;
/// <summary> ConfigStruct of the water meter obtained or updated by iPerlCommunication </summary>
public ConfigStruct ConfigStruct
{
get { return configStruct; }
set { configStruct = value; }
}
ConfigStruct configStruct;
/// <summary> CalibrationStruct of the water meter obtained or updated by iPerlCommunication </summary>
public CalibrationStruct CalibrationStruct
{
get { return calibrationStruct; }
set { calibrationStruct = value; }
}
CalibrationStruct calibrationStruct;
/// <summary> CalibrationStruct of the water meter obtained or updated by iPerlCommunication </summary>
public CalibrationStructV4 CalibrationStructV4
{
get { return calibrationStructV4; }
set { calibrationStructV4 = value; }
}
CalibrationStructV4 calibrationStructV4;
public ConfigStruct ConfigStruct; /// ConfigStruct of WM obtained or updated by iPerlCommunication
public CalibrationStruct CalibrationStruct; /// CalibrationStruct of WM obtained or updated by iPerlCommunication
public CalibrationStructV4 CalibrationStructV4; /// CalibrationStruct of WM obtained or updated by iPerlCommunication
public ushort OrigCalibFactor;
public ushort CalibFactor
@ -169,16 +133,16 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
///
public int WMPulses { get { return wmPulses; } }
public int WMRefPulses { get { return wmRefPulses; } }
public double WMVolume { get { return wmVolume; } }
public double BeginWMState { get { return beginWMState; } }
public double EndWMState { get { return endWMState; } }
public double WMTestTime { get { return wmTestTime; } }
public double WMVolume { get { return wmVolume; } }
public double WMTestTime { get { return wmTestTime; } }
double beginWMState;
int wmPulses;
int wmRefPulses;
double beginWMState;
double endWMState;
double wmVolume;
int wmPulses;
int wmRefPulses;
double wmTestTime;
@ -411,14 +375,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
/// </summary>
public void ClearData()
{
resultCode = 0;
ResultCode = 0;
disabled = false;
commFailed = false;
Disabled = false;
CommFailed = false;
configStruct = null;
calibrationStruct = null;
calibrationStructV4 = null;
ConfigStruct = null;
CalibrationStruct = null;
CalibrationStructV4 = null;
LastTestResult = null;
LastTestResult2 = null;
@ -522,7 +486,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
/// </summary>
public void Clear()
{
resultCode = 0;
ResultCode = 0;
volumeLtr = 0;
volumeLtr0 = 0;
@ -556,34 +520,41 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
endTelegramIdx3 = 0;
TestEndTelegramIx = 0;
/// File name is: PCB_AA_BB_HH_MI_SS..txt
string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#'
if (wmPosition.Length == 1) wmPosition = "0" + wmPosition;
if (StateMachine.Procedure != null && Sequences.ProcessData.CompleteTestInfos == null)
{
Sequences.ProcessData.CompleteTestInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
}
Results.Output.SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos;
optoDataLogFileName = null;
///
if (testInfos != null)
/// Determine opto data file name: PCB_AA_BB_HH_MI_SS..txt
///
Results.Output.SensusTestInfo[] localTestInfos = Sequences.ProcessData.CompleteTestInfos;
if (localTestInfos == null && StateMachine.Procedure != null)
{
string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
foreach (var ti in testInfos)
localTestInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
}
///
string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
string qBezeichnungOpto = null; /// To be determined from TestInfo-s (if there are any)
if (localTestInfos != null)
{
foreach (var ti in localTestInfos)
{
if ((ti.PruefungsNrOpto != 0) && (ti.TestName == fullTestName))
{
optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}.txt",
(ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr",
wmPosition,
string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2") : ti.QBezeichnungOpto,
StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss"));
qBezeichnungOpto = string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2") : ti.QBezeichnungOpto;
break;
}
}
}
if (qBezeichnungOpto == null)
{
qBezeichnungOpto = fullTestName; /// No appropriate TestInfo found => set default opto data file name
}
///
string pcbNr = (ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr";
string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#'
if (wmPosition.Length == 1) wmPosition = "0" + wmPosition;
string cycleStartTime = StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss");
///
optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnungOpto, cycleStartTime);
StartParsingOptoSerialPort();
}
@ -658,11 +629,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
if (TestStartTelegramIx == 0 || optoDataCount < 100)
{
resultCode |= (int)Results.Entities.ResultCode.MissingOptoData;
ResultCode |= (int)Results.Entities.ResultCode.MissingOptoData;
}
else if (volumeLtrEnd == volumeLtrStart)
{
resultCode |= (int)Results.Entities.ResultCode.OptoDataWithZeroFlow;
ResultCode |= (int)Results.Entities.ResultCode.OptoDataWithZeroFlow;
}
}
@ -980,29 +951,29 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public void WriteBinary(BinaryWriter writer)
{
writer.Write(disabled);
writer.Write(commFailed);
writer.Write(resultCode);
writer.Write(Disabled);
writer.Write(CommFailed);
writer.Write(ResultCode);
writer.Write(PositiveCounting);
if (configStruct != null)
if (ConfigStruct != null)
{
writer.Write(true);
configStruct.WriteBinary(writer);
ConfigStruct.WriteBinary(writer);
}
else writer.Write(false);
if (calibrationStruct != null)
if (CalibrationStruct != null)
{
writer.Write(true);
calibrationStruct.WriteBinary(writer);
CalibrationStruct.WriteBinary(writer);
}
else writer.Write(false);
if (calibrationStructV4 != null)
if (CalibrationStructV4 != null)
{
writer.Write(true);
calibrationStructV4.WriteBinary(writer);
CalibrationStructV4.WriteBinary(writer);
}
else writer.Write(false);
@ -1032,14 +1003,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public void ReadBinary(BinaryReader reader)
{
disabled = reader.ReadBoolean();
commFailed = reader.ReadBoolean();
resultCode = reader.ReadInt32();
Disabled = reader.ReadBoolean();
CommFailed = reader.ReadBoolean();
ResultCode = reader.ReadInt32();
PositiveCounting = reader.ReadBoolean();
if (reader.ReadBoolean()) (configStruct = new ConfigStruct()).ReadBinary(reader);
if (reader.ReadBoolean()) (calibrationStruct = new CalibrationStruct()).ReadBinary(reader);
if (reader.ReadBoolean()) (calibrationStructV4 = new CalibrationStructV4()).ReadBinary(reader);
if (reader.ReadBoolean()) (ConfigStruct = new ConfigStruct()).ReadBinary(reader);
if (reader.ReadBoolean()) (CalibrationStruct = new CalibrationStruct()).ReadBinary(reader);
if (reader.ReadBoolean()) (CalibrationStructV4 = new CalibrationStructV4()).ReadBinary(reader);
OrigCalibFactor = reader.ReadUInt16();
OrigCalibFactorLNA = reader.ReadUInt16();