列车ITC级别运行相关逻辑完善
This commit is contained in:
parent
38da1d716c
commit
884b312623
@ -111,15 +111,12 @@ public class MaService {
|
||||
|
||||
public float calculateDistanceOfEbTriggerEnd() {
|
||||
if (this.type.equals(MaType.ITC_Signal)) {
|
||||
Signal signal = (Signal) this.device;
|
||||
boolean right = this.train.isRight();
|
||||
if (signal.isNormalOpen()) {
|
||||
Float distance = CalculateService.calculateDistance(this.train.getHeadPosition(), this.eoaPosition, right);
|
||||
if (distance == null) {
|
||||
distance = 0f;
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
} else if (this.type.equals(MaType.Limit_Signal_Without_Overlap)) {
|
||||
Signal signal = (Signal) this.device;
|
||||
if (signal.getSection().isJustTurnBackTrack()) {
|
||||
@ -137,7 +134,7 @@ public class MaService {
|
||||
this.type.equals(MaType.ITC_Signal)) {
|
||||
Signal signal = (Signal) this.device;
|
||||
SectionPosition sectionPosition = new SectionPosition(signal.getSection(), signal.getOffset());
|
||||
SectionPosition end = CalculateService.calculateNextPositionByStartAndLen(sectionPosition, !right, 2);
|
||||
SectionPosition end = CalculateService.calculateNextPositionByStartAndLen(sectionPosition, !right, 5);
|
||||
Float distance = CalculateService.calculateDistance(this.train.getHeadPosition(), end, right);
|
||||
if (distance == null) {
|
||||
return 0;
|
||||
@ -341,7 +338,7 @@ public class MaService {
|
||||
if (signal != null) { // 车头所在区段前方信号机开放
|
||||
if (signal.isNormalOpen()) {
|
||||
Float distance = CalculateService.calculateDistance(headPosition, new SectionPosition(section, signal.getOffset()), right);
|
||||
if (distance != null && distance > 0 && distance < 2) { // 此处距离为暂时的估计值,
|
||||
if (distance != null) { // 此处距离为暂时的估计值,
|
||||
Route lockedRoute = signal.getLockedRoute();
|
||||
if (lockedRoute != null) { // 进路存在,取进路终端信号机,结束
|
||||
signal = lockedRoute.getDestination();
|
||||
|
@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -16,6 +17,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 应答器信号发射
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ResponderService {
|
||||
|
||||
@ -56,6 +58,7 @@ public class ResponderService {
|
||||
if (!CollectionUtils.isEmpty(responders)) {
|
||||
for (Responder responder : responders) {
|
||||
if (responder.isBetween(headPosition, headPositionNew)) { // 列车经过应答器
|
||||
log.debug(String.format("列车[%s]经过应答器[%s]", train.getGroupNumber(), responder.debugStr()));
|
||||
train.viaResponder(responder);
|
||||
if (!train.isCommunicable() &&
|
||||
(responder.isIB() || responder.isVB())) {
|
||||
|
@ -423,8 +423,11 @@ public class AtsTrainLoadService {
|
||||
this.ciLogicLoop.routeLogic(simulation);
|
||||
MapConfig config = simulation.getRepository().getConfig();
|
||||
if (RunLevel.ITC.equals(config.getRunMode())) {
|
||||
loadedList.forEach(train -> {
|
||||
for (VirtualRealityTrain train : simulation.getRepository().getAllVrTrain()) {
|
||||
train.setCommunication(false);
|
||||
train.setNoCommunicateDevice(true);
|
||||
}
|
||||
loadedList.forEach(train -> {
|
||||
this.maService.calculateAndUpdateItcMa(simulation, train);
|
||||
});
|
||||
}
|
||||
|
@ -1203,6 +1203,11 @@ public class MapDeviceBuilder {
|
||||
for (Signal signal : signalList) {
|
||||
Responder responder = responderMap.get(signal.getCode());
|
||||
if (responder == null) {
|
||||
Section section = signal.getSection();
|
||||
if (section.isNormalStandTrack()) {
|
||||
errMsgList.add(String.format("没有关联信号机[%s(%s)]的主应答器(VB)",
|
||||
signal.getName(), signal.getCode()));
|
||||
}
|
||||
log.warn(String.format("信号机[%s]没有主应答器", signal.debugStr()));
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ public class Signal extends MayOutOfOrderDevice {
|
||||
|
||||
public SectionPosition getItcMaCalPosition() {
|
||||
if (this.itcMaCalPosition == null) {
|
||||
this.itcMaCalPosition = new SectionPosition(this.section, this.right ? this.getOffset() - 2 : this.offset + 2);
|
||||
this.itcMaCalPosition = new SectionPosition(this.section, this.right ? this.getOffset() - 1 : this.offset + 1);
|
||||
}
|
||||
return itcMaCalPosition;
|
||||
}
|
||||
|
@ -102,6 +102,10 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
|
||||
// -----------列车运行属性-----------
|
||||
|
||||
/**
|
||||
* 是否没有通信设备
|
||||
*/
|
||||
private boolean noCommunicateDevice;
|
||||
/**
|
||||
* 车载服务通讯是否正常在线
|
||||
*/
|
||||
@ -425,7 +429,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
private boolean released;
|
||||
|
||||
public void setCommunication(boolean communication) {
|
||||
if ((Fault.COMMUNICATION_ABNORMAL.equals(this.fault) || !atpOn) && communication)
|
||||
if ((Fault.COMMUNICATION_ABNORMAL.equals(this.fault) || !atpOn || this.noCommunicateDevice) && communication)
|
||||
return;
|
||||
this.communication = communication;
|
||||
}
|
||||
@ -480,6 +484,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.noCommunicateDevice = false;
|
||||
this.communication = true;
|
||||
this.runLevel = null;
|
||||
this.driveMode = null;
|
||||
|
@ -190,6 +190,7 @@ public class VRTrainRunningService {
|
||||
if (section.equals(headPositionNew.getSection())) {
|
||||
Signal signal = section.getSignalOf(right);
|
||||
if (signal != null && signal.getItcMaCalPosition().isBetween(headPosition, headPositionNew)) {
|
||||
log.debug(String.format("列车[%s]触发ITC-MA计算并更新逻辑(无应答器线路)", train.getGroupNumber()));
|
||||
this.maService.calculateAndUpdateItcMa(simulation, train);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class SpeedCurve {
|
||||
|
||||
public static SpeedCurve calculateAtoStopCurveAndUpdate(VirtualRealityTrain train, MaService.Ma ma) {
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
SectionPosition tailPosition = train.getTailPosition();
|
||||
SectionPosition tailPosition = train.calculateTailPosition();
|
||||
boolean right = train.isRight();
|
||||
float stopDistance = ma.calculateDistanceOfAtoEnd();
|
||||
float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f);
|
||||
|
@ -85,6 +85,20 @@ public class ATPLogicLoop {
|
||||
}
|
||||
|
||||
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (train.isReleased()) {
|
||||
if (!simulation.getRepository().hasResponder()) { // 没有应答器
|
||||
// 列车处于释放中,如果列车车头已经跨过信号机还没有更新ITC-MA,触发EB
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
SectionPosition tailPosition = train.calculateTailPosition();
|
||||
Signal signal = headPosition.getSection().getSignalOf(train.isRight());
|
||||
if (signal != null) {
|
||||
if (new SectionPosition(signal.getSection(), signal.getOffset()).isBetween(headPosition, tailPosition)) {
|
||||
this.atpService.triggerSignalEB(train);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
MaService.Ma ma2 = train.getMa2();
|
||||
// ITC级别列车停车手动释放操作判断
|
||||
if (train.isStop() && train.isITC() && train.isAtoOn() && ma2 != null && !train.isReleased()) {
|
||||
|
@ -35,6 +35,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
@Override
|
||||
public void updateCtcMa(Simulation simulation, MaService.Ma ma) {
|
||||
VirtualRealityTrain train = ma.getTrain();
|
||||
// log.debug(String.format("列车[%s]更新CTC-MA: %s", train.getGroupNumber(), ma.debugStr()));
|
||||
SpeedCurve.calculateAndUpdate(simulation, train, ma);
|
||||
train.setCbtcMaMissDuration(0);
|
||||
}
|
||||
@ -44,7 +45,11 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
if (ma == null) {
|
||||
return;
|
||||
}
|
||||
if (train.isCommunicable()) {
|
||||
log.debug(String.format("列车[%s]是通信车,不更新ITC-MA", train.getGroupNumber()));
|
||||
}
|
||||
if (!train.isCommunicable()) {
|
||||
log.debug(String.format("列车[%s]更新ITC-MA: %s", train.getGroupNumber(), ma.debugStr()));
|
||||
boolean update = SpeedCurve.calculateAndUpdate(simulation, train, ma);
|
||||
if (train.isIL()) {
|
||||
train.setITCMode();
|
||||
|
Loading…
Reference in New Issue
Block a user