diff --git a/Module.EMeter.ModbusTcp.Tool/Manager/EMeterModbus527Tool.cs b/Module.EMeter.ModbusTcp.Tool/Manager/EMeterModbus527Tool.cs index 8539f5d..102cc7a 100644 --- a/Module.EMeter.ModbusTcp.Tool/Manager/EMeterModbus527Tool.cs +++ b/Module.EMeter.ModbusTcp.Tool/Manager/EMeterModbus527Tool.cs @@ -264,11 +264,11 @@ namespace Module.EMeter.ModbusTcp /// /// 吸收有功电能二次侧 /// - private float _show_energy; + private decimal _show_energy; /// /// 吸收有功电能二次侧 003FH~0040H(吸收有功电能) /// - public float F_ShowEnergy + public decimal F_ShowEnergy { get { @@ -533,8 +533,8 @@ namespace Module.EMeter.ModbusTcp var CT = _client.ByteTransform.TransInt16(operateResult1.Content, 8); //_total_active_power = _client.ByteTransform.TransUInt16(_client.Read("x=3;45", 150).Content, 4); //_total_active_energy = _client.ByteTransform.TransSingle(_client.Read("x=3;45", 150).Content, 56) / 1000f; - var transInt16 = (new decimal(_client.ByteTransform.TransUInt16(operateResult2.Content, 0)) * 65536 + _client.ByteTransform.TransUInt16(operateResult2.Content, 2) / new decimal(1000f)) * new decimal(PT) * new decimal(CT); - _show_energy = (float)transInt16; + var transInt16 = ((new decimal(_client.ByteTransform.TransUInt16(operateResult2.Content, 0)) * 65536 + _client.ByteTransform.TransUInt16(operateResult2.Content, 2) )/ new decimal(1000f)) * new decimal(PT) * new decimal(CT); + _show_energy = transInt16; MEMeterParamResult paramRlt = new MEMeterParamResult() { F_EqmCode = _eqm_code, diff --git a/Module.EMeter.ModbusTcp.Tool/Manager/ElecMeterEqmManger.cs b/Module.EMeter.ModbusTcp.Tool/Manager/ElecMeterEqmManger.cs index b71800d..797cbaf 100644 --- a/Module.EMeter.ModbusTcp.Tool/Manager/ElecMeterEqmManger.cs +++ b/Module.EMeter.ModbusTcp.Tool/Manager/ElecMeterEqmManger.cs @@ -110,6 +110,10 @@ namespace Module.EMeter.ModbusTcp CmnElecMeterBaseInfo.EBC07.Connect(); } Thread.Sleep(100); + if (!CmnElecMeterBaseInfo.EBC08.F_NetConnected) + { + CmnElecMeterBaseInfo.EBC08.Connect(); + } Thread.Sleep(100); @@ -303,18 +307,31 @@ namespace Module.EMeter.ModbusTcp result.Add(CmnElecMeterBaseInfo.EBC03.F_EMeterParamResult); } - + + if (CmnElecMeterBaseInfo.EBC04.F_NetConnected) + { result.Add(CmnElecMeterBaseInfo.EBC04.F_EMeterParamResult); - - + } + + if (CmnElecMeterBaseInfo.EBC05.F_NetConnected) + { result.Add(CmnElecMeterBaseInfo.EBC05.F_EMeterParamResult); + } + if (CmnElecMeterBaseInfo.EBC06.F_NetConnected) + { + result.Add(CmnElecMeterBaseInfo.EBC06.F_EMeterParamResult); + } + if (CmnElecMeterBaseInfo.EBC07.F_NetConnected) + { + result.Add(CmnElecMeterBaseInfo.EBC07.F_EMeterParamResult); + } + if (CmnElecMeterBaseInfo.EBC08.F_NetConnected) + { + result.Add(CmnElecMeterBaseInfo.EBC08.F_EMeterParamResult); + } - result.Add(CmnElecMeterBaseInfo.EBC06.F_EMeterParamResult); - - result.Add(CmnElecMeterBaseInfo.EBC07.F_EMeterParamResult); - - + diff --git a/Module.Humiture.ModBusTcp/Manager/HumiMeterModbusTool.cs b/Module.Humiture.ModBusTcp/Manager/HumiMeterModbusTool.cs index 51b72c3..6e0ab94 100644 --- a/Module.Humiture.ModBusTcp/Manager/HumiMeterModbusTool.cs +++ b/Module.Humiture.ModBusTcp/Manager/HumiMeterModbusTool.cs @@ -426,8 +426,8 @@ namespace Module.HMeter.ModBusTcp if (readResult.IsSuccess) { byte[] byteResult = readResult.Content; - UInt16 tempVal = _client.ByteTransform.TransUInt16(byteResult, 0); - UInt16 humiVal = _client.ByteTransform.TransUInt16(byteResult, 2); + UInt16 humiVal = _client.ByteTransform.TransUInt16(byteResult, 0); + UInt16 tempVal= _client.ByteTransform.TransUInt16(byteResult, 2); MHumiParamResult paramRlt = new MHumiParamResult() { F_TempValue = (float)tempVal/10, diff --git a/Monitor.Models/MEMeterParamResult.cs b/Monitor.Models/MEMeterParamResult.cs index 11f2d22..1929640 100644 --- a/Monitor.Models/MEMeterParamResult.cs +++ b/Monitor.Models/MEMeterParamResult.cs @@ -25,7 +25,7 @@ namespace Monitor.Models /// /// 吸收有功电能二次侧 003FH~0040H /// - public float F_ShowEnergy { get; set; } + public decimal F_ShowEnergy { get; set; } } }