Changes for Xylem Nanjing, ver. 3.1.1676
This commit is contained in:
@@ -71,7 +71,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
public Common.Unit MsrdUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -93,7 +93,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
Shape = Shape.Scale;
|
||||
Sz = Sz.M;
|
||||
MsrdFormat = "{0:F3}";
|
||||
MsrdUnit = Config.Unit.kg;
|
||||
MsrdUnit = Common.Unit.kg;
|
||||
|
||||
Factory = factory;
|
||||
Name = "WT1";
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
@@ -121,9 +122,9 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
}
|
||||
}
|
||||
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
for (Common.Unit units = 0; units < global::Common.Unit.Count; units++)
|
||||
{
|
||||
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Mass))
|
||||
if (global::Common.Units.IsQuantity(units, Quantity.Mass))
|
||||
{
|
||||
unitsComboBox.Items.Add(units.ToString());
|
||||
}
|
||||
@@ -279,8 +280,8 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
config.MsrdFormat = formatTextBox.Text;
|
||||
config.MsrdUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
config.MsrdUnit = global::Common.Unit.None;
|
||||
for (Common.Unit units = 0; units < global::Common.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.MettlerToledo.Standard
|
||||
@@ -150,7 +150,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
|
||||
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}, Mass = {2}", Name,
|
||||
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
|
||||
@@ -192,7 +192,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out mass))
|
||||
{
|
||||
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass);
|
||||
mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.WarnFormat("{0} - Balance response = {1}, Mass = {2}", Name,
|
||||
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
|
||||
@@ -256,7 +256,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
/// <param name="units"></param>
|
||||
/// <returns>SetUnitsOp instance reference casted to IOperaton</returns>
|
||||
public IOperation SetUnitsOp(Config.Unit units)
|
||||
public IOperation SetUnitsOp(Common.Unit units)
|
||||
{
|
||||
return new SetUnitsOp(this, units);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Globalization;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.MettlerToledo.Standard
|
||||
@@ -117,7 +117,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
|
||||
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}, Mass = {2}", Name,
|
||||
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
|
||||
@@ -126,7 +126,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
|
||||
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}, Mass = {2}", Name,
|
||||
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
|
||||
@@ -165,7 +165,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
|
||||
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}, Mass = {2}", Name,
|
||||
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
|
||||
@@ -219,7 +219,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
/// <param name="units"></param>
|
||||
/// <returns>SetUnitsOp instance reference casted to IOperaton</returns>
|
||||
public IOperation SetUnitsOp(Config.Unit units)
|
||||
public IOperation SetUnitsOp(Common.Unit units)
|
||||
{
|
||||
return new SetUnitsOp(this, units);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -57,7 +58,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
sortedMassReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
timeout = (method == Config.Entities.MassMethod.Scale) ? 60 : 2;
|
||||
timeout = (method == MassMethod.Scale) ? 60 : 2;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@@ -76,7 +77,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
void StartMeasurement()
|
||||
{
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
if (method == MassMethod.Scale)
|
||||
scale.SendStableMeasurementCmd();
|
||||
else
|
||||
scale.SendImmediateMeasurementCmd();
|
||||
@@ -158,7 +159,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
Array.Copy(massReadings, sortedMassReadings, totalReadingsCount);
|
||||
Array.Sort(sortedMassReadings);
|
||||
|
||||
if (method == Config.Entities.MassMethod.Spread)
|
||||
if (method == MassMethod.Spread)
|
||||
{
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
@@ -173,7 +174,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
return Event.ScaleDone; /// Mass has just been calculated
|
||||
}
|
||||
}
|
||||
else if (method == Config.Entities.MassMethod.StdDev)
|
||||
else if (method == MassMethod.StdDev)
|
||||
{
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev scale;
|
||||
Config.Unit units;
|
||||
Common.Unit units;
|
||||
bool activityStarted;
|
||||
|
||||
/// <summary>
|
||||
@@ -24,7 +24,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="result">Reference to the serialNumber</param>
|
||||
public SetUnitsOp(BalanceDev scale, Config.Unit units)
|
||||
public SetUnitsOp(BalanceDev scale, Common.Unit units)
|
||||
{
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
|
||||
Reference in New Issue
Block a user