Changes done on Fuzhou300 system:

- ControlComDev.SetFMFreq() modifications (array size)
- StatusP and Route logging
- StatusP bit assignments: bit3 -> bit5
- MettlerToledo logging
This commit is contained in:
Milan Hanajik
2014-09-05 22:14:12 +02:00
parent 1d098f7893
commit 74a6800f9e
7 changed files with 64 additions and 5 deletions
@@ -9,6 +9,32 @@ namespace TBF.BenchControl.Elde
Stop = 2, /// Stop the measurement
}
#if FUZHOU300
public enum StatusP : ulong
{
RefFlowMeterMask = 0x7,
TestCompleted = 0x10,
TestInProgress = 0x20,
//DiverterError = 0x20,
MsrmntWithDivrtr = 0x80,
RefPulsesMsrmnt = 0x100,
SynchroMethod = 0x800,
WaterMeterCalib = 0x1000,
EmgcyStopActive = 0x2000,
MsrmntGateActive = 0x4000,
TimeMeasurement = 0x8000,
FrequencyMeasured = 0x80000,
ADCError = 0x80000000,
TimeoutOccured = 0x100000000,
MeretAddresses = 0x200000000,
SampleBuferFull = 0x400000000,
ErrorTempMeter = 0x10000000000,
ErrorPressMeter1 = 0x1000000000000,
ErrorPressMeter2 = 0x2000000000000,
ErrorPressMeter3 = 0x4000000000000,
ErrorPressMeter4 = 0x8000000000000,
}
#else
public enum StatusP : ulong
{
RefFlowMeterMask = 0x7,
@@ -33,6 +59,7 @@ namespace TBF.BenchControl.Elde
ErrorPressMeter3 = 0x4000000000000,
ErrorPressMeter4 = 0x8000000000000,
}
#endif
public enum StopDevs
{
@@ -114,11 +114,26 @@ namespace TBF.BenchControl.Elde
int shortImp;
StopDevs stopDevs;
/// <summary>
/// Sets the power of the selected pump
/// </summary>
/// <param name="index">Pump index 0 .. 5, invalid pump index sets all pumps to 0%</param>
/// <param name="power">Power (0.0f .. 100.0f)</param>
public void SetFMFreq(int index, float power)
{
#if FUZHOU300
if (index == 0) FMFreq = new float[6] { power, 0, 0, 0, 0, 0 };
else if (index == 1) FMFreq = new float[6] { 0, power, 0, 0, 0, 0 };
else if (index == 2) FMFreq = new float[6] { 0, 0, power, 0, 0, 0 };
else if (index == 3) FMFreq = new float[6] { 0, 0, 0, power, 0, 0 };
else if (index == 4) FMFreq = new float[6] { 0, 0, 0, 0, power, 0 };
else if (index == 5) FMFreq = new float[6] { 0, 0, 0, 0, 0, power };
else FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 };
#else
if (index == 0) FMFreq = new float[2] { power, 0 };
else if (index == 1) FMFreq = new float[2] { 0, power };
else FMFreq = new float[2] { 0, 0 };
#endif
}
public void UpdateWeights()
@@ -137,7 +152,7 @@ namespace TBF.BenchControl.Elde
{
if (cfg == null) throw new ArgumentNullException("cfg");
this.controlBoardCfg = cfg;
FMFreq = new float[2] { 0, 0 };
FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6
emergencyStop = false;
previousEmergencyStop = false;
}
@@ -228,15 +228,22 @@ namespace TBF.BenchControl.Elde
// regConst,
// shortImp,
// stopDevs));
log.InfoFormat("SendCommand(Cmd={0}, Ref={1}, 0x{2}, Total={3}, TM={4}, filt={5}, FM=[{6},{7}], Reg={8}, ShrtImp={9}, Stop={10})",
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.ToString("X"),
((route >> 48) & 0xFFFF).ToString("X4"),
((route >> 32) & 0xFFFF).ToString("X4"),
((route >> 16) & 0xFFFF).ToString("X4"),
(route & 0xFFFF).ToString("X4"),
totalRefPulses,
testMethods,
filterConstant,
fmFreq[0],
fmFreq[1],
fmFreq[2],
fmFreq[3],
fmFreq[4],
fmFreq[5],
regConst,
shortImp,
stopDevs);
@@ -55,8 +55,15 @@ namespace TBF.BenchControl.Elde
public Event Run()
{
if (started) return Event.MeasurementStarted;
if (0 != (controlBoard.StatusP & StatusP.TestInProgress))
StatusP statusP = controlBoard.StatusP;
log.DebugFormat("statusP = {0} {1} {2} {3}",
(((ulong)statusP >> 48) & 0xFFFF).ToString("X4"),
(((ulong)statusP >> 32) & 0xFFFF).ToString("X4"),
(((ulong)statusP >> 16) & 0xFFFF).ToString("X4"),
((ulong)statusP & 0xFFFF).ToString("X4"));
if (0 != (statusP & StatusP.TestInProgress))
{
log.Info("Test started");
started = true;
return Event.MeasurementStarted;
}
@@ -50,6 +50,7 @@ namespace TBF.BenchControl.MettlerToledo
{
result.Val = balanceDev.Mass;
done = true;
log.InfoFormat("ReadMassOp.Run() ... mass={0} ... returning Event.BalanceDone", balanceDev.Mass);
balanceDev.GetImmediateMassMeasurement(); /// Start another measurement
return Event.BalanceDone; /// Mass read OK
}
@@ -72,6 +72,8 @@ namespace TBF.BenchControl.MettlerToledo
for (int i = 1; i < totalReadingsCount - 1; i++) calcMass += massReadings[i];
calcMass = (calcMass / (totalReadingsCount - 2));
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", calcMass);
result.Val = calcMass;
return Event.BalanceDone; /// Mass has just been calculated
}
@@ -469,7 +469,7 @@ namespace TBF.BenchControl.Sequences
///
/// Stop the pump at the end of test
///
StateMachine.ControlBoard.SetFMFreq(0, 0); /// Stop FM controlled pumps
StateMachine.ControlBoard.SetFMFreq(-1, 0); /// Stop FM controlled pumps
State.Create("SequenceBase : Test(s) completed -> Stopping the pump")
.AddOperation(checkUiOp)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null)