Uni.CBoard -> Uni.UniCB, 'config', actions, non-conflicting fetching and communication implemented, ver. 3.1.1601

This commit is contained in:
Milan Hanajik 2021-03-03 15:51:36 +01:00
parent f5786ef93d
commit cdca702738
44 changed files with 688 additions and 351 deletions

View File

@ -11,14 +11,6 @@ namespace TBF.BenchControl.ControlBoard
{
void SpecifyInvertedValves(UInt128 valvesToInvert);
/// <summary>
/// Display value in a third party component, update UI
/// </summary>
/// <param name="sParam">String parameter</param>
/// <param name="iParam">Integer parameter</param>
/// <param name="value">Value to be displayed</param>
void UpdateUI(string sParam, int iParam, double value);
/// <summary>
/// Called on beginning of a test
/// </summary>

View File

@ -15,13 +15,13 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public bool ShowMore { get { return false; } }
CBoardCfg config;
PapouchCBCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as CBoardCfg;
config = value as PapouchCBCfg;
Redraw();
}
}

View File

@ -6,25 +6,25 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.ControlBoard.Papouch
{
public class CBoardFactory : IComponentFactory
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public override string ToString() { return ClassName; }
public void ResetStaticProperties() { CBoard.ResetStaticProperties(); }
public void ResetStaticProperties() { PapouchCB.ResetStaticProperties(); }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponent DummyComponent() { return new CBoard(); }
public IComponent DummyComponent() { return new PapouchCB(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new CBoard(cfg, components); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new PapouchCB(cfg, components); }
public IComponentCfg DefaultConfig() { return new CBoardCfg(this); }
public IComponentCfg DefaultConfig() { return new PapouchCBCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(CBoardCfg.Serializer, component, this);
return ComponentCfgBase.CreateFromDbEntity(PapouchCBCfg.Serializer, component, this);
}
}
}

View File

@ -16,12 +16,12 @@ using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.ControlBoard.Papouch
{
public class CBoard : ComponentBase, IControlBoard, IOperation
public class PapouchCB : ComponentBase, IControlBoard, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
private static readonly ILog log = LogManager.GetLogger(typeof(PapouchCB));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
readonly CBoardCfg cBoardCfg;
readonly PapouchCBCfg cbCfg;
readonly GenericDevices.IModbus modbus;
UInt32 currentOutputs;
@ -48,17 +48,17 @@ namespace TBF.BenchControl.ControlBoard.Papouch
bool opCompleted; /// true = Operation was completed and waits for Stop();
public CBoard()
public PapouchCB()
{
}
/// <summary>
/// Constructor
/// </summary>
public CBoard(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
public PapouchCB(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
cBoardCfg = cfg as CBoardCfg;
cbCfg = cfg as PapouchCBCfg;
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
@ -66,7 +66,7 @@ namespace TBF.BenchControl.ControlBoard.Papouch
routeMask = 0;
for (int i = 0; i < 128; i++)
{
if (i < cBoardCfg.VirtualValvesRangeLo || i > cBoardCfg.VirtualValvesRangeHi)
if (i < cbCfg.VirtualValvesRangeLo || i > cbCfg.VirtualValvesRangeHi)
{
routeMask = routeMask | ((UInt128)1 << i);
}
@ -105,11 +105,11 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public void RunDeviceBefore()
{
if (cBoardCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return;
if (cbCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return;
if (modbus.ReceivedTelegrams[cBoardCfg.ModbusAddress].Count > 0)
if (modbus.ReceivedTelegrams[cbCfg.ModbusAddress].Count > 0)
{
byte[] telegram = modbus.ReceivedTelegrams[cBoardCfg.ModbusAddress].Dequeue();
byte[] telegram = modbus.ReceivedTelegrams[cbCfg.ModbusAddress].Dequeue();
if ((telegram.Length >= 8) && (telegram[1] == 0x11) && (telegram[2] == telegram.Length - 5))
{
@ -198,33 +198,33 @@ namespace TBF.BenchControl.ControlBoard.Papouch
private void RequestInputs()
{
byte addr = cBoardCfg.ModbusAddress;
byte addr = cbCfg.ModbusAddress;
byte cmd = (byte)Function.ReadSingleInput;
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 2, 0, 0 });
}
private void SendOutputs(UInt32 outputs)
{
byte addr = cBoardCfg.ModbusAddress;
byte addr = cbCfg.ModbusAddress;
byte cmd = (byte)Function.ForceMultipleCoils;
byte dataLo = (byte)(outputs & 0xFF);
byte data2 = (byte)(outputs >> 8);
byte data3 = (byte)(outputs >> 16);
byte dataHi = (byte)(outputs >> 24);
if (cBoardCfg.Variant == QuidoVariant.QuidoRS_4_4)
if (cbCfg.Variant == QuidoVariant.QuidoRS_4_4)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 4, 1, dataLo, 0, 0 });
}
else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_8_8)
else if (cbCfg.Variant == QuidoVariant.QuidoRS_8_8)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 8, 1, dataLo, 0, 0 });
}
else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_2_16)
else if (cbCfg.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)
else if (cbCfg.Variant == QuidoVariant.QuidoRS_2_32)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 32, 4, dataLo, data2, data3, dataHi, 0, 0 });
}
@ -265,7 +265,6 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public double TestTimeWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 1.0 : 1.0; }
public void UpdateUI(string sParam, int iParam, double value) { }
public void ClearProcessValues() { }
/// <summary>
@ -402,9 +401,9 @@ namespace TBF.BenchControl.ControlBoard.Papouch
System.Drawing.Color backColor;
TBF.BenchControl.Operations.MessageBoxForm messageBoxForm;
///
delegate void MessageBoxFormDlgt(CBoard myRef);
delegate void MessageBoxFormDlgt(PapouchCB myRef);
///
void OpenFormDlg(CBoard myRef)
void OpenFormDlg(PapouchCB myRef)
{
myRef.messageBoxForm = new TBF.BenchControl.Operations.MessageBoxForm(promptMsg, backColor);
messageBoxForm.Show();

View File

@ -16,9 +16,9 @@ namespace TBF.BenchControl.ControlBoard.Papouch
Count
}
public class CBoardCfg : ComponentCfgBase, Generic.IChildComponentCfg
public class PapouchCBCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CBoardCfg) })[0];
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PapouchCBCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new CBoardCfgCtrl(); }
@ -32,7 +32,7 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public int VirtualValvesRangeHi;
/// Private parameterless constructor invoked by all other (public) constructors
CBoardCfg()
PapouchCBCfg()
{
Name = "CB";
ParentName = "Modbus";
@ -42,7 +42,7 @@ namespace TBF.BenchControl.ControlBoard.Papouch
VirtualValvesRangeHi = 59;
}
public CBoardCfg(IComponentFactory factory)
public PapouchCBCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;

View File

