118 lines
4.1 KiB
C#
118 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
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 enum StatusP : ulong
|
|
{
|
|
/// byte 0
|
|
FlowmtrNrMask = 0x7, /// bits 0,1,2
|
|
TestInProgress = 0x8, /// bit 3
|
|
TestCompleted = 0x10, /// bit 4
|
|
ReadingCounters = 0x20, /// bit 5
|
|
WaitingForDiverter = 0x40, /// bit 6
|
|
TestWithDiverter = 0x80, /// bit 7
|
|
/// byte 1
|
|
TestWithRefFlowmtr = 0x100, /// bit 8
|
|
DirectionOfDiverer = 0x200, /// bit 9
|
|
SynchroMethod = 0x800, /// bit 11
|
|
WaterMeterCalib = 0x1000, /// bit 12
|
|
EmgcyStopActive = 0x2000, /// bit 13
|
|
GateOn = 0x4000, /// bit 14
|
|
TimeMeasurementEn = 0x8000, /// bit 15
|
|
/// byte 2
|
|
FrequencyMeasured = 0x80000, /// bit 19
|
|
CoaxRegValveBusy = 0x200000, /// bit 21
|
|
/// byte 3
|
|
ADCError = 0x80000000, /// bit 31
|
|
/// byte 4
|
|
TimeoutOccured = 0x100000000, /// bit 32 (after 40s without communication)
|
|
MeretAddresses = 0x200000000, /// bit 33
|
|
ScopeBufferFull = 0x400000000, /// bit 34
|
|
/// byte 5
|
|
/// byte 6
|
|
Flowmtr1Active = 0x1000000000000, /// bit 48
|
|
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,
|
|
}
|
|
}
|