温湿度和电表 获取值 修改

master
sl 6 months ago
parent 78762e5ad7
commit 1578632dbf

@ -264,11 +264,11 @@ namespace Module.EMeter.ModbusTcp
/// <summary>
/// 吸收有功电能二次侧
/// </summary>
private float _show_energy;
private decimal _show_energy;
/// <summary>
/// 吸收有功电能二次侧 003FH0040H(吸收有功电能)
/// </summary>
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,

@ -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);

@ -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,

@ -25,7 +25,7 @@ namespace Monitor.Models
/// <summary>
/// 吸收有功电能二次侧 003FH0040H
/// </summary>
public float F_ShowEnergy { get; set; }
public decimal F_ShowEnergy { get; set; }
}
}

Loading…
Cancel
Save