Generate CompleteTestInfos from Procedure in case Oracle DB is off, ver. 2.25.1427
This commit is contained in:
parent
f10be22c0b
commit
54a28aa8bf
@ -417,6 +417,93 @@ namespace Results.Output
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a array of SensusTestInfo objects representing the procedure.
|
||||
/// Multiple parts of the same test (with the same name) generate only one SensusTestInfo object.
|
||||
/// </summary>
|
||||
/// <param name="procedure">Procedure entity</param>
|
||||
/// <returns>Array of SensusTestInfo objects</returns>
|
||||
public static SensusTestInfo[] CreateFromProcedure(Config.Entities.Procedure procedure)
|
||||
{
|
||||
///
|
||||
/// Count the number of different tests.
|
||||
/// Multiple parts of the same test (same name) are counted only once.
|
||||
///
|
||||
IList<string> listOfHydroTests = new List<string>();
|
||||
foreach (var test in procedure.Tests)
|
||||
{
|
||||
if (!test.Method.ToLower().Contains("iperlcommunication"))
|
||||
{
|
||||
for (int repNr = 1; repNr <= test.Repeats; repNr++)
|
||||
{
|
||||
string fullTestNameWoPart = (test.Repeats == 1) ? test.Name : string.Format("{0} ({1}/{2})", test.Name, repNr, test.Repeats);
|
||||
if (!listOfHydroTests.Contains(fullTestNameWoPart))
|
||||
{
|
||||
listOfHydroTests.Add(fullTestNameWoPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SensusTestInfo[] stiArray = new SensusTestInfo[listOfHydroTests.Count];
|
||||
int ix = 0;
|
||||
int luID = listOfHydroTests.Count;
|
||||
listOfHydroTests.Clear();
|
||||
|
||||
foreach (var test in procedure.Tests)
|
||||
{
|
||||
if (!test.Method.ToLower().Contains("iperlcommunication"))
|
||||
{
|
||||
for (int repNr = 1; repNr <= test.Repeats; repNr++)
|
||||
{
|
||||
string fullTestNameWoPart = (test.Repeats == 1) ? test.Name : string.Format("{0} ({1}/{2})", test.Name, repNr, test.Repeats);
|
||||
if (!listOfHydroTests.Contains(fullTestNameWoPart))
|
||||
{
|
||||
listOfHydroTests.Add(fullTestNameWoPart);
|
||||
stiArray[ix++] = CreateFromTest(test, repNr, luID--, fullTestNameWoPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stiArray;
|
||||
}
|
||||
|
||||
public static SensusTestInfo CreateFromTest(Config.Entities.Test test, int repetitionNr, int luID, string fullTestNameWoPart)
|
||||
{
|
||||
bool isQ4Q3 = test.Name.ToLower().Contains("q4") ||
|
||||
test.Name.ToLower().Contains("q3") ||
|
||||
test.Name.ToLower().Contains("qmax") ||
|
||||
test.Name.ToLower().Contains("qn");
|
||||
|
||||
bool isQ2Q1 = test.Name.ToLower().Contains("q2") ||
|
||||
test.Name.ToLower().Contains("q1") ||
|
||||
test.Name.ToLower().Contains("qt") ||
|
||||
test.Name.ToLower().Contains("qmin");
|
||||
|
||||
/// Range.R90_100 or Range.R100_110 (flow range in % of a target flow)
|
||||
Range range = isQ4Q3 ? Range.R90_100 : (isQ2Q1 ? Range.R100_110 : Range.R95_105);
|
||||
|
||||
return new SensusTestInfo()
|
||||
{
|
||||
TestName = fullTestNameWoPart, /// Test name in TBF procedures
|
||||
PruefungsNrDB = luID, /// Identification of a flow
|
||||
QBezeichnungDB = fullTestNameWoPart, /// Flow name in Oracle database
|
||||
PruefungsNrOpto = luID, /// Identification of a flow - string form for log files
|
||||
QBezeichnungOpto = luID.ToString("D02"), /// Flow name in Oracle database
|
||||
PruefungsNrLog = luID, /// Identification of a flow
|
||||
QBezeichnungLog = fullTestNameWoPart, /// Flow name in Oracle database
|
||||
Range = range,
|
||||
Flow = (range == Range.R100_110) ? test.Qfrom : (range == Range.R90_100) ? test.Qto : (test.Qfrom + test.Qto) / 2,
|
||||
TestTime = (int)Math.Round(test.TstTime),
|
||||
ErrLimLoFromDB = test.ErrLimLo,
|
||||
ErrLimHiFromDB = test.ErrLimHi,
|
||||
Uncertainty = test.Uncertainty,
|
||||
TestMethod = test.Method,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} DB={1}/'{2}' Opto={3}/'{4}' Log={5}/'{6}'/{7}", TestName, PruefungsNrDB, QBezeichnungDB, PruefungsNrOpto, QBezeichnungOpto, PruefungsNrLog, QBezeichnungLog, Range);
|
||||
|
||||
@ -180,13 +180,20 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
Results.Entities.WaterMeter wm0 = null;
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && (wm.CompleteTestInfos != null) && (wm.WaterMeterData != null))
|
||||
//if ((wm != null) && wm.PassedFromTests())
|
||||
if (wm != null && wm.WaterMeterData != null)
|
||||
{
|
||||
wm0 = wm;
|
||||
wm0 = wm;
|
||||
if (wm0.CompleteTestInfos == null)
|
||||
{
|
||||
wm0.CompleteTestInfos = (TBF.BenchControl.Sequences.ProcessData.CompleteTestInfos != null)
|
||||
? TBF.BenchControl.Sequences.ProcessData.CompleteTestInfos
|
||||
: Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (wm0 == null)
|
||||
{
|
||||
log.Error("Not a single watermeter in the batch");
|
||||
|
||||
@ -351,6 +351,8 @@ namespace TBF.BenchControl.Sequences
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
RawTestInfos = null;
|
||||
CompleteTestInfos = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -381,18 +381,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
ClearData();
|
||||
optoSerialPortParsingEnabled = false;
|
||||
|
||||
/// Allocate memory for opto-data from iPerl
|
||||
optoData = new OptoTelegramRaw[MaxOptoDataCount];
|
||||
for (int i = 0; i < MaxOptoDataCount; i++) optoData[i] = new OptoTelegramRaw();
|
||||
|
||||
toBeFlushed = new OptoTelegramRaw();
|
||||
|
||||
synchronized = false;
|
||||
synchronized2 = false;
|
||||
partOfTelegram = string.Empty;
|
||||
|
||||
if (DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
/// Allocate memory for opto-data from iPerl
|
||||
optoData = new OptoTelegramRaw[MaxOptoDataCount];
|
||||
for (int i = 0; i < MaxOptoDataCount; i++) optoData[i] = new OptoTelegramRaw();
|
||||
|
||||
toBeFlushed = new OptoTelegramRaw();
|
||||
|
||||
synchronized = false;
|
||||
synchronized2 = false;
|
||||
partOfTelegram = string.Empty;
|
||||
|
||||
/// Prepare serial port
|
||||
optoSerialPort = new SerialPort(string.Format("COM{0}", iperlHeadCfg.OptoComPortNr),
|
||||
9600, Parity.None, 8, StopBits.One);
|
||||
@ -556,6 +556,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
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;
|
||||
///
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.25.1420.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1420.0")]
|
||||
[assembly: AssemblyVersion("2.25.1427.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1427.0")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user