diff --git a/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs b/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs index 37fbf918f..680efc7df 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs @@ -62,7 +62,11 @@ namespace TBF.BenchControl.Elde public uint AnalogInputRaw(int adcNr0, int bank) { return ctrlBrdComponent.AnalogyRaw[adcNr0, bank]; } /// bank0=RV, bank1=Temp public float ReferenceVolume { get { return ctrlBrdComponent.ReferenceVolume; } } public float VyslExt(int wmNr0, int what) { return ctrlBrdComponent.VyslExt[wmNr0, what]; } - public void SetWeight(int pos, float mass) { ctrlBrdComponent.Weight[pos] = mass; } + public void SetWeight(int pos, float mass) + { + ctrlBrdComponent.Weight[pos] = mass; + log.DebugFormat("ControlComWrap . . . . . Weight[{0}] = {1}", pos, mass); + } /// diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 9fb02828f..b02b452a0 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -252,11 +252,13 @@ namespace TBF.BenchControl.Sequences /// Try to fetch all test paths and transitions /// to detect configuration errors as early as possible. + string errorMsg; if (!StateMachine.GetPaths(test, out inPath, out benchPath, out outPath, out sensPath, - out transitionStart, out transitionStop)) + out transitionStart, out transitionStop, + out errorMsg)) { - UiBridge.Bridge.OnError(this, string.Format("Cannot load paths")); + UiBridge.Bridge.OnError(this, errorMsg); goto select_cycle_or_test; } } @@ -265,11 +267,13 @@ namespace TBF.BenchControl.Sequences foreach (var test in StateMachine.Tests) { /// Fetch the test paths and transitions + string errorMsg; if (!StateMachine.GetPaths(test, out inPath, out benchPath, out outPath, out sensPath, - out transitionStart, out transitionStop)) + out transitionStart, out transitionStop, + out errorMsg)) { - UiBridge.Bridge.OnError(this, string.Format("Cannot load paths")); + UiBridge.Bridge.OnError(this, errorMsg); goto select_cycle_or_test; } @@ -304,13 +308,20 @@ namespace TBF.BenchControl.Sequences else { Entities.Test test = StateMachine.GetTest(selection); + if (test == null) + { + UiBridge.Bridge.OnError(this, string.Format("No test specified")); + goto select_cycle_or_test; + } /// Fetch the test paths and transitions + string errorMsg; if (!StateMachine.GetPaths(test, out inPath, out benchPath, out outPath, out sensPath, - out transitionStart, out transitionStop)) + out transitionStart, out transitionStop, + out errorMsg)) { - UiBridge.Bridge.OnError(this, string.Format("Cannot load paths")); + UiBridge.Bridge.OnError(this, errorMsg); goto select_cycle_or_test; } diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index 6d4b55f1f..06cf73313 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -386,8 +386,13 @@ namespace TBF.BenchControl /// /// true when all four paths are defined (non null) public static bool GetPaths(Entities.Test test, - out FeedingPath pfeed, out BenchPath pben, out OutputPath pout, out MetersPath pmtrs, - out Entities.TransitionSequence transitionStart, out Entities.TransitionSequence transitionEnd) + out FeedingPath pfeed, + out BenchPath pben, + out OutputPath pout, + out MetersPath pmtrs, + out Entities.TransitionSequence transitionStart, + out Entities.TransitionSequence transitionEnd, + out string errorMsg) { pfeed = null; pben = null; @@ -434,7 +439,26 @@ namespace TBF.BenchControl if (transition.Name == test.TransitionEnd) transitionEnd = transition; } - return (pfeed != null) && (pben != null) && (pout != null) && (pmtrs != null); + if ((pfeed == null) || (pben == null) || (pout == null) || (pmtrs == null)) + { + errorMsg = "Cannot load paths"; + return false; + } + + if (pout.Balance == null) + { + errorMsg = string.Format("No balance specified in path {0}", test.OutputPath); + return false; + } + + if (Program.LocalSettings.RealDensity < 500.0f || Program.LocalSettings.RealDensity > 2000.0f) + { + errorMsg = string.Format("Density was not specified"); + return false; + } + + errorMsg = string.Empty; + return true; } ///