(1) Bug fix in sending FM pump frequencies to control board, (2) More logging, ver. 2.24.1386

This commit is contained in:
Milan Hanajik 2019-12-17 08:25:06 +01:00
parent 296198550a
commit b4763441a8
6 changed files with 58 additions and 34 deletions

View File

@ -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();

View File

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

View File

@ -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<TransitionStep> transitionSteps = new List<TransitionStep>();
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)

View File

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

View File

@ -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")]

View File

@ -136,12 +136,6 @@
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RecordProcessing\RecordProcessing.csproj">
<Project>{67BD7A8F-0FED-4FDE-B875-78D5A2BC9B2C}</Project>
<Name>RecordProcessing</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.