diff --git a/Config/Data.cs b/Config/Data.cs
index cf77ba91c..5bfcb9d74 100644
--- a/Config/Data.cs
+++ b/Config/Data.cs
@@ -14,13 +14,13 @@ namespace Config
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
-#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
+#elif BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200 || DN100
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
-#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
+#elif FUZHOU_150 || FUZHOU_300 || GENESIS || IZRAEL_200 || PETERSBURG_200 || SLM_150
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
@@ -56,13 +56,13 @@ namespace Config
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
-#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN || GELSENWASSER
+#elif BADGER_MALA_TRAT || BERLIN || GELSENWASSER || TORINO_50
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
-#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
+#elif ALZIR_25 || BAHRAIN_50 || CEVAK_40 || FEWA_50 || FILIPINY_50 || FUZHOU_50 || IZRAEL_25 || JUZNA_AFRIKA_50 || JUZNA_AFRIKA_NEW || KEMPNO_50 || KRAKOW_50 || MURES_40 || PETERSBURG_50 || TORUN_50 || ZAMBIA || ZODINO
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs
index d74111047..ad00fb8cd 100644
--- a/Config/Properties/AssemblyInfo.cs
+++ b/Config/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.26.1458.0")]
-[assembly: AssemblyFileVersion("2.26.1458.0")]
+[assembly: AssemblyVersion("3.1.1464.0")]
+[assembly: AssemblyFileVersion("3.1.1464.0")]
diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs
index 46481b524..f264ea963 100644
--- a/Results/Properties/AssemblyInfo.cs
+++ b/Results/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.26.1458.0")]
-[assembly: AssemblyFileVersion("2.26.1458.0")]
+[assembly: AssemblyVersion("3.1.1464.0")]
+[assembly: AssemblyFileVersion("3.1.1464.0")]
diff --git a/ResultsBrowser/Properties/AssemblyInfo.cs b/ResultsBrowser/Properties/AssemblyInfo.cs
index aab6e9b5a..dd20080cc 100644
--- a/ResultsBrowser/Properties/AssemblyInfo.cs
+++ b/ResultsBrowser/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.25.1440.0")]
-[assembly: AssemblyFileVersion("2.25.1440.0")]
+[assembly: AssemblyVersion("3.1.1464.0")]
+[assembly: AssemblyFileVersion("3.1.1464.0")]
diff --git a/TBF/BenchControl/BuiltIn/SetValvesOp.cs b/TBF/BenchControl/BuiltIn/SetValvesOp.cs
index 9053c1fe6..f455acb0c 100644
--- a/TBF/BenchControl/BuiltIn/SetValvesOp.cs
+++ b/TBF/BenchControl/BuiltIn/SetValvesOp.cs
@@ -43,20 +43,22 @@ namespace TBF.BenchControl.BuiltIn
foreach (var vlv in VOpen)
{
/// Skip the delay evaluation and update in case the valve/pump have not changed
- if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
- if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
- if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
- if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
+ if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
+ if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
+ if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
+ if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
+ if (vlv is Modbus.Danfoss.VLT.Pump && ((vlv as Modbus.Danfoss.VLT.Pump).Mask & changed) == 0) continue;
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
}
foreach (var vlv in VClose)
{
/// Skip the delay evaluation and update in case the valve/pump have not changed
- if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
- if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
- if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
- if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
+ if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
+ if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
+ if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
+ if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
+ if (vlv is Modbus.Danfoss.VLT.Pump && ((vlv as Modbus.Danfoss.VLT.Pump).Mask & changed) == 0) continue;
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
}
@@ -157,6 +159,7 @@ namespace TBF.BenchControl.BuiltIn
if (valve is Pump.Pump) point.MasksOpen |= (valve as Pump.Pump).Mask;
if (valve is Elde.PumpWithFM.Pump) point.MasksOpen |= (valve as Elde.PumpWithFM.Pump).Mask;
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.Pump).Mask;
+ if (valve is Modbus.Danfoss.VLT.Pump) point.MasksOpen |= (valve as Modbus.Danfoss.VLT.Pump).Mask;
if (valve is PumpTandem.Pump) point.MasksOpen |= (valve as PumpTandem.Pump).Mask;
}
point.MasksClose = 0;
@@ -166,6 +169,7 @@ namespace TBF.BenchControl.BuiltIn
if (valve is Pump.Pump) point.MasksClose |= (valve as Pump.Pump).Mask;
if (valve is Elde.PumpWithFM.Pump) point.MasksClose |= (valve as Elde.PumpWithFM.Pump).Mask;
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.Pump).Mask;
+ if (valve is Modbus.Danfoss.VLT.Pump) point.MasksClose |= (valve as Modbus.Danfoss.VLT.Pump).Mask;
if (valve is PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
}
point.TimeSec += timeShift;
diff --git a/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs b/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs
index 5cfc941e3..31565057a 100644
--- a/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs
+++ b/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs
@@ -137,11 +137,11 @@ namespace TBF.BenchControl.ControlBoard.Legacy
public float[] EtCalib = new float[8] { 1, 1, 1, 1, 1, 1, 1, 1 };
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MURES_40 || FUZHOU_50 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || FUZHOU_100 || ALZIR_25
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
-#if IZRAEL_50
+ #if IZRAEL_50
public byte[] MeretRS485Address = new byte[6];
-#else
+ #else
public byte[] MeretRS485Address = new byte[4];
-#endif
+ #endif
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
#elif IZRAEL_50 || SLM_END
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
@@ -159,9 +159,14 @@ namespace TBF.BenchControl.ControlBoard.Legacy
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[8] { 1, 1, 1, 1, 1, 1, 1, 1 };
+#else
+ /// New benches => no initialization buffers at all
+ public uint[,] RegValveCalib = new uint[0,0];
+ public byte[] MeretRS485Address = new byte[0];
+ public float[] EtCalib = new float[0];
#endif
- public uint[] BalanceRange = new uint[2];
+ public uint[] BalanceRange = new uint[2];
@@ -383,8 +388,9 @@ namespace TBF.BenchControl.ControlBoard.Legacy
}
else
{
+#if !JUZNA_AFRIKA_NEW
controlCom = new ControlComWrap(eldeComponent);
-
+#endif
/// Default number of scales (and BalanceRange length) is 2.
/// If there are more scales, BalanceRange length is larger.
int scalesCnt = Math.Max(2, tankCapacities.Length);
diff --git a/TBF/BenchControl/ControlBoard/Papouch/CBoard.cs b/TBF/BenchControl/ControlBoard/Papouch/CBoard.cs
index 6c2ca9ece..45fb31492 100644
--- a/TBF/BenchControl/ControlBoard/Papouch/CBoard.cs
+++ b/TBF/BenchControl/ControlBoard/Papouch/CBoard.cs
@@ -15,26 +15,37 @@ using TBF.BenchControl.Modbus;
namespace TBF.BenchControl.ControlBoard.Papouch
{
- public class CBoard : ComponentBase, IControlBoard
+ public class CBoard : ComponentBase, IControlBoard, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
readonly CBoardCfg cBoardCfg;
readonly GenericDevices.IModbus modbus;
-
- public QuidoVariant Variant { get { return cBoardCfg.Variant; } }
-
- private ushort currentOutputs;
- private DateTime lastOutputsChange;
-
- public OutputPath Devices
- {
- set { devices = value; }
- get { return devices; }
- }
+
+ UInt32 currentOutputs;
+ bool outputsInitialized;
+ DateTime lastOutputsChange;
+ ///
+ UInt128 benchModelRoute;
+ UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
+ readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
+ ///
OutputPath devices;
+
+ enum SelectedOp
+ {
+ None,
+ SetFlow,
+ QueryMeasurementEnd,
+ }
+ SelectedOp scheduledOp;
+ SelectedOp runningOp;
+ ///
+ bool opCompleted; /// true = Operation was completed and waits for Stop();
+
+
public CBoard()
{
}
@@ -50,6 +61,15 @@ namespace TBF.BenchControl.ControlBoard.Papouch
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
+ routeMask = 0;
+ for (int i = 0; i < 128; i++)
+ {
+ if (i < cBoardCfg.VirtualValvesRangeLo || i > cBoardCfg.VirtualValvesRangeHi)
+ {
+ routeMask = routeMask | ((UInt128)1 << i);
+ }
+ }
+
log.Debug(this.ToString());
}
@@ -59,9 +79,13 @@ namespace TBF.BenchControl.ControlBoard.Papouch
this.benchModelRoute = valvesToInvert;
}
-
+ ///
+ /// IDevice interface
+ ///
public void Initialize()
{
+ outputsInitialized = false;
+ runningOp = SelectedOp.None;
}
public void RunDeviceBefore()
@@ -84,8 +108,19 @@ namespace TBF.BenchControl.ControlBoard.Papouch
}
}
- public void RunDeviceAfter() { }
- public void StopDevice() { SendOutputs(0); }
+ public void RunDeviceAfter()
+ {
+ if (currentOutputs != (UInt32)(benchModelRoute & 0xFFFFFFFF) || !outputsInitialized)
+ {
+ SetOutputs((UInt32)(benchModelRoute & 0xFFFFFFFF));
+ }
+ }
+
+ public void StopDevice()
+ {
+ SendOutputs(0);
+ }
+
public void StopDevice2() { }
@@ -93,10 +128,11 @@ namespace TBF.BenchControl.ControlBoard.Papouch
/// Set outputs of QuidoRS board
///
/// output value
- public void SetOutputs(ushort outputs)
+ public void SetOutputs(UInt32 outputs)
{
lock (this)
{
+ currentOutputs = outputs;
SendOutputs(currentOutputs);
}
}
@@ -106,10 +142,11 @@ namespace TBF.BenchControl.ControlBoard.Papouch
///
/// Specifies bit(s) to set
/// output value
- public void SetBit(ushort bitMask)
+ public void SetBit(UInt32 bitMask)
{
lock (this)
{
+ currentOutputs = currentOutputs | bitMask;
SendOutputs(currentOutputs);
}
}
@@ -119,26 +156,25 @@ namespace TBF.BenchControl.ControlBoard.Papouch
///
/// Specifies bit(s) to reset
/// output value
- public void ResetBit(ushort bitMask)
+ public void ResetBit(UInt32 bitMask)
{
lock (this)
{
+ currentOutputs = currentOutputs & (~bitMask);
SendOutputs(currentOutputs);
}
}
- private void SendOutputs(ushort outputs)
+ private void SendOutputs(UInt32 outputs)
{
byte addr = cBoardCfg.ModbusAddress;
byte cmd = (byte)Function.ForceMultipleCoils;
byte dataLo = (byte)(outputs & 0xFF);
- byte dataHi = (byte)(outputs >> 8);
+ byte data2 = (byte)(outputs >> 8);
+ byte data3 = (byte)(outputs >> 16);
+ byte dataHi = (byte)(outputs >> 24);
- if (cBoardCfg.Variant == QuidoVariant.QuidoRS_2_16)
- {
- modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 16, 2, dataLo, dataHi, 0, 0 });
- }
- else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_4_4)
+ if (cBoardCfg.Variant == QuidoVariant.QuidoRS_4_4)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 4, 1, dataLo, 0, 0 });
}
@@ -146,7 +182,16 @@ namespace TBF.BenchControl.ControlBoard.Papouch
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 8, 1, dataLo, 0, 0 });
}
+ else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_2_16)
+ {
+ modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 16, 2, dataLo, data2, 0, 0 });
+ }
+ else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_2_32)
+ {
+ modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 32, 4, dataLo, data2, data3, dataHi, 0, 0 });
+ }
+ outputsInitialized = true;
lastOutputsChange = DateTime.Now;
}
@@ -155,13 +200,16 @@ namespace TBF.BenchControl.ControlBoard.Papouch
/// IControlBoard interface
///
+ public OutputPath Devices
+ {
+ set { devices = value; }
+ get { return devices; }
+ }
+
///
/// Route: 128-bit word representing the current state of all valves and pumps
///
public UInt128 Route { get { return benchModelRoute; } }
- UInt128 benchModelRoute;
- UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
- readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
public UInt64 DigitalInputs { get { return 0; } }
@@ -181,9 +229,19 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public void UpdateUI(string sParam, int iParam, double value) { }
public void ClearProcessValues() { }
+ ///
+ /// Set valves to new positions.
+ ///
+ /// 'UInt128' with bits of valves to open set to '1'
+ /// 'UInt128' with bits of valves to close set to '1'
+ /// 'UInt128' with bits of valves that have changed set to '1'
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList extendedValves)
{
- return routeMask;
+ UInt128 oldRoute = benchModelRoute;
+ benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
+ foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
+ log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(benchModelRoute));
+ return oldRoute ^ benchModelRoute;
}
///
@@ -233,14 +291,29 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public float ValveOpenCloseTime { get { return 0.1f; } }
+ ///
+ /// Returns operation to display a prompt message to set the flow.
+ ///
+ /// Lower limit
+ /// Upper limit
+ /// Reference to a box for the measured flow or null
+ /// Flow set timeout
+ /// Operation
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
{
- return null; /// TODO
+ string loLimStr = reqrdFlowLo.ToString(Config.Utils.SignificantDigitsToFmt(reqrdFlowLo, 2));
+ string hiLimStr = reqrdFlowHi.ToString(Config.Utils.SignificantDigitsToFmt(reqrdFlowHi, 2));
+ this.promptMsg = string.Format("Set flow measured by {0} withing {1} and {2} m3/h by regulation valve {3}",
+ devices.FlowMeter.Name, loLimStr, hiLimStr, devices.RegulValve.Name);
+ this.backColor = System.Drawing.Color.LightSalmon;
+
+ scheduledOp = SelectedOp.SetFlow;
+ return this;
}
public IOperation StopFlowRegulationOp()
{
- return null; /// TODO
+ return new Operations.ReturnGivenEventOp(Event.FlowRegulationStopped);
}
///
@@ -252,17 +325,14 @@ namespace TBF.BenchControl.ControlBoard.Papouch
/// Operation
public IOperation StartTestOp(Test test, int iParam = 0, double dParam1 = 0, double dParam2 = 0)
{
- return null; /// TODO
+ currentTest = test;
+ return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
}
public IOperation QueryMeasurementEndOp()
{
- return null; /// TODO
- }
-
- public IOperation StopMeasurementOp()
- {
- return null; /// TODO
+ scheduledOp = SelectedOp.QueryMeasurementEnd;
+ return this;
}
public IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
@@ -272,7 +342,95 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public IOperation StopPreviousOp()
{
- return null;
+ return new Operations.ReturnGivenEventOp(Event.PreviousStopped);
+ }
+
+
+ Test currentTest;
+
+ string promptMsg;
+ System.Drawing.Color backColor;
+ TBF.BenchControl.Operations.MessageBoxForm messageBoxForm;
+ ///
+ delegate void MessageBoxFormDlgt(CBoard myRef);
+ ///
+ void OpenFormDlg(CBoard myRef)
+ {
+ myRef.messageBoxForm = new TBF.BenchControl.Operations.MessageBoxForm(promptMsg, backColor);
+ messageBoxForm.Show();
+ }
+
+
+ ///
+ /// Start selected operation
+ ///
+ public void Start()
+ {
+ if (scheduledOp == SelectedOp.None || runningOp != SelectedOp.None)
+ {
+ throw new Exception("Sequence error");
+ }
+
+ runningOp = scheduledOp;
+ scheduledOp = SelectedOp.None;
+
+ if (runningOp == SelectedOp.SetFlow)
+ {
+ Program.MainWnd.Invoke(new MessageBoxFormDlgt(OpenFormDlg), this);
+ }
+ else if (runningOp == SelectedOp.QueryMeasurementEnd)
+ {
+ }
+ }
+
+
+ ///
+ /// Run selected operation
+ ///
+ /// Event.None or Event.FlowReached or Event.MeasurementCompleted
+ public Event Run()
+ {
+ if (runningOp == SelectedOp.SetFlow)
+ {
+ if (opCompleted || messageBoxForm.Completed)
+ {
+ opCompleted = true;
+ messageBoxForm = null;
+ return Event.FlowReached;
+ }
+ }
+ else if (runningOp == SelectedOp.QueryMeasurementEnd)
+ {
+ if (opCompleted) return Event.MeasurementCompleted;
+
+ double currentMass = TBF.BenchControl.Sequences.ProcessData.Mass.Val;
+
+ if (currentMass - TBF.BenchControl.Sequences.ProcessData.StartMass.Val >= currentTest.Volume)
+ {
+ opCompleted = true;
+ return Event.MeasurementCompleted;
+ }
+ }
+
+ return Event.None;
+ }
+
+ ///
+ /// Stop this operation
+ ///
+ public void Stop()
+ {
+ if (runningOp == SelectedOp.SetFlow)
+ {
+ if (messageBoxForm != null)
+ {
+ messageBoxForm.OnCloseThisForm(this, null);
+ messageBoxForm = null;
+ }
+ }
+
+ runningOp = SelectedOp.None;
+ opCompleted = false;
}
}
}
diff --git a/TBF/BenchControl/ControlBoard/Papouch/CBoardCfg.cs b/TBF/BenchControl/ControlBoard/Papouch/CBoardCfg.cs
index 48ab99681..79aeed0bf 100644
--- a/TBF/BenchControl/ControlBoard/Papouch/CBoardCfg.cs
+++ b/TBF/BenchControl/ControlBoard/Papouch/CBoardCfg.cs
@@ -10,9 +10,10 @@ namespace TBF.BenchControl.ControlBoard.Papouch
{
public enum QuidoVariant
{
- QuidoRS_2_16,
QuidoRS_4_4,
QuidoRS_8_8,
+ QuidoRS_2_16,
+ QuidoRS_2_32,
Count
}
@@ -37,7 +38,7 @@ namespace TBF.BenchControl.ControlBoard.Papouch
Name = "CB";
ParentName = "Modbus";
ModbusAddress = 1;
- Variant = QuidoVariant.QuidoRS_2_16;
+ Variant = QuidoVariant.QuidoRS_2_32;
VirtualValvesRangeLo = 50;
VirtualValvesRangeHi = 59;
}
diff --git a/TBF/BenchControl/Operations/ReturnGivenEventOp.cs b/TBF/BenchControl/Operations/ReturnGivenEventOp.cs
index 3dbbc24b9..aa458870e 100644
--- a/TBF/BenchControl/Operations/ReturnGivenEventOp.cs
+++ b/TBF/BenchControl/Operations/ReturnGivenEventOp.cs
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
-using log4net;
+using System;
namespace TBF.BenchControl.Operations
{
@@ -10,9 +10,6 @@ namespace TBF.BenchControl.Operations
///
class ReturnGivenEventOp : IOperation
{
- private static readonly ILog log = LogManager.GetLogger(typeof(ReturnGivenEventOp));
- public override string ToString() { return string.Format("ReturnGivenEventOp({0})", givenEvent); }
-
/// Set by the constructor
readonly Event givenEvent;
@@ -24,13 +21,13 @@ namespace TBF.BenchControl.Operations
this.givenEvent = givenEvent;
}
- public void Start() {}
+ public void Start() { }
public Event Run()
{
return givenEvent;
}
- public void Stop() {}
+ public void Stop() { }
}
}
diff --git a/TBF/BenchControl/StateMachine.cs b/TBF/BenchControl/StateMachine.cs
index ef3303bad..50eff820a 100644
--- a/TBF/BenchControl/StateMachine.cs
+++ b/TBF/BenchControl/StateMachine.cs
@@ -211,17 +211,21 @@ namespace TBF.BenchControl
/// Mode of operation
/// A copy of bench data used by the state machine
/// Identifies the initial state
+ public static void InitializeBoardEtc(
#if DN100
- public static void InitializeBoardEtc(ControlCom2VB.ControlCom2panel ctrlBrdComponent)
+ ControlCom2VB.ControlCom2panel
#elif MUNICH || FUZHOU_150
- public static void InitializeBoardEtc(ControlComponent3Munich.UserControl1 ctrlBrdComponent)
+ ControlComponent3Munich.UserControl1
#elif FUZHOU_300
- public static void InitializeBoardEtc(ControlComponent3F300.UserControl1 ctrlBrdComponent)
+ ControlComponent3F300.UserControl1
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || SLM_150 || PETERSBURG_200
- public static void InitializeBoardEtc(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent)
-#else /// all newer benches
- public static void InitializeBoardEtc(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent)
+ ControlComponent_Izrael2014.UserControl1
+#elif JUZNA_AFRIKA_NEW
+ object
+#else /// other benches
+ ControlComponent_Torino2015.UserControl1
#endif
+ ctrlBrdComponent)
{
/// Load the list of components (entities) from the database.
/// Then create the components (derived from IComponent).
@@ -290,14 +294,18 @@ namespace TBF.BenchControl
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = tanks[i].Capacity;
/// Pre-initialize the control board (= buffer the arguments ctrlBrdComponent, tankCapacities)
- if (ControlBoard != null)
- {
- ControlBoard.InitializeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities);
- }
- else
+ if (ControlBoard == null)
{
throw new Exception("Control board component is missing");
}
+ else if (ControlBoard is ControlBoard.Legacy.ControlBoardDev)
+ {
+ ControlBoard.InitializeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities);
+ }
+ else
+ {
+ ControlBoard.InitializeComponent(null, valvesToInvert, tankCapacities);
+ }
}
diff --git a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs
index e4c58a24c..ea1102314 100644
--- a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs
+++ b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs
@@ -23,7 +23,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.ControlBoardDev) &&
- !(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.New.CBoard))
{
/// Control board does not support this method
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
index d75a1792b..1e8f007a2 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
@@ -23,6 +23,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.ControlBoardDev) &&
+ !(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.New.CBoard))
{
/// Control board does not support this method
@@ -503,7 +504,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
}
- TestStartTime = DateTime.Now;
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Start mass");
@@ -579,6 +579,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
+ .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.EnterState();
do {
@@ -655,7 +656,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
- .AddOperation(cBrd.StartTestOp(test))
+ .AddOperation(scale.ReadMassOp(ref Mass))
+ .AddOperation(cBrd.StartTestOp(test))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -665,10 +667,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (!e.Contains(Event.MeasurementStarted));
StartTime = (double)StateMachine.Time;
+ TestStartTime = DateTime.Now;
State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
+ .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.OpenStartValveOp())
.EnterState();
do {
@@ -766,10 +770,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
StopRecordingStatistics();
EndTime = (double)StateMachine.Time;
+ TestEndTime = DateTime.Now;
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
+ .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.CloseStartValveOp())
.EnterState();
do {
@@ -782,6 +788,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
+ .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.StopFlowRegulationOp())
.EnterState();
do {
@@ -837,7 +844,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (!e.Contains(Event.BalanceDone));
///
tMass2 = StateMachine.Time;
- TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
@@ -1021,7 +1027,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime;
- tstRslt.TestTime = Math.Max(1.0, EndTime - StartTime); /// [s] measurement time, at least 1 to prevent division by zero
+ TimeSpan duration = TestEndTime - TestStartTime;
+ tstRslt.TestTime = duration.TotalSeconds; /// [s] measurement time, at least 1 to prevent division by zero
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val;
@@ -1029,13 +1036,27 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = massEnd;
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + massOfEvaporatedWater) / tstRslt.TestTime; /// [kg/h]
- tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
- tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
- tstRslt.Buoyancy = buoyancy;
- tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
- tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
- tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
- tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
+ tstRslt.Buoyancy = buoyancy;
+ tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
+
+ if (cBrd is ControlBoard.Papouch.CBoard)
+ {
+ /// Test bench with Papouch control board without reference flow meter
+ tstRslt.VolumeMaster = volumeCTV; /// [l] volume from the master flow meter
+ tstRslt.FlowVolume = 3.6 * tstRslt.VolumeMaster / tstRslt.TestTime; /// [m3/h]
+ tstRslt.ConstMasterRaw = 1; /// Uncorrected master flowmeter coefficient
+ tstRslt.ConstMasterCorr = 1; /// Corrected master pulses per liter
+ tstRslt.ConstMaster = 1;
+ }
+ else
+ {
+ /// Test bench with ELDE control board and reference flow meter
+ tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
+ tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
+ tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
+ tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
+ tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
+ }
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index 0081f4ce6..53eba57bc 100644
--- a/TBF/Properties/AssemblyInfo.cs
+++ b/TBF/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.26.1463.0")]
-[assembly: AssemblyFileVersion("2.26.1463.0")]
+[assembly: AssemblyVersion("3.1.1470.0")]
+[assembly: AssemblyFileVersion("3.1.1470.0")]
diff --git a/TBF/UI/MainWnd.Designer.cs b/TBF/UI/MainWnd.Designer.cs
index cb12a9a7c..70c5870e3 100644
--- a/TBF/UI/MainWnd.Designer.cs
+++ b/TBF/UI/MainWnd.Designer.cs
@@ -752,6 +752,8 @@ namespace TBF.UI
#elif TURA_IPERL || TURA_IPERL_NEW || IZRAEL_50
private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent;
private TBF.UI.Process.ProcessTabPageCtrl48 processTabPageCtrl;
+#elif JUZNA_AFRIKA_NEW
+ private TBF.UI.Process.ProcessTabPageCtrl24 processTabPageCtrl;
#endif
private System.Windows.Forms.ToolStripMenuItem benchTSMenuItem;
diff --git a/TBF/UI/MainWnd.cs b/TBF/UI/MainWnd.cs
index 552a62245..5a4a6d96d 100644
--- a/TBF/UI/MainWnd.cs
+++ b/TBF/UI/MainWnd.cs
@@ -133,7 +133,11 @@ namespace TBF.UI
try
{
/// Load components, initialize the control board, etc.
+#if JUZNA_AFRIKA_NEW
+ BenchControl.StateMachine.InitializeBoardEtc(null);
+#else
BenchControl.StateMachine.InitializeBoardEtc(ctrlBrdComponent);
+#endif
/// Check remote and local configuration DB compatibility
string msg;
diff --git a/Users/Properties/AssemblyInfo.cs b/Users/Properties/AssemblyInfo.cs
index 9d4494464..5359c4adc 100644
--- a/Users/Properties/AssemblyInfo.cs
+++ b/Users/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.25.1400.0")]
-[assembly: AssemblyFileVersion("2.25.1400.0")]
+[assembly: AssemblyVersion("3.1.1464.0")]
+[assembly: AssemblyFileVersion("3.1.1464.0")]