修改苏安院实体设备逻辑

This commit is contained in:
joylink_zhangsai 2023-03-11 17:55:14 +08:00
parent f8c3c530ad
commit 587a7bc7cf
14 changed files with 249 additions and 213 deletions

View File

@ -19,10 +19,7 @@ import club.joylink.rtss.vo.client.project.hhcj.HhcjPsdConfigVO;
import club.joylink.rtss.vo.client.project.richor.ZjdIbpConfigVO;
import club.joylink.rtss.vo.client.project.richor.ZjdPsdConfigVO;
import club.joylink.rtss.vo.client.project.richor.ZjdPslConfigVO;
import club.joylink.rtss.vo.client.project.say.SayIbpConfigVO;
import club.joylink.rtss.vo.client.project.say.SayPsdConfigVO;
import club.joylink.rtss.vo.client.project.say.SaySignalConfigVO;
import club.joylink.rtss.vo.client.project.say.SaySwitchConfigVO;
import club.joylink.rtss.vo.client.project.say.*;
import club.joylink.rtss.vo.client.project.sdy.SdyPsdConfigVO;
import club.joylink.rtss.vo.client.project.sdy.SdyPslConfigVO;
import club.joylink.rtss.vo.client.project.sr.SrSectionConfigVO;
@ -480,7 +477,7 @@ public class DeviceServiceImpl implements DeviceService {
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
plcGateway.setCreateTime(now);
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 256);
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 48);
plcGateway.setConfig(plcGatewayConfigVO.toJson());
list.add(plcGateway);
// IBP盘
@ -521,6 +518,15 @@ public class DeviceServiceImpl implements DeviceService {
aSwitch.setCreateTime(now);
aSwitch.setConfig(new SaySwitchConfigVO().toJson());
list.add(aSwitch);
//SECTION
ProjectDevice section = new ProjectDevice();
section.setProjectCode(projectCode);
section.setCode(prefix + "section");
section.setType(ProjectDeviceType.SECTION.name());
section.setCreator(accountVO.getId());
section.setCreateTime(now);
section.setConfig(new SaySectionConfigVO().toJson());
list.add(section);
return list;
}

View File

@ -22,7 +22,6 @@ import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog;
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainLoadService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.command.CommandBO;
import club.joylink.rtss.simulation.cbtc.command.CommandExecuteService;
@ -38,11 +37,9 @@ import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
import club.joylink.rtss.simulation.cbtc.data.vo.RealDeviceVO;
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.SimulationRealDeviceConnectManager;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
import club.joylink.rtss.simulation.cbtc.event.*;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
@ -846,7 +843,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
if (!CollectionUtils.isEmpty(realDeviceList)) {
Set<ProjectDeviceType> displayDeviceTypes =
new HashSet<>(List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL, ProjectDeviceType.PLC_GATEWAY, ProjectDeviceType.IBP));
new HashSet<>(List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL,
ProjectDeviceType.PLC_GATEWAY, ProjectDeviceType.IBP, ProjectDeviceType.SECTION));
realDeviceList = realDeviceList
.stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType())).collect(Collectors.toList());
}

View File

