Invalid configuration checked in StateMachine.GetPaths(...). More logging of mass display.

This commit is contained in:
Milan Hanajik 2015-05-20 16:18:54 +02:00
parent 18ee69f0db
commit ceb3de90bf
3 changed files with 49 additions and 10 deletions

View File

@ -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);
}
///

View File

@ -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;
}

View File

@ -386,8 +386,13 @@ namespace TBF.BenchControl
/// <param name="pmtrs"></param>
/// <returns>true when all four paths are defined (non null)</returns>
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;
}
/// <summary>