diff --git a/Examples/GUIsimple/GUIsimpleForm.cs b/Examples/GUIsimple/GUIsimpleForm.cs index cec8e95..d27a44e 100644 --- a/Examples/GUIsimple/GUIsimpleForm.cs +++ b/Examples/GUIsimple/GUIsimpleForm.cs @@ -298,23 +298,6 @@ private void button1_Click(object sender, EventArgs e) string display = ""; switch (comboBox1.SelectedItem) { - /** - * Serial number - Device identification - Firmware version - Weight step - Scale range - Tare mode - Weight stable - Manual tare value - Maximum capacity - Calibration weight - Zero signal - Nominal signal - Connection - Connection type - Application mode - * **/ case "Serial number": display = _wtxDevice.SerialNumber; @@ -326,7 +309,8 @@ Application mode display = _wtxDevice.FirmwareVersion; break; case "Weight step (DSE)": - display = ((DSEJet)_wtxDevice).WeightStep.ToString() + " " + _wtxDevice.Unit; + if (_wtxDevice.GetType() == typeof(DSEJet)) display = ((DSEJet)_wtxDevice).WeightStep.ToString() + " " + _wtxDevice.Unit; + else display = "Device is not instance of DSE!"; break; case "Scale range": display = _wtxDevice.ScaleRange.ToString(); diff --git a/Hbm.Automation.API/Weighing/DSE/DSEJet.cs b/Hbm.Automation.API/Weighing/DSE/DSEJet.cs index 718b7d4..4998dde 100644 --- a/Hbm.Automation.API/Weighing/DSE/DSEJet.cs +++ b/Hbm.Automation.API/Weighing/DSE/DSEJet.cs @@ -53,8 +53,8 @@ public class DSEJet : BaseWTDevice, IDataScale, IDataDigitalFilter private const int SCALE_COMMAND_CLEAR_PEAK_VALUES = 1801545072; private const int SCALE_COMMAND_ZERO = 1869768058; private const int SCALE_COMMAND_SET_GROSS = 1936683623; - private const int SCALE_COMMAND_STATUS_ONGOING = 1634168417; - private const int SCALE_COMMAND_STATUS_OK = 1801543519; + private const int SCALE_COMMAND_STATUS_ONGOING = 1869049455; + private const int SCALE_COMMAND_STATUS_OK = 1802461023; private const int SCALE_COMMAND_STATUS_ERROR_E1 = 826629983; private const int SCALE_COMMAND_STATUS_ERROR_E2 = 843407199; private const int SCALE_COMMAND_STATUS_ERROR_E3 = 860184415; @@ -828,25 +828,26 @@ public override void RecordWeight() { Connection.WriteInteger(JetBusCommands.STORecordWeight, SCALE_COMMAND_TARE); } - + /// public override void CalculateAdjustment(double scaleZeroLoad_mVV, double scaleCapacity_mVV) { int scalZeroLoad_d; - int scaleCapacity_d; + int scaleCapacity_d; scalZeroLoad_d = (int)(scaleZeroLoad_mVV * CONVERISION_FACTOR_MVV_TO_D); scaleCapacity_d = (int)(scalZeroLoad_d + (scaleCapacity_mVV * CONVERISION_FACTOR_MVV_TO_D)); - - Connection.WriteInteger(JetBusCommands.LDWZeroValue, scalZeroLoad_d); - Connection.WriteInteger(JetBusCommands.LWTNominalValue, Convert.ToInt32(scaleCapacity_d)); + + this.ZeroSignal = Convert.ToInt32(scalZeroLoad_d); + this.NominalSignal = Convert.ToInt32(scaleCapacity_d); + } /// public override bool AdjustZeroSignal() { Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_ZERO); - + while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING) { Thread.Sleep(200); @@ -922,6 +923,8 @@ protected override void ProcessDataUpdateTick(object info) } } + + public FilterTypes FilterType(int i) { //Convert ascending integer into filter type diff --git a/Hbm.Automation.API/Weighing/WTX/WTXJet.cs b/Hbm.Automation.API/Weighing/WTX/WTXJet.cs index 5de9623..7176d80 100644 --- a/Hbm.Automation.API/Weighing/WTX/WTXJet.cs +++ b/Hbm.Automation.API/Weighing/WTX/WTXJet.cs @@ -858,12 +858,14 @@ public override void CalculateAdjustment(double scaleZeroLoad_mVV, double scaleC /// public override bool AdjustZeroSignal() { - Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_ZERO); + Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_ZERO); - while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING) + int com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)); + while ((com != SCALE_COMMAND_STATUS_ONGOING) && (com != SCALE_COMMAND_STATUS_OK)) { - Thread.Sleep(200); - } + Thread.Sleep(10); + com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)); + } while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) == SCALE_COMMAND_STATUS_ONGOING) { Thread.Sleep(200); @@ -882,9 +884,11 @@ public override bool AdjustNominalSignal() { Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_NOMINAL); - while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING) + int com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)); + while ((com != SCALE_COMMAND_STATUS_ONGOING) && (com != SCALE_COMMAND_STATUS_OK)) { - Thread.Sleep(100); + Thread.Sleep(10); + com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)); } while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) == SCALE_COMMAND_STATUS_ONGOING) @@ -906,13 +910,15 @@ public override bool AdjustNominalSignalWithCalibrationWeight(double calibration Connection.WriteInteger(JetBusCommands.CIA461CalibrationWeight, MeasurementUtils.DoubleToDigit(calibrationWeight, ProcessData.Decimals)); Connection.WriteInteger(JetBusCommands.CIA461ScaleCommand, SCALE_COMMAND_CALIBRATE_NOMINAL); - - - while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) != SCALE_COMMAND_STATUS_ONGOING) + + + int com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)); + while ((com != SCALE_COMMAND_STATUS_ONGOING) && (com != SCALE_COMMAND_STATUS_OK)) { - Thread.Sleep(100); + Thread.Sleep(10); + com = Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)); } - + while (Convert.ToInt32(Connection.ReadFromBuffer(JetBusCommands.CIA461ScaleCommandStatus)) == SCALE_COMMAND_STATUS_ONGOING) { Thread.Sleep(100);