@ -9,23 +9,7 @@ import club.joylink.rtss.services.auth.UserLogoutEvent;
import club.joylink.rtss.services.project.DeviceService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.SimulationRealDeviceThread;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1IbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PscConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PslConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.hhcj.HhcjIbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.hhcj.HhcjPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SayIbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SayPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SaySignalConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SaySwitchConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.zjd.ZjdIbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.zjd.ZjdPslConfig;
import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPRealDeviceThread;
import club.joylink.rtss.simulation.cbtc.device.real.udp.sr.config.SrSectionConfig;
import club.joylink.rtss.simulation.cbtc.device.real.udp.sr.config.SrSignalConfig;
import club.joylink.rtss.simulation.cbtc.device.real.udp.sr.config.SrSwitchConfig;
import club.joylink.rtss.simulation.cbtc.device.real.udp.sr.config.SrTrainConfig;
import club.joylink.rtss.simulation.cbtc.event.SimulationUserEnterEvent;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
@ -135,71 +119,75 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation
}
private String queryDeviceCodeFromConfig(RealDeviceConfig config) {
switch (config.getProject()) {
case "HEB": {
switch (config.getDeviceType()) {
case IBP:
return ((Heb1IbpConfig) config).getConfig().getStationCode();
case PSL:
return ((Heb1PslConfig) config).getConfig().getPsdCode();
case PSC:
return ((Heb1PscConfig) config).getConfig().getPsdCode();
}
break;
}
case "XTY": {
switch (config.getDeviceType()) {
case PSD:
return ((XtyPsdConfig) config).getConfig().getPsdCode();
}
break;
}
case "RICHOR_JOINT": {
switch (config.getDeviceType()) {
case IBP:
return ((ZjdIbpConfig) config).getConfigVO().getIbpCode();
case PSL:
return ((ZjdPslConfig) config).getConfigVO().getPslCode();
}
break;
}
case "SR_SANDBOX": {
switch (config.getDeviceType()) {
case SIGNAL:
return ((SrSignalConfig) config).getConfigVO().getVrCode();
case SECTION:
return ((SrSectionConfig) config).getConfigVO().getVrCode();
case SWITCH:
return ((SrSwitchConfig) config).getConfigVO().getVrCode();
case TRAIN:
return ((SrTrainConfig) config).getConfigVO().getVrCode();
}
break;
}
case "RICHOR_HHCJ": {
switch (config.getDeviceType()) {
case IBP:
return ((HhcjIbpConfig) config).getConfigVO().getIbpCode();
case PSD:
return ((HhcjPsdConfig) config).getConfigVO().getPsdCode();
}
break;
}
case "SAY": {
switch (config.getDeviceType()) {
case IBP:
return ((SayIbpConfig) config).getConfigVO().getIbpCode();
case PSD:
return ((SayPsdConfig) config).getConfigVO().getPsdCode();
case SIGNAL:
return ((SaySignalConfig) config).getConfigVO().getSignalCode();
case SWITCH:
return ((SaySwitchConfig) config).getConfigVO().getSwitchCode();
}
break;
}
}
return null;
return config.findDeviceCode();
// switch (config.getProject()) {
// case "HEB": {
// switch (config.getDeviceType()) {
// case IBP:
// return ((Heb1IbpConfig) config).getConfig().getStationCode();
// case PSL:
// return ((Heb1PslConfig) config).getConfig().getPsdCode();
// case PSC:
// return ((Heb1PscConfig) config).getConfig().getPsdCode();
// }
// break;
// }
// case "XTY": {
// switch (config.getDeviceType()) {
// case PSD:
// return ((XtyPsdConfig) config).getConfig().getPsdCode();
// }
// break;
// }
// case "RICHOR_JOINT": {
// switch (config.getDeviceType()) {
// case IBP:
// return ((ZjdIbpConfig) config).getConfigVO().getIbpCode();
// case PSL:
// return ((ZjdPslConfig) config).getConfigVO().getPslCode();
// }
// break;
// }
// case "SR_SANDBOX": {
// switch (config.getDeviceType()) {
// case SIGNAL:
// return ((SrSignalConfig) config).getConfigVO().getVrCode();
// case SECTION:
// return ((SrSectionConfig) config).getConfigVO().getVrCode();
// case SWITCH:
// return ((SrSwitchConfig) config).getConfigVO().getVrCode();
// case TRAIN:
// return ((SrTrainConfig) config).getConfigVO().getVrCode();
// }
// break;
// }
// case "RICHOR_HHCJ": {
// switch (config.getDeviceType()) {
// case IBP:
// return ((HhcjIbpConfig) config).getConfigVO().getIbpCode();
// case PSD:
// return ((HhcjPsdConfig) config).getConfigVO().getPsdCode();
// }
// break;
// }
// case "SAY": {
// return config.findDeviceCode();
// switch (config.getDeviceType()) {
// case IBP:
// return ((SayIbpConfig) config).getConfigVO().getIbpCode();
// case PSD:
// return ((SayPsdConfig) config).getConfigVO().getPsdCode();
// case SIGNAL:
// return ((SaySignalConfig) config).getConfigVO().getSignalCode();
// case SWITCH:
// return ((SaySwitchConfig) config).getConfigVO().getSwitchCode();
// case SECTION:
// return config.findDeviceCode();
// }
// break;
// }
// }
// return null;
}
private Simulation queryProjectSimulation(String project) {

View File

@ -39,6 +39,8 @@ public class VirtualRealitySignal extends ControllableVrDevice<SignalAspect> {
public void apply(SignalAspect aspect) {
if (aspect.equals(this.getCommand())) {
this.finish();
} else {
this.aspect = aspect; //徐州连接实体设备需要
}
}

View File

@ -85,5 +85,9 @@ public abstract class RealDeviceConfig {
return this.projectDevice.getType();
}
/**
* 仿真设备的code
* 目前用于实体设备配置与仿真设备连接
*/
public abstract String findDeviceCode();
}

View File

@ -0,0 +1,24 @@
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.project.say.SaySectionConfigVO;
import lombok.Getter;
@Getter
public class SaySectionConfig extends RealDeviceConfig {
private SaySectionConfigVO configVO;
public SaySectionConfig(ProjectDeviceVO projectDevice) {
super(projectDevice);
if (projectDevice != null) {
configVO = JsonUtils.read(projectDevice.getConfig(), SaySectionConfigVO.class);
}
}
@Override
public String findDeviceCode() {
return configVO == null ? null : configVO.findDeviceCode();
}
}

View File

@ -0,0 +1,39 @@
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
import club.joylink.rtss.vo.client.project.say.SaySectionConfigVO;
import io.netty.buffer.ByteBuf;
import org.springframework.stereotype.Service;
@Service
public class SaySectionServiceImpl implements RealDeviceService {
@Override
public boolean canHandle(RealDeviceConfig deviceConfig) {
return deviceConfig instanceof SaySectionConfig;
}
@Override
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
}
@Override
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
if (plcGateway == null)
return;
SaySectionConfig config = (SaySectionConfig) deviceConfig;
VirtualRealitySectionAxleCounter vrAxleCounter = (VirtualRealitySectionAxleCounter) config.getMapElement();
if (vrAxleCounter == null)
return;
SaySectionConfigVO configVO = config.getConfigVO();
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity());
boolean r_occupied = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_occupied());
vrAxleCounter.setOccupy(r_occupied);
}
}

