More logging in MettlerToledo.Standard component
This commit is contained in:
@@ -115,11 +115,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.Warn("ZeroWhenStable() returns without starting zeroing the scale because measurementState == MeasurementState.Busy");
|
||||
log.WarnFormat("{0} - ZeroWhenStable() returns without starting zeroing the scale because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.Info("ZeroWhenStable()");
|
||||
log.InfoFormat("{0} - ZeroWhenStable()", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
@@ -132,11 +132,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.Warn("Taring() returns without starting taring the scale because measurementState == MeasurementState.Busy");
|
||||
log.WarnFormat("{0} - Taring() returns without starting taring the scale because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.Info("Taring()");
|
||||
log.InfoFormat("{0} - Taring()", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
@@ -152,11 +152,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.Warn("GetStableMassMeasurement() returns without starting a measurement because measurementState == MeasurementState.Busy");
|
||||
log.WarnFormat("{0} - GetStableMassMeasurement() returns without starting a measurement because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.Info("GetStableMassMeasurement()");
|
||||
log.InfoFormat("{0} - GetStableMassMeasurement()", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
@@ -172,11 +172,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.Warn("GetImmediateMassMeasurement() returns without starting a measurement because measurementState == MeasurementState.Busy");
|
||||
log.WarnFormat("{0} - GetImmediateMassMeasurement() returns without starting a measurement because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.Info("GetImmediateMassMeasurement()");
|
||||
log.InfoFormat("{0} - GetImmediateMassMeasurement()", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
@@ -203,11 +203,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.Warn("SetUnits() returns without setting the units because measurementState == MeasurementState.Busy");
|
||||
log.WarnFormat("{0} - SetUnits() returns without setting the units because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("SetUnits({0})", unit);
|
||||
log.InfoFormat("{0} - SetUnits({1})", Name, unit);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
@@ -235,14 +235,14 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.Debug("RunDevice()");
|
||||
log.DebugFormat("{0} - RunDevice()", Name);
|
||||
|
||||
if (msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
|
||||
string justReceived = serialPort.ReadExisting();
|
||||
if (justReceived != null && justReceived.Length > 0)
|
||||
{
|
||||
log.Debug("RunDevice() received " + justReceived);
|
||||
log.DebugFormat("{0} - RunDevice() received {1}", Name, justReceived);
|
||||
stringBuilder.Append(justReceived);
|
||||
}
|
||||
|
||||
@@ -276,13 +276,13 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
mass = 0;
|
||||
Masses[balanceNr] = mass;
|
||||
//msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\"", received);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\"", Name, received);
|
||||
return;
|
||||
}
|
||||
else if (fields.Length < 2)
|
||||
{
|
||||
msrmntState = MsrmntState.Failed;
|
||||
log.WarnFormat("Balance response = \"{0}<cr><lf>\", Unexpected error !!!", received);
|
||||
log.WarnFormat("{0} - Balance response = \"{1}<cr><lf>\", Unexpected error !!!", Name, received);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -293,13 +293,13 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
mass = 0;
|
||||
Masses[balanceNr] = mass;
|
||||
//msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\"", received);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\"", Name, received);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
msrmntState = MsrmntState.Failed;
|
||||
log.WarnFormat("Balance response = \"{0}<cr><lf>\", error !!!", received);
|
||||
log.WarnFormat("{0} - Balance response = \"{1}<cr><lf>\", error !!!", Name, received);
|
||||
}
|
||||
}
|
||||
else if (fields[0].Equals("S")) /// Stable mass: field[1] = <mass> field[2] = "kg"
|
||||
@@ -314,19 +314,19 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
if (fields[2].Equals("t")) mass *= 1000.0f;
|
||||
Masses[balanceNr] = mass;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\", Mass = {1}", received, mass);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
else if (fields.Length == 2 && fields[1].Equals("-"))
|
||||
{
|
||||
mass = 0;
|
||||
Masses[balanceNr] = mass;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\", Mass = {1}", received, mass);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
else
|
||||
{
|
||||
msrmntState = MsrmntState.Failed;
|
||||
log.WarnFormat("Balance response = \"{0}<cr><lf>\", Overload or and unexpected error !!!", received);
|
||||
log.WarnFormat("{0} Balance response = \"{1}<cr><lf>\", Overload or and unexpected error !!!", Name, received);
|
||||
bool b = float.TryParse(fields[1], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out mass);
|
||||
|
||||
}
|
||||
@@ -343,19 +343,19 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
if (fields[2].Equals("t")) mass *= 1000.0f;
|
||||
Masses[balanceNr] = mass;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\", Mass = {1}", received, mass);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
else if (fields.Length == 2 && fields[1].Equals("-"))
|
||||
{
|
||||
mass = 0;
|
||||
Masses[balanceNr] = mass;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\", Mass = {1}", received, mass);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
else
|
||||
{
|
||||
msrmntState = MsrmntState.Failed;
|
||||
log.WarnFormat("Balance response = \"{0}<cr><lf>\", Overload or and unexpected error !!!", received);
|
||||
log.WarnFormat("{0} - Balance response = \"{1}<cr><lf>\", Overload or and unexpected error !!!", Name, received);
|
||||
bool b = float.TryParse(fields[1], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out mass);
|
||||
|
||||
}
|
||||
@@ -371,18 +371,18 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
if (fields[2].Equals("g")) mass /= 1000.0f;
|
||||
if (fields[2].Equals("t")) mass *= 1000.0f;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Balance response = \"{0}<cr><lf>\", Tara = {1}", received, mass);
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass);
|
||||
}
|
||||
else
|
||||
{
|
||||
msrmntState = MsrmntState.Failed;
|
||||
log.WarnFormat("Balance response = \"{0}<cr><lf>\", Overload or and unexpected error !!!", received);
|
||||
log.WarnFormat("{0} - Balance response = \"{1}<cr><lf>\", Overload or and unexpected error !!!", Name, received);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msrmntState = MsrmntState.Failed;
|
||||
log.WarnFormat("Balance response = \"{0}<cr><lf>\", Unexpected error !!!", received);
|
||||
log.WarnFormat("{0} - Balance response = \"{1}<cr><lf>\", Unexpected error !!!", Name, received);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user