@ -0,0 +1,312 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using log4net;
using Dirichlet.Numerics;
namespace TBF.BenchControl.ControlBoard.Uni
{
public enum ActionID
{
/// Basic
ChangeRoute = 1, /// Change digital outputs (route)
SetFlow = 2, /// Set flow
MeasureFlow = 4, /// Activate a flow meter to measure the flow
StartTest = 8, /// Start a test
Stop = 16, /// Stop a test or a flow regulation
SwitchDiverter = 32, /// Switch diverter to tank/sink
/// Advanced
GetDiverterTransitionData,
GetScopeAnalyzerData,
ResetScopeAnalyzer,
GetSwitchCounterData,
}
public class Action
{
private static readonly ILog log = LogManager.GetLogger(typeof(Action));
public ActionID ActionId { get; set; }
public ulong Route { get; set; } /// ChangeRoute argument
public int FlowMId { get; set; } /// SetFlow, MeasureFlow and StartTest argument
public int RegVId { get; set; } /// SetFlow and StartTest argument
public int DivId { get; set; } /// StartTest and SwitchDiverter argument
public bool IsSyncMethod { get; set; } /// StartTest argument
public bool IsDivUsed { get; set; } /// StartTest argument
public bool ToTank { get; set; } /// SwitchDiverter argument
public int TotalPulsesCount { get; set; } /// StartTest argument
public int MassPulsesCount { get; set; } /// StartTest argument
public int FlowRegP1 { get; set; } /// SetFlow
public int FlowRegP2 { get; set; } /// SetFlow
public int PID { get; set; } /// SetFlow
public int TolerRV { get; set; } /// SetFlow
public int StabTime { get; set; } /// SetFlow
public int DivThreshold { get; set; } /// StartTest argument
int StartStop { get; set; } /// Implicitly used by SetFlow, StartTest and Stop: -1=not defined, 0=stop, 1=start
public Action()
{
/// Values -1 indicate the related arguments are not used yet
FlowMId = -1;
RegVId = -1;
DivId = -1;
StartStop = -1;
/// These values are used by one action type only. No conflicts possible
Route = 0;
FlowRegP1 = 0;
FlowRegP2 = 0;
TotalPulsesCount = 0;
MassPulsesCount = 0;
}
public bool IsStart()
{
return (ActionId & (ActionID.SetFlow | ActionID.StartTest)) != 0;
}
public bool IsStop()
{
return (ActionId & ActionID.Stop) != 0;
}
///----------------------------------------------------------------------------------------------
public static Action ChangeRoute(ulong route)
{
return new Action
{
ActionId = ActionID.ChangeRoute,
Route = route,
};
}
void SetChangeRouteArgs(Action action)
{
Route = action.Route;
}
bool CompareChangeRouteArgs(Action action)
{
return Route == action.Route;
}
///----------------------------------------------------------------------------------------------
public static Action MeasureFlow(int flowMeterId)
{
return new Action
{
ActionId = ActionID.MeasureFlow,
FlowMId = flowMeterId,
};
}
void SetMeasureFlowArgs(Action action)
{
FlowMId = action.FlowMId;
}
bool CompareMeasureFlowArgs(Action action)
{
return (FlowMId == -1 || FlowMId == action.FlowMId);
}
///----------------------------------------------------------------------------------------------
public static Action SetFlow(int flowMeterId, int regValveId, int flowRegPar1, int flowRegPar2,
int pid, int tolerRV, int stabTime)
{
return new Action
{
ActionId = ActionID.SetFlow,
FlowMId = flowMeterId,
RegVId = regValveId,
FlowRegP1 = flowRegPar1,
FlowRegP2 = flowRegPar2,
PID = pid,
TolerRV = tolerRV,
StabTime = stabTime,
StartStop = 1,
};
}
void SetSetFlowArgs(Action action)
{
FlowMId = action.FlowMId;
RegVId = action.RegVId;
FlowRegP1 = action.FlowRegP1;
FlowRegP2 = action.FlowRegP2;
PID = action.PID;
TolerRV = action.TolerRV;
StabTime = action.StabTime;
StartStop = 1;
}
bool CompareSetFlowArgs(Action action)
{
return (FlowMId == -1 || FlowMId == action.FlowMId) &&
(RegVId == -1 || RegVId == action.RegVId) &&
(StartStop == -1 || StartStop == 1);
}
///----------------------------------------------------------------------------------------------
public static Action StartTest(int flowMId, int divId, int divThreshold, bool isSyncMethod,
bool isDivUsed, int totalPulsesCount, int massPulsesCount = -1)
{
return new Action
{
ActionId = ActionID.StartTest,
FlowMId = flowMId,
DivId = divId,
DivThreshold = divThreshold,
IsSyncMethod = isSyncMethod,
IsDivUsed = isDivUsed,
TotalPulsesCount = totalPulsesCount,
MassPulsesCount = (massPulsesCount == -1) ? totalPulsesCount : massPulsesCount,
StartStop = 1,
};
}
void SetStartTestArgs(Action action)
{
FlowMId = action.FlowMId;
DivId = action.DivId;
DivThreshold = action.DivThreshold;
IsSyncMethod = action.IsSyncMethod;
IsDivUsed = action.IsDivUsed;
TotalPulsesCount = action.TotalPulsesCount;
MassPulsesCount = action.MassPulsesCount;
StartStop = 1;
}
bool CompareStartTestArgs(Action action)
{
return (FlowMId == -1 || FlowMId == action.FlowMId) &&
(DivId == -1 || DivId == action.DivId) &&
(StartStop == -1 || StartStop == 1);
}
///----------------------------------------------------------------------------------------------
public static Action Stop()
{
return new Action()
{
ActionId = ActionID.Stop,
StartStop = 0,
};
}
void SetStopArgs(Action action)
{
StartStop = 0;
}
bool CompareStopArgs(Action action)
{
return (StartStop == -1 || StartStop == 0);
}
///----------------------------------------------------------------------------------------------
public static Action SwitchDiverter(int divId, bool toTank)
{
return new Action
{
ActionId = ActionID.SwitchDiverter,
DivId = divId,
ToTank = toTank,
};
}
void SetSwitchDiverterArgs(Action action)
{
DivId = action.DivId;
ToTank = action.ToTank;
}
bool CompareSwitchDiverterArgs(Action action)
{
return (DivId == -1 || DivId == action.DivId);
}
///----------------------------------------------------------------------------------------------
void SetArgs(Action action)
{
ActionId |= action.ActionId;
switch (action.ActionId)
{
case ActionID.ChangeRoute: SetChangeRouteArgs(action); return;
case ActionID.MeasureFlow: SetMeasureFlowArgs(action); return;
case ActionID.SetFlow: SetSetFlowArgs(action); return;
case ActionID.StartTest: SetStartTestArgs(action); return;
case ActionID.Stop: SetStopArgs(action); return;
case ActionID.SwitchDiverter: SetSwitchDiverterArgs(action); return;
default: return;
}
}
/// <summary>
/// Checks whether there is a conflict in usage of arguments.
/// </summary>
/// <param name="action">2nd action</param>
/// <returns>true if there is no conflict</returns>
bool CompareSharedArgs(Action action)
{
switch (action.ActionId)
{
case ActionID.ChangeRoute: return CompareChangeRouteArgs(action);
case ActionID.MeasureFlow: return CompareMeasureFlowArgs(action);
case ActionID.SetFlow: return CompareSetFlowArgs(action);
case ActionID.StartTest: return CompareStartTestArgs(action);
case ActionID.Stop: return CompareStopArgs(action);
case ActionID.SwitchDiverter: return CompareSwitchDiverterArgs(action);
default: return false;
}
}
///----------------------------------------------------------------------------------------------
public static Action FetchNonConflictingActions(Queue<Action> queue)
{
log.Debug("Fetching non conflicting actions:");
if (queue == null || queue.Count == 0) return null;
Action resultA = queue.Dequeue();
log.Debug(resultA.ToString());
while (queue.Count > 0)
{
var peekA = queue.Peek();
if ((resultA.ActionId & peekA.ActionId) == 0 && resultA.CompareSharedArgs(peekA) == true)
{
/// ActionId would not be repeated and arguments are compatible => apply the new action
resultA.SetArgs(peekA);
log.Debug(peekA.ToString());
queue.Dequeue();
}
else
{
/// Leave actions in the queue and quit the loop as the next scheduled action is incompatible
break;
}
}
return resultA;
}
public override string ToString()
{
string args;
switch (ActionId)
{
case ActionID.ChangeRoute:
args = string.Format("Route={0}", Route.ToString("X16"));
break;
case ActionID.SetFlow:
args = string.Format("Etalon={0} RV={1} Par1={2} Par2={3}", FlowMId, RegVId, FlowRegP1, FlowRegP2);
break;
case ActionID.MeasureFlow:
args = string.Format("Etalon={0}", FlowMId);
break;
case ActionID.StartTest:
args = string.Format("Etalon={0} TotalP={1} MassP={2}", FlowMId, TotalPulsesCount, MassPulsesCount);
break;
default:
args = string.Empty;
break;
}
return string.Format(" {0} {1}", ActionId, args);
}
}
}

