Merge branch 'feature/task/UnionTown-Cordonel-completion-at-the-customer-last-task-11' into feature/task/UnionTown-Cordonel-completion-at-the-customer-milestone
This commit is contained in:
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.9.3146.118")]
|
||||
[assembly: AssemblyFileVersion("3.9.3146.118")]
|
||||
[assembly: AssemblyVersion("3.9.3146.120")]
|
||||
[assembly: AssemblyFileVersion("3.9.3146.120")]
|
||||
|
||||
@@ -79,6 +79,17 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
void StartMeasurement()
|
||||
{
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
log.Warn("ReadStableMassOp ... underload before measurement, zeroing scale");
|
||||
currentReadingsCount = 0;
|
||||
Array.Clear(massReadings, 0, massReadings.Length);
|
||||
Array.Clear(sortedMassReadings, 0, sortedMassReadings.Length);
|
||||
zeroingAfterUnderload = true;
|
||||
scale.SendZeroWhenStableCmd();
|
||||
return;
|
||||
}
|
||||
|
||||
if (method == MassMethod.Scale)
|
||||
scale.SendStableMeasurementCmd();
|
||||
else
|
||||
@@ -95,9 +106,9 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
|
||||
if (delayBefore == 0 && scale.Activity == Activity.Idle)
|
||||
{
|
||||
StartMeasurement();
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
opState = OpState.MassMeasurement;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
StartMeasurement();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,9 +128,9 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
{
|
||||
if (StateMachine.Time >= startTime + delayBefore && scale.Activity == Activity.Idle)
|
||||
{
|
||||
StartMeasurement();
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
opState = OpState.MassMeasurement;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
StartMeasurement();
|
||||
}
|
||||
|
||||
return Event.None;
|
||||
@@ -132,6 +143,29 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
return Event.ScaleDone;
|
||||
}
|
||||
|
||||
// A zero response is not a mass sample. Never fall through to measurement
|
||||
// retries after failed zeroing, or the next mass could look like zero success.
|
||||
if (zeroingAfterUnderload)
|
||||
{
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
// Give stable zeroing its own timeout, independent of the mass method.
|
||||
if (scale.MsrmntTime < 60) return Event.None;
|
||||
log.Error("ReadStableMassOp ... zeroing after underload timed out");
|
||||
scale.MsrmntState = MsrmntState.Failed;
|
||||
return Event.Error;
|
||||
}
|
||||
if (scale.MsrmntState != MsrmntState.Valid)
|
||||
{
|
||||
log.ErrorFormat("ReadStableMassOp ... zeroing after underload failed: {0}", scale.MsrmntState);
|
||||
return Event.Error;
|
||||
}
|
||||
log.Info("ReadStableMassOp ... zeroing after underload completed, restarting measurement");
|
||||
zeroingAfterUnderload = false;
|
||||
StartMeasurement();
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
/// Measurement is in progress - resend command if timeout occurs
|
||||
@@ -141,28 +175,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
log.WarnFormat(
|
||||
"ReadStableMassOp.Run() ... scale underload detected, zeroing scale");
|
||||
|
||||
currentReadingsCount = 0;
|
||||
Array.Clear(massReadings, 0, massReadings.Length);
|
||||
Array.Clear(sortedMassReadings, 0, sortedMassReadings.Length);
|
||||
|
||||
zeroingAfterUnderload = true;
|
||||
scale.SendZeroWhenStableCmd();
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (zeroingAfterUnderload && scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
log.InfoFormat(
|
||||
"ReadStableMassOp.Run() ... scale zeroing after underload completed, restarting measurement");
|
||||
|
||||
zeroingAfterUnderload = false;
|
||||
StartMeasurement();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,17 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
/// </summary>
|
||||
void StartMeasurement()
|
||||
{
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
log.Warn("ReadStableMassOp ... underload before measurement, zeroing scale");
|
||||
currentReadingsCount = 0;
|
||||
Array.Clear(massReadings, 0, massReadings.Length);
|
||||
Array.Clear(sortedMassReadings, 0, sortedMassReadings.Length);
|
||||
opState = OpState.ZeroingAfterUnderload;
|
||||
scale.SendZeroWhenStableCmd();
|
||||
return;
|
||||
}
|
||||
|
||||
if (method == MassMethod.Scale)
|
||||
scale.SendStableMeasurementCmd();
|
||||
else
|
||||
@@ -93,9 +104,9 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
|
||||
if (delayBefore == 0 && scale.Activity == Activity.Idle)
|
||||
{
|
||||
StartMeasurement();
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
opState = OpState.MassMeasurement;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
StartMeasurement();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -115,9 +126,9 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
{
|
||||
if (StateMachine.Time >= startTime + delayBefore && scale.Activity == Activity.Idle)
|
||||
{
|
||||
StartMeasurement();
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
opState = OpState.MassMeasurement;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
StartMeasurement();
|
||||
}
|
||||
|
||||
if (scale.DebugLevel == DebugMode.Simulate)
|
||||
@@ -143,15 +154,35 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
return Event.ScaleDone;
|
||||
}
|
||||
|
||||
// A zero response is not a mass sample. Never fall through to measurement
|
||||
// retries after failed zeroing, or the next mass could look like zero success.
|
||||
if (opState == OpState.ZeroingAfterUnderload)
|
||||
{
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
// Give stable zeroing its own timeout, independent of the mass method.
|
||||
if (scale.MsrmntTime < 60) return Event.None;
|
||||
log.Error("ReadStableMassOp ... zeroing after underload timed out");
|
||||
scale.MsrmntState = MsrmntState.Failed;
|
||||
return Event.Error;
|
||||
}
|
||||
if (scale.MsrmntState != MsrmntState.Valid)
|
||||
{
|
||||
log.ErrorFormat("ReadStableMassOp ... zeroing after underload failed: {0}", scale.MsrmntState);
|
||||
return Event.Error;
|
||||
}
|
||||
log.Info("ReadStableMassOp ... zeroing after underload completed, restarting measurement");
|
||||
opState = OpState.MassMeasurement;
|
||||
StartMeasurement();
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
/// The command is still being processed - resend it after timeout.
|
||||
if (scale.MsrmntTime >= timeout)
|
||||
{
|
||||
if (opState == OpState.ZeroingAfterUnderload)
|
||||
scale.SendZeroWhenStableCmd();
|
||||
else
|
||||
StartMeasurement();
|
||||
StartMeasurement();
|
||||
}
|
||||
|
||||
return Event.None;
|
||||
@@ -159,25 +190,7 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
log.Warn("ReadStableMassOp.Run() ... scale underload detected, zeroing scale");
|
||||
|
||||
currentReadingsCount = 0;
|
||||
Array.Clear(massReadings, 0, massReadings.Length);
|
||||
Array.Clear(sortedMassReadings, 0, sortedMassReadings.Length);
|
||||
|
||||
opState = OpState.ZeroingAfterUnderload;
|
||||
scale.SendZeroWhenStableCmd();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (opState == OpState.ZeroingAfterUnderload && scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
log.Info("ReadStableMassOp.Run() ... scale zeroing completed, restarting mass measurement");
|
||||
|
||||
opState = OpState.MassMeasurement;
|
||||
StartMeasurement();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user