From 74a6800f9e5e13c322cb69e9e9f4fd36e78bf358 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 5 Sep 2014 22:14:12 +0200 Subject: [PATCH] Changes done on Fuzhou300 system: - ControlComDev.SetFMFreq() modifications (array size) - StatusP and Route logging - StatusP bit assignments: bit3 -> bit5 - MettlerToledo logging --- .../BenchControl/Elde/Common.cs | 27 +++++++++++++++++++ .../BenchControl/Elde/ControlBoardDev.cs | 17 +++++++++++- .../BenchControl/Elde/ControlComWrap.cs | 11 ++++++-- .../BenchControl/Elde/StartMeasurementOp.cs | 9 ++++++- .../BenchControl/MettlerToledo/ReadMassOp.cs | 1 + .../MettlerToledo/ReadStableMassOp.cs | 2 ++ .../BenchControl/Sequences/SequenceBase.cs | 2 +- 7 files changed, 64 insertions(+), 5 deletions(-) diff --git a/TestBenchFramework/BenchControl/Elde/Common.cs b/TestBenchFramework/BenchControl/Elde/Common.cs index 899b38bc4..574cb3bee 100644 --- a/TestBenchFramework/BenchControl/Elde/Common.cs +++ b/TestBenchFramework/BenchControl/Elde/Common.cs @@ -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 { diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs index 8e4c2ac8f..9e6df9358 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs @@ -114,11 +114,26 @@ namespace TBF.BenchControl.Elde int shortImp; StopDevs stopDevs; + /// + /// Sets the power of the selected pump + /// + /// Pump index 0 .. 5, invalid pump index sets all pumps to 0% + /// Power (0.0f .. 100.0f) 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; } diff --git a/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs b/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs index 746b7a288..0f595f219 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs @@ -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); diff --git a/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs b/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs index ca6bd7993..117229073 100644 --- a/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs +++ b/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs @@ -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; } diff --git a/TestBenchFramework/BenchControl/MettlerToledo/ReadMassOp.cs b/TestBenchFramework/BenchControl/MettlerToledo/ReadMassOp.cs index 7adb0da44..6967aa50d 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/ReadMassOp.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/ReadMassOp.cs @@ -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 } diff --git a/TestBenchFramework/BenchControl/MettlerToledo/ReadStableMassOp.cs b/TestBenchFramework/BenchControl/MettlerToledo/ReadStableMassOp.cs index ac092c7ae..70c6a6244 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/ReadStableMassOp.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/ReadStableMassOp.cs @@ -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 } diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs index c17a19567..c2953e212 100644 --- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs +++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs @@ -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)