View File

@ -1,23 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.ControlBoard.Uni
{
public class Const
{
public const byte STX = 0x10;
public const int WMsCount = 20; /// water meters count
public const int ADCsCount = 16; /// ADCs count: feedback from RV-s and diverters
public const int RVsCount = 8; /// 0..7
public const int FlowmtrsCount = 7; /// ID=1..7, ID=0 ... flowmeters 1,2,3 parallel
public const int DivertersCount = 5; /// 1..5
public const int DivTimeResolution = 2; /// [ms]
public const double TimeResolution = 0.0002; /// [s]
public const int WMsCount = 20; /// water meters count
public const int ADCsCount = 16; /// ADCs count: feedback from RV-s and diverters
public const int RVsCount = 8; /// 0..7
public const int FlowmtrsCount = 7; /// ID=1..7, ID=0 ... flowmeters 1,2,3 parallel
public const int DivertersCount = 5; /// 1..5
public const int DivTimeResolution = 2; /// [ms]
public const double TimeResolution = 0.0002; /// [s]
}
public enum StatusP : ulong
{
/// byte 0
@ -50,68 +48,4 @@ namespace TBF.BenchControl.ControlBoard.Uni
Flowmtr2Active = 0x2000000000000, /// bit 49
Flowmtr3Active = 0x4000000000000, /// bit 50
}
public enum Command : byte
{
RequestData = 0,
Start = 1,
Stop = 2,
GetDiverterTransitionData = 4,
GetScopeAnalyzerData = 7,
ResetScopeAnalyzer = 8,
GetSwitchCounterData = 9,
}
public enum StartParam : byte
{
EtalonMask = 7,
DiverterStart = 8,
SynchroMethod = 16,
DirectGateStart = 32, /// ???
StartStopMethod = 64,
CalibrationMode = 128,
}
public enum StopDevs : byte
{
None = 0,
Reference = 0x01, /// bit 0
Diverter = 0x02, /// bit 1
GatePulse = 0x08, /// bit 3
TimeMeasurement = 0x10, /// bit 4
BypassDevCoupled2Div = 0x20, /// bit 5
RegValveRegulation = 0x80, /// bit 7
All = 0xFF,
}
public enum TestMethods
{
Diverter = 0x01, /// bit 0: 1=Mass method (diverters are used), 0=Volume method
FixedStart = 0x02, /// bit 1: 1=fixed start method, 0=flying start method
Synchro = 0x04, /// bit 2: 1=Synchro method, 0=Pulse counting
MassAndContinue = 0x10, /// bit 4: 1=Method with mass measurement followed by a volume method
}
public enum ValveChgFlag : byte
{
DoNotChange = 0,
Change = 1,
SendPressureMeterAddresses = 2,
}
public enum RegValveMode : byte
{
None = 0,
PulseWidth = 1, /// Pulse width 0.05 .. 2 sec.
TargetPosition = 2, /// Low and high position (=DAC value) limits (0..100%) are specified
TargetFrequency = 3, /// Low and high frequency limits (0..2000Hz,0..2200Hz) are specified
Stop = 4, /// Stop regulation
}
public enum RegValveState : byte
{
Idle = 0,
PwOrFreqRegul = 2,
DacValueRegul = 3,
}
}

View File

@ -11,17 +11,17 @@ namespace TBF.BenchControl.ControlBoard.Uni
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public override string ToString() { return ClassName; }
public void ResetStaticProperties() { CBoard.ResetStaticProperties(); }
public void ResetStaticProperties() { UniCB.ResetStaticProperties(); }
public IComponent DummyComponent() { return new CBoard(); }
public IComponent DummyComponent() { return new UniCB(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new CBoard(cfg); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new UniCB(cfg); }
public IComponentCfg DefaultConfig() { return new CBoardCfg("UniCB", this); }
public IComponentCfg DefaultConfig() { return new UniCBCfg("UniCB", this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(CBoardCfg.Serializer, component, this);
return ComponentCfgBase.CreateFromDbEntity(UniCBCfg.Serializer, component, this);
}
}
}

View File

