Prolonged test support in Action, OutputMessage, etc., ver. 3.1.1634

This commit is contained in:
Milan Hanajik 2021-03-15 15:51:13 +01:00
parent 4770f3e393
commit d22158404d
7 changed files with 37 additions and 16 deletions

View File

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

View File

@ -43,6 +43,7 @@ namespace TBF.Rig.ControlBoard.Uni
public bool IsSyncMethod { get; set; } /// StartTest argument
public bool IsDivUsed { 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
public int TotalPulsesCount { get; set; } /// StartTest argument
public int MassPulsesCount { get; set; } /// StartTest argument
@ -70,6 +71,7 @@ namespace TBF.Rig.ControlBoard.Uni
IsSyncMethod = false;
IsDivUsed = false;
IsStartStop = false;
IsProlonged = false;
MassPulsesCount = 0;
RVMovePar1 = 0;
RVMovePar2 = 0;
@ -126,9 +128,10 @@ namespace TBF.Rig.ControlBoard.Uni
IsFromUI = isFromUI,
///
FlowMId = flowMeterId,
IsSyncMethod = true,
IsSyncMethod = false,
IsDivUsed = false,
IsStartStop = false,
IsProlonged = false,
TotalPulsesCount = 0x7FFFFF,
MassPulsesCount = 0x7FFFFF,
StartStop = Command.Start,
@ -137,9 +140,10 @@ namespace TBF.Rig.ControlBoard.Uni
void SetMeasureFlowArgs(Action action)
{
FlowMId = action.FlowMId;
IsSyncMethod = true;
IsSyncMethod = false;
IsDivUsed = false;
IsStartStop = false;
IsProlonged = false;
TotalPulsesCount = action.TotalPulsesCount;
MassPulsesCount = action.MassPulsesCount;
StartStop = Command.Start;
@ -192,8 +196,9 @@ namespace TBF.Rig.ControlBoard.Uni
}
///----------------------------------------------------------------------------------------------
public static Action StartTest(bool isFromUI, int flowMId, int divId, int divThreshold, bool isSyncMethod,
bool isDivUsed, bool isStartStop, int totalPulsesCount, int massPulsesCount = 0)
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)
{
return new Action
{
@ -206,6 +211,7 @@ namespace TBF.Rig.ControlBoard.Uni
IsSyncMethod = isSyncMethod,
IsDivUsed = isDivUsed,
IsStartStop = isStartStop,
IsProlonged = isProlonged,
TotalPulsesCount = totalPulsesCount,
MassPulsesCount = (massPulsesCount <= 0) ? totalPulsesCount : massPulsesCount,
StartStop = Command.Start,
@ -219,6 +225,7 @@ namespace TBF.Rig.ControlBoard.Uni
IsSyncMethod = action.IsSyncMethod;
IsDivUsed = action.IsDivUsed;
IsStartStop = action.IsStartStop;
IsProlonged = IsProlonged;
TotalPulsesCount = action.TotalPulsesCount;
MassPulsesCount = action.MassPulsesCount;
StartStop = Command.Start;
@ -445,7 +452,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} ToTank={9} Puls={10} MPls={11} RVMode={12} P1={13} P2={14}",
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}",
((int)combinedAction.ActionId).ToString("X3"),
combinedAction.Route.ToString("X12"),
combinedAction.FlowMId,
@ -455,6 +462,7 @@ namespace TBF.Rig.ControlBoard.Uni
combinedAction.IsSyncMethod,
combinedAction.IsDivUsed,
combinedAction.IsStartStop,
combinedAction.IsProlonged,
combinedAction.ToTank,
combinedAction.TotalPulsesCount,
combinedAction.MassPulsesCount,
@ -484,7 +492,7 @@ namespace TBF.Rig.ControlBoard.Uni
args = string.Format("RV={0} P1={1} P2={2}", RegVId, RVMovePar1, RVMovePar2);
break;
case ActionID.StartTest:
args = string.Format("Et={0} Puls={1} MPls={2} Sync={3} Div={4} SS={5}", FlowMId, TotalPulsesCount, MassPulsesCount, IsSyncMethod, IsDivUsed, IsStartStop);
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);
break;
case ActionID.RegVlvIncrMove:
args = string.Format("RV={0} Time={1}ms", RegVId, (RegVMode & RegValveMode.NegPulseWidth) != 0 ? -50 * RVMovePar1 : 50 * RVMovePar1);

