string Results.entities.MeterTestRslt.ExtraDataPath and related changes, supported by FlyingStart, FlStMassCollection and FlStMassCollProlonged.

This commit is contained in:
Milan Hanajik 2021-06-24 12:19:15 +02:00
parent 760ec598ca
commit 8e25fa6232
6 changed files with 30 additions and 10 deletions

View File

@ -31,6 +31,7 @@ namespace Results.Entities
public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
#if ORACLE_DB
public virtual string ExtraDataPath { get; set; } /// Relative path to a file with opto-data/raw-data
public virtual double LastError { get; set; } /// [%] Previous test error at this Q in case Pruefindex > 1
#endif
@ -141,7 +142,8 @@ namespace Results.Entities
TestDone = oriMTR.TestDone;
Passed = oriMTR.Passed;
#if ORACLE_DB
LastError = oriMTR.LastError;
ExtraDataPath = oriMTR.ExtraDataPath;
LastError = oriMTR.LastError;
#endif
}
@ -168,7 +170,8 @@ namespace Results.Entities
TestDone = src.TestDone;
Passed = src.Passed;
#if ORACLE_DB
LastError = src.LastError;
ExtraDataPath = src.ExtraDataPath;
LastError = src.LastError;
#endif
}
@ -199,6 +202,7 @@ namespace Results.Entities
writer.Write(TestDone);
writer.Write(Passed);
#if ORACLE_DB
writer.Write((ExtraDataPath != null) ? ExtraDataPath : string.Empty);
writer.Write(LastError);
#endif
writer.Write((TestRslt != null && TestRslt.Name() != null) ? TestRslt.Name() : string.Empty);
@ -227,6 +231,7 @@ namespace Results.Entities
TestDone = reader.ReadBoolean();
Passed = reader.ReadBoolean();
#if ORACLE_DB
ExtraDataPath = reader.ReadString();
LastError = reader.ReadDouble();
#endif
TestRslt = null;

View File

@ -27,6 +27,7 @@ namespace Results.Mappings
Map(x => x.TestDone);
Map(x => x.Passed);
#if ORACLE_DB
Map(x => x.ExtraDataPath);
Map(x => x.LastError);
#endif
References(x => x.WaterMeter);

View File

@ -619,6 +619,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
#if IPERL
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
#endif
meterRslt.ExtraDataPath = iPerl.ExtraDataPath;
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
iPerl.LastTestResult = meterRslt; /// Save this test result
}

View File

@ -1028,6 +1028,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
#if IPERL
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
#endif
meterRslt.ExtraDataPath = iPerl.ExtraDataPath;
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
iPerl.LastTestResult = meterRslt; /// Save this test result
}

View File

@ -954,6 +954,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
#if IPERL
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
#endif
meterRslt.ExtraDataPath = iPerl.ExtraDataPath;
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
iPerl.LastTestResult = meterRslt; /// Save this test result
}

View File

@ -25,6 +25,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
#else
public const int MaxOptoDataCount = 40000;
#endif
public const string OptoDataDirectory = "C:\\TBF\\ProcessData";
public const int StartOptoDataCount = MaxOptoDataCount / 2;
public const int EndOptoDataCount = MaxOptoDataCount - StartOptoDataCount;
public const int StartEndFilterSamplesCount2 = 20; /// StartEndFilterSamplesCount = 2 * StartEndFilterSamplesCount2 + 1
@ -75,6 +76,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public int ResultCode;
string extraDataPath;
public string ExtraDataPath { get { return extraDataPath; } }
/// <summary>
/// Passed to OptoTelegramRaw.UpdateFromString(...)
/// </summary>
@ -570,6 +575,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
///
optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnungOpto, cycleStartTime);
extraDataPath = null;
StartParsingOptoSerialPort();
}
@ -628,7 +634,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
OptoTelegramRaw.FIRFilterFlow(optoData, 0, StartOptoDataCount - 1);
OptoTelegramRaw.FIRFilterFlow(optoData, (optoDataCount - EndOptoDataCount), optoDataCount - 1);
}
SaveOptoData();
extraDataPath = SaveOptoData();
if (TestStartTelegramIx == 0 || optoDataCount < 100)
{
@ -643,20 +650,20 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
/// <summary>
/// Save opto data to a file.
/// </summary>
void SaveOptoData()
string SaveOptoData()
{
if (!string.IsNullOrEmpty(optoDataLogFileName))
{
string directory = Path.Combine("C:\\TBF\\ProcessData", StateMachine.CycleStartTimeStamp.ToString("yy"),
StateMachine.CycleStartTimeStamp.ToString("MM"),
StateMachine.CycleStartTimeStamp.ToString("dd"));
string fullFileName = Path.Combine(directory, optoDataLogFileName);
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
StateMachine.CycleStartTimeStamp.ToString("MM"),
StateMachine.CycleStartTimeStamp.ToString("dd"));
string fullFileName = Path.Combine(OptoDataDirectory, relativeDirectory, optoDataLogFileName);
log.WarnFormat("Saving {0} opto data to {1}", Name, fullFileName);
try
{
Directory.CreateDirectory(directory);
Directory.CreateDirectory(Path.Combine(OptoDataDirectory, relativeDirectory));
double scalFact = ScalingFactor();
@ -696,6 +703,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
optoLogFile.Close();
}
return Path.Combine(relativeDirectory, optoDataLogFileName);
}
catch (Exception exc)
{
@ -704,7 +713,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
log.ErrorFormat(string.Format("Exception message: {0}", exc.Message));
}
}
}
return null;
}
void ReadPulses()
{