FileWriters.IperlLogger rewritten : uses OraId, OraIdRepetMulti, OraDesignation and LUTestData class, BatchResults bug fix
This commit is contained in:
@@ -285,12 +285,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
/// </summary>
|
||||
/// <param name="test">Currently executed test</param>
|
||||
/// <param name="repetitionNr">Currently executed repetition number</param>
|
||||
public void TestIsGoingToStartSoon(Test test, int repetitionNr)
|
||||
public void TestIsGoingToStartSoon(Test _test, int _repetitionNr)
|
||||
{
|
||||
/// Store/update values to be used as a part of the opto-data log file name
|
||||
testName = test.Name;
|
||||
testRepeats = test.Repeats;
|
||||
this.repetitionNr = repetitionNr;
|
||||
this.test = _test;
|
||||
this.repetitionNr = _repetitionNr;
|
||||
|
||||
if (IsDataStreamProcessing())
|
||||
{
|
||||
@@ -326,8 +325,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
}
|
||||
///
|
||||
string testName;
|
||||
int testRepeats;
|
||||
Test test;
|
||||
int repetitionNr;
|
||||
|
||||
|
||||
@@ -660,20 +658,24 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
//
|
||||
// log.DebugFormat("Feature vector calculation end, save opto-file start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("MM"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("dd"));
|
||||
string directory = Path.Combine(OptoDataDirectory, relativeDirectory);
|
||||
string fileName = DetermineExtraDataFileName();
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
if (test.RawDataId + repetitionNr * test.RawDataIdRepetMulti != 0)
|
||||
{
|
||||
if (SaveOptoDataToFile(directory, fileName))
|
||||
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("MM"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("dd"));
|
||||
string fileName = DetermineExtraDataFileName();
|
||||
if (SaveOptoDataToFile(Path.Combine(OptoDataDirectory, relativeDirectory), fileName))
|
||||
{
|
||||
extraDataPath = Path.Combine(relativeDirectory, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
log.WarnFormat("IperlHeadd.Stop() startIx={0} endIx={1} optoData.Len={2} filename={3}", startIx, endIx, optoData.Length, !string.IsNullOrEmpty(fileName) ? fileName : "<null>");
|
||||
log.WarnFormat("IperlHead.Stop() startIx={0} endIx={1} len={2} raw data file = {3}",
|
||||
startIx, endIx, optoData.Length, fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("IperlHead.Stop() startIx={0} endIx={1} len={2} no raw data file", startIx, endIx, optoData.Length);
|
||||
}
|
||||
|
||||
if (TestStartTelegramIx == 0 || optoDataCount < 100)
|
||||
{
|
||||
@@ -740,36 +742,21 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
string DetermineExtraDataFileName()
|
||||
{
|
||||
///
|
||||
/// Select or create appropriate test infos
|
||||
///
|
||||
Results.Output.SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos;
|
||||
///
|
||||
if ((ProcessData.OracleDB != null && ProcessData.OracleDB.DesigMode == DesigMode.Based_on_procedure) ||
|
||||
(testInfos == null && StateMachine.Procedure != null))
|
||||
{
|
||||
testInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
|
||||
}
|
||||
|
||||
///
|
||||
/// Select or create appropriate 'qBezeichnung'
|
||||
///
|
||||
string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
|
||||
var ti = testInfos.FirstOrDefault(x => x.PruefungsNrOpto != 0 && x.TestName == fullTestName);
|
||||
string qBezeichnung = (ti == null) ? fullTestName /// No appropriate TestInfo found => set default opto data file name
|
||||
: string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2")
|
||||
: ti.QBezeichnungOpto;
|
||||
///
|
||||
/// Get other required pieces of information
|
||||
/// Get required pieces of information
|
||||
///
|
||||
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");
|
||||
|
||||
string[] designations = string.IsNullOrEmpty(test.RawDataDesignation) ? new string[0] : test.RawDataDesignation.Split(new char[] { '~' });
|
||||
string designation = string.IsNullOrEmpty(test.RawDataDesignation)
|
||||
? (test.RawDataId + repetitionNr * test.RawDataIdRepetMulti).ToString("D2") /// Name is generated from Id
|
||||
: (designations.Length > repetitionNr - 1) ? designations[repetitionNr - 1] /// Name is from 'RawDataDesignation' parameter
|
||||
: string.Format("{0}{1}", test.Name, repetitionNr); /// Name is form test name and repetition nr.
|
||||
///
|
||||
/// Return the file name
|
||||
///
|
||||
return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnung, cycleStartTime);
|
||||
///
|
||||
return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, designation, cycleStartTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -779,7 +766,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
bool SaveOptoDataToFile(string directory, string fileName)
|
||||
{
|
||||
string fullFileName = Path.Combine(directory, fileName);
|
||||
log.WarnFormat("Saving {0} opto data to {1}", Name, fullFileName);
|
||||
log.WarnFormat("Saving {0} raw data to {1}", Name, fullFileName);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -953,7 +940,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
/// CR+LF was found && (pos >= OptoTelegramRaw.Length - 2) && the telegram is OK
|
||||
flowDirectionDetection.WriteToFifo(volumeRawExtLast, timestampExtLast);
|
||||
OptoTelegramRreceived(optoDataCount, synchronized2, volumeRawExtLast, timestampExtLast);
|
||||
OptoTelegramReceived(optoDataCount, synchronized2, volumeRawExtLast, timestampExtLast);
|
||||
synchronized2 = synchronized;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
@@ -1003,7 +990,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
|
||||
|
||||
void OptoTelegramRreceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
|
||||
void OptoTelegramReceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
|
||||
{
|
||||
currentTelegramIx = currentIx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user