You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
4.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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>01200</para>
/// <para>12400</para>
/// <para>24800</para>
/// <para>39600</para>
/// <para>419200</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; }
}
}