Merge remote-tracking branch 'origin/test' into wechat-micro2-login

This commit is contained in:
walker-sheng 2021-06-21 15:49:51 +08:00
commit e8373fc6e6
8 changed files with 116 additions and 76 deletions

View File

@ -100,6 +100,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
case JJTC: case JJTC:
element.setOn(true); element.setOn(true);
stands.forEach(stand -> ciApiService.standEC(simulation, stand)); stands.forEach(stand -> ciApiService.standEC(simulation, stand));
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(alarm -> alarm.setOn(true));
break; break;
case QXJJTC: case QXJJTC:
element.setOn(true); element.setOn(true);
@ -265,9 +266,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
case KM: case KM:
case AXLE_RESET: case AXLE_RESET:
case PRERESET_Z: case PRERESET_Z:
break;
case ALARM: case ALARM:
element.setOn(stands.stream().anyMatch(Stand::isEmergencyClosed));
break; break;
case kcLight: case kcLight:
element.setOn(stands.stream().anyMatch(Stand::isIbpHoldTrain)); element.setOn(stands.stream().anyMatch(Stand::isIbpHoldTrain));

View File

@ -178,13 +178,18 @@ public class AtpSectionService {
* @param sectionList * @param sectionList
*/ */
public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) { public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) {
if (!simulation.getRepository().getConfig().isNoARB()) { if (!section.isInvalid() && section.isNctOccupied()) {
if (!section.isInvalid() && section.isNctOccupied()) { if (!sectionList.contains(section)) {
if (!sectionList.contains(section)) { log.debug(String.format("区段[%s(%s)]检测为ARB故障",
log.debug(String.format("区段[%s(%s)]检测为ARB故障", section.getName(), section.getCode()));
section.getName(), section.getCode())); section.judgeAsInvalid();
section.judgeAsInvalid(); }
} }
//ARB故障判定
if (Section.AxleFault.ARB.equals(section.getFault())) {
section.setInvalid(true);
for (Section logic : section.getLogicList()) {
logic.setInvalid(true);
} }
} }
} }

View File