View File

@ -42,35 +42,29 @@ public class SaySignalServiceImpl implements RealDeviceService {
Channel channel = plcGateway.getChannel();
switch (aspect) {
case No:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), false, channel);
break;
case R:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), false, channel);
break;
case G:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), false, channel);
break;
case Y:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), true, channel);
break;
case RY:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), true, channel);
break;
default:
log.error("不支持的显示:{}", aspect);
@ -90,76 +84,64 @@ public class SaySignalServiceImpl implements RealDeviceService {
SaySignalConfigVO configVO = config.getConfigVO();
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity());
boolean r_dj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dj());
boolean r_dj1 = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dj1());
boolean r_dj2 = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dj2());
boolean r_lxy = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_lxy());
boolean r_dxy = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dxy());
boolean r_dsbj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dsbj());
boolean r_yxy = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yxy());
boolean r_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_r());
boolean r_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_g());
boolean r_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_y());
SignalAspect aspect = null;
if (r_dj) {
if (!r_r && !r_g && !r_y) {
aspect = SignalAspect.No;
} else if (r_r && !r_g && !r_y) {
aspect = SignalAspect.R;
} else if (r_dj1) {
if (r_lxy) {
aspect = SignalAspect.Y;
} else if (r_dxy) {
} else if (!r_r && r_g && !r_y) {
aspect = SignalAspect.G;
} else if (r_yxy && r_dj2) {
} else if (!r_r && !r_g && r_y) {
aspect = SignalAspect.Y;
} else if (r_r && !r_g && r_y) {
aspect = SignalAspect.RY;
}
}
if (aspect == null) {
log.error("未知的状态:[{}]-[{}]-[{}]-[{}]-[{}]-[{}]-[{}]", r_dj, r_dj1, r_dj2, r_lxy, r_dxy, r_dsbj, r_yxy);
log.error("未知的信号组合[红:%s][绿:%s][黄:%s]", r_r, r_g, r_y);
} else {
vrSignal.apply(aspect);
}
if (vrSignal.isTurning()) {
boolean w_dj2 = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dj2());
boolean w_lxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_lxj());
boolean w_dxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dxj());
boolean w_yxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yxj());
boolean w_ddjdq = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_ddjdq());
boolean w_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_r());
boolean w_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_g());
boolean w_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_y());
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
Channel channel = plcGateway.getChannel();
SignalAspect command = vrSignal.getCommand();
switch (command) {
case No:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, false, channel);
break;
case R:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, false, channel);
break;
case G:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, false, channel);
break;
case Y:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, true, channel);
break;
case RY:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, true, channel);
break;
default:
log.error("不支持的显示:{}", command);
log.error("不支持的显示:{}", aspect);
break;
}
}

