泰国沙盘改动(删除测试用的逻辑)

This commit is contained in:
joylink_zhangsai 2023-07-11 15:14:56 +08:00
parent 2a08dab6c9
commit ecdf9fdc84

View File

@ -3,7 +3,6 @@ package club.joylink.rtss.simulation.cbtc.device.real.udp.thailand.service;
import club.joylink.rtss.constants.ProjectCode;
import club.joylink.rtss.constants.ProjectDeviceType;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
@ -14,7 +13,6 @@ import club.joylink.rtss.simulation.cbtc.device.real.udp.thailand.config.Thailan
import io.netty.buffer.ByteBuf;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -35,26 +33,26 @@ public class ThailandSectionServiceImpl implements UDPRealDeviceService {
@Override
public void run(Simulation simulation, UDPLowConfig udpLowConfig, RealDeviceConfig realDevice) {
// TODO: 2023/7/5 模拟计轴占压数据
List<VirtualRealityTrain> trainList = simulation.getRepository().getOnlineTrainList();
LocalDateTime now = LocalDateTime.now();
for (VirtualRealityTrain train : trainList) {
LocalDateTime time = map.computeIfAbsent(train, K -> now.plusSeconds(7));
Section section = train.getHeadPosition().getSection();
VirtualRealitySectionAxleCounter currentAxle = section.findAxle();
if (!train.isStop() && !now.isBefore(time)) {
Section nextSection = section.getNextRunningSectionOf(train.isRight());
if (nextSection == null) {
continue;
}
VirtualRealitySectionAxleCounter nextAxle = nextSection.findAxle();
if (nextAxle != currentAxle) {
nextAxle.occupied(train.isRight());
currentAxle.setOccupy(false);
}
map.put(train, time.plusSeconds(7));
}
}
//本地测试模拟计轴占用
// List<VirtualRealityTrain> trainList = simulation.getRepository().getOnlineTrainList();
// LocalDateTime now = LocalDateTime.now();
// for (VirtualRealityTrain train : trainList) {
// LocalDateTime time = map.computeIfAbsent(train, K -> now.plusSeconds(7));
// Section section = train.getHeadPosition().getSection();
// VirtualRealitySectionAxleCounter currentAxle = section.findAxle();
// if (!train.isStop() && !now.isBefore(time)) {
// Section nextSection = section.getNextRunningSectionOf(train.isRight());
// if (nextSection == null) {
// continue;
// }
// VirtualRealitySectionAxleCounter nextAxle = nextSection.findAxle();
// if (nextAxle != currentAxle) {
// nextAxle.occupied(train.isRight());
// currentAxle.setOccupy(false);
// }
// map.put(train, time.plusSeconds(7));
// }
// }
}
@Override