UniCB : Flow measurement start fixed, ver. 3.1.1608

This commit is contained in:
Milan Hanajik
2021-03-05 16:12:33 +01:00
parent 6cf3bd6160
commit e2a8d66e48
4 changed files with 31 additions and 23 deletions
+25 -14
View File
@@ -34,9 +34,10 @@ namespace TBF.Rig.ControlBoard.Uni
public ActionID ActionId { get; set; }
public ulong Route { get; set; } /// ChangeRoute argument
public int FlowMId { get; set; } /// SetFlow, MeasureFlow and StartTest argument
public int FlowMId { get; set; } /// MeasureFlow, SetFlow and StartTest argument
public int RegVId { get; set; } /// SetFlow and StartTest argument
public int DivId { get; set; } /// StartTest and SwitchDiverter argument
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 ToTank { get; set; } /// SwitchDiverter argument
@@ -49,7 +50,6 @@ namespace TBF.Rig.ControlBoard.Uni
public int TolerRV { get; set; } /// SetFlow
public int StabTime { get; set; } /// SetFlow
public int DivThreshold { get; set; } /// StartTest argument
int StartStop { get; set; } /// Implicitly used by StartTest and StopTest: -1=not defined, 0=stop, 1=start
public Action()
@@ -58,11 +58,13 @@ namespace TBF.Rig.ControlBoard.Uni
FlowMId = -1;
RegVId = -1;
DivId = -1;
StartStop = Command.None;
RegVMode = RegValveMode.None;
StartStop = -1;
/// These values are used by one action type only. No conflicts possible
Route = 0;
IsSyncMethod = false;
IsDivUsed = false;
TotalPulsesCount = 0;
MassPulsesCount = 0;
RVMovePar1 = 0;
@@ -72,12 +74,12 @@ namespace TBF.Rig.ControlBoard.Uni
public bool IsStart()
{
return (ActionId & (ActionID.SetFlow | ActionID.StartTest)) != 0;
return StartStop == Command.Start;
}
public bool IsStop()
{
return (ActionId & ActionID.StopTest) != 0;
return StartStop == Command.Stop;
}
///----------------------------------------------------------------------------------------------
@@ -106,16 +108,19 @@ namespace TBF.Rig.ControlBoard.Uni
{
ActionId = ActionID.MeasureFlow,
FlowMId = flowMeterId,
StartStop = Command.Start,
};
}
void SetMeasureFlowArgs(Action action)
{
FlowMId = action.FlowMId;
StartStop = Command.Start;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedMeasureFlowArgs(Action newAction)
{
return (FlowMId == -1 || FlowMId == newAction.FlowMId);
return (FlowMId == -1 || FlowMId == newAction.FlowMId) &&
(StartStop == Command.None || StartStop == Command.Start);
}
///----------------------------------------------------------------------------------------------
@@ -136,6 +141,7 @@ namespace TBF.Rig.ControlBoard.Uni
PID = pid,
TolerRV = tolerRV,
StabTime = stabTime,
StartStop = Command.Start,
};
}
void SetSetFlowArgs(Action action)
@@ -148,6 +154,7 @@ namespace TBF.Rig.ControlBoard.Uni
PID = action.PID;
TolerRV = action.TolerRV;
StabTime = action.StabTime;
StartStop = Command.Start;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedSetFlowArgs(Action newAction)
@@ -156,7 +163,8 @@ namespace TBF.Rig.ControlBoard.Uni
(RegVId == -1 || RegVId == newAction.RegVId) &&
(RegVMode == RegValveMode.None || RegVMode == newAction.RegVMode) &&
(RVMovePar1 == -1 || RVMovePar1 == newAction.RVMovePar1) &&
(RVMovePar2 == -1 || RVMovePar2 == newAction.RVMovePar2);
(RVMovePar2 == -1 || RVMovePar2 == newAction.RVMovePar2) &&
(StartStop == Command.None || StartStop == Command.Start);
}
///----------------------------------------------------------------------------------------------
@@ -173,7 +181,7 @@ namespace TBF.Rig.ControlBoard.Uni
IsDivUsed = isDivUsed,
TotalPulsesCount = totalPulsesCount,
MassPulsesCount = (massPulsesCount == -1) ? totalPulsesCount : massPulsesCount,
StartStop = 1,
StartStop = Command.Start,
};
}
void SetStartTestArgs(Action action)
@@ -185,14 +193,14 @@ namespace TBF.Rig.ControlBoard.Uni
IsDivUsed = action.IsDivUsed;
TotalPulsesCount = action.TotalPulsesCount;
MassPulsesCount = action.MassPulsesCount;
StartStop = 1;
StartStop = Command.Start;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedStartTestArgs(Action newAction)
{
return (FlowMId == -1 || FlowMId == newAction.FlowMId) &&
(DivId == -1 || DivId == newAction.DivId) &&
(StartStop == -1 || StartStop == 1);
(StartStop == Command.None || StartStop == Command.Start);
}
///----------------------------------------------------------------------------------------------
@@ -201,17 +209,17 @@ namespace TBF.Rig.ControlBoard.Uni
return new Action()
{
ActionId = ActionID.StopTest,
StartStop = 0,
StartStop = Command.Stop,
};
}
void SetStopTestArgs(Action action)
{
StartStop = 0;
StartStop = Command.Stop;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedStopTestArgs(Action action)
{
return (StartStop == -1 || StartStop == 0);
return (StartStop == Command.None || StartStop == Command.Stop);
}
///----------------------------------------------------------------------------------------------
@@ -317,17 +325,20 @@ namespace TBF.Rig.ControlBoard.Uni
ActionId = ActionID.SwitchDiverter,
DivId = divId,
ToTank = toTank,
StartStop = Command.Start,
};
}
void SetSwitchDiverterArgs(Action action)
{
DivId = action.DivId;
ToTank = action.ToTank;
StartStop = Command.Start;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedSwitchDiverterArgs(Action action)
{
return (DivId == -1 || DivId == action.DivId);
return (DivId == -1 || DivId == action.DivId) ||
(StartStop == Command.None || StartStop == Command.Start);
}
///----------------------------------------------------------------------------------------------
+3 -6
View File
@@ -90,10 +90,7 @@ namespace TBF.Rig.ControlBoard.Uni
static byte GetCommand(Action action)
{
int command = 0;
if (action.IsStart()) command |= (int)Command.Start;
if (action.IsStop()) command |= (int)Command.Stop;
return (byte)command;
return (byte)action.StartStop;
}
static byte GetStartParams(Action action)
@@ -121,7 +118,7 @@ namespace TBF.Rig.ControlBoard.Uni
public enum Command : byte
{
RequestData = 0,
None = 0, /// Request data only
Start = 1,
Stop = 2,
GetDiverterTransitionData = 4,
@@ -135,7 +132,7 @@ namespace TBF.Rig.ControlBoard.Uni
EtalonMask = 0x07,
DiverterStart = 0x08,
SynchroMethod = 0x10,
DirectGateStart = 0x20, /// ???
DirectGateStart = 0x20, /// ???
StartStopMethod = 0x40,
CalibrationMode = 0x80,
}