(1) bug fixes, (2) common iPerlCommunication test result derived from the 1st test (Read configuration), version 1.5.111.

This commit is contained in:
Milan Hanajik 2015-09-11 19:36:37 +02:00
parent e230ce02bf
commit 06c46785f6
7 changed files with 118 additions and 14 deletions

View File

@ -260,14 +260,32 @@ namespace TBF.BenchControl.DB.SensusOracle
}
writer.WriteLine(string.Empty);
///--------
/// Body
///--------
/// Write text body to a disk file
if (combined)
{
for (int wmNr = 0; wmNr < Program.CompoundWMsCount; wmNr++) WriteCombinedWM(wmNr + 1); /// wmNr is 0-based
}
else
{
for (int wmNr = 0; wmNr < Program.WMsCount; wmNr++) /// wmNr is 0-based
{
if (!unsortedResults[0].Meters[wmNr].Disabled)
{
IList<Entities.TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, combined));
WriteSingleWM(wmNr, wmNr + 1, results);
}
}
}
/// Close the file
writer.Close();
writer = null;
///---------------------------------
/// Write results to the database
///--------------------------------
if (!combined)
{
/// Open the Oracle database
conn.Open();
@ -277,7 +295,6 @@ namespace TBF.BenchControl.DB.SensusOracle
if (!unsortedResults[0].Meters[wmNr].Disabled)
{
IList<Entities.TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, combined));
WriteSingleWM(wmNr, wmNr + 1, results);
SaveSingleWM2DB(wmNr, results);
}
}
@ -395,8 +412,8 @@ namespace TBF.BenchControl.DB.SensusOracle
parm9.Value = 4; /// = ANBID Stara Tura
OracleParameter parm10 = new OracleParameter();
parm9.OracleDbType = OracleDbType.Int32;
parm9.Value = dbCfg.Baujahr;
parm10.OracleDbType = OracleDbType.Int32;
parm10.Value = dbCfg.Baujahr;
if (MAX_Pruefindex % 100 == 1)
{
@ -675,8 +692,6 @@ namespace TBF.BenchControl.DB.SensusOracle
/// <summary>Stop this operation</summary>
public void Stop()
{
if (writer != null) writer.Close();
writer = null;
}
}
}

View File

@ -59,7 +59,7 @@ namespace TBF.BenchControl.Sequences
/// Overwrite (=delete) any previous result with the same name.
/// </summary>
/// <param name="newTestResult">New test result</param>
protected static void AddOrOverwriteResult(Entities.TestResult newTestResult)
public static void AddOrOverwriteResult(Entities.TestResult newTestResult)
{
if (newTestResult == null) return;

View File

@ -36,7 +36,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
tp.UpdateTestParams(tstPrms);
string lowercaseAct = tp.Activity.ToLower();
return lowercaseAct.Contains("simulate ") || lowercaseAct.Contains("q2 corrected from ");
return lowercaseAct.Contains("read configuration") || lowercaseAct.Contains("simulate ") || lowercaseAct.Contains("q2 corrected from ");
}
}
return false;

View File

