修改新版ma计算;恢复ATO到站自动开门后关闭ATO逻辑
This commit is contained in:
parent
43274b5511
commit
3e16198215
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
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();
|
||||
}
|
||||
|
@ -88,18 +88,24 @@ public class RobotLogicLoop {
|
||||
if (activity == null)
|
||||
return;
|
||||
switch (activity) {
|
||||
case OPEN_DOOR:
|
||||
if (!train.isAtoOn()) {
|
||||
atoService.syncOpenDoor(simulation, train);
|
||||
}
|
||||
break;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
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()) {
|
||||
|
@ -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()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user