Changes for Xylem Nanjing, ver. 3.1.1676
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Globalization;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.Generic;
|
||||
@@ -241,7 +242,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// Get the serial number
|
||||
/// </summary>
|
||||
/// <remarks>After a successful SetUnits(kg) mass is still sent in g. MH 15.10.2013</remarks>
|
||||
public void SendSetUnitsCmd(Config.Unit unit)
|
||||
public void SendSetUnitsCmd(Common.Unit unit)
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
@@ -255,23 +256,23 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
stringBuilder.Clear();
|
||||
switch (unit)
|
||||
{
|
||||
case Config.Unit.g:
|
||||
case Common.Unit.g:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U g\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U g\r\n");
|
||||
break;
|
||||
case Config.Unit.t:
|
||||
case Common.Unit.t:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U t\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U t\r\n");
|
||||
break;
|
||||
case Config.Unit.lb:
|
||||
case Common.Unit.lb:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U lb\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U lb\r\n");
|
||||
break;
|
||||
case Config.Unit.oz:
|
||||
case Common.Unit.oz:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U oz\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U oz\r\n");
|
||||
break;
|
||||
case Config.Unit.kg:
|
||||
case Common.Unit.kg:
|
||||
default:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U kg\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U kg\r\n");
|
||||
@@ -378,7 +379,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
CultureInfo.InvariantCulture,
|
||||
out mass))
|
||||
{
|
||||
mass = Config.Units.ConvertFrom(ParseUnit(field[2]), mass);
|
||||
mass = Common.Units.ConvertFrom(ParseUnit(field[2]), mass);
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
@@ -388,7 +389,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
CultureInfo.InvariantCulture,
|
||||
out mass))
|
||||
{
|
||||
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass);
|
||||
mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
@@ -414,7 +415,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
CultureInfo.InvariantCulture,
|
||||
out mass))
|
||||
{
|
||||
mass = Config.Units.ConvertFrom(ParseUnit(field[2]), mass);
|
||||
mass = Common.Units.ConvertFrom(ParseUnit(field[2]), mass);
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
|
||||
}
|
||||
@@ -440,7 +441,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
CultureInfo.InvariantCulture,
|
||||
out mass))
|
||||
{
|
||||
mass = Config.Units.ConvertFrom(ParseUnit(field[2]), mass);
|
||||
mass = Common.Units.ConvertFrom(ParseUnit(field[2]), mass);
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass);
|
||||
}
|
||||
@@ -458,7 +459,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
CultureInfo.InvariantCulture,
|
||||
out mass))
|
||||
{
|
||||
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass);
|
||||
mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass);
|
||||
}
|
||||
@@ -535,7 +536,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
/// <returns>ReadMassAverageOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadStableMassOp(ref DoubleBox mass, int delayBefore, Config.Entities.MassMethod method, int readingsCount, double maxSpread)
|
||||
public IOperation ReadStableMassOp(ref DoubleBox mass, int delayBefore, MassMethod method, int readingsCount, double maxSpread)
|
||||
{
|
||||
return new ReadStableMassOp(this, ref mass, delayBefore, method, readingsCount, maxSpread);
|
||||
}
|
||||
@@ -556,13 +557,13 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
/// <param name="unitStr">String: "kg", "g", "t", "lb" or "oz" expected</param>
|
||||
/// <returns></returns>
|
||||
protected Config.Unit ParseUnit(string unitStr)
|
||||
protected Common.Unit ParseUnit(string unitStr)
|
||||
{
|
||||
if (unitStr == "g") return Config.Unit.g;
|
||||
if (unitStr == "t") return Config.Unit.t;
|
||||
if (unitStr == "lb") return Config.Unit.lb;
|
||||
if (unitStr == "oz") return Config.Unit.oz;
|
||||
return Config.Unit.kg;
|
||||
if (unitStr == "g") return Common.Unit.g;
|
||||
if (unitStr == "t") return Common.Unit.t;
|
||||
if (unitStr == "lb") return Common.Unit.lb;
|
||||
if (unitStr == "oz") return Common.Unit.oz;
|
||||
return Common.Unit.kg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user