Merge remote-tracking branch 'origin/ats-restruct' into ats-restruct

This commit is contained in:
walker-sheng 2021-08-05 17:41:02 +08:00
commit 3af6b866ab
9 changed files with 62 additions and 56 deletions

10
sql/20210805-thesai.sql Normal file
View File

@ -0,0 +1,10 @@
CREATE TABLE `draft_map_route_overrun` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`map_id` bigint(20) NOT NULL,
`code` varchar(255) NOT NULL,
`section_code` varchar(255) NOT NULL,
`ci_switch` varchar(255) DEFAULT NULL,
`switch_code` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

View File

@ -3,10 +3,13 @@ package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapOverrunService; import club.joylink.rtss.services.draftData.DraftMapOverrunService;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO; import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO;
import club.joylink.rtss.vo.map.MapRouteNewVO;
import club.joylink.rtss.vo.map.MapRouteOverrunVO; import club.joylink.rtss.vo.map.MapRouteOverrunVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/draftMap/{id}/overrun") @RequestMapping("/api/draftMap/{id}/overrun")
public class DraftMapOverrunController { public class DraftMapOverrunController {
@ -18,6 +21,11 @@ public class DraftMapOverrunController {
return draftMapOverrunService.pagingQuery(id, queryVO); return draftMapOverrunService.pagingQuery(id, queryVO);
} }
@GetMapping("/all")
public List<MapRouteOverrunVO> queryAll(@PathVariable Long id) {
return this.draftMapOverrunService.queryAll(id);
}
@PostMapping("") @PostMapping("")
public void createOverrun(@PathVariable Long id, @RequestBody MapRouteOverrunVO overrunVO) { public void createOverrun(@PathVariable Long id, @RequestBody MapRouteOverrunVO overrunVO) {
draftMapOverrunService.createOverrun(id, overrunVO); draftMapOverrunService.createOverrun(id, overrunVO);

View File

@ -4,6 +4,8 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO; import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO;
import club.joylink.rtss.vo.map.MapRouteOverrunVO; import club.joylink.rtss.vo.map.MapRouteOverrunVO;
import java.util.List;
public interface DraftMapOverrunService { public interface DraftMapOverrunService {
void createOverrun(long mapId, MapRouteOverrunVO overrunVO); void createOverrun(long mapId, MapRouteOverrunVO overrunVO);
@ -12,4 +14,6 @@ public interface DraftMapOverrunService {
void delete(long mapId, String code); void delete(long mapId, String code);
void update(Long mapId, String code, MapRouteOverrunVO vo); void update(Long mapId, String code, MapRouteOverrunVO vo);
List<MapRouteOverrunVO> queryAll(Long mapId);
} }

View File

@ -85,6 +85,12 @@ public class DraftMapOverrunServiceImpl implements DraftMapOverrunService {
draftMapRouteOverrunDAO.updateByPrimaryKey(newEntity); draftMapRouteOverrunDAO.updateByPrimaryKey(newEntity);
} }
@Override
public List<MapRouteOverrunVO> queryAll(Long mapId) {
List<DraftMapRouteOverrun> entities = findEntitiesByMapId(mapId);
return MapRouteOverrunVO.convertFromDraft(entities);
}
private List<DraftMapRouteOverrun> findEntitiesByMapId(long mapId) { private List<DraftMapRouteOverrun> findEntitiesByMapId(long mapId) {
DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample(); DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample();
example.createCriteria().andMapIdEqualTo(mapId); example.createCriteria().andMapIdEqualTo(mapId);

View File

@ -122,6 +122,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
update.setName(routeNewVO.getName()); update.setName(routeNewVO.getName());
update.setSetOverlapInCtc(routeNewVO.isSetOverlapInCtc()); update.setSetOverlapInCtc(routeNewVO.isSetOverlapInCtc());
update.setOverlapCode(routeNewVO.getOverlapCode()); update.setOverlapCode(routeNewVO.getOverlapCode());
update.setOverrunList(routeNewVO.getOverrunList());
update.setHoldStandList(routeNewVO.getHoldStandList()); update.setHoldStandList(routeNewVO.getHoldStandList());
DraftMapRoute db = update.convert2Draft(); DraftMapRoute db = update.convert2Draft();
this.draftMapRouteDAO.updateByPrimaryKeyWithBLOBs(db); this.draftMapRouteDAO.updateByPrimaryKeyWithBLOBs(db);

View File

@ -310,8 +310,8 @@ public class MaService {
// 关闭的区段 // 关闭的区段
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Closed_Section)); ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Closed_Section));
} }
if (this.isFaultStand(section)) { if (this.isAbnormalStand(section)) {
// 故障/紧急停车站台 // 屏蔽门不安全/紧急停车站台
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Stand)); ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Stand));
} }
Section next = section.getNextRunningSectionOf(right); Section next = section.getNextRunningSectionOf(right);
@ -351,14 +351,13 @@ public class MaService {
return ma; return ma;
} }
private boolean isFaultStand(Section section) { private boolean isAbnormalStand(Section section) {
if (section.isNormalStandTrack()) { if (section.isNormalStandTrack()) {
for (Stand stand : section.getStandList()) { for (Stand stand : section.getStandList()) {
if (stand.isEmergencyClosed()) { if (stand.isEmergencyClosed()) {
return true; return true;
} }
PSD psd = stand.getPsd(); if (!stand.isPsdSafe()) {
if (psd != null && (!psd.isCloseAndLock() && !psd.isInterlockRelease()) && !stand.isTrainParking()) {
return true; return true;
} }
} }

View File

@ -201,45 +201,10 @@ public class ATPLogicLoop {
float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance()); float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance());
train.setAtpSpeed(atpSpeed); train.setAtpSpeed(atpSpeed);
train.setAtoSpeed(atoSpeed); train.setAtoSpeed(atoSpeed);
} else {
train.setAtpSpeed(0);
train.setAtoSpeed(0);
} }
// // 驾驶故障导致EB
// MovementAuthority ma = train.getMa();
// if (Objects.nonNull(ma)) { // 通信正常,移动授权可用
// // 获取移动授权剩余距离
// Float remainDistance = atpService.calculateProtectDistance(train, ma.getEnd());
// if (Objects.isNull(remainDistance) || remainDistance <= 0) {
// log.warn(String.format("列车[%s]无法计算出移动防护剩余距离或防护距离不为正", train.getGroupNumber()));
// atpSpeed = 0;
// atoSpeed = 0;
// } else {
//// // 获取防护速度
//// SpeedCurve protectSpeedCurve = ma.getProtectSpeedCurve();
//// float protectSpeed = protectSpeedCurve.getSpeedOf(remainDistance);
//// atpSpeed = protectSpeed;
// // 计算推荐速度曲线
// float targetDistance = ATOService.calculateTargetRemainDistance(train, ma);
// SectionPosition headPosition = train.getHeadPosition();
// SectionPosition tailPosition = train.calculateTailPosition();
// boolean right = train.isRight();
// float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f);
// SpeedCurve speedCurve = SpeedCurve
// .buildTargetSpeedCurve(headPosition, tailPosition, right,
// targetDistance, train.getSpeed(), speedMax);
// // 更新目标距离和建议速度
// train.setTargetDistance(targetDistance);
// train.setSpeedCurve(speedCurve);
// atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance());
// atpSpeed = atoSpeed + 5 / 3.6f;
// }
// } else {
// atpSpeed = 0;
// atoSpeed = 0;
// log.warn(String.format("列车[%s-%s|%s|%s]速度[%s]没有移动授权触发EB",
// train.getGroupNumber(), train.getServiceNumber(),
// train.getTripNumber(), train.getDestinationCode(),
// train.getSpeed()));
// }
// break;
} }
} }
@ -330,9 +295,15 @@ public class ATPLogicLoop {
// } // }
//// } //// }
// } else { // } else {
if (train.isAtoOn()) {
this.atoService.syncOpenDoor(simulation, train); this.atoService.syncOpenDoor(simulation, train);
}
if (this.isAllDoorOpen(simulation, train)) { if (this.isAllDoorOpen(simulation, train)) {
train.nextParkedTrainActivity(); train.nextParkedTrainActivity();
if (train.isAtoOn()) {
atoService.closeATO(train);
train.setAutoOpenATO(true);
}
} }
// } // }
break; break;
@ -360,7 +331,7 @@ public class ATPLogicLoop {
// } // }
// } // }
// 可以关门 // 可以关门
this.atoService.syncCloseDoor(simulation, train); // this.atoService.syncCloseDoor(simulation, train);
if (this.isAllDoorClose(simulation, train)) { if (this.isAllDoorClose(simulation, train)) {
train.nextParkedTrainActivity(); train.nextParkedTrainActivity();
} }

View File

@ -88,18 +88,24 @@ public class RobotLogicLoop {
if (activity == null) if (activity == null)
return; return;
switch (activity) { switch (activity) {
case OPEN_DOOR:
if (!train.isAtoOn()) {
atoService.syncOpenDoor(simulation, train);
}
break;
case CLOSE_DOOR: case CLOSE_DOOR:
atpService.openOrCloseDoor(simulation, train, false, false); atoService.syncCloseDoor(simulation, train);
atpService.openOrCloseDoor(simulation, train, true, false); // atpService.openOrCloseDoor(simulation, train, false, false);
if (!train.isCommunicable()) { // atpService.openOrCloseDoor(simulation, train, true, false);
Section headSection = train.getHeadPosition().getSection(); // if (!train.isCommunicable()) {
List<Stand> standList = headSection.getStandList(); // Section headSection = train.getHeadPosition().getSection();
if (!CollectionUtils.isEmpty(standList)) { // List<Stand> standList = headSection.getStandList();
for (Stand stand : standList) { // if (!CollectionUtils.isEmpty(standList)) {
ciApiService.closeScreenDoor(simulation, stand.getCode()); // for (Stand stand : standList) {
} // ciApiService.closeScreenDoor(simulation, stand.getCode());
} // }
} // }
// }
break; break;
case START: case START:
if (train.isAutoOpenATO()) { if (train.isAutoOpenATO()) {

View File

@ -229,6 +229,7 @@ public class MapRouteNewVO {
if (Objects.nonNull(route.getOverlap())) { if (Objects.nonNull(route.getOverlap())) {
vo.setOverlapCode(route.getOverlap().getCode()); vo.setOverlapCode(route.getOverlap().getCode());
} }
if (!CollectionUtils.isEmpty(route.getStandHoldList())) { if (!CollectionUtils.isEmpty(route.getStandHoldList())) {
vo.setHoldStandList(route.getStandHoldList().stream().map(Stand::getCode).collect(Collectors.toList())); vo.setHoldStandList(route.getStandHoldList().stream().map(Stand::getCode).collect(Collectors.toList()));
} }