using S7.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RIZO.Model.PLC
{
public class PlcConfig
{
///
/// 工站名称/工位标识符
///
public string StationName { get; set; }
///
/// PLC设备的IP地址
///
public string IpAddress { get; set; }
///
/// S7协议中标识CPU所在的物理机架
///
public short Rack { get; set; } = 0;
///
/// S7协议中标识CPU在机架中的具体插槽
///
public short Slot { get; set; } = 1;
///
/// 数据读取间隔时间(毫秒)
///
public int ReadIntervalMs { get; set; } = 1000;
///
/// 定义要从PLC读取的具体数据点和属性
///
public List DataItems { get; set; } = new();
}
///
/// 定义要从PLC读取的具体数据点和属性
///
public class DataItemConfig
{
///
/// 数据项的逻辑名称/别名 温度
///
public string Name { get; set; }
///
/// 地址 "DB1.DBD0"- DB块1,双字(Double Word),起始字节0
///
public string Address { get; set; }
public S7.Net.DataType DataType { get; set; }
///
/// 含义: S7.Net库中定义的变量数据类型
/// 作用: 告诉库如何解析从PLC读取的原始字节数据
///
public VarType VarType { get; set; }
///
/// 指定数据存储在哪个DB块中
///
public int DB { get; set; }
///
/// 数据在DB块中的起始字节地址
///
public int StartByteAdr { get; set; }
}
}