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.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO;
import club.joylink.rtss.vo.map.MapRouteNewVO;
import club.joylink.rtss.vo.map.MapRouteOverrunVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/draftMap/{id}/overrun")
public class DraftMapOverrunController {
@ -18,6 +21,11 @@ public class DraftMapOverrunController {
return draftMapOverrunService.pagingQuery(id, queryVO);
}
@GetMapping("/all")
public List<MapRouteOverrunVO> queryAll(@PathVariable Long id) {
return this.draftMapOverrunService.queryAll(id);
}
@PostMapping("")
public void createOverrun(@PathVariable Long id, @RequestBody MapRouteOverrunVO 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.map.MapRouteOverrunVO;
import java.util.List;
public interface DraftMapOverrunService {
void createOverrun(long mapId, MapRouteOverrunVO overrunVO);
@ -12,4 +14,6 @@ public interface DraftMapOverrunService {
void delete(long mapId, String code);
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);
}
@Override
public List<MapRouteOverrunVO> queryAll(Long mapId) {
List<DraftMapRouteOverrun> entities = findEntitiesByMapId(mapId);
return MapRouteOverrunVO.convertFromDraft(entities);
}
private List<DraftMapRouteOverrun> findEntitiesByMapId(long mapId) {
DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample();
example.createCriteria().andMapIdEqualTo(mapId);

View File

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

View File

@ -310,8 +310,8 @@ public class MaService {
// 关闭的区段
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));
}
Section next = section.getNextRunningSectionOf(right);
@ -351,14 +351,13 @@ public class MaService {
return ma;
}
private boolean isFaultStand(Section section) {
private boolean isAbnormalStand(Section section) {
if (section.isNormalStandTrack()) {
for (Stand stand : section.getStandList()) {
if (stand.isEmergencyClosed()) {
return true;
}
PSD psd = stand.getPsd();
if (psd != null && (!psd.isCloseAndLock() && !psd.isInterlockRelease()) && !stand.isTrainParking()) {
if (!stand.isPsdSafe()) {
return true;
}
}

View File

@ -201,45 +201,10 @@ public class ATPLogicLoop {
float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance());
train.setAtpSpeed(atpSpeed);
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 {
this.atoService.syncOpenDoor(simulation, train);
if (train.isAtoOn()) {
this.atoService.syncOpenDoor(simulation, train);
}
if (this.isAllDoorOpen(simulation, train)) {
train.nextParkedTrainActivity();
if (train.isAtoOn()) {
atoService.closeATO(train);
train.setAutoOpenATO(true);
}
}
// }
break;
@ -360,7 +331,7 @@ public class ATPLogicLoop {
// }
// }
// 可以关门
this.atoService.syncCloseDoor(simulation, train);
// this.atoService.syncCloseDoor(simulation, train);
if (this.isAllDoorClose(simulation, train)) {
train.nextParkedTrainActivity();
}

View File

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

View File

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