Changes for Juzna-Afrika-NEW, JUZNA_AFRIKA_NEW symbol, ver. 3.1.1470
This commit is contained in:
parent
c007bca797
commit
2ec611964f
@ -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;
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
/// <param name="outputs">output value</param>
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="bitMask">Specifies bit(s) to set</param>
|
||||
/// <param name="outputs">output value</param>
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="bitMask">Specifies bit(s) to reset</param>
|
||||
/// <param name="outputs">output value</param>
|
||||
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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Route: 128-bit word representing the current state of all valves and pumps
|
||||
/// </summary>
|
||||
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() { }
|
||||
|
||||
/// <summary>
|
||||
/// Set valves to new positions.
|
||||
/// </summary>
|
||||
/// <param name="valvesToOpen">'UInt128' with bits of valves to open set to '1'</param>
|
||||
/// <param name="valvesToClose">'UInt128' with bits of valves to close set to '1'</param>
|
||||
/// <returns>'UInt128' with bits of valves that have changed set to '1'</returns>
|
||||
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<BuiltIn.ValveEx.Valve> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -233,14 +291,29 @@ namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
public float ValveOpenCloseTime { get { return 0.1f; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns operation to display a prompt message to set the flow.
|
||||
/// </summary>
|
||||
/// <param name="reqrdFlowLo">Lower limit</param>
|
||||
/// <param name="reqrdFlowHi">Upper limit</param>
|
||||
/// <param name="measuredFlow">Reference to a box for the measured flow or null</param>
|
||||
/// <param name="timeout">Flow set timeout</param>
|
||||
/// <returns>Operation</returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -252,17 +325,14 @@ namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
/// <returns>Operation</returns>
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start selected operation
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Run selected operation
|
||||
/// </summary>
|
||||
/// <returns>Event.None or Event.FlowReached or Event.MeasurementCompleted </returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop this operation
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (runningOp == SelectedOp.SetFlow)
|
||||
{
|
||||
if (messageBoxForm != null)
|
||||
{
|
||||
messageBoxForm.OnCloseThisForm(this, null);
|
||||
messageBoxForm = null;
|
||||
}
|
||||
}
|
||||
|
||||
runningOp = SelectedOp.None;
|
||||
opCompleted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
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() { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,17 +211,21 @@ namespace TBF.BenchControl
|
||||
/// <param name="mode">Mode of operation</param>
|
||||
/// <param name="benchData">A copy of bench data used by the state machine</param>
|
||||
/// <param name="label">Identifies the initial state</param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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")]
|
||||
|
||||
2
TBF/UI/MainWnd.Designer.cs
generated
2
TBF/UI/MainWnd.Designer.cs
generated
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user