|
|
|
@ -23,20 +23,21 @@ namespace VOL.Data.Services.modbus
|
|
|
|
|
// 生产数据
|
|
|
|
|
Dictionary<string, object> map1 = new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线
|
|
|
|
|
{ "run_time", modbus.readData(1, 6435, "int16") }, // 运行时长 分钟
|
|
|
|
|
{ "turnout_1", modbus.readData(1, 6436, "int16") }, // 工单1产量 件
|
|
|
|
|
{ "turnout_2", modbus.readData(1, 6437, "int16") }, // 工单2产量 件
|
|
|
|
|
{ "turnout_3", modbus.readData(1, 6438, "int16") }, // 工单3产量 件
|
|
|
|
|
{ "turnout_all", modbus.readData(1, 6439, "int16") }, // 当班产量 件
|
|
|
|
|
{ "config_id", 1},
|
|
|
|
|
{ "com_status",modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线
|
|
|
|
|
{ "run_time", (int)modbus.readData(1, 6435, "int16") }, // 运行时长 分钟
|
|
|
|
|
{ "turnout_1",(int)modbus.readData(1, 6436, "int16") }, // 工单1产量 件
|
|
|
|
|
{ "turnout_2", (int)modbus.readData(1, 6437, "int16") }, // 工单2产量 件
|
|
|
|
|
{ "turnout_3", (int)modbus.readData(1, 6438, "int16") }, // 工单3产量 件
|
|
|
|
|
{ "turnout_all", (int)modbus.readData(1, 6439, "int16") }, // 当班产量 件
|
|
|
|
|
{ "status", modbus.readData(1, 6440, "int16") }, // 运行状态 0:待机 1:运行 2:故障
|
|
|
|
|
{ "schedule_1", modbus.readData(1, 1315, "single") }, // 工单1任务进度 %
|
|
|
|
|
{ "schedule_2", modbus.readData(1, 1317, "single") }, // 工单2任务进度 %
|
|
|
|
|
{ "schedule_3", modbus.readData(1, 1319, "single") }, // 工单3任务进度 %
|
|
|
|
|
{ "yield_1", modbus.readData(1, 1321, "single") }, // 工单1良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_2", modbus.readData(1, 1323, "single") }, // 工单2良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_3", modbus.readData(1, 1325, "single") }, // 工单3良品率 % 真实值 *= 100
|
|
|
|
|
{ "oee", modbus.readData(1, 1339, "single") }, // 设备综合效率 % 真实值 *= 100
|
|
|
|
|
{ "schedule_1", (decimal)modbus.readData(1, 1315, "single") }, // 工单1任务进度 %
|
|
|
|
|
{ "schedule_2",(decimal) modbus.readData(1, 1317, "single") }, // 工单2任务进度 %
|
|
|
|
|
{ "schedule_3", (decimal)modbus.readData(1, 1319, "single") }, // 工单3任务进度 %
|
|
|
|
|
{ "yield_1", (decimal)modbus.readData(1, 1321, "single") }, // 工单1良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_2", (decimal)modbus.readData(1, 1323, "single") }, // 工单2良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_3", (decimal)modbus.readData(1, 1325, "single") }, // 工单3良品率 % 真实值 *= 100
|
|
|
|
|
{ "oee", (decimal)modbus.readData(1, 1339, "single") }, // 设备综合效率 % 真实值 *= 100
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 机床数据
|
|
|
|
@ -44,17 +45,18 @@ namespace VOL.Data.Services.modbus
|
|
|
|
|
{
|
|
|
|
|
// 操作模式 0:JOG 1:AUTO 2:AUTO + TEACHIN 3:JOG + REPOIN 4:JOG + REPOS
|
|
|
|
|
// 5:MDA 6:MDA + REPOS 7:MDA + REPOS + TEAHIN8:MDA + TEACHIN
|
|
|
|
|
{ "config_id", 1},
|
|
|
|
|
{ "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线
|
|
|
|
|
{ "smode", modbus.readData(1, 6099, "int16") },
|
|
|
|
|
{ "state", modbus.readData(1, 6429, "int16") }, // 运行状态 0:待机 1:故障 2:运行 3:暂停
|
|
|
|
|
{ "temperature", modbus.readData(1, 1201, "single")}, // 电机温度 ℃
|
|
|
|
|
{ "potential", modbus.readData(1, 1203, "single")}, // 母线电压 V
|
|
|
|
|
{ "current", modbus.readData(1, 1205, "single")}, // 实际电流 A
|
|
|
|
|
{ "quantity", modbus.readData(1, 1215, "single")}, // 加工数 次
|
|
|
|
|
{ "cut_rate", modbus.readData(1, 1225, "single")}, // 切削倍率
|
|
|
|
|
{ "main_rate", modbus.readData(1, 1231, "single")}, // 主轴倍率
|
|
|
|
|
{ "temperature", (decimal)modbus.readData(1, 1201, "single")}, // 电机温度 ℃
|
|
|
|
|
{ "potential", (decimal)modbus.readData(1, 1203, "single")}, // 母线电压 V
|
|
|
|
|
{ "current", (decimal)modbus.readData(1, 1205, "single")}, // 实际电流 A
|
|
|
|
|
{ "quantity", (long)modbus.readData(1, 1215, "single")}, // 加工数 次
|
|
|
|
|
{ "cut_rate", (decimal)modbus.readData(1, 1225, "single")}, // 切削倍率
|
|
|
|
|
{ "main_rate", (decimal)modbus.readData(1, 1231, "single")}, // 主轴倍率
|
|
|
|
|
{ "run_program_no", modbus.readData(1, 6689, "string", 26)}, // 加工程序号 length = 52
|
|
|
|
|
{ "run_time_total", modbus.readData(1, 6435, "int16")}, // 累计运行时长 分钟
|
|
|
|
|
{ "run_time_total", (long)modbus.readData(1, 6435, "int16")}, // 累计运行时长 分钟
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 组装Map返回
|
|
|
|
@ -70,37 +72,39 @@ namespace VOL.Data.Services.modbus
|
|
|
|
|
// 生产数据
|
|
|
|
|
Dictionary<string, object> map1 = new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ "program_no", modbus.readData(1, 6429, "int16") }, // 程序编号
|
|
|
|
|
{ "config_id", 2}, // 枚举todo
|
|
|
|
|
{ "program_no", (int)modbus.readData(1, 6429, "int16") }, // 程序编号
|
|
|
|
|
{ "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线
|
|
|
|
|
{ "run_time", modbus.readData(1, 6435, "int16") }, // 运行时长 分钟
|
|
|
|
|
{ "turnout_1", modbus.readData(1, 6436, "int16") }, // 工单1产量 件
|
|
|
|
|
{ "turnout_2", modbus.readData(1, 6437, "int16") }, // 工单2产量 件
|
|
|
|
|
{ "turnout_3", modbus.readData(1, 6438, "int16") }, // 工单3产量 件
|
|
|
|
|
{ "turnout_all", modbus.readData(1, 6439, "int16") }, // 当班产量 件
|
|
|
|
|
{ "status", modbus.readData(1, 6435, "int16") }, // 运行状态 0:待机 1:运行 2:故障
|
|
|
|
|
{ "schedule_1", modbus.readData(1, 1315, "single") }, // 工单1任务进度 %
|
|
|
|
|
{ "schedule_2", modbus.readData(1, 1317, "single") }, // 工单2任务进度 %
|
|
|
|
|
{ "schedule_3", modbus.readData(1, 1319, "single") }, // 工单3任务进度 %
|
|
|
|
|
{ "yield_1", modbus.readData(1, 1321, "single") }, // 工单1良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_2", modbus.readData(1, 1323, "single") }, // 工单2良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_3", modbus.readData(1, 1325, "single") }, // 工单3良品率 % 真实值 *= 100
|
|
|
|
|
{ "oee", modbus.readData(1, 1331, "single") }, // 设备综合效率 % 真实值 *= 100
|
|
|
|
|
{ "run_time", (int)modbus.readData(1, 6435, "int16") }, // 运行时长 分钟
|
|
|
|
|
{ "turnout_1", (int)modbus.readData(1, 6436, "int16") }, // 工单1产量 件
|
|
|
|
|
{ "turnout_2", (int)modbus.readData(1, 6437, "int16") }, // 工单2产量 件
|
|
|
|
|
{ "turnout_3", (int)modbus.readData(1, 6438, "int16") }, // 工单3产量 件
|
|
|
|
|
{ "turnout_all",(int)modbus.readData(1, 6439, "int16") }, // 当班产量 件
|
|
|
|
|
{ "status", modbus.readData(1, 6440, "int16") }, // 运行状态 0:待机 1:运行 2:故障
|
|
|
|
|
{ "schedule_1", (decimal)modbus.readData(1, 1315, "single") }, // 工单1任务进度 %
|
|
|
|
|
{ "schedule_2", (decimal)modbus.readData(1, 1317, "single") }, // 工单2任务进度 %
|
|
|
|
|
{ "schedule_3", (decimal)modbus.readData(1, 1319, "single") }, // 工单3任务进度 %
|
|
|
|
|
{ "yield_1", (decimal)modbus.readData(1, 1321, "single") }, // 工单1良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_2", (decimal)modbus.readData(1, 1323, "single") }, // 工单2良品率 % 真实值 *= 100
|
|
|
|
|
{ "yield_3", (decimal)modbus.readData(1, 1325, "single") }, // 工单3良品率 % 真实值 *= 100
|
|
|
|
|
{ "oee", (decimal)modbus.readData(1, 1331, "single") }, // 设备综合效率 % 真实值 *= 100
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 机床数据
|
|
|
|
|
Dictionary<string, object> map2 = new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ "config_id", 2},
|
|
|
|
|
{ "com_status", modbus.readData(1, 6430, "int16") }, // 通讯状态 5:通讯正常 15:通讯断线
|
|
|
|
|
{ "gmode", modbus.readData(1, 6099, "int16") }, // 工作方式 0:编辑 1:自动 2:MDI 3:DNC 4:手动 5:手轮 6:回参考点
|
|
|
|
|
{ "state", modbus.readData(1, 6099, "int16") }, // 运行状态 0:复位 1:停止 2:运行 3:暂停
|
|
|
|
|
{ "quantity", modbus.readData(1, 1199, "int32")}, // 加工数量 次
|
|
|
|
|
{ "on_time", modbus.readData(1, 1201, "int32")}, // 开机时间 秒
|
|
|
|
|
{ "run_time", modbus.readData(1, 1203, "int32")}, // 运行时间 秒
|
|
|
|
|
{ "feed_rate", modbus.readData(1, 1241, "single")}, // 进给倍率
|
|
|
|
|
{ "main_rate", modbus.readData(1, 1247, "single")}, // 主轴倍率
|
|
|
|
|
{ "state", modbus.readData(1, 6100, "int16") }, // 运行状态 0:复位 1:停止 2:运行 3:暂停
|
|
|
|
|
{ "quantity", (long)modbus.readData(1, 1199, "int32")}, // 加工数量 次
|
|
|
|
|
{ "on_time", (long)modbus.readData(1, 1201, "int32")}, // 开机时间 秒
|
|
|
|
|
{ "run_time", (long)modbus.readData(1, 1203, "int32")}, // 运行时间 秒
|
|
|
|
|
{ "feed_rate", (decimal)modbus.readData(1, 1242, "single")}, // 进给倍率
|
|
|
|
|
{ "main_rate", (decimal)modbus.readData(1, 1248, "single")}, // 主轴倍率
|
|
|
|
|
{ "run_program_no", modbus.readData(1, 6299, "string", 4)}, // 运行程序编号 length = 8
|
|
|
|
|
{ "run_time_total", modbus.readData(1, 4115, "int32")}, // 累计运行时长 分钟
|
|
|
|
|
{ "quantity_total", modbus.readData(1, 4117, "int32")} // 累计加工数 次
|
|
|
|
|
{ "run_time_total", (long)modbus.readData(1, 4115, "int32")}, // 累计运行时长 分钟
|
|
|
|
|
{ "quantity_total", (long)modbus.readData(1, 4117, "int32")} // 累计加工数 次
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 组装Map返回
|
|
|
|
@ -121,18 +125,18 @@ namespace VOL.Data.Services.modbus
|
|
|
|
|
{ "gmode", machine.gmode ?? 1 },
|
|
|
|
|
{ "smode", machine.smode ?? 1 },
|
|
|
|
|
{ "run_program_no", machine.run_program_no ?? "12345"},
|
|
|
|
|
{ "state", machine.state ?? 2 },
|
|
|
|
|
{ "temperature", machine.temperature ?? 33M },
|
|
|
|
|
{ "potential", machine.potential ?? 220M},
|
|
|
|
|
{ "current", machine.current ?? 36M},
|
|
|
|
|
{ "quantity", machine.current ?? 1008},
|
|
|
|
|
{ "on_time", machine.on_time ?? 1694683609},
|
|
|
|
|
{ "run_time", machine.run_time ?? 1694683629},
|
|
|
|
|
{ "feed_rate",machine.cut_rate ?? 62.00M},
|
|
|
|
|
{ "cut_rate", machine.cut_rate ?? 68.00M},
|
|
|
|
|
{ "main_rate", machine.cut_rate ?? 65.00M},
|
|
|
|
|
{ "run_time_total", machine.run_time_total ?? 10080},
|
|
|
|
|
{ "quantity_total", machine.quantity_total ?? 10086}
|
|
|
|
|
{ "state", machine.state ?? 0 },
|
|
|
|
|
{ "temperature", machine.temperature ?? 0M },
|
|
|
|
|
{ "potential", machine.potential ?? 0M},
|
|
|
|
|
{ "current", machine.current ?? 0M},
|
|
|
|
|
{ "quantity", machine.quantity ?? 0},
|
|
|
|
|
{ "on_time", machine.on_time ?? 0},
|
|
|
|
|
{ "run_time", machine.run_time ?? 0},
|
|
|
|
|
{ "feed_rate",machine.feed_rate ?? 0M},
|
|
|
|
|
{ "cut_rate", machine.cut_rate ?? 0M},
|
|
|
|
|
{ "main_rate", machine.main_rate ?? 0M},
|
|
|
|
|
{ "run_time_total", machine.run_time_total ?? 0},
|
|
|
|
|
{ "quantity_total", machine.quantity_total ?? 0}
|
|
|
|
|
};
|
|
|
|
|
model.MainData = mapData;
|
|
|
|
|
try {
|
|
|
|
@ -162,21 +166,21 @@ namespace VOL.Data.Services.modbus
|
|
|
|
|
Dictionary<string, object> mapData = new()
|
|
|
|
|
{
|
|
|
|
|
{ "config_id", produce.config_id},
|
|
|
|
|
{ "program_no", produce.program_no ?? 56789 },
|
|
|
|
|
{ "program_no", produce.program_no ?? 12345 },
|
|
|
|
|
{ "com_status", produce.com_status ?? 15 },
|
|
|
|
|
{ "run_time", produce.run_time ?? 34695 },
|
|
|
|
|
{ "status", produce.status ?? 1 },
|
|
|
|
|
{ "turnout_all", produce.turnout_all ?? 1640 },
|
|
|
|
|
{ "turnout_1", produce.turnout_1 ?? 450 },
|
|
|
|
|
{ "turnout_2", produce.turnout_2 ?? 630 },
|
|
|
|
|
{ "turnout_3", produce.turnout_3 ?? 560 },
|
|
|
|
|
{ "schedule_1", produce.schedule_1 ?? 0.92M },
|
|
|
|
|
{ "schedule_2", produce.schedule_2 ?? 0.88M },
|
|
|
|
|
{ "schedule_3", produce.schedule_3 ?? 0.78M },
|
|
|
|
|
{ "yield_1", produce.yield_1 ?? 0.97M },
|
|
|
|
|
{ "yield_2", produce.yield_2 ?? 0.88M },
|
|
|
|
|
{ "yield_3", produce.yield_3 ?? 0.92M },
|
|
|
|
|
{ "oee", produce.oee ?? 0.99M }
|
|
|
|
|
{ "run_time", produce.run_time ?? 0 },
|
|
|
|
|
{ "status", produce.status ?? 0 },
|
|
|
|
|
{ "turnout_all", produce.turnout_all ?? 0 },
|
|
|
|
|
{ "turnout_1", produce.turnout_1 ?? 0 },
|
|
|
|
|
{ "turnout_2", produce.turnout_2 ?? 0 },
|
|
|
|
|
{ "turnout_3", produce.turnout_3 ?? 0 },
|
|
|
|
|
{ "schedule_1", produce.schedule_1 ?? 0M },
|
|
|
|
|
{ "schedule_2", produce.schedule_2 ?? 0M },
|
|
|
|
|
{ "schedule_3", produce.schedule_3 ?? 0M },
|
|
|
|
|
{ "yield_1", produce.yield_1 ?? 1M },
|
|
|
|
|
{ "yield_2", produce.yield_2 ?? 0M },
|
|
|
|
|
{ "yield_3", produce.yield_3 ?? 0M },
|
|
|
|
|
{ "oee", produce.oee ?? 0.95M } // 默认95%
|
|
|
|
|
};
|
|
|
|
|
model.MainData = mapData;
|
|
|
|
|
try
|
|
|
|
|