@ -15,11 +15,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
public ulong Vystupy;
public uint[] StavDA = new uint[2];
public double[] ReferenceFreq = new double[4];
public uint[] EtPulses = new uint[Const.WMsCount + 1]; /// EtPulses[0]=total pulses, EtPulses[1..WMsCount] gated et.pulses for respective WM
public uint EtPulsesK;
public uint EtPulses2;
public uint EtPulses3;
public uint[] WMeterPuls = new uint[Const.WMsCount + 1]; /// WMsCount = 20
public int[] EtPulses = new int[Const.WMsCount + 1]; /// EtPulses[0]=total pulses, EtPulses[1..WMsCount] gated et.pulses for respective WM
public int EtPulsesK;
public int EtPulses2;
public int EtPulses3;
public int[] WMeterPuls = new int[Const.WMsCount + 1]; /// WMsCount = 20
public double[] ImpulseTime = new double[Const.WMsCount + 1]; /// WMsCount = 20
public uint[] RegVStatus = new uint[Const.RVsCount + 1 + 1]; /// RVsCount = 8, posledny rValveStatus[9] je prudovy
public float[] RegVMoveTime = new float[Const.RVsCount];
@ -99,8 +99,8 @@ namespace TBF.BenchControl.ControlBoard.Uni
TemperatureRaw[i] = GetInt16(data, offs + (int)Poz.Groch + 2 * i);
}
EtPulses[0] = GetUInt24(data, offs + (int)Poz.Et1); /// Byte 73,74,75
EtPulsesK = GetUInt24(data, offs + (int)Poz.EtK); /// Byte 76,77,78
EtPulses[0] = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.Et1));/// Byte 73,74,75
EtPulsesK = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.EtK)); /// Byte 76,77,78
byte spare1 = data[offs + (int)Poz.spare1]; /// byte 79
byte spare2 = data[offs + (int)Poz.spare2]; /// byte 82
@ -125,13 +125,13 @@ namespace TBF.BenchControl.ControlBoard.Uni
if ((State & (ulong)StatusP.SynchroMethod) != 0)
{
ushort pulses = GetUInt16(data, ix2);
WMeterPuls[wmNr] = pulses;
EtPulses[wmNr] = (pulses == 0) ? 0 : GetUInt24(data, ix1);
ImpulseTime[wmNr] = (pulses == 0) ? 0 : GetUInt24(data, ix1 + 3) * Const.TimeResolution;
WMeterPuls[wmNr] = Convert.ToInt32(pulses);
EtPulses[wmNr] = (pulses == 0) ? 0 : Convert.ToInt32(GetUInt24(data, ix1));
ImpulseTime[wmNr] = (pulses == 0) ? 0 : Const.TimeResolution * Convert.ToDouble(GetUInt24(data, ix1 + 3));
}
else
{
WMeterPuls[wmNr] = GetUInt24(data, ix1);
WMeterPuls[wmNr] = Convert.ToInt32(GetUInt24(data, ix1));
EtPulses[wmNr] = EtPulses[0];
ImpulseTime[wmNr] = Ttime;
}
@ -185,8 +185,8 @@ namespace TBF.BenchControl.ControlBoard.Uni
RegVMoveTime[i] = 10 * GetUInt16(data, offs + (int)Poz.CasKoh + 2*i);
}
EtPulses2 = GetUInt24(data, offs + (int)Poz.ETX2); /// Byte 294,295,296
EtPulses3 = GetUInt24(data, offs + (int)Poz.ETX3); /// Byte 297,298.299 !!!!!!!!!!!!!!!
EtPulses2 = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.ETX2)); /// Byte 294,295,296
EtPulses3 = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.ETX3)); /// Byte 297,298.299 !!!!!!!!!!!!!!!
}
}

View File

@ -1,12 +0,0 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.ControlBoard.Uni
{
public interface IOutputMessage
{
int PayloadLen { get; }
byte MessageCode { get; }
byte[] GetMessage();
}
}

View File

@ -7,111 +7,74 @@ using Dirichlet.Numerics;
namespace TBF.BenchControl.ControlBoard.Uni
{
public class OutputMessage : IOutputMessage
public static class OutputMessage
{
public int PayloadLen { get { return 38; } }
public byte MessageCode { get { return (byte)' '; } }
public const int PayloadLen = 38;
public const byte MessageCode = (byte)' ';
Command command;
byte startOrStopParams;
UInt32 totalPulsesCount;
UInt32 massPuleseCount;
UInt128 route;
OutputMessage()
{
command = Command.RequestData;
startOrStopParams = 0;
totalPulsesCount = 0;
massPuleseCount = 0;
}
public static OutputMessage CreateDataRequestMsg()
{
var msg = new OutputMessage();
msg.command = Command.RequestData;
return msg;
}
public static OutputMessage CreateSetFlowMsg(OutputPath devices, float flowLo, float flowHi, int timeOut)
{
var msg = new OutputMessage();
msg.command = Command.RequestData;
return msg;
}
public static OutputMessage CreateTestStartCmd(int etalonNr, int regValveNr, int divNr, long totalPulsesCount, long massPulsesCount = -1)
{
var msg = new OutputMessage();
//msg.command = Command.Start;
//msg.etalonNr = etalonNr;
//msg.regValveNr = regValveNr;
//msg.divNr = divNr;
//msg.totalPulsesCount = totalPulsesCount;
//msg.massPuleseCount = (massPulsesCount >= 0) ? massPulsesCount : totalPulsesCount;
return msg;
}
public static OutputMessage CreateTestStopCmd()
{
var msg = new OutputMessage();
msg.command = Command.Stop;
return msg;
}
public byte[] GetMessage()
public static byte[] GetMessage(Action action, short config)
{
byte[] message = new byte[PayloadLen + 5]; /// headed 3 bytes, checksum 2 bytes
/// Header (3 bytes)
/// Header + message code (4 bytes)
message[0] = Const.STX;
message[1] = 1; /// Control board addres
message[2] = (byte)PayloadLen; /// Payload length
message[3] = MessageCode;
/// Command
message[3] = MessageCode;
message[4] = (byte)command;
message[5] = startOrStopParams;
message[6] = 0; /// nn | (paralelEt << 3);
message[4] = GetCommand(action);
message[5] = action.IsStart() ? GetStartParams(action) : action.IsStop() ? GetStopParams(action) : (byte)0;
message[6] = (action.DivId <= 0) ? (byte)0 : (byte)(action.DivId - 1);
int totalPulsesCount = (action.TotalPulsesCount < 0) ? 0 : action.TotalPulsesCount;
message[7] = (byte)(totalPulsesCount & 0xFF);
message[8] = (byte)((totalPulsesCount >> 8) & 0xFF);
message[9] = (byte)((totalPulsesCount >> 16) & 0xFF);
message[10] = (byte)(massPuleseCount & 0xFF);
message[11] = (byte)((massPuleseCount >> 8) & 0xFF);
message[12] = (byte)((massPuleseCount >> 16) & 0xFF);
int massPulsesCount = (action.MassPulsesCount < 0) ? 0 : action.MassPulsesCount;
message[10] = (byte)(massPulsesCount & 0xFF);
message[11] = (byte)((massPulsesCount >> 8) & 0xFF);
message[12] = (byte)((massPulsesCount >> 16) & 0xFF);
///// Valves
//message[13] = (byte)((route >> 16) & 0xFF);
//message[14] = (byte)((route >> 24) & 0xFF);
//message[15] = (byte)((route >> 32) & 0xFF);
//message[16] = (byte)((route >> 40) & 0xFF);
//message[17] = (byte)((route >> 48) & 0xFF);
//message[18] = (byte)((route >> 56) & 0xFF);
//message[19] = 0;
message[13] = 0;
///// Frequency converter parameters
//message[20] = 0;
//message[21] = 0;
//message[22] = 0;
//message[23] = 0;
//message[24] = 0;
//message[25] = 0;
//message[26] = 0;
//message[27] = 0;
//message[28] = 0;
//message[29] = 0;
message[14] = (byte)(config & 0xff);
message[15] = (byte)((config >> 8) & 0xff);
//message[30] = (byte)(regValveNrTextBox.Visible ? int.Parse(regValveNrTextBox.Text) : 0);
//message[31] = (byte)GetRegValveMode();
message[32] = 0; /// reg. v. position
message[33] = 0; /// reg. v. frequency
message[34] = 0; /// reg. v. time ticks
message[35] = 0; /// analog v. regul
message[36] = 0; /// analog v. regul
message[37] = 0; /// analog v. regul
message[38] = 0; /// analog v. regul
message[39] = 0; /// analog v. regul
/// Route
message[16] = ((action.ActionId & ActionID.ChangeRoute) != 0) ? (byte)1 : (byte)0; /// Route change flag
message[17] = (byte)(action.Route & 0xFF);
message[18] = (byte)((action.Route >> 8) & 0xFF);
message[19] = (byte)((action.Route >> 16) & 0xFF);
message[20] = (byte)((action.Route >> 24) & 0xFF);
message[21] = (byte)((action.Route >> 32) & 0xFF);
message[22] = (byte)((action.Route >> 40) & 0xFF);
message[23] = (byte)((action.Route >> 48) & 0xFF);
message[24] = (byte)((action.Route >> 56) & 0xFF);
/// DA2
message[25] = 0;
message[26] = 0;
/// Regulation valve
message[27] = (action.RegVId < 0) ? (byte)0 : (byte)action.RegVId;
message[28] = (byte)(action.FlowRegP1 & 0xFF);
message[29] = (byte)((action.FlowRegP1 >> 8) & 0xFF);
message[30] = (byte)(action.FlowRegP2 & 0xFF);
message[31] = (byte)((action.FlowRegP2 >> 8) & 0xFF);
message[32] = action.IsStop() ? (byte)0x20 : action.IsStart() ? (byte)0x42 : (byte)0; /// ZStavReg
/// DA1
message[33] = 0; /// PrudParL
message[34] = 0; /// PrudParH
message[35] = (byte)Math.Max(1, Math.Min(255, action.PID)); /// PIDRV
message[36] = (byte)Math.Max(4, Math.Min(255, action.TolerRV)); /// TolerRV (4..20 mA reg.valve only)
message[37] = (byte)Math.Max(0, Math.Min(255, action.StabTime)); /// StabRV
message[38] = (byte)((action.DivThreshold >> 2) & 0xFF); /// HranAK
message[39] = 0;
message[40] = 0;
Debug.Assert(40 == PayloadLen + 2);
@ -124,9 +87,99 @@ namespace TBF.BenchControl.ControlBoard.Uni
return message;
}
public override string ToString()
static byte GetCommand(Action action)
{
return string.Format("CommandMessage : {0}", command);
int command = 0;
if (action.IsStart()) command |= (int)Command.Start;
if (action.IsStop()) command |= (int)Command.Stop;
return (byte)command;
}
static byte GetStartParams(Action action)
{
int param = action.FlowMId & (int)StartParam.EtalonMask;
if (action.IsDivUsed)
param |= (int)StartParam.DiverterStart;
if (action.IsSyncMethod)
param |= (int)StartParam.SynchroMethod;
else
param |= (int)StartParam.StartStopMethod;
return (byte)param;
}
static byte GetStopParams(Action action)
{
int param = 0;
return (byte)param;
}
}
public enum Command : byte
{
RequestData = 0,
Start = 1,
Stop = 2,
GetDiverterTransitionData = 4,
GetScopeAnalyzerData = 7,
ResetScopeAnalyzer = 8,
GetSwitchCounterData = 9,
}
public enum StartParam : byte
{
EtalonMask = 0x07,
DiverterStart = 0x08,
SynchroMethod = 0x10,
DirectGateStart = 0x20, /// ???
StartStopMethod = 0x40,
CalibrationMode = 0x80,
}
public enum StopDevs : byte
{
None = 0,
Reference = 0x01, /// bit 0
Diverter = 0x02, /// bit 1
GatePulse = 0x08, /// bit 3
TimeMeasurement = 0x10, /// bit 4
BypassDevCoupled2Div = 0x20, /// bit 5
RegValveRegulation = 0x80, /// bit 7
All = 0xFF,
}
public enum TestMethods
{
Diverter = 0x01, /// bit 0: 1=Mass method (diverters are used), 0=Volume method
FixedStart = 0x02, /// bit 1: 1=fixed start method, 0=flying start method
Synchro = 0x04, /// bit 2: 1=Synchro method, 0=Pulse counting
MassAndContinue = 0x10, /// bit 4: 1=Method with mass measurement followed by a volume method
}
public enum ValveChgFlag : byte
{
DoNotChange = 0,
Change = 1,
SendPressureMeterAddresses = 2,
}
public enum RegValveMode : byte
{
None = 0,
PulseWidth = 1, /// Pulse width 0.05 .. 2 sec.
TargetPosition = 2, /// Low and high position (=DAC value) limits (0..100%) are specified
TargetFrequency = 3, /// Low and high frequency limits (0..2000Hz,0..2200Hz) are specified
Stop = 4, /// Stop regulation
}
public enum RegValveState : byte
{
Idle = 0,
PwOrFreqRegul = 2,
DacValueRegul = 3,
}
}

