FlyingStartMassCollection : Delayed start param., Action.IsDelayedStart added.

This commit is contained in:
Milan Hanajik 2023-08-18 16:46:47 +02:00
parent 1691c634c6
commit ecccfab7a6
26 changed files with 562 additions and 80 deletions

View File

@ -28,7 +28,7 @@ namespace TBF.Rig.ControlBoard
/// <param name="divStopPlotter">Plotter for diverter end</param>
/// <returns>Operation running a test</returns>
IOperation FlyingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount,
bool withDiverter, bool isProlonged, int massPulsesCount,
bool withDiverter, bool isDelayedStart, bool isProlonged, int massPulsesCount,
bool readDivTransition, Statistics divStartPlotter, Statistics divStopPlotter);
}
}

View File

@ -41,6 +41,7 @@ namespace TBF.Rig.ControlBoard.Uni
public Command StartStop { get; set; } /// MeasureFlow, SetFlow, StartTest, StopTest and SwitchDiverter
public bool IsSyncMethod { get; set; } /// StartTest argument
public bool IsDivUsed { get; set; } /// StartTest argument
public bool IsDelayedStart { get; set; } /// StartTest argument
public bool IsStartStop { get; set; } /// StartTest argument
public bool IsProlonged { get; set; } /// StartTest argument
public bool ToTank { get; set; } /// SwitchDiverter argument
@ -70,6 +71,7 @@ namespace TBF.Rig.ControlBoard.Uni
Route = 0;
IsSyncMethod = false;
IsDivUsed = false;
IsDelayedStart = false;
IsStartStop = false;
IsProlonged = false;
MassPulsesCount = 0;
@ -131,6 +133,7 @@ namespace TBF.Rig.ControlBoard.Uni
FlowMId = flowMeterId,
IsSyncMethod = false,
IsDivUsed = false,
IsDelayedStart = false,
IsStartStop = false,
IsProlonged = false,
TotalPulsesCount = 0x7FFFFF,
@ -143,6 +146,7 @@ namespace TBF.Rig.ControlBoard.Uni
FlowMId = action.FlowMId;
IsSyncMethod = false;
IsDivUsed = false;
IsDelayedStart = false;
IsStartStop = false;
IsProlonged = false;
TotalPulsesCount = action.TotalPulsesCount;
@ -202,8 +206,8 @@ namespace TBF.Rig.ControlBoard.Uni
///----------------------------------------------------------------------------------------------
public static Action StartTest(bool isFromUI, int flowMId, int divId, int divThreshold,
bool isSyncMethod, bool isDivUsed, bool isStartStop, bool isProlonged,
int totalPulsesCount, int massPulsesCount = 0)
bool isSyncMethod, bool isDivUsed, bool isDelayedStart, bool isStartStop,
bool isProlonged, int totalPulsesCount, int massPulsesCount = 0)
{
return new Action
{
@ -215,6 +219,7 @@ namespace TBF.Rig.ControlBoard.Uni
DivThreshold = divThreshold,
IsSyncMethod = isSyncMethod,
IsDivUsed = isDivUsed,
IsDelayedStart = isDelayedStart,
IsStartStop = isStartStop,
IsProlonged = isProlonged,
TotalPulsesCount = totalPulsesCount,
@ -229,6 +234,7 @@ namespace TBF.Rig.ControlBoard.Uni
DivThreshold = action.DivThreshold;
IsSyncMethod = action.IsSyncMethod;
IsDivUsed = action.IsDivUsed;
IsDelayedStart = action.IsDelayedStart;
IsStartStop = action.IsStartStop;
IsProlonged = action.IsProlonged;
TotalPulsesCount = action.TotalPulsesCount;
@ -576,7 +582,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
}
log.InfoFormat("Combined action: {0} Rt={1} Et={2} RV={3} Div#={4} Cmd={5} Sync={6} wDiv={7} S/S={8} Prolng={9} ToTank={10} Puls={11} MPls={12} RVMode={13} P1={14} P2={15} Ao1={19}",
log.InfoFormat("Combined action: {0} Rt={1} Et={2} RV={3} Div#={4} Cmd={5} Sync={6} wDiv={7} delStrt={8} S/S={9} Prolng={10} ToTank={11} Puls={12} MPls={13} RVMode={14} P1={15} P2={16} Ao1={20}",
((int)combinedAction.ActionId).ToString("X3"),
combinedAction.Route.ToString("X32"),
combinedAction.FlowMId,
@ -585,6 +591,7 @@ namespace TBF.Rig.ControlBoard.Uni
combinedAction.StartStop,
combinedAction.IsSyncMethod,
combinedAction.IsDivUsed,
combinedAction.IsDelayedStart,
combinedAction.IsStartStop,
combinedAction.IsProlonged,
combinedAction.ToTank,
@ -617,7 +624,7 @@ namespace TBF.Rig.ControlBoard.Uni
args = string.Format("RV={0} P1={1} P2={2} pid={3}", RegVId, RVMovePar1, RVMovePar2, PID);
break;
case ActionID.StartTest:
args = string.Format("Et={0} Puls={1} MPls={2} Sync={3} Div={4} S/S={5} Prolonged={6}", FlowMId, TotalPulsesCount, MassPulsesCount, IsSyncMethod, IsDivUsed, IsStartStop, IsProlonged);
args = string.Format("Et={0} Puls={1} MPls={2} Sync={3} Div={4} DelStrt={5} S/S={6} Prolonged={7}", FlowMId, TotalPulsesCount, MassPulsesCount, IsSyncMethod, IsDivUsed, IsDelayedStart, IsStartStop, IsProlonged);
break;
case ActionID.RegVlvIncrMove:
args = string.Format("RV={0} Time={1}ms", RegVId, (RegVMode & RegValveMode.NegPulseWidth) != 0 ? -50 * RVMovePar1 : 50 * RVMovePar1);

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using log4net;
@ -18,6 +18,7 @@ namespace TBF.Rig.ControlBoard.Uni
readonly double qTo;
readonly int pulsesCount; /// Number of reference pulses for a complete test
readonly bool withDiverter;
readonly bool isDelayedStart;
readonly bool isProlonged;
readonly int massPulsesCount; /// Number of reference pulses for mass collection
readonly bool readDivTransition;
@ -48,8 +49,8 @@ namespace TBF.Rig.ControlBoard.Uni
/// <param name="isProlonged">true = Prolonged test with diverter</param>
/// <param name="massPulsesCount">Test part 1 duration - number of reference flow meter pulses<</param>
/// <param name="readDivTransition">true = Read diverter transition</param>
public FlyingStartStopTestOp(UniCB cb, OutputPath devices, double qFrom, double qTo, int pulsesCount, bool withDiverter,
bool isProlonged, int massPulsesCount,
public FlyingStartStopTestOp(UniCB cb, OutputPath devices, double qFrom, double qTo, int pulsesCount,
bool withDiverter, bool isDelayedStart, bool isProlonged, int massPulsesCount,
bool readDivTransition, Statistics divStartPlotter, Statistics divStopPlotter)
{
this.uniCB = cb;
@ -57,6 +58,7 @@ namespace TBF.Rig.ControlBoard.Uni
this.qTo = qTo;
this.pulsesCount = pulsesCount;
this.withDiverter = withDiverter;
this.isDelayedStart = isDelayedStart;
this.isProlonged = withDiverter && isProlonged;
this.massPulsesCount = massPulsesCount;
this.readDivTransition = withDiverter && readDivTransition;
@ -99,7 +101,7 @@ namespace TBF.Rig.ControlBoard.Uni
if (withDiverter) { uniCB.DivResolution = diverter.Resolution; }
uniCB.SetActivity((diverter != null) ? Activity.FlyingStartStopTestWithDiverter : Activity.FlyingStartStopTest);
uniCB.StartTest(false, flowMeter.Idx1, (diverter != null) ? diverter.DiverterNr : 0, (diverter != null) ? diverter.StartThreshold : 0,
true, withDiverter, false, isProlonged, pulsesCount, massPulsesCount);
true, withDiverter, isDelayedStart, false, isProlonged, pulsesCount, massPulsesCount);
opState = OpState.StartingTest;
}

View File

@ -47,7 +47,7 @@ namespace TBF.Rig.ControlBoard.Uni
/// Command
message[4] = GetCommand(action);
message[5] = action.IsStart() ? GetStartParams(action) : action.IsStop() ? GetStopParams(action) : (byte)0;
message[6] = (byte)(((arguments.DivId <= 0) ? 0 : (arguments.DivId - 1)) + ((arguments.FlowMId > 7) ? arguments.FlowMId : 0));
message[6] = (byte)(((arguments.DivId <= 0) ? 0 : (arguments.DivId - 1)) + ((arguments.FlowMId > 7) ? arguments.FlowMId : 0) + (action.IsDelayedStart ? 128 : 0));
int totalPulsesCount = (arguments.TotalPulsesCount < 0) ? 0 : arguments.TotalPulsesCount;
message[7] = (byte)(totalPulsesCount & 0xFF);

View File

@ -77,7 +77,7 @@ namespace TBF.Rig.ControlBoard.Uni
if (withDiverter) { uniCB.DivResolution = diverter.Resolution; }
uniCB.SetActivity(Activity.StandingStartStopTest);
uniCB.StartTest(false, flowMeter.Idx1, (withDiverter ? diverter.DiverterNr : 0), 0,
false, withDiverter, true, false, pulsesCount);
false, withDiverter, false, true, false, pulsesCount);
opState = OpState.StartingTest;
}

View File

@ -708,11 +708,11 @@ namespace TBF.Rig.ControlBoard.Uni
/// </summary>
/// <returns>Operation running a test</returns>
public IOperation FlyingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter = false,
bool isProlonged = false, int massPulsesCount = 0, bool readDivTransition = false,
TBF.Rig.Sequences.Statistics plotterStart = null, TBF.Rig.Sequences.Statistics plotterEnd = null)
bool isDelayedStart = false, bool isProlonged = false, int massPulsesCount = 0,
bool readDivTransition = false, Statistics plotterStart = null, Statistics plotterEnd = null)
{
return new FlyingStartStopTestOp(this, devices, qFrom, qTo, pulsesCount, withDiverter, isProlonged, massPulsesCount,
readDivTransition, plotterStart, plotterEnd);
return new FlyingStartStopTestOp(this, devices, qFrom, qTo, pulsesCount, withDiverter,
isDelayedStart, isProlonged, massPulsesCount, readDivTransition, plotterStart, plotterEnd);
}
/// <summary>
@ -804,13 +804,13 @@ namespace TBF.Rig.ControlBoard.Uni
}
public void StartTest(bool isFromUI, int flowMId, int divId, int divThreshold,
bool isSyncMethod, bool isDivUsed, bool isStartStop, bool isProlonged,
bool isSyncMethod, bool isDivUsed, bool isDelayedStart, bool isStartStop, bool isProlonged,
int totalPulsesCount, int massPulsesCount = -1)
{
if (IsUIBlocked && isFromUI) return;
actionQueue.Enqueue(Action.StartTest(isFromUI, flowMId, divId, divThreshold,
isSyncMethod, isDivUsed, isStartStop, isProlonged,
isSyncMethod, isDivUsed, isDelayedStart, isStartStop, isProlonged,
totalPulsesCount, massPulsesCount));
log.InfoFormat("Enqueue( StartTest(fm={0}, div={1}, Sync={2}, withDiv={3}, s/s={4}, prolonged={5} pulsesCount={6} massPulsesCount={7}) )",
flowMId, divId, isSyncMethod, isDivUsed, isStartStop, isProlonged, totalPulsesCount, massPulsesCount);
@ -900,7 +900,7 @@ namespace TBF.Rig.ControlBoard.Uni
if (toTank)
{
actionQueue.Enqueue(Action.StartTest(isFromUI, 0, divNr1, 127, true, true, false, false, int.MaxValue, 0));
actionQueue.Enqueue(Action.StartTest(isFromUI, 0, divNr1, 127, true, true, false, false, false, int.MaxValue, 0));
}
else
{

View File

@ -66,7 +66,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
}
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
CombinedWithDetTestParams testParams,
bool isDelayedStart, CombinedWithDetTestParams testParams,
Common.DebugMode debugLevel)
{
if (debugLevel == Common.DebugMode.Simulate)
@ -511,7 +511,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(cBrd.FlyingStartStopTestOp(test, qfrom_detected, qto_detected, totalPulses, true, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(cBrd.FlyingStartStopTestOp(test, qfrom_detected, qto_detected, totalPulses, true, isDelayedStart, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(processDataLoggingOp)
.EnterState();
do {

View File

@ -38,7 +38,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new CombinedWithDetectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, DebugLevel);
return (new CombinedWithDetectionSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel);
}
}
}

View File

@ -466,7 +466,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(cameraMeasurementOps)
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, pulsesNow, true, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, pulsesNow, true, false, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(processDataLoggingOp)
.EnterState();
do {

View File

@ -526,7 +526,7 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
.AddOperations(cameraMeasurementOps);
if (repetitionNr == 1)
{
state.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, 0, true, DiverterStart, DiverterEnd));
state.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, false, 0, true, DiverterStart, DiverterEnd));
}
else
{

View File

@ -622,7 +622,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(cameraMeasurementOps)
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(processDataLoggingOp)
.EnterState();
do {

View File

@ -519,7 +519,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
DiverterStart.Start(BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
DiverterEnd.Start(BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
var prolongedTest = cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, targetTotalPulses, true, true, targetMassPulses, true, DiverterStart, DiverterEnd);
var prolongedTest = cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, targetTotalPulses, true, false, true, targetMassPulses, true, DiverterStart, DiverterEnd);
///
/// Measurement loop - 1st part

View File

@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Common;
using Config.Entities;
@ -17,17 +16,20 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Compound
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CombinedTestParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows)
public bool DelayedStart; /// true = Test start (=gating pulses from meters) is delayed by 2 s
public bool SupressTrills; /// true = Main meter readings are ignored during test (suitable for small flows)
public override void InitializeAll()
{
SupressTrills = false;
DelayedStart = false;
SupressTrills = false;
}
string[] paramNames = new string[]
{
Strings.SupressWMTrills,
"Delayed start",
Strings.SupressWMTrills,
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
@ -36,28 +38,31 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Compound
{
switch (i)
{
case 0: return (SupressTrills ? Strings.yes : Strings.no);
case 0: return DelayedStart ? Strings.yes : Strings.no;
case 1: return SupressTrills ? Strings.yes : Strings.no;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
public CfgUpdateFlags UpdateParam(int i, string str)
{
switch (i)
{
case 0: SupressTrills = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
case 0: DelayedStart = str.Equals(Strings.yes); return CfgUpdateFlags.None;
case 1: SupressTrills = str.Equals(Strings.yes); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
public bool ValidateParam(int i, string str, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
case 1:
if (str.Equals(Strings.yes) || str.Equals(Strings.no)) return true;
break;
default:
message = "Invalid index";
@ -70,7 +75,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Compound
void CopyContentTo(CombinedTestParams prms)
{
prms.SupressTrills = this.SupressTrills;
prms.DelayedStart = DelayedStart;
prms.SupressTrills = SupressTrills;
}
public IParamsProvider Clone()

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -38,7 +38,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Compound
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
return new FlyingStartMassCollectionSeq().Execute(test, repetNr, isLastRepetition,
testMethodCfg.TestParams.DelayedStart, testMethodCfg.TestParams, null, DebugLevel);
}
}
}

View File

@ -82,10 +82,9 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
Compound.CombinedTestParams compoundTestParams,
HeatMeters.TestParams heatMetersTestParams,
Common.DebugMode debugLevel)
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition,
bool isDelayedStart, Compound.CombinedTestParams compoundTestParams,
HeatMeters.TestParams heatMetersTestParams, DebugMode debugLevel)
{
if (debugLevel == Common.DebugMode.Simulate)
{
@ -530,7 +529,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
.AddOperations(readTempPressOps)
.AddOperations(readDatastreamOps)
.AddOperations(cameraMeasurementOps)
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, isDelayedStart, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(processDataLoggingOp)
.EnterState();
do {

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -37,7 +37,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.HeatMeters
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
return new FlyingStartMassCollectionSeq().Execute(test, repetNr, isLastRepetition,
testMethodCfg.TestParams.DelayedStart, null, testMethodCfg.TestParams, DebugLevel);
}
}
}

View File

@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Common;
using Config.Entities;
@ -30,14 +29,16 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.HeatMeters
public float ChangeInTimeWarm;
public float ChangeInTimeCold;
public string Prompt;
public bool DelayedStart; /// true = Test start (=gating pulses from meters) is delayed by 2 s
public override void InitializeAll()
public override void InitializeAll()
{
FlowMeasuredAtHiTempPipe = false;
}
DelayedStart = false;
}
string[] paramNames = new string[]
string[] paramNames = new string[]
{
Strings.Err_limit_neg_pct_chdr,
Strings.Err_limit_pos_pct_chdr,
@ -52,7 +53,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.HeatMeters
"Change in time T warm",
"Change in time T cold",
Strings.Prompt,
};
"Delayed start",
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
@ -73,32 +75,34 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.HeatMeters
case 10: return ChangeInTimeWarm.ToString();
case 11: return ChangeInTimeCold.ToString();
case 12: return Prompt;
default: return string.Empty;
case 13: return DelayedStart ? Strings.yes : Strings.no;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
public CfgUpdateFlags UpdateParam(int i, string str)
{
switch (i)
{
case 0: ErrorLimitLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 1: ErrorLimitHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 2: EvaluateVolume = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
case 3: TempWarmLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 4: TempWarmHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 5: TempColdLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 6: TempColdHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 7: FlowMeasuredAtHiTempPipe = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
case 8: DeltaTempWarm = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 9: DeltaTempCold = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 10: ChangeInTimeWarm = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 11: ChangeInTimeCold = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 12: Prompt = strValue; return CfgUpdateFlags.None;
case 0: ErrorLimitLo = Utils.ParseSFloat(str); return CfgUpdateFlags.None;
case 1: ErrorLimitHi = Utils.ParseSFloat(str); return CfgUpdateFlags.None;
case 2: EvaluateVolume = str.Equals(Strings.yes); return CfgUpdateFlags.None;
case 3: TempWarmLo = Utils.ParseSFloat(str); return CfgUpdateFlags.None;
case 4: TempWarmHi = Utils.ParseSFloat(str); return CfgUpdateFlags.None;
case 5: TempColdLo = Utils.ParseSFloat(str); return CfgUpdateFlags.None;
case 6: TempColdHi = Utils.ParseSFloat(str); return CfgUpdateFlags.None;
case 7: FlowMeasuredAtHiTempPipe = str.Equals(Strings.yes); return CfgUpdateFlags.None;
case 8: DeltaTempWarm = Utils.ParseUFloat(str); return CfgUpdateFlags.None;
case 9: DeltaTempCold = Utils.ParseUFloat(str); return CfgUpdateFlags.None;
case 10: ChangeInTimeWarm = Utils.ParseUFloat(str); return CfgUpdateFlags.None;
case 11: ChangeInTimeCold = Utils.ParseUFloat(str); return CfgUpdateFlags.None;
case 12: Prompt = str; return CfgUpdateFlags.None;
case 13: DelayedStart = str.Equals(Strings.yes); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
public bool ValidateParam(int i, string str, out string message)
{
message = string.Empty;
float dummy;
@ -111,17 +115,18 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.HeatMeters
case 4:
case 5:
case 6:
if (Utils.TryParseSFloat(strValue, out dummy)) return true;
if (Utils.TryParseSFloat(str, out dummy)) return true;
break;
case 2:
case 7:
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
case 13:
if (str.Equals(Strings.yes) || str.Equals(Strings.no)) return true;
break;
case 8:
case 9:
case 10:
case 11:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
if (Utils.TryParseUFloat(str, out dummy)) return true;
break;
case 12:
return true;
@ -149,9 +154,10 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.HeatMeters
prms.ChangeInTimeWarm = ChangeInTimeWarm;
prms.ChangeInTimeCold = ChangeInTimeCold;
prms.Prompt = Prompt;
}
prms.DelayedStart = DelayedStart;
}
public IParamsProvider Clone()
public IParamsProvider Clone()
{
TestParams pars = new TestParams();
CopyContentTo(pars);

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -23,11 +23,15 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
return FlyingStartMassCollectionSeq.CheckDeviceCaps(test, devices, out message);
}
readonly TestMethodCfg testMethodCfg;
public Component() { }
///
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
log.Warn(this.ToString());
}
///
@ -37,7 +41,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
{
if (DebugLevel == DebugMode.Normal)
{
return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel);
return new FlyingStartMassCollectionSeq().Execute(test, repetNr, isLastRepetition,
testMethodCfg.TestParams.DelayedStart, null, null, DebugLevel);
}
else
{

View File

@ -1,22 +1,21 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
/// Copyright (c) 2016-2023 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.Rig.Generic;
using TBF.Rig.Configs.NameOnly;
namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
public string ClassName { get { return GetType().Namespace.Substring(8); } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(20).Replace(".Single", ""), this); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(GetType().Namespace.Substring(20).Replace(".Single", ""), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{

View File

@ -0,0 +1,50 @@
///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
[XmlIgnore]
public TestParams TestParams;
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(true); }
public override IParamsProvider GetUITestParamsProvider(Test test)
{
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
TestParams = new TestParams(true);
}
public TestMethodCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
}
public string ToString(int i)
{
return string.Format("Name={0}", Name);
}
}
}

