///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using Dirichlet.Numerics;
namespace TBF.BenchControl.Elde
{
interface IControlCom
{
StatusP StatusP { get; }
int EtPulses(int wmNr1);
int EtPulsesK { get; }
int EtPulses2 { get; }
int EtPulses3 { get; }
UInt16 WMeterPulses(int wmNr1);
int WMeterReference(int wmNr0);
uint RegulValveDAC(int rvNr0);
float Pressure(int prsNr0);
float Temperature(int tmpNr0);
RegulValveState RegulValveState(int rvNr1);
UInt128 RRoute { get; }
uint DivTime(int id); /// 50% id=0, 10% id=1, 90% id=2
float TTime { get; }
float ImpulseTime(int WMNr1);
uint FmState { get; }
uint BeginState(int wmNr0);
double ReferenceFreq { get; }
double ReferenceFreqs(int i); /// Frequences for doble/tripple flowmeter
double ReferenceFlow { get; }
float RValvePosition(int rvNr1);
float DivSamples(int time, int divIx0); /// time unit is 2 ms
int ScopeSamples(int i, int j, int k);
ulong DigitalInputs { get; }
float AnalogInput(int adcNr0);
uint AnalogInputRaw(int adcNr0, int bank);
float TotalRefVolume { get; }
float VyslExt(int wmNr0, int what);
void SetWeight(int pos, double mass);
uint[] CyclePar { get; set; }
uint[] WMeterCont { get; }
bool ManualUIAllowed { get; set; }
float ValveOpenCloseTime { get; }
void SetDivLimit(int divNr, uint limLoPct, uint limHiPct);
void SetReservoirTemp(int nr, float temp);
///
/// Sends calibration and configuration data to the control board.
///
/// Regulating valves calib.coefs, ix1 = valve nr. (1..5), ix2 = coef.nr. (0..1), values typ. c0 = 0, c1 = 0.2
/// Meret address, index = 0..1, value typ. 99 and 100
/// COM port number of the control board (typ. 1)
/// Temp.calc.coefs, ix1 = temp.sens.nr. (0..7 ???), ix2 = coef.nr
/// Etalon nominal values
/// Percentages for switching of diverters, ix = diverter nr.(0,1), typ.value 50 (%)
/// TODO
/// TODO
void SendCalibData(uint[,] rvCalib, byte[] meretA, int usedCom, float[,] tempCalib, float[] etCalib, uint[] divEdge, uint[] balanceRange, byte meretProtocol);
///
/// Updates a command that is regularly sent to the control board by SendCommand.
///
/// Arguments, see SendCommandArgs class
/// State of valves, 128-bit word
/// Array with length=8 of filter costants (0..255, 0 = no filtering)
/// Freq.inverter control (not applicable in DT100, Munich)
/// PID coefficient for flow control
/// 0 = default value, 1 = spec. processing of very short pulses
void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
///
/// Control of regulating valves.
///
/// Regulating valve nr. (1..5)
/// ???
/// ???
/// Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.
void ValveMove(int valveNo, RegulValveMode valveMode, float[] valveValue, int stableTime);
void RunDeviceBefore();
void RunDeviceAfter();
}
}