View File

@ -15,16 +15,18 @@ using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.ControlBoard.Uni
{
public class CBoard : ComponentBase, IControlBoard, SchematicDrawing.IDrawingItCmpntWithMeasuredVal
public class UniCB : ComponentBase, IControlBoard, SchematicDrawing.IDrawingItCmpntWithMeasuredVal
{
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
public override string ToString() { return string.Format("CBoard({0})", cBoardCfg != null ? cBoardCfg.ToString(1) : string.Empty); }
private static readonly ILog log = LogManager.GetLogger(typeof(UniCB));
public override string ToString() { return string.Format("CBoard({0})", cbCfg != null ? cbCfg.ToString(1) : string.Empty); }
/// TBF component configuration
readonly CBoardCfg cBoardCfg;
/// TBF component configuration and useful wrappers
readonly UniCBCfg cbCfg;
string comPort { get { return string.Format("COM{0}", cbCfg.ComPortNr); } }
short config { get { return (short)((cbCfg.DrainValvesCount << 8) + ((cbCfg.DivertersCount - 1) << 3) + cbCfg.RegValvesCount - 4); } }
/// IDrawingItCmpnt interface implementation
public SchematicDrawing.IDrawingItem DrawingItem { get { return cBoardCfg as SchematicDrawing.IDrawingItem; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return cbCfg as SchematicDrawing.IDrawingItem; } }
public double MeasuredVal { get { return 0.1; } }
@ -65,10 +67,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
}
}
/// Wrappers
int comPortNr { get { return cBoardCfg.ComPortNr; } }
int virtValvesRngLo { get { return cBoardCfg.VirtValvesRangeLo; } }
int virtValvesRngHi { get { return cBoardCfg.VirtValvesRangeHi; } }
/// Uni CB state
UInt32 currentOutputs;
bool outputsInitialized;
DateTime lastOutputsChange;
int lastStateMachineTime = 0;
/// Propagated from configurations of other components
@ -85,7 +88,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
int rcvdBytesCount; /// Count of valid bytes in rcvdData buffer
/// Message queue
Queue<IOutputMessage> msgQueue;
Queue<Action> scheduledActionQueue;
/// Received data
public GeneralData Data;
@ -143,7 +146,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// Constructor for user interfaces (change settings only).
/// Initialize(), RunDeviceXY() and StopDevice() methods of the created object will not be called.
/// </summary>
public CBoard()
public UniCB()
{
devices = new OutputPath(string.Empty, 0);
}
@ -151,7 +154,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// <summary>
/// Constructor invoked when starting the test bench and creating components.
/// </summary>
public CBoard(Generic.IComponentCfg cfg)
public UniCB(Generic.IComponentCfg cfg)
: base(cfg)
{
#if DEBUG
@ -163,10 +166,10 @@ namespace TBF.BenchControl.ControlBoard.Uni
Debug.WriteLine(string.Format("{0} ... {1}", e, ((int)e)));
}
#endif
cBoardCfg = cfg as CBoardCfg;
cbCfg = cfg as UniCBCfg;
devices = new OutputPath(string.Empty, 0);
msgQueue = new Queue<IOutputMessage>();
scheduledActionQueue = new Queue<Action>();
Data = new GeneralData();
divTransitionData = null;
@ -182,7 +185,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
routeMask = 0;
for (int i = 0; i < 128; i++)
{
if (i < cBoardCfg.VirtValvesRangeLo || i > cBoardCfg.VirtValvesRangeHi)
if (i < cbCfg.VirtValvesRangeLo || i > cbCfg.VirtValvesRangeHi)
{
routeMask = routeMask | ((UInt128)1 << i);
}
@ -221,13 +224,13 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// </summary>
public void Initialize()
{
if (cBoardCfg.DebugLevel != DebugMode.Normal)
if (cbCfg.DebugLevel != DebugMode.Normal)
{
log.FatalFormat("{0} - Device simulated", Name);
return;
}
serialPort = new SerialPort(string.Format("COM{0}", comPortNr), 9600, Parity.None, 8, StopBits.One);
serialPort = new SerialPort(comPort, 9600, Parity.None, 8, StopBits.One);
serialPort.DtrEnable = true;
serialPort.WriteTimeout = 4000;
serialPort.ParityReplace = 0xFF;
@ -241,7 +244,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// </summary>
public void RunDeviceBefore()
{
if (cBoardCfg.DebugLevel != DebugMode.Normal || serialPort == null || !serialPort.IsOpen) return;
if (cbCfg.DebugLevel != DebugMode.Normal || serialPort == null || !serialPort.IsOpen) return;
/// Read new received bytes and append them to a buffer
int bytesCount = serialPort.BytesToRead;
@ -330,8 +333,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// </summary>
public void RunDeviceAfter()
{
if (cBoardCfg.DebugLevel != DebugMode.Normal) return;
if (cbCfg.DebugLevel != DebugMode.Normal) return;
/// Make sure the serial port is open
if (serialPort == null || !serialPort.IsOpen)
{
/// Serial port is closed or does not exist => re-open the serial port
@ -339,7 +343,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
{
if (serialPort == null)
{
serialPort = new SerialPort(string.Format("COM{0}", comPortNr), 9600, Parity.None, 8, StopBits.One);
serialPort = new SerialPort(comPort, 9600, Parity.None, 8, StopBits.One);
}
serialPort.DtrEnable = true;
serialPort.WriteTimeout = 4000;
@ -353,18 +357,20 @@ namespace TBF.BenchControl.ControlBoard.Uni
}
}
IOutputMessage message = (msgQueue.Count > 0) ? msgQueue.Dequeue() : OutputMessage.CreateDataRequestMsg();
if (Data.Vystupy != (ulong)(benchModelRoute & 0xFFFFFFFFFFUL) || !outputsInitialized || (StateMachine.Time - lastStateMachineTime) >= 3)
{
scheduledActionQueue.Enqueue(Action.ChangeRoute((ulong)(benchModelRoute & 0xFFFFFFFFFFUL)));
}
byte[] outData = message.GetMessage();
var combinedAction = Action.FetchNonConflictingActions(scheduledActionQueue);
byte[] outData = OutputMessage.GetMessage(combinedAction, config);
if (outData != null && outData.Length > 0)
{
serialPort.Write(outData, 0, outData.Length);
string s1 = message.ToString();
string s2 = Telegram.LogTelegram("Message ", outData);
Debug.WriteLine(s1);
Debug.WriteLine(s2);
log.Debug(s1);
log.Debug(s2);
string s = Telegram.LogTelegram("Sent: ", outData);
Debug.WriteLine(s);
log.Debug(s);
}
ProcessData.UpdateMeasuredValuesAndSetpoints();
@ -388,11 +394,35 @@ namespace TBF.BenchControl.ControlBoard.Uni
///
/// Interface functions
///
public void UpdateUI(string sParam, int iParam, double value) { }
public void ClearProcessValues() { }
public double TestTimeWM(int wmNr1) { return 0; }
public int RefPulsesWM(int wmNr1) { return 0; }
public int PulsesWM(int wmNr1) { return 0; }
public double TestTimeWM(int wmNr1)
{
if (wmNr1 >= 1 && wmNr1 < Data.ImpulseTime.Length)
{
return Data.ImpulseTime[wmNr1];
}
return 0;
}
public int RefPulsesWM(int wmNr1)
{
if (wmNr1 >= 1 && wmNr1 < Data.EtPulses.Length)
{
return Data.EtPulses[wmNr1];
}
return 0;
}
public int PulsesWM(int wmNr1)
{
if (wmNr1 >= 1 && wmNr1 < Data.WMeterPuls.Length)
{
return Data.WMeterPuls[wmNr1];
}
return 0;
}
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<BuiltIn.ValveEx.Valve> extendedValves)
{
UInt128 oldRoute = benchModelRoute;
@ -411,11 +441,13 @@ namespace TBF.BenchControl.ControlBoard.Uni
public IOperation SetFlowOp(double flowLimLo, double flowLimHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
{
//var msg = new OutputMessage(Command.Start, );
// scheduledActionQueue.Enqueue(Action.Stop());
return null;
}
public IOperation StopFlowRegulationOp()
{
//scheduledActionQueue.Enqueue(Action.Stop());
return null;
}
@ -461,9 +493,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// <param name="valveToOpen">Valve to be opened</param>
/// <param name="valveToClose">Valve to be closed</param>
/// <returns>Newly created operation instance reference casted to IOperaton</returns>
public IOperation SetValvesOp(IValve valveToOpen, IValve valveToClose)
public IOperation SetValvesOp(IValve valveOpen, IValve valveClose)
{
return null;
return new BuiltIn.SetValvesOp(this, valveOpen, valveClose);
}
/// <summary>
@ -473,9 +505,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// <param name="valvesToOpen">A list of valves to be opened</param>
/// <param name="valvesToClose">A list of valves to be closed</param>
/// <returns>Newly created operation instance reference casted to IOperaton</returns>
public IOperation SetValvesOp(IList<IValve> valvesToOpen, IList<IValve> valvesToClose)
public IOperation SetValvesOp(IList<IValve> valvesOpen, IList<IValve> valvesClose)
{
return null;
return new BuiltIn.SetValvesOp(this, valvesOpen, valvesClose);
}
/// <summary>
@ -485,7 +517,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// <returns>Created operation</returns>
public IOperation OpenStartValveOp()
{
return null;
return new BuiltIn.SetValvesOp(this, true, devices);
}
/// <summary>
@ -495,21 +527,24 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// <returns>Created operation</returns>
public IOperation CloseStartValveOp()
{
return null;
return new BuiltIn.SetValvesOp(this, false, devices);
}
#endregion
public void DiverterToTank(int divNr1)
{
scheduledActionQueue.Enqueue(Action.SwitchDiverter(divNr1, true));
}
public void DiverterToSink(int divNr1)
{
scheduledActionQueue.Enqueue(Action.SwitchDiverter(divNr1, false));
}
public void ReadDiverterTransition(int divNr1)
{
/// TODO
}
}
}

View File

@ -13,9 +13,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// <summary>
/// Holds backup and security options - serializable configuration.
/// </summary>
public class CBoardCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, IDrawingItemWithMeasuredVal
public class UniCBCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CBoardCfg) })[0];
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(UniCBCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
@ -24,6 +24,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
/// Serialized parameters
///
public int ComPortNr;
public int DivertersCount;
public int DrainValvesCount;
public int RegValvesCount;
public int VirtValvesRangeLo;
public int VirtValvesRangeHi;
@ -51,13 +54,13 @@ namespace TBF.BenchControl.ControlBoard.Uni
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
CBoardCfg()
UniCBCfg()
{
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public CBoardCfg(string name, IComponentFactory factory)
public UniCBCfg(string name, IComponentFactory factory)
: this()
{
Shape = Shape.UniCB;
@ -81,6 +84,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
string[] paramNames = new string[]
{
"Serial port number",
"Diverters count (1..5)",
"Drain valves count (0..8)",
"Regulation valves count (4..8)",
"Virtual valves range LO [bit#]",
"Virtual valves range HI [bit#]",
};
@ -102,8 +108,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
switch (i)
{
case 0: return ComPortNr.ToString();
case 1: return VirtValvesRangeLo.ToString();
case 2: return VirtValvesRangeHi.ToString();
case 1: return DivertersCount.ToString();
case 2: return DrainValvesCount.ToString();
case 3: return RegValvesCount.ToString();
case 4: return VirtValvesRangeLo.ToString();
case 5: return VirtValvesRangeHi.ToString();
default: return string.Empty;
}
}
@ -112,9 +121,12 @@ namespace TBF.BenchControl.ControlBoard.Uni
{
switch (i)
{
case 0: ComPortNr = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 1: VirtValvesRangeLo = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 2: VirtValvesRangeHi = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 0: ComPortNr = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 1: DivertersCount = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 2: DrainValvesCount = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 3: RegValvesCount = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 4: VirtValvesRangeLo = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 5: VirtValvesRangeHi = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
@ -122,18 +134,25 @@ namespace TBF.BenchControl.ControlBoard.Uni
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
int dummy;
int n;
switch (i)
{
case 0:
/// Real number between 800 and 1200 kg/m3 expected
if (int.TryParse(strValue, out dummy) && (dummy >= 1) && (dummy <= 1000)) return true;
if (int.TryParse(strValue, out n) && (n >= 1)) return true;
break;
case 1:
if (int.TryParse(strValue, out n) && (n >= 1) && n <= 5) return true;
break;
case 2:
/// Real number above 0 expected
if (int.TryParse(strValue, out dummy) && (dummy >= 0) && dummy <= 127) return true;
if (int.TryParse(strValue, out n) && (n >= 0) && n <= 8) return true;
break;
case 3:
if (int.TryParse(strValue, out n) && (n >= 4) && n <= 8) return true;
break;
case 4:
case 5:
if (int.TryParse(strValue, out n) && (n >= 0) && n <= 127) return true;
break;
default:
message = "Invalid index";
@ -144,16 +163,19 @@ namespace TBF.BenchControl.ControlBoard.Uni
return false;
}
void CopyContentTo(CBoardCfg prms)
void CopyContentTo(UniCBCfg prms)
{
prms.ComPortNr = this.ComPortNr;
prms.VirtValvesRangeLo = this.VirtValvesRangeLo;
prms.VirtValvesRangeHi = this.VirtValvesRangeHi;
prms.ComPortNr = ComPortNr;
prms.DivertersCount = DivertersCount;
prms.DrainValvesCount = DrainValvesCount;
prms.RegValvesCount = RegValvesCount;
prms.VirtValvesRangeLo = VirtValvesRangeLo;
prms.VirtValvesRangeHi = VirtValvesRangeHi;
}
public Config.Entities.IParamsProvider Clone()
{
var pars = new CBoardCfg();
var pars = new UniCBCfg();
CopyContentTo(pars);
return pars;
}

View File

@ -6,7 +6,7 @@ using System.Diagnostics;
namespace TBF.BenchControl.ControlBoard.Uni
{
class ValveMoveMsg : IOutputMessage
class ValveMoveMsg
{
public int PayloadLen { get { return 38; } }
public byte MessageCode { get { return 0x20; } }

View File

@ -76,7 +76,9 @@ namespace TBF.BenchControl.Modbus.Easytherm
if (easythermCfg.ReservoirNr > 0 && easythermCfg.ReservoirNr <= 3)
{
StateMachine.ControlBoard.UpdateUI("ReservoirTemp", easythermCfg.ReservoirNr, actualTemperature);
// TODO: Reimplement IControlBoard.UpradateUI()
//
// StateMachine.ControlBoard.UpdateUI("ReservoirTemp", easythermCfg.ReservoirNr, actualTemperature);
}
}
}

View File

@ -17,7 +17,7 @@ namespace TBF.BenchControl
Factories.Add(new Ambient.Comet.Factory());
Factories.Add(new Ambient.Greco.Factory());
Factories.Add(new ControlBoard.Papouch.CBoardFactory());
Factories.Add(new ControlBoard.Papouch.Factory());
Factories.Add(new ControlBoard.Uni.Factory());
Factories.Add(new DataContainer.BackupAndSecurityOptions.Factory());
Factories.Add(new DataContainer.BenchInfo.Factory());

View File

@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -27,7 +27,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,8 +25,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -23,8 +23,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);
@ -865,7 +865,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
tstRslt.Buoyancy = buoyancy;
tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
if (cBrd is ControlBoard.Papouch.CBoard)
if (cBrd is ControlBoard.Papouch.PapouchCB)
{
/// Test bench with Papouch control board without reference flow meter
tstRslt.VolumeMaster = volumeCTV; /// [l] volume from the master flow meter

View File

@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -23,8 +23,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);
@ -1027,7 +1027,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
tstRslt.Buoyancy = buoyancy;
tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
if (cBrd is ControlBoard.Papouch.CBoard)
if (cBrd is ControlBoard.Papouch.PapouchCB)
{
/// Test bench with Papouch control board without reference flow meter
tstRslt.VolumeMaster = volumeCTV; /// [l] volume from the master flow meter

View File

@ -24,7 +24,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,8 +25,8 @@ namespace TBF.BenchControl.TestMethods.FlowAdjustment
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -26,8 +26,8 @@ namespace TBF.BenchControl.TestMethods.LeakTest
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -25,8 +25,8 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Papouch.CBoard) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.CBoard))
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);

