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

This commit is contained in:
Milan Hanajik
2019-12-18 13:25:05 +01:00
parent 67a53909f8
commit ebb2950e84
6 changed files with 58 additions and 34 deletions
+34 -17
View File
@@ -213,20 +213,27 @@ namespace TBF.BenchControl.Elde
} }
#endif #endif
if (index >= 0 && index < FMFreq.Length && FMFreq[index] != power) if (index >= 0 && index < FMFreq.Length)
{ {
FMFreq[index] = power; 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}]", string s = string.Format("FMFreq=[{0}{1}{2}{3}{4}{5}]", FMFreq[0].ToString(),
FMFreq[0].ToString(), (FMFreq.Length > 1) ? ("," + FMFreq[1].ToString()) : "",
(FMFreq.Length > 1) ? ("," + FMFreq[1].ToString()) : "", (FMFreq.Length > 2) ? ("," + FMFreq[2].ToString()) : "",
(FMFreq.Length > 2) ? ("," + FMFreq[2].ToString()) : "", (FMFreq.Length > 3) ? ("," + FMFreq[3].ToString()) : "",
(FMFreq.Length > 3) ? ("," + FMFreq[3].ToString()) : "", (FMFreq.Length > 4) ? ("," + FMFreq[4].ToString()) : "",
(FMFreq.Length > 4) ? ("," + FMFreq[4].ToString()) : "", (FMFreq.Length > 5) ? ("," + FMFreq[5].ToString()) : "");
(FMFreq.Length > 5) ? ("," + FMFreq[5].ToString()) : ""); log.Warn(s);
} }
}
else
{
log.ErrorFormat("Wrong FM pump: index = {0}, power = {1}", index, power);
}
} }
@@ -312,7 +319,7 @@ namespace TBF.BenchControl.Elde
#else /// all newer benches #else /// all newer benches
ControlComponent_Torino2015.UserControl1 ctrlBrdComponent, ControlComponent_Torino2015.UserControl1 ctrlBrdComponent,
#endif #endif
UInt128 valvesToInvert, UInt128 valvesToInvert,
double[] tankCapacities) double[] tankCapacities)
{ {
this.valvesToInvert = valvesToInvert; this.valvesToInvert = valvesToInvert;
@@ -442,15 +449,20 @@ namespace TBF.BenchControl.Elde
if (cbCommandQueue.Count > 0) if (cbCommandQueue.Count > 0)
{ {
///
/// There is a command in the queue /// There is a command in the queue
/// ///
controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp); controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask); lastSentRoute = (benchModelRoute & routeMask);
lastSentFilters = uintFilters;
lastSentFMFreq = FMFreq;
lastsentRegConst = regConst; lastsentRegConst = regConst;
lastSentShortImp = shortImp; 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) || else if (((benchModelRoute & routeMask) != lastSentRoute) ||
filtersAreDifferent || filtersAreDifferent ||
@@ -458,15 +470,20 @@ namespace TBF.BenchControl.Elde
(lastsentRegConst != regConst) || (lastsentRegConst != regConst) ||
(lastSentShortImp != shortImp)) (lastSentShortImp != shortImp))
{ {
///
/// Command queue is mepty, but 'route', pump frequency, PID coef., filters or shortImp have changed /// 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); controlCom.SendCommand(new SendCommandArgs(Command.None, 0, 0, 0, 0, 0), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask); lastSentRoute = (benchModelRoute & routeMask);
lastSentFilters = uintFilters;
lastSentFMFreq = FMFreq;
lastsentRegConst = regConst; lastsentRegConst = regConst;
lastSentShortImp = shortImp; 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(); controlCom.RunDeviceAfter();
+1 -1
View File
@@ -69,7 +69,7 @@ namespace TBF.BenchControl.Elde
} }
public float Pressure(int prsNr0) { return ctrlBrdComponent.pressure[prsNr0]; } 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]; } public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)ctrlBrdComponent.rValveStatus[rvNr1 - 1]; }
#if GENESIS || BERLIN || PETERSBURG_200 || DEWA_300 #if GENESIS || BERLIN || PETERSBURG_200 || DEWA_300
public UInt128 RRoute { get { return ((UInt128)ctrlBrdComponent.rRouteH << 64) | (UInt128)ctrlBrdComponent.rRoute; } } public UInt128 RRoute { get { return ((UInt128)ctrlBrdComponent.rRouteH << 64) | (UInt128)ctrlBrdComponent.rRoute; } }
+15 -7
View File
@@ -511,14 +511,14 @@ namespace TBF.BenchControl.Sequences
if (transitionSequence == null) if (transitionSequence == null)
{ {
log.WarnFormat("Transition(null, context={0})", context);
/// ///
/// No transition sequence defined --> Default action /// No transition sequence defined --> Default action
/// ///
if ((context == TransitionContext.AfterTest) || (context == TransitionContext.AfterTestWithOverlap)) 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") State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
@@ -536,8 +536,8 @@ namespace TBF.BenchControl.Sequences
} }
else else
{ {
/// ///
/// Fetch and execute the transition sequence /// Fetch and execute the transition sequence, it is guaranteed (transitionSequence != null)
/// ///
IList<TransitionStep> transitionSteps = new List<TransitionStep>(); IList<TransitionStep> transitionSteps = new List<TransitionStep>();
if (StateMachine.TransitionSteps != null) if (StateMachine.TransitionSteps != null)
@@ -553,7 +553,7 @@ namespace TBF.BenchControl.Sequences
int stepsCount = transitionSteps.Count; 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) foreach (var step in transitionSteps)
{ {
@@ -729,13 +729,17 @@ namespace TBF.BenchControl.Sequences
/// ///
if (context == TransitionContext.Stop || errorFlag || stopFlag) 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 /// On error or when STOP pressed
/// ///
foreach (var fmPump in PumpsWithFM) fmPump.TurnOff(); foreach (var fmPump in PumpsWithFM) fmPump.TurnOff();
if (inPath != null) if (inPath != null)
{ {
///
/// Stop the pump /// Stop the pump
/// ///
State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump") State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump")
@@ -751,6 +755,8 @@ namespace TBF.BenchControl.Sequences
} }
else if (context == TransitionContext.BeforeTest) 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 /// 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)) 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 /// Set route for the next test
State.Create("SequenceBase : AfterTestWithOverlap : Default action") State.Create("SequenceBase : AfterTestWithOverlap : Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
+6 -1
View File
@@ -634,6 +634,7 @@ namespace TBF.BenchControl
else errorMsg = string.Empty; else errorMsg = string.Empty;
if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null)) if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null))
{ {
log.ErrorFormat("GetPaths({0},...) returns false, wrong configuration", test.Name);
return false; return false;
} }
@@ -645,6 +646,7 @@ namespace TBF.BenchControl
#endif #endif
if (heatMetersPathRequired && phmtrs == null) if (heatMetersPathRequired && phmtrs == null)
{ {
log.ErrorFormat("GetPaths({0},...) returns false, missing heat meters sensors", test.Name);
errorMsg = "Cannot load heat meters sensors"; errorMsg = "Cannot load heat meters sensors";
return false; return false;
} }
@@ -658,16 +660,19 @@ namespace TBF.BenchControl
if (isHydroTest && pout.Scale == null) 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); errorMsg = string.Format("No balance specified in path {0}", test.OutputPath);
return false; return false;
} }
if (Program.LocalSettings.RealDensity < 500.0f || Program.LocalSettings.RealDensity > 2000.0f) if (Program.LocalSettings.RealDensity < 500.0f || Program.LocalSettings.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; return false;
} }
log.WarnFormat("GetPaths({0},...) returns true, paths loaded OK, isHydroTest={1}", test.Name, isHydroTest);
errorMsg = string.Empty; errorMsg = string.Empty;
return true; return true;
} }
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.18.1380.0")] [assembly: AssemblyVersion("2.18.1387.0")]
[assembly: AssemblyFileVersion("2.18.1380.0")] [assembly: AssemblyFileVersion("2.18.1387.0")]
-6
View File
@@ -136,12 +136,6 @@
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.