iPerlST component dated 160304, ver.2.4.255.

This commit is contained in:
Milan Hanajik 2016-04-04 09:23:07 +02:00
parent 45c6c10755
commit 2a3f76c3dc
11 changed files with 115 additions and 92 deletions

View File

@ -73,29 +73,30 @@ namespace TBF.BenchControl.Elde
public enum StopDevs
{
None = 0,
Reference = 0x01,
Diverter = 0x02,
GatePulse = 0x08,
TimeMeasurement = 0x10,
BypassDevCoupled2Div = 0x20,
RegValveRegulation = 0x80,
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, /// 0x01 = Mass method (diverters are used), 0 = Volume method
FixedStart = 0x02,
Synchro = 0x04, /// 0x02 = Synchro method, 0 = Pulse counting
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 = 0x08, /// bit 3: 1=Method with mass measurement followed by a volume method
}
public enum RegulValveMode : 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
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 RegulValveState

View File

@ -60,7 +60,7 @@ namespace TBF.BenchControl.Elde
public ulong DigitalInputs { get { return controlCom.DigitalInputs; } }
public float AnalogInput(int adcNr0) { return controlCom.AnalogInput(adcNr0); }
public uint AnalogInputRaw(int adcNr0, int bank) { return controlCom.AnalogInputRaw(adcNr0, bank); } /// adcNr0: 0=RV1, 1=RV2,... bank: 0=RV, 1=Temp
public float ReferenceVolume { get { return controlCom.ReferenceVolume; } }
public float ReferenceVolume { get { return controlCom.TotalRefVolume; } }
public float VyslExt(int wmNr0, int what) { return controlCom.VyslExt(wmNr0, what); }
/// <summary> Extracted from the StatusP in RunDeviceBefore </summary>
@ -139,8 +139,9 @@ namespace TBF.BenchControl.Elde
Command cmd;
int refNr;
ulong route;
int refPulses;
TestMethods testMethods;
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
float filterConstant;
float[] FMFreq;
int regConst;
@ -308,8 +309,9 @@ namespace TBF.BenchControl.Elde
/// SendCommand() arguments to clear the emergency stop state
sendCommandFlag = true;
this.refNr = 0;
this.refPulses = 0;
this.cmd = Command.Stop;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.cmd = Command.Stop;
this.testMethods = 0;
this.stopDevs = StopDevs.All;
}
@ -319,8 +321,9 @@ namespace TBF.BenchControl.Elde
sendCommandFlag = true;
this.cmd = Command.Start;
this.refNr = flowmeterNr4DiverterTest;
this.refPulses = int.MaxValue;
this.testMethods = TestMethods.Diverter;
this.totalRefPulses = int.MaxValue;
this.massRefPulses = int.MaxValue;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleDiverterToTank = false;
}
@ -330,8 +333,9 @@ namespace TBF.BenchControl.Elde
sendCommandFlag = true;
this.cmd = Command.Stop;
this.refNr = flowmeterNr4DiverterTest;
this.refPulses = 0;
this.testMethods = TestMethods.Diverter;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = StopDevs.Diverter;
scheduleDiverterToSink = false;
}
@ -341,8 +345,9 @@ namespace TBF.BenchControl.Elde
sendCommandFlag = true;
this.cmd = Command.ReadDivTransition;
this.refNr = flowmeterNr4DiverterTest;
this.refPulses = 0;
this.testMethods = TestMethods.Diverter;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleReadDiverterTransition = false;
}
@ -359,8 +364,9 @@ namespace TBF.BenchControl.Elde
sendCommandFlag = false;
this.cmd = Command.None;
this.refNr = 0;
this.refPulses = 0;
this.testMethods = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = 0;
this.stopDevs = 0;
}
this.filterConstant = 0;
@ -373,7 +379,8 @@ namespace TBF.BenchControl.Elde
{
if (sendCommandFlag)
{
controlCom.SendCommand(cmd, refNr, (route & routeMask), refPulses, testMethods,
controlCom.SendCommand(cmd, refNr, (route & routeMask),
totalRefPulses, massRefPulses, testMethods,
filterConstant, FMFreq, regConst, shortImp, stopDevs);
}
@ -406,14 +413,16 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, ulong route, int totalRefPulses, TestMethods testMethods,
public void SendCommand(Command cmd, int refFlowmtrNr, ulong route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, int regConst, int shortImp, StopDevs stopDevs)
{
this.cmd = cmd;
this.refNr = refFlowmtrNr;
this.route = route;
this.refPulses = totalRefPulses;
this.testMethods = testMethods;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.filterConstant = filterConstant;
this.regConst = regConst;
this.shortImp = shortImp;

View File

@ -66,7 +66,7 @@ namespace TBF.BenchControl.Elde
public ulong DigitalInputs { get { return 0; } }
public float AnalogInput(int adcNr0) { return 0; }
public uint AnalogInputRaw(int adcNr0, int bank) { return 0; } /// bank0=RV, bank1=Temp
public float ReferenceVolume { get { return 0; } }
public float TotalRefVolume { get { return 0; } }
public float VyslExt(int wmNr0, int what) { return 0; }
public void SetWeight(int pos, float mass) { return; } /// not available in sim. mode
@ -89,6 +89,7 @@ namespace TBF.BenchControl.Elde
ulong route;
public ulong Route { get { return route; } }
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
float filterConstant;
float[] FMFreq;
@ -147,28 +148,24 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, ulong route, int totalRefPulses, TestMethods testMethods,
public void SendCommand(Command cmd, int refFlowmtrNr, ulong route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
{
log.InfoFormat("SendCommand(cmd={0}, ref={1}, route={2} {3} {4} {5}, pulses={6}, TM={7}, filt={8}, pumpFM=[{9}{10}{11}{12}{13}{14}], reg={15}, shrtImp={16}, stop={17})",
cmd,
refFlowmtrNr,
((route >> 48) & 0xFFFF).ToString("X4"),
((route >> 32) & 0xFFFF).ToString("X4"),
((route >> 16) & 0xFFFF).ToString("X4"),
(route & 0xFFFF).ToString("X4"),
totalRefPulses,
testMethods,
filterConstant,
fmFreq[0].ToString(),
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "",
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "",
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "",
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "",
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "",
regConst,
shortImp,
stopDevs);
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
cmd, refFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstant, /// 6, 7, 8, 9
fmFreq[0].ToString(), /// 10
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 13
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 14
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 15
regConst, shortImp, stopDevs); /// 16, 17, 18
///
/// Simulation
///
@ -191,6 +188,7 @@ namespace TBF.BenchControl.Elde
TestBenchSim.RouteSim = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.filterConstant = filterConstant;
this.FMFreq = fmFreq;

View File

@ -54,7 +54,13 @@ namespace TBF.BenchControl.Elde
public ulong DigitalInputs { get { return (ulong)ctrlBrdComponent.Vstupy; } }
public float AnalogInput(int adcNr0) { return ctrlBrdComponent.Analogy[adcNr0]; }
public uint AnalogInputRaw(int adcNr0, int bank) { return ctrlBrdComponent.AnalogyRaw[adcNr0, bank]; } /// bank0=RV, bank1=Temp
public float ReferenceVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
#if IPERLST
public float TotalRefVolume { get { return ctrlBrdComponent.ReferenceVolume[0]; } }
public float MassRefVolume { get { return ctrlBrdComponent.ReferenceVolume[1]; } }
#else
public float TotalRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
public float MassRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
#endif
public float VyslExt(int wmNr0, int what) { return ctrlBrdComponent.VyslExt[wmNr0, what]; }
public void SetWeight(int pos, float mass)
{
@ -211,28 +217,31 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control the regulation valve (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowMeterNr, ulong route, int totalRefPulses, TestMethods testMethods,
public void SendCommand(Command cmd, int refFlowMeterNr, ulong route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
{
if (Program.MainWnd.InvokeRequired)
{
/// When SendCommand(...) called from the worker thread
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, testMethods,
filterConstant, fmFreq, regConst, shortImp, stopDevs };
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses,
testMethods, filterConstant, fmFreq, regConst, shortImp, stopDevs };
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, args); /// Component was created in UI thread - use Invoke()
}
else
{
/// When SendCommand(...) called from the UI thread
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, testMethods,
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
filterConstant, fmFreq, regConst, shortImp, stopDevs);
}
}
///
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, ulong route, int totalRefPulses, TestMethods testMethods,
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, ulong route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
///
private void DoSendCommand(Command cmd, int refFlowMeterNr, ulong route, int totalRefPulses, TestMethods testMethods,
private void DoSendCommand(Command cmd, int refFlowMeterNr, ulong route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
{
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCommand({1}, {2}, {3}, {4}, {5}, {6}, [{7},{8}], {9}, {10}, {11})\r\n",
@ -260,29 +269,28 @@ namespace TBF.BenchControl.Elde
if (bit39) route = route | 0x0000008000000000;
log.DebugFormat("SendCommand route = {0}", Utils.ShowRoute(route));
#endif
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
cmd, refFlowMeterNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstant, /// 6, 7, 8, 9
fmFreq[0].ToString(), /// 10
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 13
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 14
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 15
regConst, shortImp, stopDevs); /// 16, 17, 18
log.InfoFormat("SendCommand(Cmd={0}, Ref={1}, rt={2} {3} {4} {5}, Total={6}, TM={7}, filt={8}, FM=[{9}{10}{11}{12}{13}{14}], Reg={15}, ShrtImp={16}, Stop={17})",
cmd,
refFlowMeterNr,
((route >> 48) & 0xFFFF).ToString("X4"),
((route >> 32) & 0xFFFF).ToString("X4"),
((route >> 16) & 0xFFFF).ToString("X4"),
(route & 0xFFFF).ToString("X4"),
totalRefPulses,
testMethods,
filterConstant,
fmFreq[0].ToString(),
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "",
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "",
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "",
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "",
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "",
regConst,
shortImp,
stopDevs);
#if (DN100 || MUNICH)
#if DN100 || MUNICH
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
filterConstant, fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
#elif IPERLST
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
filterConstant, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
#else
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
filterConstant, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.Elde
ulong DigitalInputs { get; }
float AnalogInput(int adcNr0);
uint AnalogInputRaw(int adcNr0, int bank);
float ReferenceVolume { get; }
float TotalRefVolume { get; }
float VyslExt(int wmNr0, int what);
void SetWeight(int pos, float mass);
@ -49,14 +49,15 @@ namespace TBF.BenchControl.Elde
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="refPulses">kolko impulzov ma trvat skuska</param>
/// <param name="totalRefPulses">Kolko impulzov ma trvat skuska</param>
/// <param name="massRefPulses">Pri 'MassAndContinue' metode kolko impulzov ma trvat mass measurement</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
void SendCommand(Command cmd, int refNr, ulong route, int refPulses, TestMethods testMethods,
void SendCommand(Command cmd, int refNr, ulong route, int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
/// <summary>

View File

@ -194,7 +194,8 @@ namespace TBF.BenchControl.Elde.RegulValve
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route, int.MaxValue, tm,
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm,
0.0f, (int)pidCoef, 0, sd);
}
@ -239,7 +240,8 @@ namespace TBF.BenchControl.Elde.RegulValve
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route, int.MaxValue, tm,
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm,
0.0f, (int)pidCoef, 0, sd);
return Event.None;
}
@ -441,7 +443,8 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, tm,
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route,
50000, 50000, tm,
0.0f, 20, 0, sd);
}
}

View File

@ -198,7 +198,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route, int.MaxValue, tm,
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm,
0.0f, (int)pidCoef, 0, sd);
}
@ -347,7 +348,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, tm,
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route,
50000, 50000, tm,
0.0f, 20, 0, sd);
}
}

View File

@ -103,7 +103,8 @@ namespace TBF.BenchControl.Elde
int flowMeterIdxAndDiv = flowMeterNr;
#endif
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route, refPulses, testMethod,
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
refPulses, refPulses, testMethod,
filterConstant, 20, 0, StopDevs.None);
opState = OpState.StartingTest;

View File

@ -47,7 +47,7 @@ namespace TBF.BenchControl.Elde
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, /// ref. pulses
0, 0, /// ref. pulses
TestMethods.Diverter,
0.0f,
20,
@ -79,7 +79,7 @@ namespace TBF.BenchControl.Elde
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, /// ref. pulses
0, 0, /// ref. pulses
TestMethods.Diverter,
0.0f,
20,
@ -99,7 +99,7 @@ namespace TBF.BenchControl.Elde
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, /// ref. pulses
0, 0, /// ref. pulses
TestMethods.Diverter,
0.0f,
20,

View File

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