View File

@ -32,7 +32,7 @@ namespace TBF.BenchControl.Uni.Diverter
readonly DiverterCfg diverterCfg;
public SchematicDrawing.IDrawingItem DrawingItem { get { return diverterCfg as SchematicDrawing.IDrawingItem; } }
readonly CBoard cBoard;
readonly UniCB cBoard;
readonly UInt128 mask; /// derived from bitPosition in the constructor
public int DiverterNr { get { return diverterCfg.DivNr1; } } /// 1-based public diverter number
@ -70,7 +70,7 @@ namespace TBF.BenchControl.Uni.Diverter
{
diverterCfg = cfg as DiverterCfg;
cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as CBoard;
cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
if (cBoard == null) throw new Exception("Cannot find " + Name + " parent");
if (cfg.DebugLevel != Config.Entities.DebugMode.Off)

View File

@ -5,11 +5,11 @@ namespace TBF.BenchControl.Uni.Diverter
{
public class SwitchDiverterOp : IOperation
{
TBF.BenchControl.ControlBoard.Uni.CBoard cBoard;
TBF.BenchControl.ControlBoard.Uni.UniCB cBoard;
bool toTank;
int diverterNr; /// 1 .. 5
public SwitchDiverterOp(TBF.BenchControl.ControlBoard.Uni.CBoard cBoard, bool toTank, int diverterNr)
public SwitchDiverterOp(TBF.BenchControl.ControlBoard.Uni.UniCB cBoard, bool toTank, int diverterNr)
{
this.cBoard = cBoard;
this.toTank = toTank;

View File

@ -19,7 +19,7 @@ namespace TBF.BenchControl.Uni.FlowMeter
readonly FlowMeterCfg flowMeterCfg;
public SchematicDrawing.IDrawingItem DrawingItem { get { return flowMeterCfg as SchematicDrawing.IDrawingItem; } }
readonly CBoard cBoard;
readonly UniCB cBoard;
public double MeasuredVal { get { return 0.345; } }
public string AltString { get { return string.Format("Calibration expires on {0:dd.MM.yyyy}", flowMeterCfg.CalibValidDate); } }
@ -57,7 +57,7 @@ namespace TBF.BenchControl.Uni.FlowMeter
{
flowMeterCfg = cfg as FlowMeterCfg;
cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as CBoard;
cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
if (cBoard == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
log.Warn(this.ToString());

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.Uni.RegValve
IDictionary<double, float> dict;
public IDictionary<double, float> Dict { get { return dict; } }
readonly CBoard cBoard;
readonly UniCB cBoard;
public ValveCategory Category { get { return regValveCfg.Category; } }
public int Idx1 { get { return regValveCfg.Idx1; } } /// 1..7
@ -134,7 +134,7 @@ namespace TBF.BenchControl.Uni.RegValve
{
regValveCfg = cfg as RegValveCfg;
this.cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as CBoard;
this.cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
if (this.cBoard == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
this.dict = new Dictionary<double, float>();

View File

@ -19,7 +19,7 @@ namespace TBF.BenchControl.Uni.RegValve
}
/// Set by the constructor
readonly CBoard cBoard;
readonly UniCB cBoard;
readonly RegValve regV;
readonly int regulValveNr;
readonly IFlowMeter flowMeter;
@ -78,7 +78,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// <param name="timeout">Timeout for the flow setting in [s]</param>
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
public SetFlowOp(CBoard cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
public SetFlowOp(UniCB cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
DoubleBox flowBox, bool reTryCmds, int timeout, bool leaveMeasurementRunning)
{
this.cBoard = cBoard;
@ -113,7 +113,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// Set required water flow - Do not leave the measurement running.
/// Events: FlowSet
/// </summary>
public SetFlowOp(CBoard cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
public SetFlowOp(UniCB cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
DoubleBox flowbox, bool reTryCmds, int timeout)
: this(cBoard, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, reTryCmds, timeout, false)
{
@ -123,7 +123,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// Set required water flow - No timeout.
/// Events: FlowSet
/// </summary>
public SetFlowOp(CBoard cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
public SetFlowOp(UniCB cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
DoubleBox flowbox, bool reTryCmds)
: this(cBoard, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, reTryCmds, int.MaxValue, false)
{

View File

@ -32,7 +32,7 @@ namespace TBF.BenchControl.Uni.RegValve
OpState opState;
/// Set by the constructor
readonly CBoard cBoard;
readonly UniCB cBoard;
readonly RegValve regV;
readonly int regValveNr;
readonly float posLoPct;
@ -54,7 +54,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
/// <param name="timeout">Timeout in sec. for setting the flow</param>
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
public SetRegValvePositionOp(CBoard cBoard, RegValve regValve, float posLoPct, float posHiPct, int timeout)
public SetRegValvePositionOp(UniCB cBoard, RegValve regValve, float posLoPct, float posHiPct, int timeout)
{
this.cBoard = cBoard;
if (this.cBoard == null) throw new ArgumentNullException("ctrlBoard");
@ -75,7 +75,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// Set required water flow - no timeout.
/// Events: FlowSet
/// </summary>
public SetRegValvePositionOp(CBoard cBoard, RegValve regValve, float posLoPct, float posHiPct)
public SetRegValvePositionOp(UniCB cBoard, RegValve regValve, float posLoPct, float posHiPct)
: this(cBoard, regValve, posLoPct, posHiPct, int.MaxValue)
{
}

View File

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

View File

@ -217,23 +217,23 @@
<Compile Include="BenchControl\ControlBoard\Legacy\StopPreviousOp.cs" />
<Compile Include="BenchControl\ControlBoard\Legacy\TestBenchSim.cs" />
<Compile Include="BenchControl\ControlBoard\IControlBoard.cs" />
<Compile Include="BenchControl\ControlBoard\Papouch\CBoard.cs" />
<Compile Include="BenchControl\ControlBoard\Papouch\CBoardCfg.cs" />
<Compile Include="BenchControl\ControlBoard\Papouch\PapouchCB.cs" />
<Compile Include="BenchControl\ControlBoard\Papouch\PapouchCBCfg.cs" />
<Compile Include="BenchControl\ControlBoard\Papouch\CBoardCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\ControlBoard\Papouch\CBoardCfgCtrl.Designer.cs">
<DependentUpon>CBoardCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\ControlBoard\Papouch\CBoardFactory.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\CBoard.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\CBoardCfg.cs" />
<Compile Include="BenchControl\ControlBoard\Papouch\Factory.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\Action.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\UniCB.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\UniCBCfg.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\OutputMessage.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\DivTransitionData.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\Enums.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\ExtremaData.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\Factory.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\IOutputMessage.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\GeneralData.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\ScopeAnalyzerData.cs" />
<Compile Include="BenchControl\ControlBoard\Uni\SwitchCountersData.cs" />

View File

@ -13,17 +13,17 @@ namespace UniControlBoardTest
{
private static readonly ILog log = LogManager.GetLogger(typeof(UniCBTestDlg));
readonly CBoardCfg cBoardCfg;
readonly UniCBCfg cBoardCfg;
Timer timer;
CBoard cBoard;
UniCB cBoard;
bool connected;
public UniCBTestDlg()
{
InitializeComponent();
cBoardCfg = new CBoardCfg("CB", new Factory());
cBoardCfg = new UniCBCfg("CB", new Factory());
/// Display serial port nr. n UI
serialPortTextBox.Text = Program.LocalSettings.SerialPortNr.ToString();
@ -102,7 +102,7 @@ namespace UniControlBoardTest
try
{
cBoardCfg.ComPortNr = comPortNr;
cBoard = new CBoard(cBoardCfg as TBF.BenchControl.Generic.IComponentCfg);
cBoard = new UniCB(cBoardCfg as TBF.BenchControl.Generic.IComponentCfg);
cBoard.Initialize();
PortConnected();
}