@ -488,6 +488,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
CommCompletedHandler = null;
AllCompletedHandler = null;
Entities.TestResult result = CommResult(StateMachine.Tests[0]); /// TODO: Pass the test info in a correct way
BenchControl.Sequences.SequenceBase.AddOrOverwriteResult(result); /// TODO: Pass the result in a correct way
TBF.UiBridge.Bridge.OnTestCompleted(this, new TBF.UiBridge.TestCompletedEventArgs(result));
formCompleted = true;
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
@ -1082,5 +1086,84 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
Text = data.CommMessage;
}
/// <summary>
/// Create virtual test result with representing communication success/failure
/// </summary>
/// <param name="test"></param>
/// <returns></returns>
Entities.TestResult CommResult(Entities.Test test)
{
Entities.TestResult tstRslt = new Entities.TestResult(test, 1, Entities.MetersKind.Single);
tstRslt.DoNotEvaluate = false;
tstRslt.DoNotPublish = false;
tstRslt.TimeStart = DateTime.Now;
tstRslt.TimeEnd = DateTime.Now;
tstRslt.AmbientTempAve = 20.0f;
tstRslt.AmbientPressAve = 1000.0f;
tstRslt.AmbientHumiAve = 50.0f;
tstRslt.PressInStart = 1000.0f;
tstRslt.PressOutStart = 1000.0f;
tstRslt.TempInStart = 20.0f;
tstRslt.TempOutStart = 20.0f;
tstRslt.TempDivStart = 20.0f;
tstRslt.PressInEnd = 1000.0f;
tstRslt.PressOutEnd = 1000.0f;
tstRslt.TempInEnd = 20.0f;
tstRslt.TempOutEnd = 20.0f;
tstRslt.TempDivEnd = 20.0f;
tstRslt.PressInAvrg = 1000.0f;
tstRslt.PressOutAvrg = 1000.0f;
tstRslt.TempInAvrg = 20.0f;
tstRslt.TempOutAvrg = 20.0f;
tstRslt.TempDivAvrg = 20.0f;
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.MassDiff = 0;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityOut = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.Time = 0;
tstRslt.FlowMass = 0;
tstRslt.FlowVolume = 0;
tstRslt.VolumeCTV = 0;
tstRslt.VolumeMaster = 0;
tstRslt.PulsesMaster = 0;
tstRslt.ConstMaster = 0;
tstRslt.ErrorMaster = 0;
for (int i = 0; i < Program.WMsCount; i++)
{
/// Reference to iPerl water meter or null:
WaterMeters.iPerl.WaterMeter iPerl = (i < iPerlCommunicationForm.waterMeters.Count) ? iPerlCommunicationForm.waterMeters[i] : null;
tstRslt.Meters[i].SerialNr = iPerl.SerialNr;
tstRslt.Meters[i].PulsesPerLiter = 0;
tstRslt.Meters[i].VolumeRef = 0;
tstRslt.Meters[i].Time = 0;
tstRslt.Meters[i].TimeStart = 0;
tstRslt.Meters[i].TimeEnd = 0;
tstRslt.Meters[i].PulsesMaster = 0;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeEnd = 0;
tstRslt.Meters[i].VolumeMeter = 0;
tstRslt.Meters[i].VolumeErrorPct = 0;
tstRslt.Meters[i].Passed = (!iPerl.CommFailed && !iPerl.Disabled);
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].Disabled = iPerl.Disabled;
}
return tstRslt;
}
}
}

View File

@ -213,7 +213,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
tstRslt.Meters[i].PulsesMaster = oriTestRslt.Meters[i].PulsesMaster;
tstRslt.Meters[i].Disabled = oriTestRslt.Meters[i].Disabled;
if ((iPerl == null) || (Math.Abs(tstRslt.Meters[i].VolumeErrorPct) <= 0.5f))
if ((iPerl == null) || (Math.Abs(oriTestRslt.Meters[i].VolumeErrorPct) <= 0.5f))
{
/// Normal meter or iPerl without correction
tstRslt.Meters[i].VolumeStart = oriTestRslt.Meters[i].VolumeStart;
@ -307,7 +307,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
tstRslt.Meters[i].PulsesMaster = tstRslt.PulsesMaster;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeErrorPct = errorPct;
tstRslt.Meters[i].Passed = (test.ErrLimLo <= errorPct) && (errorPct <= test.ErrLimLo);
tstRslt.Meters[i].Passed = (test.ErrLimLo <= errorPct) && (errorPct <= test.ErrLimHi);
tstRslt.Meters[i].VolumeMeter = test.Volume * (1.0f + 0.01f * errorPct);
tstRslt.Meters[i].PulsesMeter = sensPath.RegisterReaders[i].PulsesPerLtr * tstRslt.Meters[i].VolumeMeter;
tstRslt.Meters[i].Disabled = false;

View File

@ -236,6 +236,9 @@ namespace TBF.BenchControl.WaterMeters.iPerl
public WaterMeter()
{
disabled = false;
commFailed = false;
synchronized = false;
synchronized2 = false;
partOfTelegram = string.Empty;
@ -246,6 +249,9 @@ namespace TBF.BenchControl.WaterMeters.iPerl
public WaterMeter(WaterMeterCfg cfg)
: base(cfg)
{
disabled = false;
commFailed = false;
iPerlCfg = cfg;
log.Debug(this.ToString());
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.5.109.1")]
[assembly: AssemblyFileVersion("1.5.109.1")]
[assembly: AssemblyVersion("1.5.111.1")]
[assembly: AssemblyFileVersion("1.5.111.1")]