获取盒子监控点分组和监控点条目
/// <summary>
/// 获取盒子监控点分组和监控点条目
/// </summary>
/// <returns></returns>
public IList<DmonItemDtoV2> GetDmonGroups()
{
var dmonGrps = _fbox.GetDmonGroupDmonsV2(new BoxArgs(boxNo)).Result;
foreach (var grp in dmonGrps)
{
Console.WriteLine(grp.Id); // 监控点分组的Id
Console.WriteLine(grp.Name); // 监控点分组的名称
foreach (var item in grp.Items) // 遍历当前分组grp下所有的监控点条目
{
Console.WriteLine(item.Id); //监控点Id
Console.WriteLine(item.Name); //监控点名称
Console.WriteLine(item.DevAlias); //PLC别名
Console.WriteLine(item.StationNo); //站号
Console.WriteLine(item.IsDeviceChanged);//设备是否被移除(只有在移除时出现该参数,为true)FBox的连接设备変更后会出现该参数
Console.WriteLine(item.TaskState); //条目状态
Console.WriteLine(item.DeadValue); //死值区
Console.WriteLine(item.BitIndex); //按位索引号
Console.WriteLine(item.BitIndexEnabled);//是否启用按位索引号
Console.WriteLine(item.BitStateLabel);//位类型数据标签
Console.WriteLine(item.CharCount); //字符个数
Console.WriteLine(item.DataType); //数据类型
Console.WriteLine(item.Encoding); //编码方式
Console.WriteLine(item.FractionalDigits);//小数位
Console.WriteLine(item.GroupId); //监控点分组
Console.WriteLine(item.GroupName); //监控点名称
Console.WriteLine(item.IntegralDigits);//整数位(目前无作用)
Console.WriteLine(item.IoWidth); //寄存器位宽
Console.WriteLine(item.MainAddress);//主地址
Console.WriteLine(item.Memo); //备注
Console.WriteLine(item.Privilege); //读写模式
Console.WriteLine(item.RegId); //寄存器Id
Console.WriteLine(item.RegName); //寄存器名称
Console.WriteLine(item.StringByteOrder);//字节序
Console.WriteLine(item.SubAddress); //子地址
Console.WriteLine(item.SubIndex); //DB块地址
Console.WriteLine(item.TrafficSaving);//是否开启省流量模式
Console.WriteLine(item.Unit); //单位
Console.WriteLine(item.ValueTransform);//数据运算
}
}
return dmonGrps.SelectMany(x => x.Items).ToArray();//监控点条目集合
}
//在Program,Main函数中调用
class Program
{
static void Main(string[] args)
{
using (var fbox = new FBoxDemo())
{
fbox.Start(); //启动
fbox.StartAllDMonData();//开启FBox所有监控点
fbox.GetDmonGroups();//调用此方法
}
}
}