View File

@ -69,7 +69,7 @@ namespace TBF.Rig.ControlBoard.Uni
log.InfoFormat("Op.Start() RV#={0} Et#={1} Qfrom={2} Qto={3}", regV.Idx1, flowMeter.Idx1, qFrom, qTo);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, 0, 40, true, false, false, pulsesCount, 0);
uniCB.StartTest(false, flowMeter.Idx1, 0, 40, true, false, false, false, pulsesCount, 0);
opState = OpState.StartingTest;
}

View File

@ -86,7 +86,7 @@ namespace TBF.Rig.ControlBoard.Uni
log.InfoFormat("Op.Start() RV#={0} Et#={1} Div#={2} Qfrom={3} Qto={4}", regV.Idx1, flowMeter.Idx1, div.DiverterNr, qFrom, qTo);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, div.DiverterNr, 40, true, true, false, pulsesCount, massPulsesCount);
uniCB.StartTest(false, flowMeter.Idx1, div.DiverterNr, 40, true, true, false, isProlongedTest, pulsesCount, massPulsesCount);
opState = OpState.StartingTest;
}

View File

@ -93,7 +93,14 @@ namespace TBF.Rig.ControlBoard.Uni
static byte GetCommand(Action action)
{
return (byte)action.StartStop;
if (action.StartStop == Command.Start && action.IsProlonged)
{
return (byte)(Command.Start | Command.ProlongedFlag);
}
else
{
return (byte)action.StartStop;
}
}
static byte GetStartParams(Action action)
@ -130,6 +137,8 @@ namespace TBF.Rig.ControlBoard.Uni
GetScopeAnalyzerData = 7,
ResetScopeAnalyzer = 8,
GetSwitchCounterData = 9,
///
ProlongedFlag = 0x10, /// Not a command of its own, a valid command is (byte)(Command.Start | Command.ProlongedFlag)
}
public enum StartParam : byte

View File

@ -69,7 +69,7 @@ namespace TBF.Rig.ControlBoard.Uni
log.InfoFormat("Op.Start() RV#={0} Et#={1} Qfrom={2} Qto={3}", regV.Idx1, flowMeter.Idx1, qFrom, qTo);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, 0, 40, false, false, true, pulsesCount, 0);
uniCB.StartTest(false, flowMeter.Idx1, 0, 40, false, false, true, false, pulsesCount, 0);
opState = OpState.StartingTest;
}

View File

@ -601,13 +601,17 @@ namespace TBF.Rig.ControlBoard.Uni
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
public void StartTest(bool isFromUI, int flowMId, int divId, int divThreshold, bool isSyncMethod,
bool isDivUsed, bool isStartStop, int totalPulsesCount, int massPulsesCount = -1)
public void StartTest(bool isFromUI, int flowMId, int divId, int divThreshold,
bool isSyncMethod, bool isDivUsed, bool isStartStop, bool isProlonged,
int totalPulsesCount, int massPulsesCount = -1)
{
if (IsUIBlocked && isFromUI) return;
actionQueue.Enqueue(Action.StartTest(isFromUI, flowMId, divId, divThreshold, isSyncMethod, isDivUsed, isStartStop, totalPulsesCount, massPulsesCount));
log.InfoFormat("Enqueue( StartTest(fm={0}, div={1}, Sync={2}, withDiv={3}, s/s={4}, totalPulsesCount={5}) )", flowMId, divId, isSyncMethod, isDivUsed, isStartStop, totalPulsesCount);
actionQueue.Enqueue(Action.StartTest(isFromUI, flowMId, divId, divThreshold,
isSyncMethod, isDivUsed, 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);
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}