View File

@ -0,0 +1,70 @@
///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as TestMethodCfg;
Redraw();
}
}
public TestMethodCfgCtrl()
{
InitializeComponent();
}
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
}
public void Unlock()
{
nameTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
return flags;
}
}
}

View File

@ -0,0 +1,86 @@
///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
{
partial class TestMethodCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// BasicPrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "BasicPrinterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,119 @@
///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
namespace TBF.Rig.TestMethods.FlyingStartMassCollection.Single
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public bool DelayedStart; /// true = Test start (=gating pulses from meters) is delayed by 2 s
public override void InitializeAll()
{
DelayedStart = false;
}
string[] paramNames = new string[]
{
"Delayed start",
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override string ToString(int i)
{
switch (i)
{
case 0: return DelayedStart ? Strings.yes : Strings.no;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string str)
{
switch (i)
{
case 0: DelayedStart = str.Equals(Strings.yes); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string str, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
if (str.Equals(Strings.yes) || str.Equals(Strings.no)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(TestParams prms)
{
prms.DelayedStart = DelayedStart;
}
public IParamsProvider Clone()
{
TestParams pars = new TestParams();
CopyContentTo(pars);
return pars;
}
public override void UpdateFromDbEntity(ComponentTest dbEntity)
{
if (dbEntity == null) return;
try
{
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
}
}
/// <summary>
/// Parameterless constructor initializes the parameters
/// </summary>
public TestParams()
{
}
public TestParams(bool initialize)
{
if (initialize) InitializeAll();
}
public TestParams(ComponentTest testParamsEntity, string componentName, Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}

View File

@ -371,7 +371,7 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(cameraMeasurementOps)
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses, true, false, false, 0, true, DiverterStart, DiverterEnd))
.AddOperation(processDataLoggingOp)
.EnterState();
do {

View File

@ -1220,6 +1220,14 @@
<Compile Include="Rig\TestMethods\FixedStartMassCollDeferredEval\IntermediateData.cs" />
<Compile Include="Rig\TestMethods\FixedStartMassCollDeferredEval\Single\Component.cs" />
<Compile Include="Rig\TestMethods\FixedStartMassCollDeferredEval\Single\Factory.cs" />
<Compile Include="Rig\TestMethods\FlyingStartMassCollection\Single\TestMethodCfg.cs" />
<Compile Include="Rig\TestMethods\FlyingStartMassCollection\Single\TestMethodCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\TestMethods\FlyingStartMassCollection\Single\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\TestMethods\FlyingStartMassCollection\Single\TestParams.cs" />
<Compile Include="Rig\TestMethods\LiveStream\TestParams.cs" />
<Compile Include="Rig\TestMethods\S640Communication\CheckBoxImage.cs">
<SubType>Component</SubType>
@ -2867,6 +2875,9 @@
<EmbeddedResource Include="Rig\TestMethods\FlyingStartMassCollComparative\Single\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\TestMethods\FlyingStartMassCollection\Single\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\TestMethods\FlyingStartMassCollProlonged\Compound\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>