SwitchDiverterOp, Diverter sequence conditions, ver. 2.16.647
This commit is contained in:
parent
df42ec3d3a
commit
7ed21ff08c
@ -6,10 +6,11 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter
|
||||
public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter, GenericDevices.ISequenceCondition
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Diverter));
|
||||
public override string ToString() { return string.Format("Diverter({0})", Cfg.ToString(1)); }
|
||||
@ -28,15 +29,19 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public static int[] DivStartingLevelPct;
|
||||
public static int[] DivStoppingLevelPct;
|
||||
|
||||
protected int diverterNr; /// 0-based diverter number
|
||||
protected int diverterNr; /// 0-based diverter number
|
||||
|
||||
|
||||
|
||||
readonly DiverterCfg diverterCfg;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly UInt128 mask; /// derived from bitPosition in the constructor
|
||||
readonly UInt128 mask; /// derived from bitPosition in the constructor
|
||||
public int AdcNr { get { return diverterCfg.AdcNr; } }
|
||||
|
||||
readonly IOperation diverterToTankOp;
|
||||
readonly IOperation diverterToSinkOp;
|
||||
|
||||
|
||||
public bool State
|
||||
{
|
||||
get { return (controlBoard.Route & mask) != 0; }
|
||||
@ -98,6 +103,9 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
}
|
||||
|
||||
diverterToTankOp = new SwitchDiverterOp(controlBoard, true, Name.Contains("1") ? 1 : 3);
|
||||
diverterToSinkOp = new SwitchDiverterOp(controlBoard, false, Name.Contains("1") ? 1 : 3);
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
@ -115,6 +123,25 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public void StopDevice() { }
|
||||
|
||||
|
||||
///
|
||||
/// ISequenceCondition interface implementation
|
||||
///
|
||||
public int ConditionsCount { get { return 2; } }
|
||||
|
||||
/// Returned strings are added to the combo-box
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
if (i == 0) return string.Format("{0} {1}", Name, Strings.Start);
|
||||
else return string.Format("{0} {1}", Name, Strings.End);
|
||||
}
|
||||
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
if (i == 0) return diverterToTankOp;
|
||||
else return diverterToSinkOp;
|
||||
}
|
||||
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnCfgChange(object sender, CfgChangeArgs args)
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
public class SwitchDiverterOp : IOperation
|
||||
{
|
||||
ControlBoardDev controlBoard;
|
||||
bool start;
|
||||
int flowMtrNr;
|
||||
|
||||
public SwitchDiverterOp(ControlBoardDev controlBoard, bool start, int flowMtrNr)
|
||||
{
|
||||
this.controlBoard = controlBoard;
|
||||
this.start = start;
|
||||
this.flowMtrNr = flowMtrNr;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
controlBoard.DiverterToTank(flowMtrNr);
|
||||
}
|
||||
else
|
||||
{
|
||||
controlBoard.DiverterToSink(flowMtrNr);
|
||||
}
|
||||
}
|
||||
|
||||
public Event Run()
|
||||
{
|
||||
return Event.ConditionMet;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,18 +23,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
public enum CommErr
|
||||
{
|
||||
None = 0,
|
||||
CommFailed,
|
||||
OpenPort,
|
||||
Read,
|
||||
Write,
|
||||
ReadAfterWrite,
|
||||
CmdActive,
|
||||
CmdTest,
|
||||
Verify,
|
||||
WrongIPerlType,
|
||||
CalibFactorOoRange,
|
||||
MissingTest,
|
||||
RFPowerRecordMissing,
|
||||
CommFailed, /// 1
|
||||
OpenPort, /// 2
|
||||
Read, /// 3
|
||||
Write, /// 4
|
||||
ReadAfterWrite, /// 5
|
||||
CmdActive, /// 6
|
||||
CmdTest, /// 7
|
||||
Verify, /// 8
|
||||
WrongIPerlType, /// 9
|
||||
CalibFactorOoRange, /// A
|
||||
MissingTest, /// B
|
||||
RFPowerRecordMissing, /// C
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.16.646.1")]
|
||||
[assembly: AssemblyFileVersion("2.16.646.1")]
|
||||
[assembly: AssemblyVersion("2.16.647.1")]
|
||||
[assembly: AssemblyFileVersion("2.16.647.1")]
|
||||
|
||||
@ -456,6 +456,7 @@
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Elde\CoverTest\Factory.cs" />
|
||||
<Compile Include="BenchControl\Elde\Diverter\Handlers.cs" />
|
||||
<Compile Include="BenchControl\Elde\Diverter\SwitchDiverterOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeter.cs" />
|
||||
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterCfg.cs" />
|
||||
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterCfgCtrl.cs">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user