View File

@ -42,7 +42,7 @@ public class SaySwitchServiceImpl implements RealDeviceService {
return;
}
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_sb(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_sj(), true, channel);
switch (p) {
case N:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dc(), true, channel);
@ -80,11 +80,11 @@ public class SaySwitchServiceImpl implements RealDeviceService {
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
Channel channel = plcGateway.getChannel();
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sb());
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
if (vrSwitch.isTurning()) {
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sb(), w_sb, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sb, true, channel);
switch (vrSwitch.getCommand()) {
case NP:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, true, channel);
@ -98,7 +98,7 @@ public class SaySwitchServiceImpl implements RealDeviceService {
throw new IllegalStateException("Unexpected value: " + vrSwitch.getCommand());
}
} else {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sb(), w_sb, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sb, false, channel);
}
}
}

View File

@ -10,10 +10,7 @@ import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gzb.GzbSwitchConf
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.*;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.hhcj.HhcjIbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.hhcj.HhcjPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SayIbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SayPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SaySignalConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SaySwitchConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.*;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy.SdyPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy.SdyPslConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig;
@ -155,6 +152,9 @@ public class ProjectDeviceVO {
case SWITCH:
list.add(new SaySwitchConfig(deviceVO));
break;
case SECTION:
list.add(new SaySectionConfig(deviceVO));
break;
}
}
return list;

View File

@ -26,5 +26,9 @@ public abstract class RealConfigVO {
return JsonUtils.writeValueAsString(this);
}
/**
* 仿真设备code
* 目前用于实体设备配置与仿真设备连接
*/
public abstract String findDeviceCode();
}

View File

@ -0,0 +1,23 @@
package club.joylink.rtss.vo.client.project.say;
import club.joylink.rtss.vo.client.project.RealConfigVO;
import lombok.Getter;
@Getter
public class SaySectionConfigVO extends RealConfigVO {
private String sectionCode;
/**
* 占用
*/
private Integer r_occupied = 6;
public SaySectionConfigVO() {
super(0, 32);
}
@Override
public String findDeviceCode() {
return sectionCode;
}
}

View File

@ -9,68 +9,34 @@ import lombok.Setter;
public class SaySignalConfigVO extends RealConfigVO {
private String signalCode = "S13289";
/**
* DJ
*/
private Integer r_dj = 2;
/**
* DJ1
*/
private Integer r_dj1 = 3;
/**
* DJ2
*/
private Integer r_dj2 = 4;
/**
* LXY
*/
private Integer r_lxy = 5;
/**
* DXY
*/
private Integer r_dxy = 6;
/**
* 灯丝报警
*/
private Integer r_dsbj = 7;
private Integer r_bj = 2;
/**
* YXY
*
*/
private Integer r_yxy = 8;
private Integer r_r = 3;
/**
* 2DJ
* 绿
*/
private Integer w_dj2 = 19;
private Integer r_g = 4;
/**
* LXJ
*
*/
private Integer w_lxj = 20;
private Integer r_y = 5;
/**
* DXJ
*/
private Integer w_dxj = 21;
private Integer w_r = 35;
/**
* YXJ
*/
private Integer w_yxj = 22;
private Integer w_g = 36;
/**
* 点灯继电器用于点/灭灯
*/
private Integer w_ddjdq = 23;
private Integer w_y = 37;
public SaySignalConfigVO() {
super(0, 24);
super(0, 40);
}
@Override

View File

@ -22,20 +22,20 @@ public class SaySwitchConfigVO extends RealConfigVO {
/**
* 定操
*/
private Integer w_dc = 16;
private Integer w_dc = 32;
/**
* 反操
*/
private Integer w_fc = 17;
private Integer w_fc = 33;
/**
*
*
*/
private Integer w_sb = 18;
private Integer w_sj = 34;
public SaySwitchConfigVO() {
super(0, 24);
super(0, 40);
}
@Override