using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XP.Hardware.PLC.Configs
{
///
/// PLC 类型枚举 | PLC Type Enumeration
///
public enum PlcType
{
///
/// S7-200Smart 系列 | S7-200Smart series
///
S200Smart,
///
/// S7-300 系列 | S7-300 series
///
S300,
///
/// S7-400 系列 | S7-400 series
///
S400,
///
/// S7-1200 系列 | S7-1200 series
///
S1200,
///
/// S7-1500 系列 | S7-1500 series
///
S1500
}
public class PlcConfig
{
// 连接配置
public string IpAddress { get; set; } = "127.0.0.1";
public int Port { get; set; } = 502;
public short Rack { get; set; } = 0;
public short Slot { get; set; } = 1;
///
/// PLC 型号类型 | PLC model type
///
public PlcType PlcType { get; set; } = PlcType.S1200;
// 读取配置 | Read configuration
public string ReadDbBlock { get; set; } = "DB1";
public int ReadStartAddress { get; set; } = 0;
public int ReadLength { get; set; } = 100; // 字节长度
///
/// 批量读取周期(ms)| Bulk read interval (ms)
///
public int BulkReadIntervalMs { get; set; } = 100;
// 超时与重试
public int ConnectTimeoutMs { get; set; } = 3000;
public int ReadTimeoutMs { get; set; } = 3000;
public int WriteTimeoutMs { get; set; } = 3000;
public bool bReConnect { get; set; } = false;
}
}