修改苏安院实体设备逻辑

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.ZjdIbpConfigVO;
import club.joylink.rtss.vo.client.project.richor.ZjdPsdConfigVO; 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.richor.ZjdPslConfigVO;
import club.joylink.rtss.vo.client.project.say.SayIbpConfigVO; import club.joylink.rtss.vo.client.project.say.*;
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.sdy.SdyPsdConfigVO; 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.sdy.SdyPslConfigVO;
import club.joylink.rtss.vo.client.project.sr.SrSectionConfigVO; 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.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId()); plcGateway.setCreator(accountVO.getId());
plcGateway.setCreateTime(now); plcGateway.setCreateTime(now);
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 256); PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 48);
plcGateway.setConfig(plcGatewayConfigVO.toJson()); plcGateway.setConfig(plcGatewayConfigVO.toJson());
list.add(plcGateway); list.add(plcGateway);
// IBP盘 // IBP盘
@ -521,6 +518,15 @@ public class DeviceServiceImpl implements DeviceService {
aSwitch.setCreateTime(now); aSwitch.setCreateTime(now);
aSwitch.setConfig(new SaySwitchConfigVO().toJson()); aSwitch.setConfig(new SaySwitchConfigVO().toJson());
list.add(aSwitch); 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; 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.data.SimulationLog;
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher; import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainLoadService; import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainLoadService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams; import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.command.CommandBO; import club.joylink.rtss.simulation.cbtc.command.CommandBO;
import club.joylink.rtss.simulation.cbtc.command.CommandExecuteService; 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.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation; 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.RealDeviceVO;
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO; import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; 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.SimulationRealDeviceConnectManager;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
import club.joylink.rtss.simulation.cbtc.event.*; import club.joylink.rtss.simulation.cbtc.event.*;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
@ -846,7 +843,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList(); List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
if (!CollectionUtils.isEmpty(realDeviceList)) { if (!CollectionUtils.isEmpty(realDeviceList)) {
Set<ProjectDeviceType> displayDeviceTypes = 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 realDeviceList = realDeviceList
.stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType())).collect(Collectors.toList()); .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.services.project.DeviceService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.SimulationRealDeviceThread; 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.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.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.event.SimulationUserEnterEvent;
import club.joylink.rtss.simulation.cbtc.member.MemberManager; import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationUser; import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
@ -135,71 +119,75 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation
} }
private String queryDeviceCodeFromConfig(RealDeviceConfig config) { private String queryDeviceCodeFromConfig(RealDeviceConfig config) {
switch (config.getProject()) { return config.findDeviceCode();
case "HEB": { // switch (config.getProject()) {
switch (config.getDeviceType()) { // case "HEB": {
case IBP: // switch (config.getDeviceType()) {
return ((Heb1IbpConfig) config).getConfig().getStationCode(); // case IBP:
case PSL: // return ((Heb1IbpConfig) config).getConfig().getStationCode();
return ((Heb1PslConfig) config).getConfig().getPsdCode(); // case PSL:
case PSC: // return ((Heb1PslConfig) config).getConfig().getPsdCode();
return ((Heb1PscConfig) config).getConfig().getPsdCode(); // case PSC:
} // return ((Heb1PscConfig) config).getConfig().getPsdCode();
break; // }
} // break;
case "XTY": { // }
switch (config.getDeviceType()) { // case "XTY": {
case PSD: // switch (config.getDeviceType()) {
return ((XtyPsdConfig) config).getConfig().getPsdCode(); // case PSD:
} // return ((XtyPsdConfig) config).getConfig().getPsdCode();
break; // }
} // break;
case "RICHOR_JOINT": { // }
switch (config.getDeviceType()) { // case "RICHOR_JOINT": {
case IBP: // switch (config.getDeviceType()) {
return ((ZjdIbpConfig) config).getConfigVO().getIbpCode(); // case IBP:
case PSL: // return ((ZjdIbpConfig) config).getConfigVO().getIbpCode();
return ((ZjdPslConfig) config).getConfigVO().getPslCode(); // case PSL:
} // return ((ZjdPslConfig) config).getConfigVO().getPslCode();
break; // }
} // break;
case "SR_SANDBOX": { // }
switch (config.getDeviceType()) { // case "SR_SANDBOX": {
case SIGNAL: // switch (config.getDeviceType()) {
return ((SrSignalConfig) config).getConfigVO().getVrCode(); // case SIGNAL:
case SECTION: // return ((SrSignalConfig) config).getConfigVO().getVrCode();
return ((SrSectionConfig) config).getConfigVO().getVrCode(); // case SECTION:
case SWITCH: // return ((SrSectionConfig) config).getConfigVO().getVrCode();
return ((SrSwitchConfig) config).getConfigVO().getVrCode(); // case SWITCH:
case TRAIN: // return ((SrSwitchConfig) config).getConfigVO().getVrCode();
return ((SrTrainConfig) config).getConfigVO().getVrCode(); // case TRAIN:
} // return ((SrTrainConfig) config).getConfigVO().getVrCode();
break; // }
} // break;
case "RICHOR_HHCJ": { // }
switch (config.getDeviceType()) { // case "RICHOR_HHCJ": {
case IBP: // switch (config.getDeviceType()) {
return ((HhcjIbpConfig) config).getConfigVO().getIbpCode(); // case IBP:
case PSD: // return ((HhcjIbpConfig) config).getConfigVO().getIbpCode();
return ((HhcjPsdConfig) config).getConfigVO().getPsdCode(); // case PSD:
} // return ((HhcjPsdConfig) config).getConfigVO().getPsdCode();
break; // }
} // break;
case "SAY": { // }
switch (config.getDeviceType()) { // case "SAY": {
case IBP: // return config.findDeviceCode();
return ((SayIbpConfig) config).getConfigVO().getIbpCode(); // switch (config.getDeviceType()) {
case PSD: // case IBP:
return ((SayPsdConfig) config).getConfigVO().getPsdCode(); // return ((SayIbpConfig) config).getConfigVO().getIbpCode();
case SIGNAL: // case PSD:
return ((SaySignalConfig) config).getConfigVO().getSignalCode(); // return ((SayPsdConfig) config).getConfigVO().getPsdCode();
case SWITCH: // case SIGNAL:
return ((SaySwitchConfig) config).getConfigVO().getSwitchCode(); // return ((SaySignalConfig) config).getConfigVO().getSignalCode();
} // case SWITCH:
break; // return ((SaySwitchConfig) config).getConfigVO().getSwitchCode();
} // case SECTION:
} // return config.findDeviceCode();
return null; // }
// break;
// }
// }
// return null;
} }
private Simulation queryProjectSimulation(String project) { private Simulation queryProjectSimulation(String project) {

View File

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

View File

@ -85,5 +85,9 @@ public abstract class RealDeviceConfig {
return this.projectDevice.getType(); return this.projectDevice.getType();
} }
/**
* 仿真设备的code
* 目前用于实体设备配置与仿真设备连接
*/
public abstract String findDeviceCode(); 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(); Channel channel = plcGateway.getChannel();
switch (aspect) { switch (aspect) {
case No: 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; break;
case R: case R:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), false, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
break; break;
case G: case G:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), false, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
break; break;
case Y: case Y:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), false, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
break; break;
case RY: case RY:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddjdq(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_r(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dj2(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_g(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_y(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), true, channel);
break; break;
default: default:
log.error("不支持的显示:{}", aspect); log.error("不支持的显示:{}", aspect);
@ -90,76 +84,64 @@ public class SaySignalServiceImpl implements RealDeviceService {
SaySignalConfigVO configVO = config.getConfigVO(); SaySignalConfigVO configVO = config.getConfigVO();
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity()); ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity());
boolean r_dj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dj()); boolean r_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_r());
boolean r_dj1 = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dj1()); boolean r_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_g());
boolean r_dj2 = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dj2()); boolean r_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_y());
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());
SignalAspect aspect = null; 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; aspect = SignalAspect.R;
} else if (r_dj1) { } else if (!r_r && r_g && !r_y) {
if (r_lxy) { aspect = SignalAspect.G;
aspect = SignalAspect.Y; } else if (!r_r && !r_g && r_y) {
} else if (r_dxy) { aspect = SignalAspect.Y;
aspect = SignalAspect.G; } else if (r_r && !r_g && r_y) {
} else if (r_yxy && r_dj2) { aspect = SignalAspect.RY;
aspect = SignalAspect.RY;
}
} }
if (aspect == null) { 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 { } else {
vrSignal.apply(aspect); vrSignal.apply(aspect);
} }
if (vrSignal.isTurning()) { if (vrSignal.isTurning()) {
boolean w_dj2 = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dj2()); boolean w_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_r());
boolean w_lxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_lxj()); boolean w_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_g());
boolean w_dxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dxj()); boolean w_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_y());
boolean w_yxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yxj());
boolean w_ddjdq = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_ddjdq());
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr(); int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
Channel channel = plcGateway.getChannel(); Channel channel = plcGateway.getChannel();
SignalAspect command = vrSignal.getCommand(); SignalAspect command = vrSignal.getCommand();
switch (command) { switch (command) {
case No: 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; break;
case R: case R:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, false, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, false, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, false, channel);
break; break;
case G: case G:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, false, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, false, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, false, channel);
break; break;
case Y: case Y:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, false, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, false, channel);
break; break;
case RY: case RY:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddjdq(), w_ddjdq, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_r(), w_r, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dj2(), w_dj2, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_g(), w_g, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, false, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_y(), w_y, true, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dxj(), w_dxj, false, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, true, channel);
break; break;
default: default:
log.error("不支持的显示:{}", command); log.error("不支持的显示:{}", aspect);
break; break;
} }
} }

