|
|
|
@ -59,8 +59,6 @@ namespace SlnMesnac.Business
|
|
|
|
|
{
|
|
|
|
|
_record_busbar_TempServices = record_busbar_TempServices;
|
|
|
|
|
_appConfig = appConfig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
@ -114,13 +112,13 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
base.InitEquip(1); //判断PLC状态,下发工作模式
|
|
|
|
|
|
|
|
|
|
int address = _plc.readInt16ByAddress("VD2005"); //读取轨道电机当前位置,判断原点及起始位置
|
|
|
|
|
int address = _plc.readInt32ByAddress("VD2005"); //读取轨道电机当前位置,判断原点及起始位置
|
|
|
|
|
|
|
|
|
|
//获取电柜信息
|
|
|
|
|
List<base_cabinet_info> cabinet_Infos = new List<base_cabinet_info>();
|
|
|
|
|
base.GetCabinetInfos(address, out cabinet_Infos);
|
|
|
|
|
|
|
|
|
|
if (!_plc.writeInt16ByAddress("VD1517", 1)) //下发轨道电机启动信号
|
|
|
|
|
if (!_plc.writeInt32ByAddress("VD1517", 1)) //下发轨道电机启动信号
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"启动信号写入PLC失败;VD1517写1");
|
|
|
|
|
}
|
|
|
|
@ -132,7 +130,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
this.SendTrackMotorAddress(item);
|
|
|
|
|
|
|
|
|
|
if (!_plc.writeInt16ByAddress("VD1513", 1)) //母排检测完成下发检测完成信号,升降电机可以回到原位等待
|
|
|
|
|
if (!_plc.writeInt32ByAddress("VD1513", 1)) //母排检测完成下发检测完成信号,升降电机可以回到原位等待
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"下发母排检测完成下发检测完成信号写入失败;VD1513写1");
|
|
|
|
|
}
|
|
|
|
@ -156,7 +154,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
/// <exception cref="ArgumentException"></exception>
|
|
|
|
|
private void SendTrackMotorAddress(base_cabinet_info item)
|
|
|
|
|
{
|
|
|
|
|
if (!_plc.writeInt16ByAddress("VD1521", item.cabinetCode)) //下发电柜编号,通知轨道电机前往指定电柜位置
|
|
|
|
|
if (!_plc.writeInt32ByAddress("VD1521", item.cabinetCode)) //下发电柜编号,通知轨道电机前往指定电柜位置
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"下发轨道电机前往指定位置编号写入失败;VD1521写{item.cabinetCode}");
|
|
|
|
|
}
|
|
|
|
@ -166,6 +164,11 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
this.SendLiftMotorDict(item.cabinetCode);
|
|
|
|
|
|
|
|
|
|
if (!_plc.writeInt32ByAddress("VD1521", 0))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"电柜检测完成轨道电机地址写0失败;VD1521写0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -180,7 +183,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
base.GetBusbarInfos(cabinetCode, out busbar_Infos);
|
|
|
|
|
foreach (var busbar in busbar_Infos)
|
|
|
|
|
{
|
|
|
|
|
if (!_plc.writeDoubleByAddress("VD1525", Convert.ToDouble(busbar.busbarDist))) //下发母排距离,升降电机升降的距离
|
|
|
|
|
if (!_plc.writeFloatByAddress("VD1525", ((float)busbar.busbarDist))) //下发母排距离,升降电机升降的距离
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"下发母排升降距离写入失败;VD1525写{busbar.cabinetCode}");
|
|
|
|
|
}
|
|
|
|
@ -201,21 +204,12 @@ namespace SlnMesnac.Business
|
|
|
|
|
this.SaveBusbarTemp(busbar.busbarCode, busbar.cabinetCode, _realTemperatureInfo,busbar.isPictures);
|
|
|
|
|
Task.Delay(1000).Wait();
|
|
|
|
|
|
|
|
|
|
if (!_plc.writeDoubleByAddress("VD1525", 0))
|
|
|
|
|
if (!_plc.writeFloatByAddress("VD1525", 0))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"母排检测完成向PLC升降距离写0失败;VD1525写0");
|
|
|
|
|
}
|
|
|
|
|
_log.Info($"母排检测完成向PLC升降距离写0成功;VD1525写0");
|
|
|
|
|
|
|
|
|
|
if (busbar.isEnd == 1)
|
|
|
|
|
{
|
|
|
|
|
if(!_plc.writeInt16ByAddress("VD1513", 1))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"最后一层检测完成向PLC写入检测完成信号失败;VD1513写1");
|
|
|
|
|
}
|
|
|
|
|
_log.Info($"最后一层检测完成向PLC写入检测完成信号成功;VD1513写1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(busbar.isRotate == 1)
|
|
|
|
|
{
|
|
|
|
|
GimbaRotationControlEvent?.Invoke("20", "4", "10");
|
|
|
|
@ -236,11 +230,11 @@ namespace SlnMesnac.Business
|
|
|
|
|
bool is_arrive = true;
|
|
|
|
|
while (is_arrive)
|
|
|
|
|
{
|
|
|
|
|
int is_arrive_flag = _plc.readInt16ByAddress(signal); //读取PLC轨道电机到位信号
|
|
|
|
|
int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号
|
|
|
|
|
if (is_arrive_flag == 1)
|
|
|
|
|
{
|
|
|
|
|
_log.Info($"PLC已到达指定位置;{signal}值为{is_arrive_flag}");
|
|
|
|
|
if (!_plc.writeInt16ByAddress(signal, 0))
|
|
|
|
|
if (!_plc.writeInt32ByAddress(signal, 0))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"PLC到位信号复位失败;{signal}写0");
|
|
|
|
|
}
|
|
|
|
@ -317,7 +311,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
public int GetTrackMotorAddress()
|
|
|
|
|
{
|
|
|
|
|
int is_arrive_flag = _plc.readInt16ByAddress("VD2005");
|
|
|
|
|
int is_arrive_flag = _plc.readInt32ByAddress("VD2005");
|
|
|
|
|
|
|
|
|
|
return is_arrive_flag;
|
|
|
|
|
}
|
|
|
|
|