diff --git a/TBF/BenchControl/Elde/ControlBoardDev.cs b/TBF/BenchControl/Elde/ControlBoardDev.cs index 391fc7fdc..66b0bdce0 100644 --- a/TBF/BenchControl/Elde/ControlBoardDev.cs +++ b/TBF/BenchControl/Elde/ControlBoardDev.cs @@ -214,20 +214,27 @@ namespace TBF.BenchControl.Elde } #endif - if (index >= 0 && index < FMFreq.Length && FMFreq[index] != power) - { - FMFreq[index] = power; + if (index >= 0 && index < FMFreq.Length) + { + if (FMFreq[index] != power) + { + FMFreq[index] = power; - pumpPowerChanged = true; /// Forces sending a command using Command.None + pumpPowerChanged = true; /// Forces sending a command using Command.None - log.DebugFormat("FMFreq=[{0}{1}{2}{3}{4}{5}]", - 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()) : ""); - } + string s = string.Format("FMFreq=[{0}{1}{2}{3}{4}{5}]", 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()) : ""); + log.Warn(s); + } + } + else + { + log.ErrorFormat("Wrong FM pump: index = {0}, power = {1}", index, power); + } } @@ -313,7 +320,7 @@ namespace TBF.BenchControl.Elde #else /// all newer benches ControlComponent_Torino2015.UserControl1 ctrlBrdComponent, #endif - UInt128 valvesToInvert, + UInt128 valvesToInvert, double[] tankCapacities) { this.valvesToInvert = valvesToInvert; @@ -443,15 +450,20 @@ namespace TBF.BenchControl.Elde if (cbCommandQueue.Count > 0) { + /// /// There is a command in the queue /// controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp); lastSentRoute = (benchModelRoute & routeMask); - lastSentFilters = uintFilters; - lastSentFMFreq = FMFreq; lastsentRegConst = regConst; lastSentShortImp = shortImp; + + /// Deep copy of arrays lastSentFilters and lastSentFMFreq + if ((lastSentFilters == null) || (lastSentFilters.Length != uintFilters.Length)) lastSentFilters = new uint[(uintFilters == null) ? 0 : uintFilters.Length]; + for (int i = 0; i < lastSentFilters.Length; i++) lastSentFilters[i] = uintFilters[i]; + if ((lastSentFMFreq == null) || (lastSentFMFreq.Length != FMFreq.Length)) lastSentFMFreq = new float[(FMFreq == null) ? 0 : FMFreq.Length]; + for (int i = 0; i < lastSentFMFreq.Length; i++) lastSentFMFreq[i] = FMFreq[i]; } else if (((benchModelRoute & routeMask) != lastSentRoute) || filtersAreDifferent || @@ -459,15 +471,20 @@ namespace TBF.BenchControl.Elde (lastsentRegConst != regConst) || (lastSentShortImp != shortImp)) { + /// /// Command queue is mepty, but 'route', pump frequency, PID coef., filters or shortImp have changed /// controlCom.SendCommand(new SendCommandArgs(Command.None, 0, 0, 0, 0, 0), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp); lastSentRoute = (benchModelRoute & routeMask); - lastSentFilters = uintFilters; - lastSentFMFreq = FMFreq; lastsentRegConst = regConst; lastSentShortImp = shortImp; + + /// Deep copy of arrays lastSentFilters and lastSentFMFreq + if ((lastSentFilters == null) || (lastSentFilters.Length != uintFilters.Length)) lastSentFilters = new uint[(uintFilters == null) ? 0 : uintFilters.Length]; + for (int i = 0; i < lastSentFilters.Length; i++) lastSentFilters[i] = uintFilters[i]; + if ((lastSentFMFreq == null) || (lastSentFMFreq.Length != FMFreq.Length)) lastSentFMFreq = new float[(FMFreq == null) ? 0 : FMFreq.Length]; + for (int i = 0; i < lastSentFMFreq.Length; i++) lastSentFMFreq[i] = FMFreq[i]; } controlCom.RunDeviceAfter(); diff --git a/TBF/BenchControl/Elde/ControlComWrap.cs b/TBF/BenchControl/Elde/ControlComWrap.cs index 81a6c59c7..87669e64a 100644 --- a/TBF/BenchControl/Elde/ControlComWrap.cs +++ b/TBF/BenchControl/Elde/ControlComWrap.cs @@ -72,7 +72,7 @@ namespace TBF.BenchControl.Elde } public float Pressure(int prsNr0) { return ctrlBrdComponent.pressure[prsNr0]; } - public float Temperature(int tmpNr0) { return ctrlBrdComponent.temperature[tmpNr0]; } + public float Temperature(int tmpNr0) { return (tmpNr0 >= 0 && tmpNr0 < ctrlBrdComponent.temperature.Length) ? ctrlBrdComponent.temperature[tmpNr0] : 0; } public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)ctrlBrdComponent.rValveStatus[rvNr1 - 1]; } #if GENESIS || BERLIN || PETERSBURG_200 || DEWA_300 || ROMA_200 public UInt128 RRoute { get { return ((UInt128)ctrlBrdComponent.rRouteH << 64) | (UInt128)ctrlBrdComponent.rRoute; } } diff --git a/TBF/BenchControl/Sequences/SequenceBase.cs b/TBF/BenchControl/Sequences/SequenceBase.cs index a598f83ec..fd7a8b7c4 100644 --- a/TBF/BenchControl/Sequences/SequenceBase.cs +++ b/TBF/BenchControl/Sequences/SequenceBase.cs @@ -511,14 +511,14 @@ namespace TBF.BenchControl.Sequences if (transitionSequence == null) { - log.WarnFormat("Transition(null, context={0})", context); - /// /// No transition sequence defined --> Default action /// if ((context == TransitionContext.AfterTest) || (context == TransitionContext.AfterTestWithOverlap)) { - if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff(); + log.WarnFormat("Transition(null, context={0}), turning FM pump off and setting valves to defaults", context); + + if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff(); State.Create("SequenceBase : Transition : TestEnd - Default action") .AddOperation(checkUiOp) @@ -536,8 +536,8 @@ namespace TBF.BenchControl.Sequences } else { - /// - /// Fetch and execute the transition sequence + /// + /// Fetch and execute the transition sequence, it is guaranteed (transitionSequence != null) /// IList transitionSteps = new List(); if (StateMachine.TransitionSteps != null) @@ -553,7 +553,7 @@ namespace TBF.BenchControl.Sequences int stepsCount = transitionSteps.Count; - log.WarnFormat("Transition(sequence={0} ({1} steps), context={2})", transitionSequence.Name, stepsCount, context); + log.WarnFormat("Transition(sequence={0} ({1} steps), context={2})", transitionSequence.Name, stepsCount, context); foreach (var step in transitionSteps) { @@ -729,13 +729,17 @@ namespace TBF.BenchControl.Sequences /// if (context == TransitionContext.Stop || errorFlag || stopFlag) { - /// + log.ErrorFormat("Transition({0}, context={1}) errorFlag={2} stopFlag={3} ... stoppng all pumps off", + (transitionSequence != null) ? transitionSequence.Name : "null", context, errorFlag, stopFlag); + + /// /// On error or when STOP pressed /// foreach (var fmPump in PumpsWithFM) fmPump.TurnOff(); if (inPath != null) { + /// /// Stop the pump /// State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump") @@ -751,6 +755,8 @@ namespace TBF.BenchControl.Sequences } else if (context == TransitionContext.BeforeTest) { + log.WarnFormat("Transition(any, context={0}), setting the required route before a test", context); + /// /// Always set route at the beginning of this test /// @@ -773,6 +779,8 @@ namespace TBF.BenchControl.Sequences } else if ((context == TransitionContext.AfterTestWithOverlap) && (nextInPath != null) && (nextBenchPath != null) && (nextOutPath != null)) { + log.WarnFormat("Transition(., context={0}), overlapped action (next flow regulation)", context); + /// Set route for the next test State.Create("SequenceBase : AfterTestWithOverlap : Default action") .AddOperation(checkUiOp) diff --git a/TBF/BenchControl/StateMachine.cs b/TBF/BenchControl/StateMachine.cs index 648645f6e..e0b693598 100644 --- a/TBF/BenchControl/StateMachine.cs +++ b/TBF/BenchControl/StateMachine.cs @@ -633,6 +633,7 @@ namespace TBF.BenchControl else errorMsg = string.Empty; if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null)) { + log.ErrorFormat("GetPaths({0},...) returns false, wrong configuration", test.Name); return false; } @@ -644,6 +645,7 @@ namespace TBF.BenchControl #endif if (heatMetersPathRequired && phmtrs == null) { + log.ErrorFormat("GetPaths({0},...) returns false, missing heat meters sensors", test.Name); errorMsg = "Cannot load heat meters sensors"; return false; } @@ -657,16 +659,19 @@ namespace TBF.BenchControl if (isHydroTest && pout.Scale == null) { + log.ErrorFormat("GetPaths({0},...) returns false, missing scales in output path {1}", test.Name, test.OutputPath); errorMsg = string.Format("No balance specified in path {0}", test.OutputPath); return false; } if (Config.Formulas.RealDensity() < 500.0f || Config.Formulas.RealDensity() > 2000.0f) { - errorMsg = string.Format("Density was not specified"); + log.ErrorFormat("GetPaths({0},...) returns false, density was not specified", test.Name); + errorMsg = string.Format("Density was not specified"); return false; } + log.WarnFormat("GetPaths({0},...) returns true, paths loaded OK, isHydroTest={1}", test.Name, isHydroTest); errorMsg = string.Empty; return true; } diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 2b2104d8e..329376728 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.24.1382.0")] -[assembly: AssemblyFileVersion("2.24.1382.0")] +[assembly: AssemblyVersion("2.24.1386.0")] +[assembly: AssemblyFileVersion("2.24.1386.0")] diff --git a/TracingDB/TracingDB.csproj b/TracingDB/TracingDB.csproj index 956000bf2..28f7b64da 100644 --- a/TracingDB/TracingDB.csproj +++ b/TracingDB/TracingDB.csproj @@ -136,12 +136,6 @@ - - - {67BD7A8F-0FED-4FDE-B875-78D5A2BC9B2C} - RecordProcessing - -