View File

@ -42,7 +42,7 @@ public class SaySwitchServiceImpl implements RealDeviceService {
return; return;
} }
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_sb(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_sj(), true, channel);
switch (p) { switch (p) {
case N: case N:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dc(), true, channel); plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dc(), true, channel);
@ -80,11 +80,11 @@ public class SaySwitchServiceImpl implements RealDeviceService {
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr(); int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
Channel channel = plcGateway.getChannel(); 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()) { if (vrSwitch.isTurning()) {
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc()); boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc()); 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()) { switch (vrSwitch.getCommand()) {
case NP: case NP:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, true, channel); 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()); throw new IllegalStateException("Unexpected value: " + vrSwitch.getCommand());
} }
} else { } 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.heb.device.*;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.hhcj.HhcjIbpConfig; 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.hhcj.HhcjPsdConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SayIbpConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.*;
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.sdy.SdyPsdConfig; 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.sdy.SdyPslConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig;
@ -155,6 +152,9 @@ public class ProjectDeviceVO {
case SWITCH: case SWITCH:
list.add(new SaySwitchConfig(deviceVO)); list.add(new SaySwitchConfig(deviceVO));
break; break;
case SECTION:
list.add(new SaySectionConfig(deviceVO));
break;
} }
} }
return list; return list;

View File

@ -26,5 +26,9 @@ public abstract class RealConfigVO {
return JsonUtils.writeValueAsString(this); return JsonUtils.writeValueAsString(this);
} }
/**
* 仿真设备code
* 目前用于实体设备配置与仿真设备连接
*/
public abstract String findDeviceCode(); 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 { public class SaySignalConfigVO extends RealConfigVO {
private String signalCode = "S13289"; 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;
/** private Integer w_r = 35;
* DXJ
*/
private Integer w_dxj = 21;
/** private Integer w_g = 36;
* YXJ
*/
private Integer w_yxj = 22;
/** private Integer w_y = 37;
* 点灯继电器用于点/灭灯
*/
private Integer w_ddjdq = 23;
public SaySignalConfigVO() { public SaySignalConfigVO() {
super(0, 24); super(0, 40);
} }
@Override @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() { public SaySwitchConfigVO() {
super(0, 24); super(0, 40);
} }
@Override @Override