真实IBP/PSL盘改为连接vrIBP/PSL(仅义乌项目)

This commit is contained in:
joylink_zhangsai 2021-09-22 16:58:27 +08:00
parent 3cb47d9577
commit 2463a96204
20 changed files with 243 additions and 173 deletions

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.services;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus; import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
/** /**
* 虚拟真实IBP服务 * 虚拟真实IBP服务
@ -18,6 +19,9 @@ public interface IVirtualRealityIbpService {
*/ */
void pressTheButton(String group, String stationCode, String buttonCode); void pressTheButton(String group, String stationCode, String buttonCode);
void updateElementStatus(Simulation simulation, VirtualRealityIbp ibp,
VirtualRealityIbp.IbpElement element, boolean pressed);
/** /**
* 收集并发送IBP的状态数据 * 收集并发送IBP的状态数据
* @param simulation * @param simulation

View File

@ -2,10 +2,9 @@ package club.joylink.rtss.services;
import club.joylink.rtss.exception.BaseException; import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.publishData.IbpService;
import club.joylink.rtss.services.publishData.IbpServiceImpl;
import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.StandOperateHandler; import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.StandOperateHandler;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache; import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
@ -18,12 +17,6 @@ import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus; import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
import club.joylink.rtss.simulation.cbtc.event.SimulationIbpStatusEvent; import club.joylink.rtss.simulation.cbtc.event.SimulationIbpStatusEvent;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.ibp.IbpData;
import club.joylink.rtss.vo.client.ibp.IbpQueryVO;
import club.joylink.rtss.vo.client.ibp.IbpVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -50,10 +43,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired @Autowired
private IbpService ibpService; private CiStandService ciStandService;
@Autowired
private IbpServiceImpl ibpServiceImpl;
@Override @Override
public IbpStatus getIbpStatus(String group, String stationCode) { public IbpStatus getIbpStatus(String group, String stationCode) {
@ -76,79 +66,82 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
Station station = simulation.getRepository().getByCode(stationCode, Station.class); Station station = simulation.getRepository().getByCode(stationCode, Station.class);
VirtualRealityIbp ibp = collect4Ibp(simulation, station); VirtualRealityIbp ibp = collect4Ibp(simulation, station);
MapConfig config = simulation.getRepository().getConfig();
VirtualRealityIbp.IbpElement element = ibp.getByCode(buttonCode); VirtualRealityIbp.IbpElement element = ibp.getByCode(buttonCode);
theButtonIsPressed(simulation, ibp, element);
}
private void theButtonIsPressed(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.IbpElement element) {
boolean change = false;
if (VirtualRealityIbp.Type.KEY.equals(element.getType())) { if (VirtualRealityIbp.Type.KEY.equals(element.getType())) {
element.setOn(!element.isOn()); element.setOn(!element.isOn());
return; return;
} } else if (VirtualRealityIbp.Type.BUTTON.equals(element.getType())) {
List<Stand> stands = chooseStands(station, element, config); VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
boolean change = false; if (!button.isOn())
VirtualRealityIbp.SquareButton button = null;
if (VirtualRealityIbp.Type.BUTTON.equals(element.getType())) {
button = (VirtualRealityIbp.SquareButton) element;
if (!button.isPressed())
change = true; change = true;
button.setPressed(true); button.setPressed(true);
if (button.getMean() == null) { element.setOn(true);
button.setOn(true); }
if (change)
effective(simulation, ibp, element);
}
/**
* IBP盘上元素对应的功能生效
*/
private void effective(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.IbpElement element) {
if (!element.isOn())
return; return;
} Station station = ibp.getStation();
} MapConfig config = simulation.getRepository().getConfig();
List<Stand> stands = chooseStands(station, element, config);
switch (element.getMean()) { switch (element.getMean()) {
case KC: case KC:
element.setOn(true);
stands.forEach(stand -> ciApiService.ibpHoldTrain(simulation, stand.getCode())); stands.forEach(stand -> ciApiService.ibpHoldTrain(simulation, stand.getCode()));
break; break;
case ZZKC: case ZZKC:
element.setOn(true);
stands.forEach(stand -> ciApiService.ibpHoldTrainCancel(simulation, stand.getCode())); stands.forEach(stand -> ciApiService.ibpHoldTrainCancel(simulation, stand.getCode()));
break; break;
case JJTC: case JJTC:
element.setOn(true);
stands.forEach(stand -> ciApiService.standEC(simulation, stand)); stands.forEach(stand -> ciApiService.standEC(simulation, stand));
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(alarm -> alarm.setOn(true)); ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(alarm -> alarm.setOn(true));
break; break;
case QXJJTC: case QXJJTC:
element.setOn(true);
stands.forEach(stand -> ciApiService.cancelStandEC(simulation, stand)); stands.forEach(stand -> ciApiService.cancelStandEC(simulation, stand));
break; break;
case BJQC: case BJQC:
element.setOn(true);
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(ele -> ele.setOn(false)); ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(ele -> ele.setOn(false));
break; break;
case ALARM: case ALARM:
break; break;
case KM: { case KM: {
element.setOn(true); stands.forEach(stand -> ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.IBP));
stands.forEach(stand -> ciApiService.openScreenDoor(simulation, stand.getCode()));
break; break;
} }
case GM: { case GM: {
element.setOn(true); stands.forEach(stand -> ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.IBP));
stands.forEach(stand -> ciApiService.closeScreenDoor(simulation, stand.getCode()));
break; break;
} }
case XXYS: case XXYS:
case SXYS: case SXYS:
element.setOn(!element.isOn()); // element.setOn(!element.isOn());
break; break;
case AXLE_RESET: case AXLE_RESET: {
element.setOn(true); VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
ciApiService.axleReset(simulation, button.getSectionCode()); ciApiService.axleReset(simulation, button.getSectionCode());
break; break;
case AXLE_PRE_RESET: }
if (change) { case AXLE_PRE_RESET: {
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
if (!button.isEffective()) {
button.setEffective(true); button.setEffective(true);
button.setPressTime(LocalDateTime.now()); button.setPressTime(LocalDateTime.now());
} }
break; break;
}
case PRERESET_Z: case PRERESET_Z:
element.setOn(true);
break; break;
case SD: case SD:
element.setOn(true);
ibp.queryByType(VirtualRealityIbp.Type.LIGHT).forEach(light -> light.setOn(true)); ibp.queryByType(VirtualRealityIbp.Type.LIGHT).forEach(light -> light.setOn(true));
break; break;
default: default:
@ -169,14 +162,30 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
Station station = simulation.getRepository().getByCode(stationCode, Station.class); Station station = simulation.getRepository().getByCode(stationCode, Station.class);
VirtualRealityIbp ibp = collect4Ibp(simulation, station); VirtualRealityIbp ibp = collect4Ibp(simulation, station);
VirtualRealityIbp.IbpElement element = ibp.getByCode(buttonCode); VirtualRealityIbp.IbpElement element = ibp.getByCode(buttonCode);
theButtonIsReleased(element);
}
private void theButtonIsReleased(VirtualRealityIbp.IbpElement element) {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(VirtualRealityIbp.Type.BUTTON.equals(element.getType()), "元素非按钮"); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(VirtualRealityIbp.Type.BUTTON.equals(element.getType()), "元素非按钮");
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element; VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
button.setPressed(false);
if (!VirtualRealityIbp.Mean.AXLE_PRE_RESET.equals(button.getMean())) { if (!VirtualRealityIbp.Mean.AXLE_PRE_RESET.equals(button.getMean())) {
button.setOn(false); button.setOn(false);
} else {
button.setEffective(false);
} }
if (VirtualRealityIbp.Mean.SD.equals(button.getMean())) { }
ibp.queryByType(VirtualRealityIbp.Type.LIGHT).forEach(light -> light.setOn(false));
/**
* 更新IBP元素状态
* @param pressed true-按下false-松开
*/
@Override
public void updateElementStatus(Simulation simulation, VirtualRealityIbp ibp,
VirtualRealityIbp.IbpElement element, boolean pressed) {
if (pressed) {
theButtonIsPressed(simulation, ibp, element);
} else {
theButtonIsReleased(element);
} }
} }
@ -209,12 +218,12 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
@Override @Override
public void addJobs(Simulation simulation) { public void addJobs(Simulation simulation) {
simulation.addJob(Simulation.JobName.ibpJob, () -> this.logic(simulation), 500); simulation.addJob(Simulation.JobName.ibpJob, () -> this.preResetLogic(simulation), 500);
simulation.addJob(SimulationModule.IBP_STATUS.name(), () -> this.collectAndDispatcher(simulation), simulation.addJob(SimulationModule.IBP_STATUS.name(), () -> this.collectAndDispatcher(simulation),
SimulationConstants.IBP_STATUS_COLLECT_RATE); SimulationConstants.IBP_STATUS_COLLECT_RATE);
} }
private void logic(Simulation simulation) { private void preResetLogic(Simulation simulation) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
for (Station station : repository.getStationList()) { for (Station station : repository.getStationList()) {
VirtualRealityIbp ibp = station.getVrIbp(); VirtualRealityIbp ibp = station.getVrIbp();
@ -256,8 +265,6 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
boolean sd = false; boolean sd = false;
if (!CollectionUtils.isEmpty(sdList)) { if (!CollectionUtils.isEmpty(sdList)) {
sd = sdList.stream().anyMatch(VirtualRealityIbp.IbpElement::isOn); sd = sdList.stream().anyMatch(VirtualRealityIbp.IbpElement::isOn);
// VirtualRealityIbp.SquareButton sdButton = (VirtualRealityIbp.SquareButton) sdList.get(0);
// sd = sdButton.isOn();
} }
for (VirtualRealityIbp.IbpElement element : vrIbp.getElementList()) { for (VirtualRealityIbp.IbpElement element : vrIbp.getElementList()) {
List<Stand> stands = chooseStands(station, element, config); List<Stand> stands = chooseStands(station, element, config);

View File

@ -10,5 +10,7 @@ public interface IVirtualRealityPslService {
void pressTheButton(String group, String standCode, VirtualRealityPsl.Button button); void pressTheButton(String group, String standCode, VirtualRealityPsl.Button button);
void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on);
void addJobs(Simulation simulation); void addJobs(Simulation simulation);
} }

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.services.psl; package club.joylink.rtss.services.psl;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService; import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
@ -9,8 +10,6 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.simulation.cbtc.data.map.PSD;
import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent; import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent;
import club.joylink.rtss.vo.client.psl.PslStatus; import club.joylink.rtss.vo.client.psl.PslStatus;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -22,7 +21,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Service @Service
public class VirtualRealityPslService implements IVirtualRealityPslService{ public class VirtualRealityPslService implements IVirtualRealityPslService {
@Autowired @Autowired
private GroupSimulationService groupSimulationService; private GroupSimulationService groupSimulationService;
@ -31,9 +30,7 @@ public class VirtualRealityPslService implements IVirtualRealityPslService{
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired @Autowired
private CiStandService standService; private CiApiService ciApiService;
@Autowired
private VirtualRealityDeviceService virtualRealityDeviceService;
@Override @Override
public PslStatus getStatus(String group, String standCode) { public PslStatus getStatus(String group, String standCode) {
@ -58,6 +55,11 @@ public class VirtualRealityPslService implements IVirtualRealityPslService{
Simulation simulation = groupSimulationService.getSimulationByGroup(group); Simulation simulation = groupSimulationService.getSimulationByGroup(group);
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
VirtualRealityPsl vrPsl = collectStatus(stand); VirtualRealityPsl vrPsl = collectStatus(stand);
theButtonIsPressed(simulation, vrPsl, button);
}
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
Stand stand = vrPsl.getStand();
synchronized (vrPsl) { synchronized (vrPsl) {
switch (button) { switch (button) {
case YXJZ: case YXJZ:
@ -65,13 +67,13 @@ public class VirtualRealityPslService implements IVirtualRealityPslService{
break; break;
case HSJC: case HSJC:
vrPsl.setHsjcKey(!vrPsl.isHsjcKey()); vrPsl.setHsjcKey(!vrPsl.isHsjcKey());
standService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey()); ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
break; break;
case KM: case KM:
standService.openScreenDoor(simulation, stand, CiStandService.PsdCommandSource.PSL); ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break; break;
case GM: case GM:
standService.closeScreenDoor(simulation, stand, CiStandService.PsdCommandSource.PSL); ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break; break;
case SD: case SD:
vrPsl.setSdButton(!vrPsl.isSdButton()); vrPsl.setSdButton(!vrPsl.isSdButton());
@ -80,6 +82,45 @@ public class VirtualRealityPslService implements IVirtualRealityPslService{
} }
} }
@Override
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) {
switch (button) {
case YXJZ:
vrPsl.setYxjzKey(on);
break;
case HSJC:
vrPsl.setHsjcKey(on);
break;
case KM:
case GM:
break;
case SD:
vrPsl.setSdButton(on);
break;
}
effective(simulation, vrPsl.getStand(), button, on);
}
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button, boolean on) {
switch (button) {
case YXJZ:
break;
case HSJC:
ciApiService.setOrCancelInterlockRelease(simulation, stand, on);
break;
case KM:
if (on)
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break;
case GM:
if (on)
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break;
case SD:
break;
}
}
@Override @Override
public void addJobs(Simulation simulation) { public void addJobs(Simulation simulation) {
simulation.addJobIfAbsent(Simulation.JobName.pslStatus, simulation.addJobIfAbsent(Simulation.JobName.pslStatus,

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.CI; package club.joylink.rtss.simulation.cbtc.CI;
import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.ESP; import club.joylink.rtss.simulation.cbtc.data.map.ESP;
import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Route;
@ -222,15 +223,17 @@ public interface CiApiService {
* 开站台屏蔽门 * 开站台屏蔽门
* @param simulation * @param simulation
* @param standCode * @param standCode
* @param source
*/ */
void openScreenDoor(Simulation simulation, String standCode); void openScreenDoor(Simulation simulation, String standCode, CiStandService.PsdCommandSource source);
/** /**
* 关站台屏蔽门 * 关站台屏蔽门
* @param simulation * @param simulation
* @param standCode * @param standCode
* @param source
*/ */
void closeScreenDoor(Simulation simulation, String standCode); void closeScreenDoor(Simulation simulation, String standCode, CiStandService.PsdCommandSource source);
/** /**
* 站台扣车联锁关系处理 * 站台扣车联锁关系处理
@ -349,4 +352,6 @@ public interface CiApiService {
* @param overlapCode * @param overlapCode
*/ */
void setOverlap(Simulation simulation, String signalCode, String overlapCode); void setOverlap(Simulation simulation, String signalCode, String overlapCode);
void setOrCancelInterlockRelease(Simulation simulation, Stand stand, boolean release);
} }

View File

@ -318,15 +318,15 @@ public class CiApiServiceImpl2 implements CiApiService {
} }
@Override @Override
public void openScreenDoor(Simulation simulation, String standCode) { public void openScreenDoor(Simulation simulation, String standCode, CiStandService.PsdCommandSource source) {
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
if (Objects.nonNull(stand.getPsd())) { if (Objects.nonNull(stand.getPsd())) {
standService.openScreenDoor(simulation, stand, CiStandService.PsdCommandSource.SIG); standService.openScreenDoor(simulation, stand, source);
} }
} }
@Override @Override
public void closeScreenDoor(Simulation simulation, String standCode) { public void closeScreenDoor(Simulation simulation, String standCode, CiStandService.PsdCommandSource source) {
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
if (Objects.nonNull(stand.getPsd())) { if (Objects.nonNull(stand.getPsd())) {
standService.closeScreenDoor(simulation, stand, CiStandService.PsdCommandSource.SIG); standService.closeScreenDoor(simulation, stand, CiStandService.PsdCommandSource.SIG);
@ -593,6 +593,11 @@ public class CiApiServiceImpl2 implements CiApiService {
this.routeService.setOverlap(simulation, overlap); this.routeService.setOverlap(simulation, overlap);
} }
@Override
public void setOrCancelInterlockRelease(Simulation simulation, Stand stand, boolean release) {
standService.setOrCancelInterlockRelease(stand, release);
}
/** /**
* 获取计轴器并为预复位/复位操作检查设备状态 * 获取计轴器并为预复位/复位操作检查设备状态
*/ */

View File

@ -148,7 +148,7 @@ public class CiStandService {
* 设置或取消互锁解除 * 设置或取消互锁解除
* @param release 是否是设置 * @param release 是否是设置
*/ */
public void setOrCancelInterlockRelease(Simulation simulation, Stand stand, boolean release) { public void setOrCancelInterlockRelease(Stand stand, boolean release) {
stand.getPsd().getVirtualScreenDoor().updateIL(release); stand.getPsd().getVirtualScreenDoor().updateIL(release);
stand.getPsd().setInterlockRelease(release); stand.getPsd().setInterlockRelease(release);
// if (release) { // if (release) {

View File

@ -15,6 +15,7 @@ import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1Ib
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PscConfig; 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.heb.device.Heb1PslConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor.ZjdIbpConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor.ZjdIbpConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor.ZjdPslConfig;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig;
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;
@ -24,6 +25,7 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.project.LwConfigVO; import club.joylink.rtss.vo.client.project.LwConfigVO;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO; import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.project.richor.ZjdPslConfigVO;
import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.MapVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -139,7 +141,9 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation
case RICHOR_JOINT: { case RICHOR_JOINT: {
switch (config.getDeviceType()) { switch (config.getDeviceType()) {
case IBP: case IBP:
return ((ZjdIbpConfig) config).getConfigVO().getStationCode(); return ((ZjdIbpConfig) config).getConfigVO().getIbpCode();
case PSL:
return ((ZjdPslConfig) config).getConfigVO().getPslCode();
} }
} }
} }

View File

@ -812,6 +812,7 @@ public class MapDeviceBuilder {
//PSL //PSL
VirtualRealityPsl vrPsl = new VirtualRealityPsl(stand.getCode() + "_PSL", stand.getName() + "_PSL"); VirtualRealityPsl vrPsl = new VirtualRealityPsl(stand.getCode() + "_PSL", stand.getName() + "_PSL");
stand.setVrPsl(vrPsl); stand.setVrPsl(vrPsl);
vrPsl.setStand(stand);
elementMap.put(vrPsl.getCode(), vrPsl); elementMap.put(vrPsl.getCode(), vrPsl);
deviceMap.put(vrPsl.getCode(), vrPsl); deviceMap.put(vrPsl.getCode(), vrPsl);
} }
@ -1307,17 +1308,6 @@ public class MapDeviceBuilder {
if (station.isHasControlMode()) { // 有控制模式初始化为中控 if (station.isHasControlMode()) { // 有控制模式初始化为中控
station.setControlMode(Station.ControlMode.Center); station.setControlMode(Station.ControlMode.Center);
} }
//构建添加IBP
Ibp ibp = ibpMap.get(station.getCode());
if (ibp == null)
ibp = ibpMap.get(null);
if (ibp != null) {
IbpData ibpData = JsonUtils.read(ibp.getData(), IbpData.class);
VirtualRealityIbp vrIbp = new VirtualRealityIbp(station.getCode() + "_IBP", station.getName() + "_IBP", ibpData);
station.setVrIbp(vrIbp);
elementMap.put(vrIbp.getCode(), vrIbp);
deviceMap.put(vrIbp.getCode(), vrIbp);
}
}); });
// 设备集中站下的车站关联ZC联锁站下的车站关联联锁站 // 设备集中站下的车站关联ZC联锁站下的车站关联联锁站
stationList.forEach(stationVO -> { stationList.forEach(stationVO -> {

View File

@ -26,6 +26,7 @@ import javax.swing.text.Element;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@Slf4j @Slf4j
public class SimulationBuilder { public class SimulationBuilder {
@ -81,13 +82,13 @@ public class SimulationBuilder {
private static void buildIbpData(SimulationDeviceBuildResult mapDataBuildResult, List<Ibp> ibpList) { private static void buildIbpData(SimulationDeviceBuildResult mapDataBuildResult, List<Ibp> ibpList) {
if (CollectionUtils.isEmpty(ibpList)) if (CollectionUtils.isEmpty(ibpList))
return; return;
Map<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap(); Map<String, MapElement> deviceMap = mapDataBuildResult.getDeviceMap();
Map<String, VirtualRealityDevice> vrDeviceMap = mapDataBuildResult.getVrDeviceMap();
Map<String, Ibp> ibpMap = ibpList.stream().collect(Collectors.toMap(Ibp::getStationCode, Function.identity())); Map<String, Ibp> ibpMap = ibpList.stream().collect(Collectors.toMap(Ibp::getStationCode, Function.identity()));
elementMap.values().stream() List<Station> collect = deviceMap.values().stream()
.filter(element -> MapElement.DeviceType.STATION.equals(element.getDeviceType())) .filter(element -> MapElement.DeviceType.STATION.equals(element.getDeviceType()))
.map(element -> (Station) element) .map(element -> (Station) element).collect(Collectors.toList());
.forEach(station -> { collect.forEach(station -> {
//构建添加IBP //构建添加IBP
Ibp ibp = ibpMap.get(station.getCode()); Ibp ibp = ibpMap.get(station.getCode());
if (ibp == null) if (ibp == null)
@ -96,8 +97,8 @@ public class SimulationBuilder {
IbpData ibpData = JsonUtils.read(ibp.getData(), IbpData.class); IbpData ibpData = JsonUtils.read(ibp.getData(), IbpData.class);
VirtualRealityIbp vrIbp = new VirtualRealityIbp(station.getCode() + "_IBP", station.getName() + "_IBP", ibpData, station); VirtualRealityIbp vrIbp = new VirtualRealityIbp(station.getCode() + "_IBP", station.getName() + "_IBP", ibpData, station);
station.setVrIbp(vrIbp); station.setVrIbp(vrIbp);
elementMap.put(vrIbp.getCode(), vrIbp); deviceMap.put(vrIbp.getCode(), vrIbp);
elementMap.put(vrIbp.getCode(), vrIbp); vrDeviceMap.put(vrIbp.getCode(), vrIbp);
} }
}); });
} }

View File

@ -1162,14 +1162,4 @@ public class SimulationDataRepository {
.assertNotNull(vrPsl, String.format("%s无对应的vrPsl", vrPsd.debugStr())); .assertNotNull(vrPsl, String.format("%s无对应的vrPsl", vrPsd.debugStr()));
return vrPsl; return vrPsl;
} }
public Station getStationByVrIbp(@NonNull VirtualRealityIbp vrIbp) {
for (Station station : this.getStationList()) {
if (vrIbp.equals(station.getVrIbp())) {
return station;
}
}
throw BusinessExceptionAssertEnum.DATA_NOT_EXIST
.exception(String.format("%s无对应的车站", vrIbp.debugStr()));
}
} }

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.simulation.cbtc.data.vr; package club.joylink.rtss.simulation.cbtc.data.vr;
import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement; import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.vo.client.ibp.IbpData; import club.joylink.rtss.vo.client.ibp.IbpData;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -18,11 +18,13 @@ import java.util.stream.Collectors;
* 虚拟真实IBP盘 * 虚拟真实IBP盘
*/ */
public class VirtualRealityIbp extends VirtualRealityDevice { public class VirtualRealityIbp extends VirtualRealityDevice {
@Getter
private final Station station;
private final Map<String, IbpElement> elementMap = new ConcurrentHashMap<>(); private final Map<String, IbpElement> elementMap = new ConcurrentHashMap<>();
public VirtualRealityIbp(String code, String name, IbpData ibpData) { public VirtualRealityIbp(String code, String name, IbpData ibpData, Station station) {
super(code, name, DeviceType.ESP); super(code, name, DeviceType.IBP);
if (!CollectionUtils.isEmpty(ibpData.getDrawData().getSquareButtonList())) { if (!CollectionUtils.isEmpty(ibpData.getDrawData().getSquareButtonList())) {
for (IbpData.SquareButtonVO vo : ibpData.getDrawData().getSquareButtonList()) { for (IbpData.SquareButtonVO vo : ibpData.getDrawData().getSquareButtonList()) {
SquareButton button = new SquareButton(vo.getCode(), vo.getMean(), false, vo.getSectionCode(), vo.getDirection()); SquareButton button = new SquareButton(vo.getCode(), vo.getMean(), false, vo.getSectionCode(), vo.getDirection());
@ -48,6 +50,7 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
} }
} }
} }
this.station = station;
} }
public void reset() { public void reset() {
@ -100,7 +103,7 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
private Mean mean; private Mean mean;
/** 是否生效(是否亮灯) */ /** 是否开启/亮灯 */
private boolean on; private boolean on;
/** 是否上行 */ /** 是否上行 */
@ -122,9 +125,7 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
@Getter @Getter
@Setter @Setter
public class SquareButton extends IbpElement { public class SquareButton extends IbpElement {
/** /** 是否被按下 */
* 是否被按下
*/
private boolean pressed; private boolean pressed;
/** 按钮被按下的时刻 */ /** 按钮被按下的时刻 */
@ -135,8 +136,8 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
/** 有效的(防止计轴预复位按钮多次生效) */ /** 有效的(防止计轴预复位按钮多次生效) */
private boolean effective; private boolean effective;
public SquareButton(String code, Mean mean, boolean status, String sectionCode, Boolean up) { public SquareButton(String code, Mean mean, boolean on, String sectionCode, Boolean up) {
super(code, Type.BUTTON, mean, status, up); super(code, Type.BUTTON, mean, on, up);
this.sectionCode = sectionCode; this.sectionCode = sectionCode;
} }
} }
@ -157,7 +158,7 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
*/ */
KC, KC,
/** /**
* 下行终止扣车 * 终止扣车
*/ */
ZZKC, ZZKC,
/** /**

View File

@ -1,12 +1,14 @@
package club.joylink.rtss.simulation.cbtc.data.vr; package club.joylink.rtss.simulation.cbtc.data.vr;
import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement; import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class VirtualRealityPsl extends VirtualRealityDevice { public class VirtualRealityPsl extends VirtualRealityDevice {
private Stand stand;
/** 所有滑动门/应急门关闭且紧锁指示灯 */ /** 所有滑动门/应急门关闭且紧锁指示灯 */
private boolean qbgmLight; private boolean qbgmLight;

View File

@ -85,6 +85,10 @@ public class SimulationRealDeviceConnectManager {
typeEqual = true; typeEqual = true;
realDevice.connect(vrDevice); realDevice.connect(vrDevice);
} }
if (MapElement.DeviceType.PSL.equals(vrDevice.getDeviceType())) {
typeEqual = true;
realDevice.connect(vrDevice);
}
break; break;
} }
case IBP:{ case IBP:{

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor; package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor;
import club.joylink.rtss.services.IVirtualRealityIbpService;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
@ -18,12 +19,14 @@ import club.joylink.rtss.simulation.rt.iscs.IscsStatusPublisher;
import club.joylink.rtss.vo.client.project.richor.ZjdIbpConfigVO; import club.joylink.rtss.vo.client.project.richor.ZjdIbpConfigVO;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import javafx.scene.effect.Light;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Objects;
@Slf4j @Slf4j
@Component @Component
@ -36,7 +39,7 @@ public class ZjdIbpServiceImpl implements RealDeviceService {
private CiApiService ciApiService; private CiApiService ciApiService;
@Autowired @Autowired
private ApplicationContext applicationContext; private IVirtualRealityIbpService iVirtualRealityIbpService;
@Override @Override
public boolean canHandle(RealDeviceConfig deviceConfig) { public boolean canHandle(RealDeviceConfig deviceConfig) {
@ -67,8 +70,8 @@ public class ZjdIbpServiceImpl implements RealDeviceService {
if (plcGateway == null) if (plcGateway == null)
return; return;
ZjdIbpConfig config = (ZjdIbpConfig) deviceConfig; ZjdIbpConfig config = (ZjdIbpConfig) deviceConfig;
Station station = (Station) config.getMapElement(); VirtualRealityIbp vrIbp = (VirtualRealityIbp) config.getMapElement();
if (station == null) if (vrIbp == null)
return; return;
ZjdIbpConfigVO configVO = config.getConfigVO(); ZjdIbpConfigVO configVO = config.getConfigVO();
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity()); ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity());
@ -93,58 +96,67 @@ public class ZjdIbpServiceImpl implements RealDeviceService {
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr(); int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
Channel channel = plcGateway.getChannel(); Channel channel = plcGateway.getChannel();
//查找真实设备和vr设备 //查找真实设备和vr设备
SimulationDataRepository repository = simulation.getRepository(); /*------------------------- 输入 -------------------------*/
MapConfig mapConfig = repository.getConfig(); //下行紧急停车
List<Stand> stands = station.getAllNormalStands(); List<VirtualRealityIbp.IbpElement> jjtc = vrIbp.query(VirtualRealityIbp.Mean.JJTC, false);
List<Stand> upStands = station.getNormalStand(mapConfig.isRight(true)); jjtc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_jjtc));
List<Stand> downStands = station.getNormalStand(mapConfig.isRight(false)); //下行取消紧停
//输入 List<VirtualRealityIbp.IbpElement> qxjt = vrIbp.query(VirtualRealityIbp.Mean.QXJJTC, false);
if (r_xx_jjtc) qxjt.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_qxjt));
downStands.forEach(stand -> ciApiService.standEC(simulation, stand)); //下行扣车
if (r_xx_qxjt) List<VirtualRealityIbp.IbpElement> kc = vrIbp.query(VirtualRealityIbp.Mean.KC, false);
downStands.forEach(stand -> ciApiService.cancelStandEC(simulation, stand)); kc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_kc));
if (r_xx_kc) { //下行取消扣车
for (Stand stand : downStands) { List<VirtualRealityIbp.IbpElement> qxkc = vrIbp.query(VirtualRealityIbp.Mean.ZZKC, false);
if (!stand.isIbpHoldTrain()) { qxkc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_qxkc));
ciApiService.ibpHoldTrain(simulation, stand.getCode()); //上行紧急停车
} List<VirtualRealityIbp.IbpElement> sxjjtc = vrIbp.query(VirtualRealityIbp.Mean.JJTC, true);
} sxjjtc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_jjtc));
} //上行取消紧停
if (r_xx_qxkc) List<VirtualRealityIbp.IbpElement> sxqxjt = vrIbp.query(VirtualRealityIbp.Mean.QXJJTC, true);
downStands.forEach(stand -> ciApiService.ibpHoldTrainCancel(simulation, stand.getCode())); sxqxjt.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_qxjt));
if (r_sx_jjtc) //上行扣车
upStands.forEach(stand -> ciApiService.standEC(simulation, stand)); List<VirtualRealityIbp.IbpElement> sxkc = vrIbp.query(VirtualRealityIbp.Mean.KC, true);
if (r_sx_qxjt) sxkc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_kc));
upStands.forEach(stand -> ciApiService.cancelStandEC(simulation, stand)); //上行取消扣车
if (r_sx_kc) { List<VirtualRealityIbp.IbpElement> sxqxkc = vrIbp.query(VirtualRealityIbp.Mean.ZZKC, true);
for (Stand stand : upStands) { sxqxkc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_qxkc));
if (!stand.isIbpHoldTrain()) { //试灯
ciApiService.ibpHoldTrain(simulation, stand.getCode()); List<VirtualRealityIbp.IbpElement> sd = vrIbp.queryByMean(VirtualRealityIbp.Mean.SD);
} sd.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sd));
} //下行允许禁止钥匙
} List<VirtualRealityIbp.IbpElement> ibpElements = vrIbp.queryByMean(VirtualRealityIbp.Mean.XXYS);
if (r_sx_qxkc)
upStands.forEach(stand -> ciApiService.ibpHoldTrainCancel(simulation, stand.getCode()));
VirtualRealityIbp vrIbp = station.getVrIbp();
List<VirtualRealityIbp.IbpElement> ibpElements = vrIbp.queryByMean(VirtualRealityIbp.Mean.SXYS);
ibpElements.forEach(ibpElement -> ibpElement.setOn(r_sx_czyx)); ibpElements.forEach(ibpElement -> ibpElement.setOn(r_sx_czyx));
//输出 /*------------------------- 输出 -------------------------*/
if (r_sd) { boolean xxkcd = vrIbp.query(VirtualRealityIbp.Mean.kcLight, false).stream()
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, true, channel); .allMatch(VirtualRealityIbp.IbpElement::isOn);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, true, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, xxkcd, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, true, channel); boolean sxkcd = vrIbp.query(VirtualRealityIbp.Mean.kcLight, true).stream()
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, true, channel); .allMatch(VirtualRealityIbp.IbpElement::isOn);
} else { plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, sxkcd, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_fmq(), w_fmq, false, channel); boolean xxjjtcd = vrIbp.query(VirtualRealityIbp.Mean.jjtcLight, false).stream()
boolean upHoldTrain = upStands.stream().anyMatch(Stand::isIbpHoldTrain); .allMatch(VirtualRealityIbp.IbpElement::isOn);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, upHoldTrain, channel); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, xxjjtcd, channel);
boolean upEc = upStands.stream().anyMatch(Stand::isEmergencyClosed); boolean sxjjtcd = vrIbp.query(VirtualRealityIbp.Mean.jjtcLight, true).stream()
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, upEc, channel); .allMatch(VirtualRealityIbp.IbpElement::isOn);
boolean downHoldTrain = downStands.stream().anyMatch(Stand::isIbpHoldTrain); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, sxjjtcd, channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, downHoldTrain, channel); // //输出
boolean downEc = downStands.stream().anyMatch(Stand::isEmergencyClosed); // if (r_sd) {
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, downEc, channel); // plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, true, channel);
} // plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, true, channel);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, true, channel);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, true, channel);
// } else {
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_fmq(), w_fmq, false, channel);
// boolean upHoldTrain = upStands.stream().anyMatch(Stand::isIbpHoldTrain);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, upHoldTrain, channel);
// boolean upEc = upStands.stream().anyMatch(Stand::isEmergencyClosed);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, upEc, channel);
// boolean downHoldTrain = downStands.stream().anyMatch(Stand::isIbpHoldTrain);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, downHoldTrain, channel);
// boolean downEc = downStands.stream().anyMatch(Stand::isEmergencyClosed);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, downEc, channel);
// }
//ISCS状态 //ISCS状态
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository(); SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
String iscsCode = configVO.getIscsCode(); String iscsCode = configVO.getIscsCode();

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor; package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor;
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService; import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsPslStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsPslStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
@ -20,6 +20,9 @@ public class ZjdPslServiceImpl implements RealDeviceService {
@Autowired @Autowired
private CiStandService standService; private CiStandService standService;
@Autowired
private IVirtualRealityPslService iVirtualRealityPslService;
@Override @Override
public boolean canHandle(RealDeviceConfig deviceConfig) { public boolean canHandle(RealDeviceConfig deviceConfig) {
return deviceConfig instanceof ZjdPslConfig; return deviceConfig instanceof ZjdPslConfig;
@ -40,12 +43,13 @@ public class ZjdPslServiceImpl implements RealDeviceService {
boolean r_sx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_gm()); boolean r_sx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_gm());
boolean r_sx_hsjc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_hsjc()); boolean r_sx_hsjc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_hsjc());
//信号系统状态 //信号系统状态
Stand stand = (Stand) config.getMapElement(); VirtualRealityPsl vrPsl = (VirtualRealityPsl) config.getMapElement();
if (stand != null) { if (vrPsl == null)
VirtualRealityPsl vrPsl = stand.getVrPsl(); return;
vrPsl.setYxjzKey(r_sx_czyx); iVirtualRealityPslService.updateStatus(simulation, vrPsl, VirtualRealityPsl.Button.YXJZ, r_sx_czyx);
standService.setOrCancelInterlockRelease(simulation, stand, r_sx_hsjc); iVirtualRealityPslService.updateStatus(simulation, vrPsl, VirtualRealityPsl.Button.KM, r_sx_km);
} iVirtualRealityPslService.updateStatus(simulation, vrPsl, VirtualRealityPsl.Button.GM, r_sx_gm);
iVirtualRealityPslService.updateStatus(simulation, vrPsl, VirtualRealityPsl.Button.HSJC, r_sx_hsjc);
//ISCS状态 //ISCS状态
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository(); SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
String iscsCode = configVO.getIscsCode(); String iscsCode = configVO.getIscsCode();

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.onboard.ATO.service;
import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService; import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode; import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
@ -386,7 +387,7 @@ public class ATOService {
} else { } else {
this.openTrainDoor(simulation, train, train.getDoor1()); this.openTrainDoor(simulation, train, train.getDoor1());
} }
this.ciApiService.openScreenDoor(simulation, stand.getCode()); this.ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.SIG);
} }
} }
@ -407,7 +408,7 @@ public class ATOService {
this.closeTrainDoor(simulation, train, train.getDoor2()); this.closeTrainDoor(simulation, train, train.getDoor2());
} }
for (Stand stand : standList) { for (Stand stand : standList) {
this.ciApiService.closeScreenDoor(simulation, stand.getCode()); this.ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.SIG);
} }
} }

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.onboard.ATP; package club.joylink.rtss.simulation.cbtc.onboard.ATP;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode; import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
@ -310,7 +311,7 @@ public class ATPService {
} }
if (train.isCommunicable()) { if (train.isCommunicable()) {
for (Stand stand : standList) { for (Stand stand : standList) {
this.ciApiService.openScreenDoor(simulation, stand.getCode()); this.ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.SIG);
} }
} }
} else { } else {
@ -320,7 +321,7 @@ public class ATPService {
} }
if (train.isCommunicable()) { if (train.isCommunicable()) {
for (Stand stand : standList) { for (Stand stand : standList) {
this.ciApiService.closeScreenDoor(simulation, stand.getCode()); this.ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.SIG);
} }
} }
} }

View File

@ -10,10 +10,7 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class ZjdIbpConfigVO extends RealConfigVO { public class ZjdIbpConfigVO extends RealConfigVO {
/** private String ibpCode = "Station25166_IBP";
* ibp盘绑定的车站
*/
private String stationCode = "Station25166";
private String iscsCode = "ibp"; private String iscsCode = "ibp";
@ -93,7 +90,6 @@ public class ZjdIbpConfigVO extends RealConfigVO {
*/ */
private Integer w_sx_kcd = 23; private Integer w_sx_kcd = 23;
/** 操作允许 */ /** 操作允许 */
private Integer r_sx_czyx = 77; private Integer r_sx_czyx = 77;

View File

@ -10,7 +10,7 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class ZjdPslConfigVO extends RealConfigVO { public class ZjdPslConfigVO extends RealConfigVO {
private String standCode = "PF59020"; private String pslCode = "PF59020_PSL";
private String iscsCode = "psl"; private String iscsCode = "psl";