ErrorFlags STOP stops cycle

This commit is contained in:
Milan Hanajik
2021-06-28 13:56:26 +02:00
parent cd15ab2432
commit 2106e82ede
31 changed files with 175 additions and 61 deletions
+29 -8
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -27,13 +27,12 @@ namespace TBF.Rig.Various.ErrorFlags
/// <param name="switchTimeStart">Diverter or valve switch time in s on test start</param>
/// <param name="switchTimeEnd">Diverter or valve switch time in s on test end</param>
/// <returns>Error flags</returns>
public long GetErrorFlags(TestRslt testRslt, bool diverter, bool startStopValve, float switchTimeStart, float switchTimeEnd, out long infoFlags)
public long GetErrorFlags(TestRslt testRslt, bool diverter, bool startStopValve, float switchTimeStart, float switchTimeEnd, out long infoFlags, out bool stopCycle)
{
/// Any E# is 'true' on error, 'false' when OK
/// Average flow
double aveFlow = 3.6 * testRslt.VolumeCTV / testRslt.TestTime;
bool E1 = (aveFlow < testRslt.Qfrom()) || (aveFlow > testRslt.Qto());
bool E1 = (testRslt.FlowVolume < testRslt.Qfrom()) || (testRslt.FlowVolume > testRslt.Qto());
/// Max. and min. up and down water temperature
bool E2 = ProcessData.TempUpStat.Min < testRslt.TempLimLo()
@@ -89,8 +88,9 @@ namespace TBF.Rig.Various.ErrorFlags
|| ProcessData.PressDownStat.Max > errorsCfg.TestParams.Pressure_max;
/// Max. and min. flow
bool E21 = ProcessData.RefFlowStat.Min < testRslt.Qfrom()
|| ProcessData.RefFlowStat.Max > testRslt.Qto();
double rectifiedFlowMin = (testRslt.FlowMean == 0) ? testRslt.FlowMin : testRslt.FlowMin * testRslt.FlowVolume / testRslt.FlowMean;
double rectifiedFlowMax = (testRslt.FlowMean == 0) ? testRslt.FlowMax : testRslt.FlowMax * testRslt.FlowVolume / testRslt.FlowMean;
bool E21 = rectifiedFlowMin < testRslt.Qfrom() || rectifiedFlowMax > testRslt.Qto();
/// Electrical conductivity of water
bool E36 = ProcessData.ConductStat.Min < errorsCfg.TestParams.Conductivity_min
@@ -138,6 +138,25 @@ namespace TBF.Rig.Various.ErrorFlags
if (E21 && (errorsCfg.TestParams.E21 == info)) _infoFlags |= (long)ErrorFlagMask.E21;
if (E36 && (errorsCfg.TestParams.E36 == info)) _infoFlags |= (long)ErrorFlagMask.E36;
stopCycle = false;
if (E1 && (errorsCfg.TestParams.E1 == stop)) stopCycle = true;
if (E2 && (errorsCfg.TestParams.E2 == stop)) stopCycle = true;
if (E3 && (errorsCfg.TestParams.E3 == stop)) stopCycle = true;
if (E4 && (errorsCfg.TestParams.E4 == stop)) stopCycle = true;
if (E5 && (errorsCfg.TestParams.E5 == stop)) stopCycle = true;
if (E6 && (errorsCfg.TestParams.E6 == stop)) stopCycle = true;
if (E7 && (errorsCfg.TestParams.E7 == stop)) stopCycle = true;
if (E8 && (errorsCfg.TestParams.E8 == stop)) stopCycle = true;
if (E9 && (errorsCfg.TestParams.E9 == stop)) stopCycle = true;
if (E10 && (errorsCfg.TestParams.E10 == stop)) stopCycle = true;
if (E11 && (errorsCfg.TestParams.E11 == stop)) stopCycle = true;
if (E12 && (errorsCfg.TestParams.E12 == stop)) stopCycle = true;
if (E13 && (errorsCfg.TestParams.E13 == stop)) stopCycle = true;
if (E14 && (errorsCfg.TestParams.E14 == stop)) stopCycle = true;
/// E15, E16, E17, E18, E19, E20 skipped
if (E21 && (errorsCfg.TestParams.E21 == stop)) stopCycle = true;
if (E36 && (errorsCfg.TestParams.E36 == stop)) stopCycle = true;
infoFlags = _infoFlags;
return errorFlags;
}
@@ -204,10 +223,12 @@ namespace TBF.Rig.Various.ErrorFlags
: base(cfg)
{
errorsCfg = cfg as ErrorsCfg;
log.Warn(this.ToString());
}
public override void Initialize() { }
public override void Initialize()
{
log.FatalFormat("{0} initialized: {1}", Name, this);
}
#region Configuration Change Handling