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

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 {
/**
* 道岔设置临时限速
* @param simulation
* @param aSwitch
* @param limitSpeed
*/
public void setSwitchLimitSpeed(Simulation simulation, Switch aSwitch, int 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) {
if (section.isSwitchTrack()) {
@ -39,9 +33,9 @@ public class TempSpeedLimitService {
logic.setSpeedUpLimit(limitSpeed);
}
} else {
if(section.isSectionOfCross()){
if (section.isSectionOfCross()) {
section.getParent().setSpeedUpLimit(limitSpeed);
}else{
} else {
section.setSpeedUpLimit(limitSpeed);
}
}

View File

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

View File

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

View File

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

View File

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