南宁设备逻辑

This commit is contained in:
tiger_zhou 2023-06-01 09:00:34 +08:00
parent 966c70cd2f
commit a1be780b13
2 changed files with 15 additions and 10 deletions

View File

@ -25,7 +25,7 @@ public abstract class GxsdService implements RealDeviceService {
//设置plc 继电器的工作模式此配置不在configVo中体现
PlcGateway plcGateway = simulation.getPlcGateway();
Channel channel = plcGateway.getChannel();
log.info("设置plc继电器...");
// log.info("设置plc继电器...");
this.plcGatewayService.writeSingleCoil(0, 14, true, channel);
}
@ -35,7 +35,7 @@ public abstract class GxsdService implements RealDeviceService {
public boolean checkElectricRelay(ByteBuf signalStatus) {
boolean rReplay = RealDeviceConfig.getBitOf(signalStatus, 6);
// boolean outReplay = RealDeviceConfig.getBitOf(signalStatus, 14);
log.info("读取继电器... val:" + rReplay);
// log.info("读取继电器... val:" + rReplay);
return rReplay;
}
}

View File

@ -69,18 +69,18 @@ public class GxsdSignalServiceImpl extends GxsdService {
boolean w7 = RealDeviceConfig.getBitOf(signalStatus, config.getW7()); //输出 红黄灯
SignalAspect aspect = null;
if (br0 && w5) {
if (!br0 && w5) {
aspect = SignalAspect.No;
} else if (br0) {
} else if (br0 && !w5 && !w7) {
aspect = SignalAspect.R;
} else if (br3 && w3) {
} else if (br3 && w3 && !w4) {
aspect = SignalAspect.G;
} else if (br3 && w4) {
} else if (br3 && w4 && !w3) {
aspect = SignalAspect.Y;
} else if (w7) {
} else if (w7 && br0 && br3) {
aspect = SignalAspect.RY;
}
log.info("当前信号灯状态 读红[{}],读绿黄[{}],写红[{}],写黄[{}],写灭灯[{}],写红黄[{}]", br0, br3, w3, w4, w5, w7);
// log.info("当前信号灯状态 读红[{}],读绿黄[{}],写红[{}],写黄[{}],写灭灯[{}],写红黄[{}]", br0, br3, w3, w4, w5, w7);
if (Objects.nonNull(aspect)) {
vrSignal.apply(aspect);
}
@ -98,7 +98,6 @@ public class GxsdSignalServiceImpl extends GxsdService {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, true, channel);
break;
}
case G: {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, false, channel);
@ -113,7 +112,13 @@ public class GxsdSignalServiceImpl extends GxsdService {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, false, channel);
break;
}
case R:
case R: {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW5(), w5, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, false, channel);
break;
}
case No: {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, false, channel);