93 lines
2.9 KiB
C#
93 lines
2.9 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
|
|
FlowmtrIdMask = 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
|
|
}
|
|
|
|
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 StopParam : byte
|
|
{
|
|
StopEtalon = 1,
|
|
StopDiverter = 2,
|
|
StopDirectGate = 8,
|
|
StopTimer = 16,
|
|
StartStopMethod = 32,
|
|
}
|
|
|
|
public enum ValveChgFlag : byte
|
|
{
|
|
DoNotChange = 0,
|
|
Change = 1,
|
|
SendPressureMeterAddresses = 2,
|
|
}
|
|
|
|
public enum RegValveMode : byte
|
|
{
|
|
Mode0 = 0,
|
|
Mode1 = 1,
|
|
Mode2 = 2,
|
|
}
|
|
}
|