@ -126,20 +126,15 @@ public class ZCLogicLoop {
endList.add(end1); endList.add(end1);
return endList; return endList;
} }
// // 检查车头区段是否故障 // 检查车头区段是否故障
// if (headPosition.getSection().isFault()) { if (headPosition.getSection().isFault()) {
// endList.add(new MovementAuthority.End(headPosition.getSection(), MovementAuthority.EndType.FAULT_SECTION)); endList.add(new MovementAuthority.End(headPosition.getSection(), MovementAuthority.EndType.FAULT_SECTION));
// } }
// //非通信车占用区段
// if (section.isNonCbtcOccupy()) {
// endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
// return endList;
// }
//非通信车占用区段 //非通信车占用区段
MovementAuthority.End nctOccupied = checkNctOccupied(train, section); if (section.isNonCbtcOccupy()) {
if (nctOccupied != null) endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
endList.add(nctOccupied); return endList;
}
int count = 0; int count = 0;
while (count < 50) { while (count < 50) {
++count; ++count;
@ -184,16 +179,12 @@ public class ZCLogicLoop {
break; break;
} }
//非通信车占用区段 //非通信车占用区段
MovementAuthority.End end = checkNctOccupied(train, temp); if (temp.isNonCbtcOccupy()) {
if (end != null) SectionPosition headPosition1 = train.getHeadPosition();
endList.add(end); if (!temp.isSamePhysical(headPosition1.getSection().getCode())) {
// //非通信车占用区段 endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
// if (temp.isNonCbtcOccupy()) { }
// SectionPosition headPosition1 = train.getHeadPosition(); }
// if (!temp.isSamePhysical(headPosition1.getSection().getCode())) {
// endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
// }
// }
//检查关闭的区段 //检查关闭的区段
MovementAuthority.End cs = checkClosedSection(section); MovementAuthority.End cs = checkClosedSection(section);
if (cs != null) if (cs != null)
@ -221,20 +212,6 @@ public class ZCLogicLoop {
return endList; return endList;
} }
/**
* 检查非通信车占用的区段
*/
private MovementAuthority.End checkNctOccupied(VirtualRealityTrain train, Section section) {
if (train.isCBTC()) { //通信车
if (section.isNonCbtcOccupy() && !section.isInvalid())
return new MovementAuthority.End(section, MovementAuthority.EndType.NCT_OCCUPIED_SECTION);
} else { //非通信车
if (section.isNonCbtcOccupy())
return new MovementAuthority.End(section, MovementAuthority.EndType.NCT_OCCUPIED_SECTION);
}
return null;
}
private MovementAuthority.End checkClosedSection(Section section) { private MovementAuthority.End checkClosedSection(Section section) {
if (section.isClosed()) { if (section.isClosed()) {
return new MovementAuthority.End(section, MovementAuthority.EndType.CLOSED_SECTION); return new MovementAuthority.End(section, MovementAuthority.EndType.CLOSED_SECTION);
@ -306,11 +283,14 @@ public class ZCLogicLoop {
Section section = headPosition.getSection(); Section section = headPosition.getSection();
int count = 0; int count = 0;
while (Objects.nonNull(section) && count < 20) { while (Objects.nonNull(section) && count < 20) {
if (count > 1 && !CollectionUtils.isEmpty(endList))
break;
++count; ++count;
// 信号机 // 信号机
MovementAuthority.End signalEnd = checkGroundSignal(section, right); MovementAuthority.End signalEnd = checkGroundSignal(section, right);
if (Objects.nonNull(signalEnd)) { if (Objects.nonNull(signalEnd)) {
deviceEnd = signalEnd; endList.add(signalEnd);
// deviceEnd = signalEnd;
break; break;
} }
// 轨道尽头/问题道岔 // 轨道尽头/问题道岔
@ -318,15 +298,24 @@ public class ZCLogicLoop {
if (Objects.isNull(temp)) { // 到尽头 if (Objects.isNull(temp)) { // 到尽头
if (section.isSwitchTrack()) { // 问题道岔 if (section.isSwitchTrack()) { // 问题道岔
if (Objects.nonNull(section.getSectionOf(!right))) { if (Objects.nonNull(section.getSectionOf(!right))) {
deviceEnd = new MovementAuthority.End(section.getSectionOf(!right), endList.add(new MovementAuthority.End(section.getSectionOf(!right),
MovementAuthority.EndType.FAULT_SWITCH); MovementAuthority.EndType.FAULT_SWITCH));
// deviceEnd = new MovementAuthority.End(section.getSectionOf(!right),
// MovementAuthority.EndType.FAULT_SWITCH);
} }
} else { } else {
deviceEnd = new MovementAuthority.End(section, endList.add(new MovementAuthority.End(section,
MovementAuthority.EndType.END_TRACK); MovementAuthority.EndType.END_TRACK));
// deviceEnd = new MovementAuthority.End(section,
// MovementAuthority.EndType.END_TRACK);
} }
break; break;
} }
// else {
// if (temp.isNonCbtcOccupy() && temp.isInvalid()) {
// endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
// }
// }
section = temp; section = temp;
} }
if (Objects.nonNull(deviceEnd)) { if (Objects.nonNull(deviceEnd)) {

View File

@ -204,9 +204,6 @@ public class MapConfig {
/** 服务号的位数 */ /** 服务号的位数 */
private int figuresOfServiceNumber; private int figuresOfServiceNumber;
/** 没有ARB判定 */
private boolean noARB;
private Set<SimulationMember.Type> needConfirmConnectMembers = private Set<SimulationMember.Type> needConfirmConnectMembers =
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet()); Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet());
@ -254,7 +251,6 @@ public class MapConfig {
setDelayWhenCancelRouteWithAbnormalInterlock(configVO.isDelayWhenCancelRouteWithAbnormalInterlock()); setDelayWhenCancelRouteWithAbnormalInterlock(configVO.isDelayWhenCancelRouteWithAbnormalInterlock());
setFiguresOfTripNumber(configVO.getFiguresOfTripNumber()); setFiguresOfTripNumber(configVO.getFiguresOfTripNumber());
setFiguresOfServiceNumber(configVO.getFiguresOfServiceNumber()); setFiguresOfServiceNumber(configVO.getFiguresOfServiceNumber());
setNoARB(noARB);
} }
} }

View File

@ -12,6 +12,7 @@ import lombok.Setter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -593,12 +594,12 @@ public class Section extends MayOutOfOrderDevice {
//岔心解锁 //岔心解锁
if (this.parent != null && this.parent.isCross()) { if (this.parent != null && this.parent.isCross()) {
this.parent.setRouteLock(false); this.parent.setRouteLock(false);
this.parent.setOverlapLock(false); // this.parent.setOverlapLock(false);
this.parent.setLockRight(false); this.parent.setLockRight(false);
} }
//自身解锁 //自身解锁
this.routeLock = false; this.routeLock = false;
this.overlapLock = false; // this.overlapLock = false;
this.lockRight = false; this.lockRight = false;
if (!CollectionUtils.isEmpty(this.logicList)) { if (!CollectionUtils.isEmpty(this.logicList)) {
this.logicList.forEach(logic -> logic.routeUnlocking(right)); this.logicList.forEach(logic -> logic.routeUnlocking(right));
@ -727,20 +728,20 @@ public class Section extends MayOutOfOrderDevice {
if (!this.isAxleCounter()) { if (!this.isAxleCounter()) {
return; return;
} }
this.setInvalid(true); this.setNctOccupied(true);
if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段 if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段
List<Switch> relSwitchList = this.getRelSwitchList(); List<Switch> relSwitchList = this.getRelSwitchList();
for (Switch aSwitch : relSwitchList) { for (Switch aSwitch : relSwitchList) {
aSwitch.getA().setInvalid(true); aSwitch.getA().setNctOccupied(true);
if (aSwitch.isNormalPosition()) { if (aSwitch.isNormalPosition()) {
aSwitch.getB().setInvalid(true); aSwitch.getB().setNctOccupied(true);
aSwitch.getC().setInvalid(false); aSwitch.getC().setNctOccupied(false);
} else if (aSwitch.isReversePosition()) { } else if (aSwitch.isReversePosition()) {
aSwitch.getC().setInvalid(true); aSwitch.getC().setNctOccupied(true);
aSwitch.getB().setInvalid(false); aSwitch.getB().setNctOccupied(false);
} else { } else {
aSwitch.getB().setInvalid(true); aSwitch.getB().setNctOccupied(true);
aSwitch.getC().setInvalid(true); aSwitch.getC().setNctOccupied(true);
} }
} }
Section cross = queryCross(); Section cross = queryCross();
@ -749,7 +750,7 @@ public class Section extends MayOutOfOrderDevice {
} }
} else if (!CollectionUtils.isEmpty(this.logicList)) { } else if (!CollectionUtils.isEmpty(this.logicList)) {
for (Section logic : this.logicList) { for (Section logic : this.logicList) {
logic.setInvalid(true); logic.setNctOccupied(true);
} }
} }
@ -796,7 +797,7 @@ public class Section extends MayOutOfOrderDevice {
boolean leftSectionNctOccupied = leftSection.isNctOccupied() && leftSection.getParent().equals(this.parent); boolean leftSectionNctOccupied = leftSection.isNctOccupied() && leftSection.getParent().equals(this.parent);
Section rightSection = logic.getRightSection(); Section rightSection = logic.getRightSection();
boolean rightSectionNctOccupied = rightSection.isNctOccupied() && rightSection.getParent().equals(this.parent); boolean rightSectionNctOccupied = rightSection.isNctOccupied() && rightSection.getParent().equals(this.parent);
logic.setInvalid(leftSectionNctOccupied || rightSectionNctOccupied); logic.setNctOccupied(leftSectionNctOccupied || rightSectionNctOccupied);
}); });
} }
@ -1109,6 +1110,56 @@ public class Section extends MayOutOfOrderDevice {
} }
} }
} }
},
ARB {
@Override
public boolean apply(MayOutOfOrderDevice device) {
Section section = (Section) device;
List<Section> sections;
if (!section.isAxleCounter()) {
if (section.getParent() != null && section.getParent().isAxleCounter()) {
sections = Collections.singletonList(section.getParent());
} else if (!CollectionUtils.isEmpty(section.getLogicList())) {
sections = section.getLogicList();
} else {
sections = new ArrayList<>();
}
} else {
sections = Collections.singletonList(section);
}
boolean flag = false;
for (Section axleSection : sections) {
if (axleSection.isAxleCounter() && !this.equals(axleSection.getFault())) {
flag = true;
axleSection.setFault(this);
}
}
return flag;
}
@Override
public void fix(MayOutOfOrderDevice device) {
Section section = (Section) device;
List<Section> sections;
if (!section.isAxleCounter()) {
if (section.getParent() != null && section.getParent().isAxleCounter()) {
sections = Collections.singletonList(section.getParent());
} else if (!CollectionUtils.isEmpty(section.getLogicList())) {
sections = section.getLogicList();
} else {
sections = new ArrayList<>();
}
} else {
sections = Collections.singletonList(section);
}
boolean flag = false;
for (Section axleSection : sections) {
if (this.equals(axleSection.getFault())) {
axleSection.setFault(null);
}
}
}
} }
} }
} }

