新增:PSL盘逻辑
This commit is contained in:
parent
a93937c582
commit
1d103955ce
@ -3,6 +3,7 @@ package club.joylink.rtss.controller.simulation;
|
|||||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.IVirtualRealityIbpService;
|
import club.joylink.rtss.services.IVirtualRealityIbpService;
|
||||||
|
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
|
||||||
import club.joylink.rtss.services.simulation.SimulationSupportService;
|
import club.joylink.rtss.services.simulation.SimulationSupportService;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
|
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;
|
||||||
@ -13,6 +14,7 @@ import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
|
|||||||
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.vo.SimulationVO;
|
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
@ -22,6 +24,7 @@ import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
|||||||
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
|
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
|
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||||
@ -59,6 +62,9 @@ public class SimulationV1Controller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SimulationSupportService simulationSupportService;
|
private SimulationSupportService simulationSupportService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVirtualRealityPslService iVirtualRealityPslService;
|
||||||
|
|
||||||
@ApiOperation(value = "根据产品类型创建仿真")
|
@ApiOperation(value = "根据产品类型创建仿真")
|
||||||
@GetMapping("")
|
@GetMapping("")
|
||||||
public String simulation(Long mapId, String prdType,
|
public String simulation(Long mapId, String prdType,
|
||||||
@ -324,4 +330,17 @@ public class SimulationV1Controller {
|
|||||||
public List<String> queryEstablishedRoutes(@PathVariable String group, @PathVariable String groupNumber) {
|
public List<String> queryEstablishedRoutes(@PathVariable String group, @PathVariable String groupNumber) {
|
||||||
return simulationSupportService.queryEstablishedRoutes(group, groupNumber);
|
return simulationSupportService.queryEstablishedRoutes(group, groupNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------- PSL盘接口 ----------------------- */
|
||||||
|
@ApiOperation("获取PSL盘状态")
|
||||||
|
@GetMapping("/{group}/{standCode}/psl/status")
|
||||||
|
public PslStatus getPslStatus(@PathVariable String group, @PathVariable String standCode) {
|
||||||
|
return iVirtualRealityPslService.getStatus(group, standCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("按下IBP盘按钮")
|
||||||
|
@PutMapping("/{group}/{standCode}/psl/{button}")
|
||||||
|
public void pressPslButton(@PathVariable String group, @PathVariable String standCode, @PathVariable VirtualRealityPsl.Button button) {
|
||||||
|
iVirtualRealityPslService.pressTheButton(group, standCode, button);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package club.joylink.rtss.services.psl;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
|
|
||||||
|
public interface IVirtualRealityPslService {
|
||||||
|
|
||||||
|
PslStatus getStatus(String group, String standCode);
|
||||||
|
|
||||||
|
void pressTheButton(String group, String standCode, VirtualRealityPsl.Button button);
|
||||||
|
|
||||||
|
void addJobs(Simulation simulation);
|
||||||
|
}
|
@ -0,0 +1,133 @@
|
|||||||
|
package club.joylink.rtss.services.psl;
|
||||||
|
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||||
|
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.Stand;
|
||||||
|
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.vr.VirtualRealityIbp;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.event.SimulationIbpStatusEvent;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class VirtualRealityPslService implements IVirtualRealityPslService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GroupSimulationService groupSimulationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PslStatus getStatus(String group, String standCode) {
|
||||||
|
Simulation simulation = groupSimulationService.getSimulationByGroup(group);
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
Map<String, PslStatus> pslStatusMap = repository.getPslStatusMap();
|
||||||
|
PslStatus status = pslStatusMap.get(standCode);
|
||||||
|
if (status != null) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
Stand stand = repository.getByCode(standCode, Stand.class);
|
||||||
|
VirtualRealityPsl vrPsl = makeSureIbpExistAndCollectStatus(stand);
|
||||||
|
status = new PslStatus(vrPsl);
|
||||||
|
pslStatusMap.put(standCode, status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pressTheButton(String group, String standCode, VirtualRealityPsl.Button button) {
|
||||||
|
Simulation simulation = groupSimulationService.getSimulationByGroup(group);
|
||||||
|
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||||
|
VirtualRealityPsl vrPsl = makeSureIbpExistAndCollectStatus(stand);
|
||||||
|
PSD psd = stand.getPsd();
|
||||||
|
VirtualRealityScreenDoor vrPsd = psd.getVirtualScreenDoor();
|
||||||
|
switch (button) {
|
||||||
|
case YXJZ:
|
||||||
|
vrPsl.setYxjzKey(!vrPsl.isYxjzKey());
|
||||||
|
vrPsd.setPslControl(vrPsl.isYxjzKey());
|
||||||
|
break;
|
||||||
|
case HSJC:
|
||||||
|
vrPsl.setHsjcKey(!vrPsl.isHsjcKey());
|
||||||
|
vrPsd.setInterlockRelease(vrPsl.isHsjcKey());
|
||||||
|
break;
|
||||||
|
case KM:
|
||||||
|
// vrPsl.setKmButton(!vrPsl.isKmButton());
|
||||||
|
// if (vrPsl.isKmButton())
|
||||||
|
if (vrPsd.isLockAndClose())
|
||||||
|
vrPsd.startSetting(true);
|
||||||
|
break;
|
||||||
|
case GM:
|
||||||
|
// vrPsl.setGmButton(!vrPsl.isGmButton());
|
||||||
|
// if (vrPsl.isGmButton())
|
||||||
|
if (vrPsd.isOpen2End())
|
||||||
|
vrPsd.startSetting(false);
|
||||||
|
break;
|
||||||
|
case SD:
|
||||||
|
vrPsl.setSdButton(!vrPsl.isSdButton());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addJobs(Simulation simulation) {
|
||||||
|
simulation.addJobIfAbsent(Simulation.JobName.pslStatus,
|
||||||
|
() -> this.collectAndDispatcher(simulation), SimulationConstants.PSL_STATUS_COLLECT_RATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void collectAndDispatcher(Simulation simulation) {
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap();
|
||||||
|
Map<String, PslStatus> collectionMap = new HashMap<>();
|
||||||
|
for (Stand stand : repository.getStandList()) {
|
||||||
|
if (stand.getVrPsl() == null)
|
||||||
|
continue;
|
||||||
|
VirtualRealityPsl vrPsl = this.collectStatus(stand);
|
||||||
|
PslStatus pslStatus = ibpStatusMap.get(stand.getCode());
|
||||||
|
if (pslStatus == null) {
|
||||||
|
PslStatus newStatus = new PslStatus(vrPsl);
|
||||||
|
ibpStatusMap.put(stand.getCode(), newStatus);
|
||||||
|
collectionMap.put(stand.getCode(), newStatus);
|
||||||
|
} else {
|
||||||
|
PslStatus difference = pslStatus.collectDifference(vrPsl);
|
||||||
|
if (difference != null) {
|
||||||
|
collectionMap.put(stand.getCode(), difference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(collectionMap)) {
|
||||||
|
applicationContext.publishEvent(new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualRealityPsl makeSureIbpExistAndCollectStatus(Stand stand) {
|
||||||
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(stand.getPsd(), "该站台没有屏蔽门");
|
||||||
|
if (stand.getVrPsl() == null)
|
||||||
|
stand.setVrPsl(new VirtualRealityPsl());
|
||||||
|
return collectStatus(stand);
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualRealityPsl collectStatus(Stand stand) {
|
||||||
|
VirtualRealityPsl vrPsl = stand.getVrPsl();
|
||||||
|
PSD psd = stand.getPsd();
|
||||||
|
vrPsl.setPslczLight(vrPsl.isSdButton() || vrPsl.isYxjzKey());
|
||||||
|
vrPsl.setHsjcLight(vrPsl.isSdButton() || vrPsl.isHsjcKey());
|
||||||
|
vrPsl.setKmLight(vrPsl.isSdButton() || !psd.isCloseAndLock());
|
||||||
|
vrPsl.setGmLight(vrPsl.isSdButton() || psd.isCloseAndLock());
|
||||||
|
return vrPsl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -646,5 +646,6 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
|||||||
String queryDeviceStatus = "queryDeviceStatus";
|
String queryDeviceStatus = "queryDeviceStatus";
|
||||||
String UpdateDeviceStatusByCollection = "UpdateDeviceStatusByCollection";
|
String UpdateDeviceStatusByCollection = "UpdateDeviceStatusByCollection";
|
||||||
String commandExecuteRun = "commandExecuteRun";
|
String commandExecuteRun = "commandExecuteRun";
|
||||||
|
String pslStatus = "pslStatus";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc;
|
package club.joylink.rtss.simulation.cbtc;
|
||||||
|
|
||||||
import club.joylink.rtss.services.IVirtualRealityIbpService;
|
import club.joylink.rtss.services.IVirtualRealityIbpService;
|
||||||
|
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
|
||||||
import club.joylink.rtss.simulation.SimulationManager;
|
import club.joylink.rtss.simulation.SimulationManager;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATP.ground.ZCLogicLoop;
|
import club.joylink.rtss.simulation.cbtc.ATP.ground.ZCLogicLoop;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.ATSLogicLoop;
|
import club.joylink.rtss.simulation.cbtc.ATS.ATSLogicLoop;
|
||||||
@ -93,6 +94,9 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SimulationManager simulationManager;
|
private SimulationManager simulationManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVirtualRealityPslService iVirtualRealityPslService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Simulation create(SimulationBuildParams params, String group) {
|
public Simulation create(SimulationBuildParams params, String group) {
|
||||||
// 构建仿真
|
// 构建仿真
|
||||||
@ -125,6 +129,7 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic
|
|||||||
iVirtualRealityIbpService.addJobs(simulation);
|
iVirtualRealityIbpService.addJobs(simulation);
|
||||||
powerSupplyService.addJobs(simulation);
|
powerSupplyService.addJobs(simulation);
|
||||||
robotLogicLoop.addJobs(simulation);
|
robotLogicLoop.addJobs(simulation);
|
||||||
|
iVirtualRealityPslService.addJobs(simulation);
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// simulationRealDeviceConnectManager.addJobs(simulation);
|
// simulationRealDeviceConnectManager.addJobs(simulation);
|
||||||
|
@ -39,6 +39,7 @@ import club.joylink.rtss.simulation.cbtc.script.ScriptActionBO;
|
|||||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO;
|
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO;
|
import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO;
|
||||||
@ -799,6 +800,14 @@ public class SimulationMainThread {
|
|||||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventListener
|
||||||
|
public void simulationPslStatus(SimulationPslStatusEvent event) {
|
||||||
|
Simulation simulation = event.getSimulation();
|
||||||
|
SocketMessageVO<Map<String, PslStatus>> message =
|
||||||
|
SocketMessageFactory.buildSimulationPslStatusMessage(simulation.getId(), event.getStatusMap());
|
||||||
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
|
}
|
||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
public void handleDeviceFaultSetEvent(SimulationDeviceFaultSetEvent event) {
|
public void handleDeviceFaultSetEvent(SimulationDeviceFaultSetEvent event) {
|
||||||
Simulation simulation = event.getSimulation();
|
Simulation simulation = event.getSimulation();
|
||||||
|
@ -86,6 +86,9 @@ public interface SimulationConstants {
|
|||||||
/** IBP盘状态收集逻辑间隔 */
|
/** IBP盘状态收集逻辑间隔 */
|
||||||
int IBP_STATUS_COLLECT_RATE = 500;
|
int IBP_STATUS_COLLECT_RATE = 500;
|
||||||
|
|
||||||
|
/** PSL盘状态收集逻辑间隔 */
|
||||||
|
int PSL_STATUS_COLLECT_RATE = 500;
|
||||||
|
|
||||||
/** 接触网 */
|
/** 接触网 */
|
||||||
int POWER_SUPPLY_STATUS_UPDATE_RATE = 500;
|
int POWER_SUPPLY_STATUS_UPDATE_RATE = 500;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
|||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import club.joylink.rtss.util.StrUtils;
|
import club.joylink.rtss.util.StrUtils;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -74,6 +75,12 @@ public class SimulationDataRepository {
|
|||||||
*/
|
*/
|
||||||
private Map<String, IbpStatus> ibpStatusMap = new ConcurrentHashMap<>();
|
private Map<String, IbpStatus> ibpStatusMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PSL盘状态map
|
||||||
|
* key - standCode
|
||||||
|
*/
|
||||||
|
private Map<String, PslStatus> pslStatusMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列车驾驶HMI显示数据
|
* 列车驾驶HMI显示数据
|
||||||
* key-列车code
|
* key-列车code
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.data.map;
|
package club.joylink.rtss.simulation.cbtc.data.map;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
@ -59,6 +60,8 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
*/
|
*/
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
|
|
||||||
|
private VirtualRealityPsl vrPsl;
|
||||||
|
|
||||||
// -------------------------------状态属性---------------------------------
|
// -------------------------------状态属性---------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,6 +162,8 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
if (this.esp != null) {
|
if (this.esp != null) {
|
||||||
this.esp.reset();
|
this.esp.reset();
|
||||||
}
|
}
|
||||||
|
if (this.vrPsl != null)
|
||||||
|
this.vrPsl.reset();
|
||||||
this.trainParking = false;
|
this.trainParking = false;
|
||||||
this.remainTime = 0;
|
this.remainTime = 0;
|
||||||
this.stationHoldTrain = false;
|
this.stationHoldTrain = false;
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.data.vr;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class VirtualRealityPsl {
|
||||||
|
/** psl操作指示灯 */
|
||||||
|
private boolean pslczLight;
|
||||||
|
|
||||||
|
/** 互锁解除指示灯 */
|
||||||
|
private boolean hsjcLight;
|
||||||
|
|
||||||
|
/** 开门状态指示灯 */
|
||||||
|
private boolean kmLight;
|
||||||
|
|
||||||
|
/** 关门状态指示灯 */
|
||||||
|
private boolean gmLight;
|
||||||
|
|
||||||
|
/** 允许/禁止钥匙 */
|
||||||
|
private boolean yxjzKey;
|
||||||
|
|
||||||
|
/** 互锁解除钥匙 */
|
||||||
|
private boolean hsjcKey;
|
||||||
|
|
||||||
|
/** 开门按钮 */
|
||||||
|
private boolean kmButton;
|
||||||
|
|
||||||
|
/** 关门按钮 */
|
||||||
|
private boolean gmButton;
|
||||||
|
|
||||||
|
/** 试灯按钮 */
|
||||||
|
private boolean sdButton;
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
this.yxjzKey = false;
|
||||||
|
this.hsjcKey = false;
|
||||||
|
this.kmButton = false;
|
||||||
|
this.gmButton = false;
|
||||||
|
this.sdButton = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Button{
|
||||||
|
/** 允许/禁止钥匙 */
|
||||||
|
YXJZ,
|
||||||
|
/** 互锁解除钥匙 */
|
||||||
|
HSJC,
|
||||||
|
/** 开门按钮 */
|
||||||
|
KM,
|
||||||
|
/** 关门按钮 */
|
||||||
|
GM,
|
||||||
|
/** 试灯按钮 */
|
||||||
|
SD;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.event;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class SimulationPslStatusEvent extends AbstractSimulationEvent {
|
||||||
|
private Map<String, PslStatus> statusMap;
|
||||||
|
|
||||||
|
public SimulationPslStatusEvent(Object source, Simulation simulation, Map<String, PslStatus> statusMap) {
|
||||||
|
super(source, simulation);
|
||||||
|
this.statusMap = statusMap;
|
||||||
|
}
|
||||||
|
}
|
@ -49,6 +49,8 @@ public enum WebSocketMessageType {
|
|||||||
Simulation_DeviceStatus,
|
Simulation_DeviceStatus,
|
||||||
/** 仿真-IBP状态消息 */
|
/** 仿真-IBP状态消息 */
|
||||||
Simulation_IbpStatus,
|
Simulation_IbpStatus,
|
||||||
|
/** 仿真-PSL盘状态消息 */
|
||||||
|
Simulation_PslStatus,
|
||||||
/** 仿真-设备信息 */
|
/** 仿真-设备信息 */
|
||||||
Simulation_Device,
|
Simulation_Device,
|
||||||
/** 仿真-列车实际到发车站消息 */
|
/** 仿真-列车实际到发车站消息 */
|
||||||
|
@ -13,6 +13,7 @@ import club.joylink.rtss.simulation.cbtc.message.websocket.SimulationSubscribeTo
|
|||||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||||
import club.joylink.rtss.vo.client.passenger.PassengerFlowMessage2TD;
|
import club.joylink.rtss.vo.client.passenger.PassengerFlowMessage2TD;
|
||||||
|
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||||
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO;
|
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO;
|
import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO;
|
||||||
@ -78,6 +79,7 @@ public class SocketMessageFactory {
|
|||||||
case Simulation_Member:
|
case Simulation_Member:
|
||||||
case Simulation_DeviceStatus:
|
case Simulation_DeviceStatus:
|
||||||
case Simulation_IbpStatus:
|
case Simulation_IbpStatus:
|
||||||
|
case Simulation_PslStatus:
|
||||||
case Simulation_AutoFault_Trigger:
|
case Simulation_AutoFault_Trigger:
|
||||||
case Simulation_Error:
|
case Simulation_Error:
|
||||||
case Simulation_RunAsPlan_Start:
|
case Simulation_RunAsPlan_Start:
|
||||||
@ -252,6 +254,10 @@ public class SocketMessageFactory {
|
|||||||
return build(WebSocketMessageType.Simulation_IbpStatus, group, statusMap);
|
return build(WebSocketMessageType.Simulation_IbpStatus, group, statusMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SocketMessageVO<Map<String, PslStatus>> buildSimulationPslStatusMessage(String group, Map<String, PslStatus> statusMap) {
|
||||||
|
return build(WebSocketMessageType.Simulation_PslStatus, group, statusMap);
|
||||||
|
}
|
||||||
|
|
||||||
public static SocketMessageVO<Boolean> buildSimulationScenesReload(String group, boolean planRunning) {
|
public static SocketMessageVO<Boolean> buildSimulationScenesReload(String group, boolean planRunning) {
|
||||||
return build(WebSocketMessageType.Simulation_Scenes_Reload, group, planRunning);
|
return build(WebSocketMessageType.Simulation_Scenes_Reload, group, planRunning);
|
||||||
}
|
}
|
||||||
|
124
src/main/java/club/joylink/rtss/vo/client/psl/PslStatus.java
Normal file
124
src/main/java/club/joylink/rtss/vo/client/psl/PslStatus.java
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
package club.joylink.rtss.vo.client.psl;
|
||||||
|
|
||||||
|
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.VirtualRealityPsl;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PslStatus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* psl操作指示灯
|
||||||
|
*/
|
||||||
|
private Boolean pslczLight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 互锁解除指示灯
|
||||||
|
*/
|
||||||
|
private Boolean hsjcLight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开门状态指示灯
|
||||||
|
*/
|
||||||
|
private Boolean kmLight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关门状态指示灯
|
||||||
|
*/
|
||||||
|
private Boolean gmLight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许/禁止钥匙
|
||||||
|
*/
|
||||||
|
private Boolean yxjzKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 互锁解除钥匙
|
||||||
|
*/
|
||||||
|
private Boolean hsjcKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开门按钮
|
||||||
|
*/
|
||||||
|
private Boolean kmButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关门按钮
|
||||||
|
*/
|
||||||
|
private Boolean gmButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试灯按钮
|
||||||
|
*/
|
||||||
|
private Boolean sdButton;
|
||||||
|
|
||||||
|
public PslStatus(VirtualRealityPsl psl) {
|
||||||
|
this.pslczLight = psl.isPslczLight();
|
||||||
|
this.hsjcLight = psl.isHsjcLight();
|
||||||
|
this.kmLight = psl.isKmLight();
|
||||||
|
this.gmLight = psl.isGmLight();
|
||||||
|
this.yxjzKey = psl.isYxjzKey();
|
||||||
|
this.hsjcKey = psl.isHsjcKey();
|
||||||
|
this.kmButton = psl.isKmButton();
|
||||||
|
this.gmButton = psl.isGmButton();
|
||||||
|
this.sdButton = psl.isSdButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PslStatus collectDifference(VirtualRealityPsl psl) {
|
||||||
|
PslStatus pslStatus = new PslStatus();
|
||||||
|
boolean change = false;
|
||||||
|
if (!Objects.equals(this.pslczLight, psl.isPslczLight())) {
|
||||||
|
this.pslczLight = psl.isPslczLight();
|
||||||
|
pslStatus.setPslczLight(this.pslczLight);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.hsjcLight, psl.isHsjcLight())) {
|
||||||
|
this.hsjcLight = psl.isHsjcLight();
|
||||||
|
pslStatus.setHsjcLight(this.hsjcLight);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.kmLight, psl.isKmLight())) {
|
||||||
|
this.kmLight = psl.isKmLight();
|
||||||
|
pslStatus.setKmLight(this.kmLight);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.gmLight, psl.isGmLight())) {
|
||||||
|
this.gmLight = psl.isGmLight();
|
||||||
|
pslStatus.setGmLight(this.gmLight);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.yxjzKey, psl.isYxjzKey())) {
|
||||||
|
this.yxjzKey = psl.isYxjzKey();
|
||||||
|
pslStatus.setYxjzKey(this.yxjzKey);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.hsjcKey, psl.isHsjcKey())) {
|
||||||
|
this.hsjcKey = psl.isHsjcKey();
|
||||||
|
pslStatus.setHsjcKey(this.hsjcKey);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.kmButton, psl.isKmButton())) {
|
||||||
|
this.kmButton = psl.isKmButton();
|
||||||
|
pslStatus.setKmButton(this.kmButton);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.gmButton, psl.isGmButton())) {
|
||||||
|
this.gmButton = psl.isGmButton();
|
||||||
|
pslStatus.setGmButton(this.gmButton);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.sdButton, psl.isSdButton())) {
|
||||||
|
this.sdButton = psl.isSdButton();
|
||||||
|
pslStatus.setSdButton(this.sdButton);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
return change ? pslStatus : null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user