(1) TBF.BenchControl.Elde.SendCommandArgs class and cbCommandQueue (2) DiverterToTank, DiverterToSink commands modified.
This commit is contained in:
@@ -18,6 +18,8 @@ namespace TBF.BenchControl.Elde
|
|||||||
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
|
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
|
||||||
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
|
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
|
||||||
|
|
||||||
|
const int FiltersCount = 8;
|
||||||
|
|
||||||
readonly ControlBoardCfg controlBoardCfg;
|
readonly ControlBoardCfg controlBoardCfg;
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -79,48 +81,22 @@ namespace TBF.BenchControl.Elde
|
|||||||
bool previousEmergencyStop;
|
bool previousEmergencyStop;
|
||||||
|
|
||||||
|
|
||||||
|
public void DiverterToTank(int flowMtrNr)
|
||||||
private int flowmeterNr4DiverterTest;
|
|
||||||
private bool scheduleDiverterToTank;
|
|
||||||
private bool scheduleDiverterToSink;
|
|
||||||
private bool scheduleReadDiverterTransition;
|
|
||||||
private bool pumpPowerChanged;
|
|
||||||
///
|
|
||||||
public void DiverterToTank(int flowmeterNr)
|
|
||||||
{
|
{
|
||||||
if (!scheduleDiverterToSink && !scheduleReadDiverterTransition && !emergencyStop)
|
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Start, flowMtrNr, int.MaxValue, int.MaxValue, TestMethods.Diverter | TestMethods.Synchro, StopDevs.None));
|
||||||
{
|
|
||||||
flowmeterNr4DiverterTest = flowmeterNr;
|
|
||||||
scheduleDiverterToTank = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
public void DiverterToSink(int flowmeterNr)
|
public void DiverterToSink(int flowMtrNr)
|
||||||
{
|
{
|
||||||
if (!scheduleDiverterToTank && !scheduleReadDiverterTransition && !emergencyStop)
|
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, TestMethods.Diverter,
|
||||||
{
|
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation));
|
||||||
flowmeterNr4DiverterTest = flowmeterNr;
|
|
||||||
scheduleDiverterToSink = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
public void ReadDiverterTransition(int flowmeterNr)
|
public void ReadDiverterTransition(int flowMtrNr)
|
||||||
{
|
{
|
||||||
if (!scheduleDiverterToTank && !scheduleDiverterToSink && !emergencyStop)
|
cbCommandQueue.Enqueue(new SendCommandArgs(Command.ReadDivTransition, flowMtrNr, 0, 0, TestMethods.Diverter, 0));
|
||||||
{
|
|
||||||
flowmeterNr4DiverterTest = flowmeterNr;
|
|
||||||
scheduleReadDiverterTransition = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary> State of valves sent out - buffered by the last SendCommand() </summary>
|
|
||||||
public UInt128 Route { get { return benchModelRoute; } }
|
|
||||||
|
|
||||||
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
|
|
||||||
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Initialization data updated by constructors of children components
|
/// Initialization data updated by constructors of children components
|
||||||
/// and sent to 'controlCom2panel' by SendCalibData() method.
|
/// and sent to 'controlCom2panel' by SendCalibData() method.
|
||||||
@@ -177,21 +153,22 @@ namespace TBF.BenchControl.Elde
|
|||||||
public uint[] BalanceRange = new uint[2];
|
public uint[] BalanceRange = new uint[2];
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Private values sent by the last SendCommand()
|
Queue<SendCommandArgs> cbCommandQueue;
|
||||||
///
|
|
||||||
bool sendCommandFlag;
|
/// <summary>
|
||||||
Command cmd;
|
/// Route: 128-bit word representing the current state of all valves and pumps
|
||||||
int refNr;
|
/// </summary>
|
||||||
|
public UInt128 Route { get { return benchModelRoute; } }
|
||||||
UInt128 benchModelRoute;
|
UInt128 benchModelRoute;
|
||||||
int totalRefPulses;
|
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
|
||||||
int massRefPulses;
|
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
|
||||||
TestMethods testMethods;
|
|
||||||
int[] filters;
|
int[] filters;
|
||||||
float[] FMFreq;
|
float[] FMFreq;
|
||||||
int regConst;
|
int regConst;
|
||||||
int shortImp;
|
int shortImp;
|
||||||
StopDevs stopDevs;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -214,6 +191,8 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// <param name="power">Power (0.0f .. 100.0f)</param>
|
/// <param name="power">Power (0.0f .. 100.0f)</param>
|
||||||
public void SetFMFreq(int index, float power)
|
public void SetFMFreq(int index, float power)
|
||||||
{
|
{
|
||||||
|
bool pumpPowerChanged = false;
|
||||||
|
|
||||||
#if DN100 || MUNICH || FUZHOU_150
|
#if DN100 || MUNICH || FUZHOU_150
|
||||||
if ((FMFreq == null) || (FMFreq.Length != 2))
|
if ((FMFreq == null) || (FMFreq.Length != 2))
|
||||||
{
|
{
|
||||||
@@ -292,6 +271,9 @@ namespace TBF.BenchControl.Elde
|
|||||||
{
|
{
|
||||||
controlBoardCfg = cfg as ControlBoardCfg;
|
controlBoardCfg = cfg as ControlBoardCfg;
|
||||||
|
|
||||||
|
cbCommandQueue = new Queue<SendCommandArgs>();
|
||||||
|
lastSentFilters = new uint[FiltersCount];
|
||||||
|
|
||||||
#if DN100 || MUNICH || FUZHOU_150
|
#if DN100 || MUNICH || FUZHOU_150
|
||||||
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
|
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
|
||||||
#elif SLM_END || WARSAW_END
|
#elif SLM_END || WARSAW_END
|
||||||
@@ -379,7 +361,9 @@ namespace TBF.BenchControl.Elde
|
|||||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this device</summary>
|
/// <summary>
|
||||||
|
/// Run this device
|
||||||
|
/// </summary>
|
||||||
public void RunDeviceBefore()
|
public void RunDeviceBefore()
|
||||||
{
|
{
|
||||||
if (DebugLevel == DebugMode.Simulate) return;
|
if (DebugLevel == DebugMode.Simulate) return;
|
||||||
@@ -400,95 +384,89 @@ namespace TBF.BenchControl.Elde
|
|||||||
{
|
{
|
||||||
UiBridge.Bridge.OnEmergencyStopChanged(this,UiBridge.EmergencyStopEventArgs.State.CloseForm);
|
UiBridge.Bridge.OnEmergencyStopChanged(this,UiBridge.EmergencyStopEventArgs.State.CloseForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emergencyStop)
|
|
||||||
{
|
|
||||||
/// SendCommand() arguments to clear the emergency stop state
|
|
||||||
sendCommandFlag = true;
|
|
||||||
this.refNr = 0;
|
|
||||||
this.totalRefPulses = 0;
|
|
||||||
this.massRefPulses = 0;
|
|
||||||
this.cmd = Command.Stop;
|
|
||||||
this.testMethods = 0;
|
|
||||||
this.stopDevs = StopDevs.All;
|
|
||||||
}
|
|
||||||
else if (scheduleDiverterToTank)
|
|
||||||
{
|
|
||||||
/// Reset all SendCommand() arguments
|
|
||||||
sendCommandFlag = true;
|
|
||||||
this.cmd = Command.Start;
|
|
||||||
this.refNr = flowmeterNr4DiverterTest;
|
|
||||||
this.totalRefPulses = int.MaxValue;
|
|
||||||
this.massRefPulses = int.MaxValue;
|
|
||||||
this.testMethods = TestMethods.Diverter;
|
|
||||||
this.stopDevs = 0;
|
|
||||||
scheduleDiverterToTank = false;
|
|
||||||
}
|
|
||||||
else if (scheduleDiverterToSink)
|
|
||||||
{
|
|
||||||
/// Reset all SendCommand() arguments
|
|
||||||
sendCommandFlag = true;
|
|
||||||
this.cmd = Command.Stop;
|
|
||||||
this.refNr = flowmeterNr4DiverterTest;
|
|
||||||
this.totalRefPulses = 0;
|
|
||||||
this.massRefPulses = 0;
|
|
||||||
this.testMethods = TestMethods.Diverter;
|
|
||||||
this.stopDevs = StopDevs.Diverter;
|
|
||||||
scheduleDiverterToSink = false;
|
|
||||||
}
|
|
||||||
else if (scheduleReadDiverterTransition)
|
|
||||||
{
|
|
||||||
/// Reset all SendCommand() arguments
|
|
||||||
sendCommandFlag = true;
|
|
||||||
this.cmd = Command.ReadDivTransition;
|
|
||||||
this.refNr = flowmeterNr4DiverterTest;
|
|
||||||
this.totalRefPulses = 0;
|
|
||||||
this.massRefPulses = 0;
|
|
||||||
this.testMethods = TestMethods.Diverter;
|
|
||||||
this.stopDevs = 0;
|
|
||||||
scheduleReadDiverterTransition = false;
|
|
||||||
}
|
|
||||||
else if (pumpPowerChanged)
|
|
||||||
{
|
|
||||||
/// Reset all SendCommand() arguments
|
|
||||||
sendCommandFlag = true;
|
|
||||||
this.cmd = Command.None;
|
|
||||||
pumpPowerChanged = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/// Reset all SendCommand() arguments
|
|
||||||
sendCommandFlag = false;
|
|
||||||
this.cmd = Command.None;
|
|
||||||
this.refNr = 0;
|
|
||||||
this.totalRefPulses = 0;
|
|
||||||
this.massRefPulses = 0;
|
|
||||||
this.testMethods = 0;
|
|
||||||
this.stopDevs = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.filters == null) this.filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this device</summary>
|
///
|
||||||
|
/// Used in RunDeviceAfter() when sending commands
|
||||||
|
///
|
||||||
|
UInt128 lastSentRoute;
|
||||||
|
uint[] lastSentFilters;
|
||||||
|
float[] lastSentFMFreq;
|
||||||
|
int lastsentRegConst;
|
||||||
|
int lastSentShortImp;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run this device
|
||||||
|
/// </summary>
|
||||||
public void RunDeviceAfter()
|
public void RunDeviceAfter()
|
||||||
{
|
{
|
||||||
if (DebugLevel == DebugMode.Simulate) return;
|
if (DebugLevel == DebugMode.Simulate) return;
|
||||||
|
|
||||||
UpdateWeights();
|
UpdateWeights();
|
||||||
|
|
||||||
uint[] uintFilters = new uint[8];
|
/// Modify queue in case of emergency stop
|
||||||
for (int i = 0; i < 8; i++)
|
if (emergencyStop && !previousEmergencyStop)
|
||||||
{
|
{
|
||||||
uintFilters[i] = (filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
|
/// SendCommand() arguments to clear the emergency stop state
|
||||||
|
cbCommandQueue.Clear();
|
||||||
|
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, 0, StopDevs.All));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Prepare uintFilters array and evaluate changes
|
||||||
if (sendCommandFlag)
|
uint[] uintFilters = new uint[FiltersCount];
|
||||||
|
uintFilters[0] = (filters != null && filters.Length > 0) ? (uint)filters[0] : 0;
|
||||||
|
bool filtersAreDifferent = (uintFilters[0] != lastSentFilters[0]);
|
||||||
|
for (int i = 1; i < FiltersCount; i++)
|
||||||
{
|
{
|
||||||
controlCom.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
|
uintFilters[i] = (filters != null && filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
|
||||||
totalRefPulses, massRefPulses, testMethods,
|
filtersAreDifferent |= (uintFilters[i] != lastSentFilters[i]);
|
||||||
uintFilters, FMFreq, regConst, shortImp, stopDevs);
|
}
|
||||||
|
|
||||||
|
/// Evaluate FMFreq changes
|
||||||
|
bool fmFreqsAreDifferent = false;
|
||||||
|
if ((FMFreq == null) || (lastSentFMFreq == null) || (FMFreq.Length != lastSentFMFreq.Length))
|
||||||
|
{
|
||||||
|
fmFreqsAreDifferent = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < FMFreq.Length; i++)
|
||||||
|
{
|
||||||
|
if (FMFreq[i] != lastSentFMFreq[i])
|
||||||
|
{
|
||||||
|
fmFreqsAreDifferent = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cbCommandQueue.Count > 0)
|
||||||
|
{
|
||||||
|
/// There is a command in the queue
|
||||||
|
///
|
||||||
|
controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
|
||||||
|
|
||||||
|
lastSentRoute = (benchModelRoute & routeMask);
|
||||||
|
lastSentFilters = uintFilters;
|
||||||
|
lastSentFMFreq = FMFreq;
|
||||||
|
lastsentRegConst = regConst;
|
||||||
|
lastSentShortImp = shortImp;
|
||||||
|
}
|
||||||
|
else if (((benchModelRoute & routeMask) != lastSentRoute) ||
|
||||||
|
filtersAreDifferent ||
|
||||||
|
fmFreqsAreDifferent ||
|
||||||
|
(lastsentRegConst != regConst) ||
|
||||||
|
(lastSentShortImp != shortImp))
|
||||||
|
{
|
||||||
|
/// Command queue is mepty, but 'route', pump frequency, PID coef., filters or shortImp have changed
|
||||||
|
///
|
||||||
|
controlCom.SendCommand(new SendCommandArgs(Command.None, 0, 0, 0, 0, 0), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
|
||||||
|
|
||||||
|
lastSentRoute = (benchModelRoute & routeMask);
|
||||||
|
lastSentFilters = uintFilters;
|
||||||
|
lastSentFMFreq = FMFreq;
|
||||||
|
lastsentRegConst = regConst;
|
||||||
|
lastSentShortImp = shortImp;
|
||||||
}
|
}
|
||||||
|
|
||||||
controlCom.RunDeviceAfter();
|
controlCom.RunDeviceAfter();
|
||||||
@@ -512,25 +490,17 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmd">See ControlBoard.Command enum</param>
|
/// <param name="cmd">See ControlBoard.Command enum</param>
|
||||||
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
|
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
|
||||||
/// <param name="route">Route: 64-bit installation specific number</param>
|
/// <param name="route">State of valves, 128-bit word</param>
|
||||||
/// <param name="totalRefPulses">kolko impulzov ma trvat skuska</param>
|
/// <param name="totalRefPulses">kolko impulzov ma trvat skuska</param>
|
||||||
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
||||||
/// <param name="filterConstant">0 = No filtering (0..255)</param>
|
/// <param name="filterConstant">0 = No filtering (0..255)</param>
|
||||||
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
|
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
|
||||||
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
||||||
/// <param name="stopDevs">What to stop</param>
|
/// <param name="stopDevs">What to stop</param>
|
||||||
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
|
public void SendCommand(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
|
||||||
int totalRefPulses, int massRefPulses, TestMethods testMethods, StopDevs stopDevs)
|
TestMethods testMethods, StopDevs stopDevs)
|
||||||
{
|
{
|
||||||
this.cmd = cmd;
|
cbCommandQueue.Enqueue(new SendCommandArgs(cmd, refFlowmtrNr, totalRefPulses, massRefPulses, testMethods, stopDevs));
|
||||||
this.refNr = refFlowmtrNr;
|
|
||||||
this.benchModelRoute = route;
|
|
||||||
this.totalRefPulses = totalRefPulses;
|
|
||||||
this.massRefPulses = massRefPulses;
|
|
||||||
this.testMethods = testMethods;
|
|
||||||
this.stopDevs = stopDevs;
|
|
||||||
|
|
||||||
sendCommandFlag = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -545,7 +515,6 @@ namespace TBF.BenchControl.Elde
|
|||||||
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
|
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
|
||||||
foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
|
foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
|
||||||
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(benchModelRoute));
|
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(benchModelRoute));
|
||||||
sendCommandFlag = true;
|
|
||||||
return oldRoute ^ benchModelRoute;
|
return oldRoute ^ benchModelRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmd">See ControlBoard.Command enum</param>
|
/// <param name="cmd">See ControlBoard.Command enum</param>
|
||||||
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
|
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
|
||||||
/// <param name="route">Route: 64-bit installation specific number</param>
|
/// <param name="route">State of valves, 128-bit word</param>
|
||||||
/// <param name="refPulses">kolko impulzov ma trvat skuska</param>
|
/// <param name="refPulses">kolko impulzov ma trvat skuska</param>
|
||||||
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
||||||
/// <param name="filterConstant">0 = No filtering (0..255)</param>
|
/// <param name="filterConstant">0 = No filtering (0..255)</param>
|
||||||
@@ -177,17 +177,15 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
|
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
|
||||||
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
||||||
/// <param name="stopDevs">What to stop</param>
|
/// <param name="stopDevs">What to stop</param>
|
||||||
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
|
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
|
||||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
|
||||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
|
||||||
{
|
{
|
||||||
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
|
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
|
||||||
cmd, refFlowmtrNr, /// 0, 1
|
sendCommandArgs.Cmd, sendCommandArgs.RefFlowmtrNr, /// 0, 1
|
||||||
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
|
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
|
||||||
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
|
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
|
||||||
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
|
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
|
||||||
(route & 0xFFFF).ToString("X4"), /// 5
|
(route & 0xFFFF).ToString("X4"), /// 5
|
||||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
|
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
|
||||||
fmFreq[0].ToString(), /// 10
|
fmFreq[0].ToString(), /// 10
|
||||||
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
|
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
|
||||||
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
|
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
|
||||||
@@ -199,8 +197,8 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// Simulation
|
/// Simulation
|
||||||
///
|
///
|
||||||
Command lastCmd = this.cmd;
|
Command lastCmd = this.cmd;
|
||||||
this.cmd = cmd;
|
this.cmd = sendCommandArgs.Cmd;
|
||||||
this.refFlowmtrNr = refFlowmtrNr;
|
this.refFlowmtrNr = sendCommandArgs.RefFlowmtrNr;
|
||||||
|
|
||||||
#if FUZHOU_300
|
#if FUZHOU_300
|
||||||
///
|
///
|
||||||
@@ -214,14 +212,14 @@ namespace TBF.BenchControl.Elde
|
|||||||
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
|
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
|
||||||
#endif
|
#endif
|
||||||
TestBenchSim.SimRoute = this.simRoute = route;
|
TestBenchSim.SimRoute = this.simRoute = route;
|
||||||
this.totalRefPulses = totalRefPulses;
|
this.totalRefPulses = sendCommandArgs.TotalRefPulses;
|
||||||
this.massRefPulses = massRefPulses;
|
this.massRefPulses = sendCommandArgs.MassRefPulses;
|
||||||
this.testMethods = testMethods;
|
this.testMethods = sendCommandArgs.TestMethods;
|
||||||
this.filterConstants = filterConstants;
|
this.stopDevs = sendCommandArgs.StopDevs;
|
||||||
|
this.filterConstants = filterConstants;
|
||||||
this.FMFreq = fmFreq;
|
this.FMFreq = fmFreq;
|
||||||
this.regConst = regConst;
|
this.regConst = regConst;
|
||||||
this.shortImp = shortImp;
|
this.shortImp = shortImp;
|
||||||
this.stopDevs = stopDevs;
|
|
||||||
|
|
||||||
#pragma warning disable
|
#pragma warning disable
|
||||||
statusP = (StatusP)(((ulong)statusP & (ulong)0xFFFFFFFFFFFFFFF8L) | (ulong)refFlowmtrNr);
|
statusP = (StatusP)(((ulong)statusP & (ulong)0xFFFFFFFFFFFFFFF8L) | (ulong)refFlowmtrNr);
|
||||||
|
|||||||
@@ -308,63 +308,35 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a command to the control board.
|
/// Sends a command to the control board.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmd">See ControlBoard.Command enum</param>
|
/// <param name="sendCommandArgs">Arguments</param>
|
||||||
/// <param name="refFlowMeterNr">Reference flow meter number (1..5)</param>
|
/// <param name="route">State of valves, 128-bit word</param>
|
||||||
/// <param name="route">Route: 64-bit installation specific number</param>
|
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
|
||||||
/// <param name="refPulses">Test duration as a number of reference flow meter pulses</param>
|
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
|
||||||
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
/// <param name="regConst">PID coefficient for flow control</param>
|
||||||
/// <param name="filterConstants">0 = No filtering (0..255)</param>
|
|
||||||
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
|
|
||||||
/// <param name="regConst">Coefficient used to control the regulation valve (1..100)</param>
|
|
||||||
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
||||||
/// <param name="stopDevs">What to stop</param>
|
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
|
||||||
public void SendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
|
|
||||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
|
||||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
|
||||||
{
|
{
|
||||||
if (Program.MainWnd.InvokeRequired)
|
if (Program.MainWnd.InvokeRequired)
|
||||||
{
|
{
|
||||||
/// When SendCommand(...) called from the worker thread
|
/// From another thread ... use Invoke()
|
||||||
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses,
|
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, new object[] { sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp });
|
||||||
testMethods, filterConstants, fmFreq, regConst, shortImp, stopDevs };
|
|
||||||
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, args); /// Component was created in UI thread - use Invoke()
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/// When SendCommand(...) called from the UI thread
|
/// Call DoSendCommand() directly
|
||||||
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
|
DoSendCommand(sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp);
|
||||||
filterConstants, fmFreq, regConst, shortImp, stopDevs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, UInt128 route,
|
delegate void SendCommandDlgt(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
|
||||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
|
||||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
|
|
||||||
///
|
///
|
||||||
private void DoSendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
|
private void DoSendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
|
||||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
|
||||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
|
|
||||||
{
|
{
|
||||||
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCommand({1}, {2}, {3}, {4}, {5}, {6}, [{7},{8}], {9}, {10}, {11})\r\n",
|
|
||||||
// DateTime.Now.ToLongTimeString(),
|
|
||||||
// cmd,
|
|
||||||
// refFlowMeterNr,
|
|
||||||
// route.ToString("X"),
|
|
||||||
// totalRefPulses,
|
|
||||||
// testMethods,
|
|
||||||
// filterConstant,
|
|
||||||
// fmFreq[0],
|
|
||||||
// fmFreq[1],
|
|
||||||
// regConst,
|
|
||||||
// shortImp,
|
|
||||||
// stopDevs));
|
|
||||||
|
|
||||||
|
|
||||||
#if FUZHOU_300
|
#if FUZHOU_300
|
||||||
///
|
///
|
||||||
/// The following code deals with the situation that all FM controlled pumps share bit #39.
|
/// The following code deals with the situation that all FM controlled pumps share bit #39.
|
||||||
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
|
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
|
||||||
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
|
/// (in FUZHOU_300 the FM pump bit should be set to value FMIndex+50).
|
||||||
///
|
///
|
||||||
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
|
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
|
||||||
route = route & 0xFF03FFFFFFFFFFFF;
|
route = route & 0xFF03FFFFFFFFFFFF;
|
||||||
@@ -381,49 +353,100 @@ namespace TBF.BenchControl.Elde
|
|||||||
route = route & (~(((UInt128)1) << 80));
|
route = route & (~(((UInt128)1) << 80));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
|
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
|
||||||
cmd, /// 0
|
sendCommandArgs.Cmd, /// 0
|
||||||
refFlowMeterNr, /// 1
|
sendCommandArgs.RefFlowmtrNr, /// 1
|
||||||
Utils.RouteToStr(route), /// 2
|
Utils.RouteToStr(route), /// 2
|
||||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
|
sendCommandArgs.TotalRefPulses,
|
||||||
|
sendCommandArgs.MassRefPulses,
|
||||||
|
sendCommandArgs.TestMethods,
|
||||||
|
filterConstants, /// 3, 4, 5, 6
|
||||||
fmFreq[0].ToString(), /// 7
|
fmFreq[0].ToString(), /// 7
|
||||||
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
|
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
|
||||||
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
|
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
|
||||||
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 10
|
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 10
|
||||||
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 11
|
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 11
|
||||||
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 12
|
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 12
|
||||||
regConst, shortImp, stopDevs); /// 13, 14, 15
|
regConst, /// 13
|
||||||
|
shortImp, /// 14
|
||||||
|
sendCommandArgs.StopDevs); /// 15
|
||||||
|
|
||||||
#if DN100 || MUNICH
|
#if DN100 || MUNICH
|
||||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
|
||||||
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
(byte)sendCommandArgs.RefFlowmtrNr,
|
||||||
|
(ulong)route,
|
||||||
|
(uint)sendCommandArgs.TotalRefPulses,
|
||||||
|
(uint)sendCommandArgs.TestMethods,
|
||||||
|
Convert.ToSingle(filterConstants[0]),
|
||||||
|
fmFreq[0],
|
||||||
|
(uint)regConst,
|
||||||
|
(uint)shortImp,
|
||||||
|
(uint)sendCommandArgs.StopDevs);
|
||||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
|
||||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
(byte)sendCommandArgs.RefFlowmtrNr,
|
||||||
|
(ulong)route,
|
||||||
|
(uint)sendCommandArgs.TotalRefPulses,
|
||||||
|
(uint)sendCommandArgs.TestMethods,
|
||||||
|
Convert.ToSingle(filterConstants[0]),
|
||||||
|
fmFreq,
|
||||||
|
(uint)regConst,
|
||||||
|
(uint)shortImp,
|
||||||
|
(uint)sendCommandArgs.StopDevs);
|
||||||
#elif BERLIN || SLM_150 || PETERSBURG_200
|
#elif BERLIN || SLM_150 || PETERSBURG_200
|
||||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
|
||||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
|
(byte)sendCommandArgs.RefFlowmtrNr,
|
||||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
|
||||||
|
(ulong)(route >> 64),
|
||||||
|
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
|
||||||
|
(uint)sendCommandArgs.TestMethods,
|
||||||
|
Convert.ToSingle(filterConstants[0]),
|
||||||
|
fmFreq,
|
||||||
|
(uint)regConst,
|
||||||
|
(uint)shortImp,
|
||||||
|
(uint)sendCommandArgs.StopDevs);
|
||||||
#elif GENESIS || DEWA_300
|
#elif GENESIS || DEWA_300
|
||||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
|
||||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
|
(byte)sendCommandArgs.RefFlowmtrNr,
|
||||||
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
|
||||||
|
(ulong)(route >> 64),
|
||||||
|
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
|
||||||
|
(uint)sendCommandArgs.TestMethods,
|
||||||
|
filterConstants,
|
||||||
|
fmFreq,
|
||||||
|
(uint)regConst,
|
||||||
|
(uint)shortImp,
|
||||||
|
(uint)sendCommandArgs.StopDevs);
|
||||||
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
|
||||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
|
(byte)sendCommandArgs.RefFlowmtrNr,
|
||||||
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
(ulong)route,
|
||||||
|
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
|
||||||
|
(uint)sendCommandArgs.TestMethods,
|
||||||
|
filterConstants,
|
||||||
|
fmFreq,
|
||||||
|
(uint)regConst,
|
||||||
|
(uint)shortImp,
|
||||||
|
(uint)sendCommandArgs.StopDevs);
|
||||||
#else /// if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT || PUCHONG_200
|
#else /// if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT || PUCHONG_200
|
||||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
|
||||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
|
(byte)sendCommandArgs.RefFlowmtrNr,
|
||||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
(ulong)route,
|
||||||
|
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
|
||||||
|
(uint)sendCommandArgs.TestMethods,
|
||||||
|
Convert.ToSingle(filterConstants[0]),
|
||||||
|
fmFreq,
|
||||||
|
(uint)regConst,
|
||||||
|
(uint)shortImp,
|
||||||
|
(uint)sendCommandArgs.StopDevs);
|
||||||
#endif
|
#endif
|
||||||
log.DebugFormat("DoSendCommand() Route = {0}", Utils.RouteToStr(route));
|
log.DebugFormat("DoSendCommand() Route = {0}", Utils.RouteToStr(route));
|
||||||
|
|
||||||
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
|
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
|
||||||
{
|
{
|
||||||
UInt128 rRoute = RRoute;
|
UInt128 rRoute = RRoute;
|
||||||
Program.MainWnd.UpdateRoute(string.Format("{0} ({1})", Utils.RouteToStr(route), Utils.RouteToStr(rRoute)));
|
Program.MainWnd.UpdateRoute(string.Format("{0} ({1})", Utils.RouteToStr(route), Utils.RouteToStr(rRoute)));
|
||||||
lastRoute = route;
|
lastRoute = route;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
controlBoard.SyncRoute();
|
controlBoard.SyncRoute();
|
||||||
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
|
controlBoard.SendCommand(commandOnStartOp, 0, 0, 0, testMethod, StopDevs.None);
|
||||||
opState = OpState.StartingCommand;
|
opState = OpState.StartingCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
if (commandOnStopOp != Command.None)
|
if (commandOnStopOp != Command.None)
|
||||||
{
|
{
|
||||||
controlBoard.SyncRoute();
|
controlBoard.SyncRoute();
|
||||||
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
|
controlBoard.SendCommand(commandOnStopOp, 0, 0, 0, testMethod, StopDevs.None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,19 +61,13 @@ namespace TBF.BenchControl.Elde
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a command that is regularly sent to the control board by SendCommand.
|
/// Updates a command that is regularly sent to the control board by SendCommand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmd">See ControlBoard.Command enum</param>
|
/// <param name="sendCommandArgs">Arguments, see SendCommandArgs class</param>
|
||||||
/// <param name="refNr">Number of the etalon/reference (1..5)</param>
|
/// <param name="route">State of valves, 128-bit word</param>
|
||||||
/// <param name="route">Route: 64-bit installation specific number</param>
|
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
|
||||||
/// <param name="totalRefPulses">Kolko impulzov ma trvat skuska</param>
|
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
|
||||||
/// <param name="massRefPulses">Pri 'MassAndContinue' metode kolko impulzov ma trvat mass measurement</param>
|
/// <param name="regConst">PID coefficient for flow control</param>
|
||||||
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
|
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
||||||
/// <param name="filterConstant">0 = No filtering (0..255)</param>
|
void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
|
||||||
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
|
|
||||||
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
|
|
||||||
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
|
|
||||||
/// <param name="stopDevs">What to stop</param>
|
|
||||||
void SendCommand(Command cmd, int refNr, UInt128 route, int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
|
||||||
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control of regulating valves.
|
/// Control of regulating valves.
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
void SendCommand()
|
void SendCommand()
|
||||||
{
|
{
|
||||||
controlBoard.SyncRoute();
|
controlBoard.SyncRoute();
|
||||||
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, StopDevs.None);
|
controlBoard.SendCommand(Command.ReadDivTransition, 0, 0, 0, 0, StopDevs.None);
|
||||||
cmdSent = true;
|
cmdSent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,11 +198,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
opState = OpState.ValveMoveToFlow1;
|
opState = OpState.ValveMoveToFlow1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestMethods tm = 0;
|
/// Start flow measurement
|
||||||
StopDevs sd = 0;
|
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
|
||||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
|
||||||
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
|
|
||||||
int.MaxValue, int.MaxValue, tm, sd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this operation</summary>
|
/// <summary>Run this operation</summary>
|
||||||
@@ -250,11 +247,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
opState = OpState.ValveMoveToFlow1;
|
opState = OpState.ValveMoveToFlow1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestMethods tm = 0;
|
/// Start flow measurement
|
||||||
StopDevs sd = 0;
|
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
|
||||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
|
||||||
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
|
|
||||||
int.MaxValue, int.MaxValue, tm, sd);
|
|
||||||
return Event.Starting;
|
return Event.Starting;
|
||||||
}
|
}
|
||||||
else if (opState == OpState.ValveMoveToPosition1)
|
else if (opState == OpState.ValveMoveToPosition1)
|
||||||
@@ -451,14 +445,13 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// <summary>Start this operation</summary>
|
/// <summary>Start this operation</summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
opState = OpState.Idle;
|
if (!leaveMeasurementRunning)
|
||||||
|
{
|
||||||
|
/// Stop measurement
|
||||||
|
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, 50000, 50000, 0, StopDevs.RegValveRegulation); /// TestMethods=0
|
||||||
|
}
|
||||||
|
|
||||||
if (leaveMeasurementRunning) return;
|
opState = OpState.Idle;
|
||||||
|
|
||||||
/// Stop measurement
|
|
||||||
TestMethods tm = 0;
|
|
||||||
StopDevs sd = StopDevs.RegValveRegulation;
|
|
||||||
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route, 50000, 50000, tm, sd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,8 +212,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
TestMethods tm = 0;
|
TestMethods tm = 0;
|
||||||
StopDevs sd = 0;
|
StopDevs sd = 0;
|
||||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||||
int.MaxValue, int.MaxValue, tm, sd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this operation</summary>
|
/// <summary>Run this operation</summary>
|
||||||
@@ -262,8 +261,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
TestMethods tm = 0;
|
TestMethods tm = 0;
|
||||||
StopDevs sd = 0;
|
StopDevs sd = 0;
|
||||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||||
int.MaxValue, int.MaxValue, tm, sd);
|
|
||||||
log.DebugFormat(" return Event.None");
|
log.DebugFormat(" return Event.None");
|
||||||
return Event.None;
|
return Event.None;
|
||||||
}
|
}
|
||||||
@@ -479,7 +477,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// Stop measurement
|
/// Stop measurement
|
||||||
TestMethods tm = 0;
|
TestMethods tm = 0;
|
||||||
StopDevs sd = StopDevs.RegValveRegulation;
|
StopDevs sd = StopDevs.RegValveRegulation;
|
||||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
|
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
|
||||||
|
|
||||||
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
|
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,8 +217,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
TestMethods tm = 0;
|
TestMethods tm = 0;
|
||||||
StopDevs sd = 0;
|
StopDevs sd = 0;
|
||||||
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||||
int.MaxValue, int.MaxValue, tm, sd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this operation</summary>
|
/// <summary>Run this operation</summary>
|
||||||
@@ -371,7 +370,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// Stop measurement
|
/// Stop measurement
|
||||||
TestMethods tm = 0;
|
TestMethods tm = 0;
|
||||||
StopDevs sd = StopDevs.RegValveRegulation;
|
StopDevs sd = StopDevs.RegValveRegulation;
|
||||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
|
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using Dirichlet.Numerics;
|
||||||
|
|
||||||
|
namespace TBF.BenchControl.Elde
|
||||||
|
{
|
||||||
|
public class SendCommandArgs
|
||||||
|
{
|
||||||
|
public Command Cmd;
|
||||||
|
public int RefFlowmtrNr;
|
||||||
|
public int TotalRefPulses;
|
||||||
|
public int MassRefPulses;
|
||||||
|
public TestMethods TestMethods;
|
||||||
|
public StopDevs StopDevs;
|
||||||
|
|
||||||
|
public SendCommandArgs()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public SendCommandArgs(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
|
||||||
|
TestMethods testMethods, StopDevs stopDevs)
|
||||||
|
{
|
||||||
|
Cmd = cmd;
|
||||||
|
RefFlowmtrNr = refFlowmtrNr;
|
||||||
|
TotalRefPulses = totalRefPulses;
|
||||||
|
MassRefPulses = massRefPulses;
|
||||||
|
TestMethods = testMethods;
|
||||||
|
StopDevs = stopDevs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -125,8 +125,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, Stop.None)",
|
log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, Stop.None)",
|
||||||
flowMeterIdxAndDiv, totalRefPulses, testMethod);
|
flowMeterIdxAndDiv, totalRefPulses, testMethod);
|
||||||
|
|
||||||
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
|
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, totalRefPulses, massRefPulses, testMethod, StopDevs.None);
|
||||||
totalRefPulses, massRefPulses, testMethod, StopDevs.None);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Start this operation</summary>
|
/// <summary>Start this operation</summary>
|
||||||
|
|||||||
@@ -35,12 +35,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
void SendStopFlowRegulationCommand()
|
void SendStopFlowRegulationCommand()
|
||||||
{
|
{
|
||||||
controlBoard.SyncRoute();
|
controlBoard.SyncRoute();
|
||||||
controlBoard.SendCommand(Command.Stop,
|
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
|
||||||
flowMeterNr, /// ref. flowmeter number
|
|
||||||
controlBoard.Route, /// route
|
|
||||||
0, 0, /// ref. pulses
|
|
||||||
0,
|
|
||||||
StopDevs.RegValveRegulation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,7 @@ namespace TBF.BenchControl.Elde
|
|||||||
void SendStopCommand()
|
void SendStopCommand()
|
||||||
{
|
{
|
||||||
controlBoard.SyncRoute();
|
controlBoard.SyncRoute();
|
||||||
controlBoard.SendCommand(Command.Stop,
|
controlBoard.SendCommand(Command.Stop, 0, 0, 0, TestMethods.Diverter,
|
||||||
0, /// ref. flowmeter number
|
|
||||||
controlBoard.Route, /// route
|
|
||||||
0, 0, /// ref. pulses
|
|
||||||
TestMethods.Diverter,
|
|
||||||
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
|
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -572,6 +572,7 @@
|
|||||||
<Compile Include="BenchControl\Elde\RegulValveCoax\Factory.cs" />
|
<Compile Include="BenchControl\Elde\RegulValveCoax\Factory.cs" />
|
||||||
<Compile Include="BenchControl\Elde\RegulValveCoax\SetFlowOp.cs" />
|
<Compile Include="BenchControl\Elde\RegulValveCoax\SetFlowOp.cs" />
|
||||||
<Compile Include="BenchControl\Elde\RegulValveCoax\SetRegulValvePositionOp.cs" />
|
<Compile Include="BenchControl\Elde\RegulValveCoax\SetRegulValvePositionOp.cs" />
|
||||||
|
<Compile Include="BenchControl\Elde\SendCommandArgs.cs" />
|
||||||
<Compile Include="BenchControl\Elde\SetValvesOp.cs" />
|
<Compile Include="BenchControl\Elde\SetValvesOp.cs" />
|
||||||
<Compile Include="BenchControl\Elde\StopFlowRegulationOp.cs" />
|
<Compile Include="BenchControl\Elde\StopFlowRegulationOp.cs" />
|
||||||
<Compile Include="BenchControl\Elde\TempMeterInternal\ReadTempOp.cs" />
|
<Compile Include="BenchControl\Elde\TempMeterInternal\ReadTempOp.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user