IPERL : Results.Entities.MeterTestRslt.X1 .. X9, ErrorBC added, X1 = flow st. dev., Q_WZ (and VolumeMeter) calculation bug fix, etc.
This commit is contained in:
@@ -1402,7 +1402,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// :11 niz
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Max(-99999.999, Math.Min(mtr.VolumeStart, 99999.999)) }); /// :12 anfangzstand
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Max(-99999.999, Math.Min(mtr.VolumeEnd, 99999.999)) }); /// :13 endzstand
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(100.0, Math.Max(-100.0, mtr.KorrErrQ)) }); /// :14 korrerrq
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(100.0, Math.Max(-100.0, mtr.ErrorBC)) }); /// :14 korrerrq
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(100000, mtr.TestTime) }); /// :15 tiz
|
||||
|
||||
int retv = cmd.ExecuteNonQuery();
|
||||
|
||||
@@ -48,12 +48,12 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
: base(cfg)
|
||||
{
|
||||
writerCfg = cfg as WriterCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -391,13 +391,15 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("ZeitImpulse{0}={1}", flID, mtr.TestTime.ToString(Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("Impulse{0}={1}", flID, 0));
|
||||
logger.WriteLine(string.Format("Volumen{0}={1}", flID, mtr.VolumeMeter.ToString(Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("KorrFehler{0}={1}", flID, (mtr.TestData().Method != null) && mtr.TestData().Method.Contains("iPerlCommunication") && ((mtr.WaterMeter.Q2CorrRL != 0) || (mtr.WaterMeter.Q2CorrLR != 0))
|
||||
? mtr.WaterMeter.Q2ErrWOCorrection.ToString(Program.AltCulture)
|
||||
: mtr.Error.ToString(Program.AltCulture)));
|
||||
#if ORACLE_DB
|
||||
logger.WriteLine(string.Format("KorrFehler{0}={1}", flID, mtr.ErrorBC.ToString(Program.AltCulture)));
|
||||
#else
|
||||
logger.WriteLine(string.Format("KorrFehler{0}={1}", flID, mtr.Error.ToString(Program.AltCulture)));
|
||||
#endif
|
||||
logger.WriteLine(string.Format("KorrDurchfluss{0}={1}", flID, 0));
|
||||
logger.WriteLine(string.Format("Q{0}KorrBestanden={1}", flID, 0));
|
||||
logger.WriteLine(string.Format("Anfangsstand{0}={1}", flID, 0)); /// TODO
|
||||
logger.WriteLine(string.Format("Endstand{0}={1}", flID, 0)); /// TODO
|
||||
logger.WriteLine(string.Format("Q{0}KorrBestanden={1}", flID, mtr.Passed ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Anfangsstand{0}={1}", flID, mtr.VolumeStart).ToString(Program.AltCulture));
|
||||
logger.WriteLine(string.Format("Endstand{0}={1}", flID, mtr.VolumeEnd).ToString(Program.AltCulture));
|
||||
logger.WriteLine(string.Format("QMittelwert{0}={1}", flID, Utils.DoubleToStr(Units.ConvertTo(Unit.lph, mtr.FlowVolume()), 5, true)));
|
||||
logger.WriteLine(string.Format("QStandardAbweichung{0}={1}", flID, 0));
|
||||
logger.WriteLine(string.Format("ImpedanzMittelwert{0}={1}", flID, "0,00000"));
|
||||
@@ -409,9 +411,14 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("AusfallGrundGesamt={0}", 0));
|
||||
logger.WriteLine(string.Format("AuftragNum={0}", wMtr.PurchaseOrder));
|
||||
logger.WriteLine(string.Format("MaterialNum={0}", 38140500));
|
||||
logger.WriteLine(string.Format("Prefix={0}", "8SEN01"));
|
||||
logger.WriteLine(string.Format("Suffix="));
|
||||
logger.WriteLine(string.Format("Palette={0}", 0));
|
||||
#if ORACLE_DB
|
||||
logger.WriteLine(string.Format("Prefix={0}", wMtr.Prefix));
|
||||
logger.WriteLine(string.Format("Suffix={0}", wMtr.Suffix));
|
||||
#else
|
||||
logger.WriteLine(string.Format("Prefix={0}", "8SEN"));
|
||||
logger.WriteLine(string.Format("Suffix="));
|
||||
#endif
|
||||
logger.WriteLine(string.Format("Palette={0}", 0));
|
||||
logger.WriteLine(string.Format("Umkarton={0}", 0));
|
||||
logger.WriteLine(string.Format("ZNr_komplett="));
|
||||
logger.WriteLine(string.Format("OptikBewertung=0,00000"));
|
||||
|
||||
@@ -627,6 +627,15 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
#if IPERL
|
||||
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
|
||||
meterRslt.ExtraDataPath = iPerl.ExtraDataPath;
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 1) meterRslt.X1 = iPerl.X[0];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 2) meterRslt.X2 = iPerl.X[1];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 3) meterRslt.X3 = iPerl.X[2];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 4) meterRslt.X4 = iPerl.X[3];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 5) meterRslt.X5 = iPerl.X[4];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 6) meterRslt.X6 = iPerl.X[5];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 7) meterRslt.X7 = iPerl.X[6];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 8) meterRslt.X8 = iPerl.X[7];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 9) meterRslt.X9 = iPerl.X[8];
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
@@ -683,6 +692,9 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
&& (tstRslt.ErrorFlags == 0);
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
#if ORACLE_DB
|
||||
meterRslt.ErrorBC = meterRslt.Error;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -890,6 +890,15 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
#if IPERL
|
||||
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
|
||||
meterRslt.ExtraDataPath = iPerl.ExtraDataPath;
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 1) meterRslt.X1 = iPerl.X[0];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 2) meterRslt.X2 = iPerl.X[1];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 3) meterRslt.X3 = iPerl.X[2];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 4) meterRslt.X4 = iPerl.X[3];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 5) meterRslt.X5 = iPerl.X[4];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 6) meterRslt.X6 = iPerl.X[5];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 7) meterRslt.X7 = iPerl.X[6];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 8) meterRslt.X8 = iPerl.X[7];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 9) meterRslt.X9 = iPerl.X[8];
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
@@ -951,7 +960,10 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
&& (tstRslt.ErrorFlags == 0);
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
#if ORACLE_DB
|
||||
meterRslt.ErrorBC = meterRslt.Error;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -930,6 +930,15 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
#if IPERL
|
||||
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
|
||||
meterRslt.ExtraDataPath = iPerl.ExtraDataPath;
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 1) meterRslt.X1 = iPerl.X[0];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 2) meterRslt.X2 = iPerl.X[1];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 3) meterRslt.X3 = iPerl.X[2];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 4) meterRslt.X4 = iPerl.X[3];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 5) meterRslt.X5 = iPerl.X[4];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 6) meterRslt.X6 = iPerl.X[5];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 7) meterRslt.X7 = iPerl.X[6];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 8) meterRslt.X8 = iPerl.X[7];
|
||||
if (TestMethods.iPerlCommunication.iPerlHead.IperlHead.FeatureVectorSize >= 9) meterRslt.X9 = iPerl.X[8];
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
@@ -1012,7 +1021,10 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
&& (tstRslt.ErrorFlags == 0);
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
#if ORACLE_DB
|
||||
meterRslt.ErrorBC = meterRslt.Error;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
anyErrorOfThisMeter = true;
|
||||
message += string.Format("iPerl{0} : Predchádzajúci krok nebol zaznamenaný{1}", wm.WMPosition, Environment.NewLine);
|
||||
errorIndicators |= (int)ErrorFlagMask.E28; /// Previous workstep missing or NOK (production tracing)
|
||||
errorIndicators |= (int)ErrorFlagMask.E28; /// Previous workstep missing or NOK (production tracing)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -529,7 +529,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
tstRslt.MassStart = oriTestRslt.MassStart;
|
||||
tstRslt.MassEndRaw = oriTestRslt.MassEndRaw;
|
||||
tstRslt.MassEnd = oriTestRslt.MassEnd;
|
||||
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
|
||||
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
|
||||
tstRslt.FlowMass = oriTestRslt.FlowMass;
|
||||
tstRslt.FlowVolume = oriTestRslt.FlowVolume;
|
||||
tstRslt.VolumeCTV = oriTestRslt.VolumeCTV;
|
||||
@@ -561,6 +561,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
if (meterRslt != null && oriMeterRslt != null)
|
||||
{
|
||||
#if ORACLE_DB
|
||||
meterRslt.ErrorBC = oriMeterRslt.Error;
|
||||
#endif
|
||||
meterRslt.PulsesMeter = oriMeterRslt.PulsesMeter;
|
||||
meterRslt.PulsesMaster = oriMeterRslt.PulsesMaster;
|
||||
meterRslt.PulsesPerLiter = oriMeterRslt.PulsesPerLiter;
|
||||
@@ -585,7 +588,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = 0;
|
||||
meterRslt.Error = targetError - 0.1 * (oriMeterRslt.Error - targetError);
|
||||
meterRslt.VolumeMeter = (100.0 + meterRslt.Error / 100.0) * oriMeterRslt.VolumeRef;
|
||||
meterRslt.VolumeMeter = oriMeterRslt.VolumeRef * (100.0 + meterRslt.Error) / 100.0;
|
||||
meterRslt.Passed = true;
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
@@ -679,7 +682,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
tstRslt.MassStart = testRsltQ2ac.MassStart;
|
||||
tstRslt.MassEndRaw = testRsltQ2ac.MassEndRaw;
|
||||
tstRslt.MassEnd = testRsltQ2ac.MassEnd;
|
||||
tstRslt.MassOfEvapWater = testRsltQ2ac.MassOfEvapWater;
|
||||
tstRslt.MassOfEvapWater = testRsltQ2ac.MassOfEvapWater;
|
||||
tstRslt.FlowMass = testRsltQ2ac.FlowMass;
|
||||
tstRslt.FlowVolume = testRsltQ2ac.FlowVolume;
|
||||
tstRslt.VolumeCTV = testRsltQ2ac.VolumeCTV;
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
public const int StartOptoDataCount = MaxOptoDataCount / 2;
|
||||
public const int EndOptoDataCount = MaxOptoDataCount - StartOptoDataCount;
|
||||
public const int StartEndFilterSamplesCount2 = 20; /// StartEndFilterSamplesCount = 2 * StartEndFilterSamplesCount2 + 1
|
||||
public const int FeatureVectorSize = 9;
|
||||
|
||||
|
||||
readonly IperlHeadCfg iperlHeadCfg;
|
||||
@@ -80,6 +81,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
string extraDataPath;
|
||||
public string ExtraDataPath { get { return extraDataPath; } }
|
||||
|
||||
float[] x;
|
||||
public float[] X { get { return x; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Passed to OptoTelegramRaw.UpdateFromString(...)
|
||||
@@ -354,6 +358,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
: base(cfg)
|
||||
{
|
||||
iperlHeadCfg = cfg as IperlHeadCfg;
|
||||
x = new float[FeatureVectorSize];
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -414,6 +419,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
Q2CorrRL = 0;
|
||||
Q2CorrLR = 0;
|
||||
|
||||
/// Clear the data buffer
|
||||
optoDataCount = 0;
|
||||
|
||||
currentFlowDir = InitFlowDir;
|
||||
@@ -514,6 +520,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
timestampSec = 0;
|
||||
timestampSec0 = 0;
|
||||
|
||||
/// Clear the feature vector
|
||||
for (int i = 0; i < FeatureVectorSize; i++) x[i] = 0;
|
||||
|
||||
ReadPulses();
|
||||
}
|
||||
|
||||
@@ -620,6 +629,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
optoData[endIx].Flags = OptoTelegramFlags.OK_TestEnd;
|
||||
}
|
||||
|
||||
log.DebugFormat("Flow filtering start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
StopParsingOptoSerialPort();
|
||||
if (optoDataCount <= MaxOptoDataCount)
|
||||
{
|
||||
@@ -631,8 +642,16 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
OptoTelegramRaw.FIRFilterFlow(optoData, (optoDataCount - EndOptoDataCount), optoDataCount - 1);
|
||||
}
|
||||
|
||||
log.DebugFormat("Flow filtering end, feature vector calculation start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
CalculateFeatureVector(optoData, optoDataCount, startIx, endIx, ref x);
|
||||
|
||||
log.DebugFormat("Feature vector calculation end, save opto-file start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
extraDataPath = SaveOptoData();
|
||||
|
||||
log.DebugFormat("Save opto-file end: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
if (TestStartTelegramIx == 0 || optoDataCount < 100)
|
||||
{
|
||||
ResultCode |= (int)Results.Entities.ResultCode.MissingOptoData;
|
||||
@@ -643,6 +662,47 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateFeatureVector(OptoTelegramRaw[] optoData, int optoDataCount, int startIx, int endIx, ref float[] x)
|
||||
{
|
||||
if (startIx < 0 || endIx >= optoDataCount || startIx >= endIx) return;
|
||||
|
||||
int n = 0;
|
||||
Int64 sumFlow = 0;
|
||||
Int64 sumFlow2 = 0;
|
||||
Int64 sumEmf = 0;
|
||||
Int64 sumEmf2 = 0;
|
||||
Int64 sumMagF = 0;
|
||||
Int64 sumMagF2 = 0;
|
||||
Int64 sumImp = 0;
|
||||
Int64 sumImp2 = 0;
|
||||
|
||||
for (int ix = startIx; ix <= endIx; ix++)
|
||||
{
|
||||
if (optoData[ix].Flags == OptoTelegramFlags.OK ||
|
||||
optoData[ix].Flags == OptoTelegramFlags.OK_TestStart ||
|
||||
optoData[ix].Flags == OptoTelegramFlags.OK_TestEnd)
|
||||
{
|
||||
n++;
|
||||
sumFlow += optoData[ix].FlowRaw;
|
||||
sumFlow2 += ((int)optoData[ix].FlowRaw * (int)optoData[ix].FlowRaw);
|
||||
sumEmf += (int)optoData[ix].EmfRaw;
|
||||
sumEmf2 += ((Int64)optoData[ix].EmfRaw * (Int64)optoData[ix].EmfRaw);
|
||||
sumMagF += optoData[ix].MagneticFieldRaw;
|
||||
sumMagF2 += ((int)optoData[ix].MagneticFieldRaw * (int)optoData[ix].MagneticFieldRaw);
|
||||
sumImp += optoData[ix].Impedance;
|
||||
sumImp2 += ((int)optoData[ix].Impedance * (int)optoData[ix].Impedance);
|
||||
}
|
||||
}
|
||||
|
||||
if (n >= 2)
|
||||
{
|
||||
if (x.Length > 0) x[0] = ((float)sumFlow2 - (float)sumFlow * (float)sumFlow / n) / (n - 1);
|
||||
if (x.Length > 1) x[1] = ((float)sumEmf2 - (float)sumEmf * (float)sumEmf / n) / (n - 1);
|
||||
if (x.Length > 2) x[2] = ((float)sumMagF2 - (float)sumMagF * (float)sumMagF / n) / (n - 1);
|
||||
if (x.Length > 3) x[3] = ((float)sumImp2 - (float)sumImp * (float)sumImp / n) / (n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save opto data to a file.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user