修改取消进路时延时解锁条件

This commit is contained in:
joylink_zhangsai 2021-01-26 18:41:51 +08:00
parent b678d3e103
commit bf326074ad
5 changed files with 13 additions and 15 deletions

View File

@ -13,9 +13,6 @@ import org.springframework.util.CollectionUtils;
public class TempSpeedLimitService { public class TempSpeedLimitService {
/** /**
* 道岔设置临时限速 * 道岔设置临时限速
* @param simulation
* @param aSwitch
* @param limitSpeed
*/ */
public void setSwitchLimitSpeed(Simulation simulation, Switch aSwitch, int limitSpeed) { public void setSwitchLimitSpeed(Simulation simulation, Switch aSwitch, int limitSpeed) {
aSwitch.getA().setSpeedUpLimit(limitSpeed); aSwitch.getA().setSpeedUpLimit(limitSpeed);
@ -25,9 +22,6 @@ public class TempSpeedLimitService {
/** /**
* 区段设置临时限速 * 区段设置临时限速
* @param simulation
* @param section
* @param limitSpeed
*/ */
public void setSectionLimitSpeed(Simulation simulation, Section section, int limitSpeed) { public void setSectionLimitSpeed(Simulation simulation, Section section, int limitSpeed) {
if (section.isSwitchTrack()) { if (section.isSwitchTrack()) {

View File

@ -370,6 +370,8 @@ public class AtsTrainService {
Long mapId = simulation.getBuildParams().getMap().getId(); Long mapId = simulation.getBuildParams().getMap().getId();
LocalTime systemTime = simulation.getSystemTime().toLocalTime(); LocalTime systemTime = simulation.getSystemTime().toLocalTime();
Section headSection = repository.getByCode(train.getPhysicalSection(), Section.class); Section headSection = repository.getByCode(train.getPhysicalSection(), Section.class);
float offset = train.getOffsetp() * headSection.getLen();
SectionPosition headPosition = new SectionPosition(headSection, offset);
Boolean trainRight = train.getRight(); Boolean trainRight = train.getRight();
TrainType type = train.getType(); TrainType type = train.getType();
String estimatedArriveStandTrack = train.getEstimatedArriveStandTrack(); String estimatedArriveStandTrack = train.getEstimatedArriveStandTrack();
@ -392,7 +394,6 @@ public class AtsTrainService {
switch (type) { switch (type) {
case MANUAL: { case MANUAL: {
Section base = headSection; Section base = headSection;
float offset = train.getOffsetp() * headSection.getLen();
boolean right = trainRight; boolean right = trainRight;
if (!CollectionUtils.isEmpty(headSection.getStandList())) { if (!CollectionUtils.isEmpty(headSection.getStandList())) {
Optional<Stand> onStand = headSection.getStandList().stream().filter(stand -> Objects.equals(stand.isRight(), train.getRight())).findFirst(); Optional<Stand> onStand = headSection.getStandList().stream().filter(stand -> Objects.equals(stand.isRight(), train.getRight())).findFirst();
@ -426,7 +427,6 @@ public class AtsTrainService {
} }
if (headSection.isNormalStandTrack() || headSection.isTransferTrack()) { if (headSection.isNormalStandTrack() || headSection.isTransferTrack()) {
float stopPointOffset = headSection.getStopPointByDirection(right); float stopPointOffset = headSection.getStopPointByDirection(right);
SectionPosition headPosition = new SectionPosition(headSection, offset);
SectionPosition standPosition = new SectionPosition(headSection, stopPointOffset); SectionPosition standPosition = new SectionPosition(headSection, stopPointOffset);
if (headPosition.isAheadOf(standPosition, right)) { if (headPosition.isAheadOf(standPosition, right)) {
base = headSection.getNextRunningSectionOf(right); base = headSection.getNextRunningSectionOf(right);
@ -620,9 +620,10 @@ public class AtsTrainService {
if (nextTarget.getCode().equals(estimatedArriveStandTrack)) { if (nextTarget.getCode().equals(estimatedArriveStandTrack)) {
return; return;
} }
MapStationRunLevelVO runLevel = simulation.getBuildParams().getMap().getRunLevelByStartAndEndSection(estimatedArriveStandTrack, nextTarget.getCode()); SectionPosition stopPosition = new SectionPosition(nextTarget, nextTarget.getStopPointByDirection(trainRight));
if (runLevel != null) { Float distance = CalculateService.calculateDistance(headPosition, stopPosition, trainRight);
runningTime = runLevel.getL3(); if (distance != null) {
runningTime = (int) (distance / (45 / 3.6));
} }
train.updateEstimatedArriveInfo(nextTarget, simulation.getSystemTime().plusSeconds(runningTime).toLocalTime()); train.updateEstimatedArriveInfo(nextTarget, simulation.getSystemTime().plusSeconds(runningTime).toLocalTime());
this.onboardAtpApiService.updateNextStation(simulation, train.getGroupNumber(), this.onboardAtpApiService.updateNextStation(simulation, train.getGroupNumber(),

View File

@ -205,7 +205,7 @@ public class Section extends MayOutOfOrderDevice {
private boolean faultLock; private boolean faultLock;
/** /**
* 最高限速 * 最高限速单位km/h
*/ */
private int speedUpLimit = -1; private int speedUpLimit = -1;

View File

@ -117,6 +117,7 @@ public class Switch extends MayOutOfOrderDevice {
this.reversePosition = false; this.reversePosition = false;
this.delayTime = 0; this.delayTime = 0;
this.noStatus = false; this.noStatus = false;
this.preReset = false;
} }
/** /**

View File

@ -66,6 +66,8 @@ public class SwitchStatus extends DeviceStatus {
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean preReset; private boolean preReset;
private int speedUpLimit;
/** /**
* 故障 * 故障
*/ */
@ -143,9 +145,9 @@ public class SwitchStatus extends DeviceStatus {
} }
if (!Objects.equals(this.fault, aSwitch.getFault())) { if (!Objects.equals(this.fault, aSwitch.getFault())) {
this.fault = (Switch.SwitchFault) aSwitch.getFault(); this.fault = (Switch.SwitchFault) aSwitch.getFault();
status.setFault(this.fault != null ? this.fault.name() : null);
change = true; change = true;
} }
status.setFault(this.fault != null ? this.fault.name() : null);
return change; return change;
} }