2026-01-25 09:45:38 +08:00

77 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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