|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace HybirdFrameworkServices.Plc
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 可读可写区
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class PlcReadAndWritten
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 写编程使能 写 0x5AA5,打开写使能
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(0, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort ProgrammingEnable { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 本机modbus地址
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort Modbus1Addres { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 波特率
|
|
|
|
|
/// <para>0:1200</para>
|
|
|
|
|
/// <para>1:2400</para>
|
|
|
|
|
/// <para>2:4800</para>
|
|
|
|
|
/// <para>3:9600</para>
|
|
|
|
|
/// <para>4:19200</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort BaudRate { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 校验位
|
|
|
|
|
/// <para>0:无</para>
|
|
|
|
|
/// <para>1:奇</para>
|
|
|
|
|
/// <para>2:偶</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort CheckBit { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 秒
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte Seconds { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte Points { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 时
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte When { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 周
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte Weeks { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte Day { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 月
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte Month { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 年
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public byte Years { get; set; }
|
|
|
|
|
public string time
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Years + "-" +
|
|
|
|
|
Month.ToString().PadLeft(2, '0') + "-" +
|
|
|
|
|
Day.ToString().PadLeft(2, '0') + " " +
|
|
|
|
|
When.ToString().PadLeft(2, '0') + ":" +
|
|
|
|
|
Points.ToString().PadLeft(2, '0') + ":" +
|
|
|
|
|
Seconds.ToString().PadLeft(2, '0');
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 本机modbus地址
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort Modbus1Addres2 { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保留
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort Reserve { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电压变比
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort VoltageRatio { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电流变比
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort CurrentRatio { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 秒脉冲/无功电能选择
|
|
|
|
|
/// 0x5A02:秒脉冲输出
|
|
|
|
|
/// 其他:无功电能输出)
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort PulsePerSecond { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电流接线反向
|
|
|
|
|
/// <para>0x00:不反接(默认值) </para>
|
|
|
|
|
/// <para>0x01:反接</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort CurrentReversal { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电表清零
|
|
|
|
|
/// 写 0x0000 清零,其他不清
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Property(2, 2, PropertyReadConstant.Byte)]
|
|
|
|
|
public ushort MeterReset { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|