View File

@ -602,6 +602,8 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
} }
public void updateTBForce(float fk, float fb) { public void updateTBForce(float fk, float fb) {
if (isEB())
return;
if (Fault.DRIVE_FAULT.equals(fault) && fk > 0) { if (Fault.DRIVE_FAULT.equals(fault) && fk > 0) {
return; return;
} }
@ -983,7 +985,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
* 设置紧急制动的功率和制动力 * 设置紧急制动的功率和制动力
*/ */
public void emergencyBreak() { public void emergencyBreak() {
updateTBForce(0, 350); enforceUpdateTBForce(0, 350);
} }
@Getter @Getter

View File

@ -21,12 +21,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.TaskExecutor; import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Collections; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 仿真机器人逻辑循环 * 仿真机器人逻辑循环
@ -110,8 +108,11 @@ public class RobotLogicLoop {
switch (train.getDriveMode()) { switch (train.getDriveMode()) {
case AM: case AM:
case CM: case CM:
Float recommendedSpeedMax = Stream.of(train.getAtpSpeedMax(), train.getSpeedLimit() * 0.9f, train.getAtoSpeedMax())
.min(Comparator.comparingDouble(Float::doubleValue)).get();
distance = ATOService.calculateTargetRemainDistance(train, train.getMa());
speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right, speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,
distance, speed, Math.min(train.getAtpSpeedMax(), train.getSpeedLimit()) * 0.9f); distance, speed, recommendedSpeedMax);
break; break;
case RM: case RM:
speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right, speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,

View File

@ -193,9 +193,6 @@ public class RealLineConfigVO {
/** 服务号的位数 */ /** 服务号的位数 */
private int figuresOfServiceNumber = 3; private int figuresOfServiceNumber = 3;
/** 没有ARB判定 */
private boolean noARB;
public static RealLineConfigVO parseJsonStr(String configData) { public static RealLineConfigVO parseJsonStr(String configData) {
if (StringUtils.hasText(configData)) { if (StringUtils.hasText(configData)) {
return JsonUtils.read(configData, RealLineConfigVO.class); return JsonUtils.read(configData, RealLineConfigVO.class);